[PATCH 5/6] wext: Use one global netlink socket instead of one per interface.

Ben Greear greearb
Mon Dec 6 17:21:20 PST 2010


On 12/04/2010 01:12 PM, Jouni Malinen wrote:
> On Fri, Dec 03, 2010 at 04:55:04PM -0800, Ben Greear wrote:
>> This saves a lot of work for the kernel and for wpa_supplicant
>> since each netlink message no longer has to be dupplicated for
>> each interface.
>
> Is there any good reason for improving WEXT rather than nl80211? I would
> welcome this type of change for nl80211 much rather than here..
> driver_wext.c is a bit problematic for this since it is used by number
> of other driver wrappers and that may make the proper implementation
> difficult. driver_nl80211.c would not have such issue.
>
>
>> +/* One netlink instance per program, not per vif.
>> + */
>> +static struct netlink_data *netlink = NULL;
>> +static int netlink_refcnt = 0;
>> +static struct wpa_driver_wext_data* all_driver_data = NULL;
>
> These should be stored in global data structure that is initialized in
> global_init() handler (and that is the part that may be difficult to add
> for driver_wext.c without breaking other driver wrappers). Sett
> driver_nl80211.c for an example on how to maintain the global structure
> and interface list (struct nl80211_global and use of global_init() and
> init2()).

I started working on the nl80211 driver.

The 'netlink' member itself seems easy enough to
make global, but I notice there are lots of other
netlink sockets being opened as well, for instance:

	drv->nl_handle = nl80211_handle_alloc(drv->nl_cb);
	if (drv->nl_handle == NULL) {
		wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Failed to allocate netlink "
			"callbacks");
		goto err2;
	}

	drv->nl_handle_event = nl80211_handle_alloc(drv->nl_cb);
	if (drv->nl_handle_event == NULL) {
		wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Failed to allocate netlink "
			"callbacks (event)");
		goto err2b;
	}

Any reason we can't make these global as well?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com




More information about the Hostap mailing list