make cfg80211 manage wiphy netdev list
Subsystems (4)
Johannes Berg
maintainerPATCH 1/1 make cfg80211 manage wiphy netdev list
This patch makes cfg80211 handle the list of netdevices associated with a wiphy. It does this by watching NETDEV_REGISTER/UNREGISTER events.
One effect of this patch is that cfg80211 users no longer need to provide a list_devices hook. Another effect is that all cfg80211 users will get a "phy80211" symlink in all their netdevices pointing to the 802.11 phy this netdev is associated to, thereby standardising this.
Signed-off-by Johannes Berg <[email protected]>
---
James, are you ok with the "phy80211" name? The wiphy* names can be changed too, but they shall ultimately be changeable from userspace so people can have stable names there.
--- include/linux/netdevice.h | 3 +- include/net/cfg80211.h | 7 ---- include/net/wireless.h | 3 ++ net/mac80211/ieee80211_cfg.c | 18 ------------ net/mac80211/ieee80211_sysfs.c | 13 +------- net/wireless/core.c | 61 ++++++++++++++++++++++++++++++++++------- net/wireless/core.h | 3 ++ net/wireless/nl80211.c | 42 ++++++++++++---------------- 8 files changed, 80 insertions(+), 70 deletions(-)
include/linux/netdevice.h +2 -1
@@ -401,7 +401,8 @@ struct net_devicevoid *ip6_ptr;/* IPv6 specific data */ void *ec_ptr;/* Econet specific data */ void *ax25_ptr;/* AX.25 specific data */ -struct wireless_dev *ieee80211_ptr;/* IEEE 802.11 specific data */ +struct wireless_dev *ieee80211_ptr;/* IEEE 802.11 specific data, +assign before registering */ /* * Cache line mostly used on receive path (including eth_type_trans())
net/wireless/core.c +52 -9
109 lines not on this page · raw message
net/mac80211/ieee80211_sysfs.c +2 -11
@@ -699,23 +699,15 @@ int ieee80211_sysfs_change_if_type(strucint ieee80211_sysfs_add_netdevice (struct net_device *dev) { -struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);int res; - res =sysfs_create_link (&dev->dev.kobj, - &local->hw.wiphy->dev.kobj, -"wiphy" ); -if (res) - goto err_out; res =ieee80211_add_if_group (&dev->dev.kobj, dev);if (res) - goto err_link; + goto err_fail_if_group; res =ieee80211_key_kset_sysfs_register (IEEE80211_DEV_TO_SUB_IF (dev));return res; -err_link: -sysfs_remove_link (&dev->dev.kobj,"wiphy" ); -err_out: +err_fail_if_group:return res; }
@@ -723,5 +715,4 @@ void ieee80211_sysfs_remove_netdevice(st {ieee80211_key_kset_sysfs_unregister (IEEE80211_DEV_TO_SUB_IF (dev));ieee80211_remove_if_group (&dev->dev.kobj, dev); -sysfs_remove_link (&dev->dev.kobj,"wiphy" ); }
include/net/wireless.h +3 -0
@@ -9,6 +9,7 @@#include <linux/netdevice.h> #include <linux/debugfs.h> +#include <linux/list.h> #include <net/cfg80211.h> /**
@@ -48,6 +49,8 @@ struct wireless_dev {/* private to the generic wireless code */ struct cfg80211_config pending_config; +struct list_head list; +struct net_device *netdev; };/**
net/wireless/core.h +3 -0
@@ -24,6 +24,9 @@ struct cfg80211_registered_device {/* wiphy index, internal only */ int idx; +/* associate netdev list */ +struct list_head netdev_list; +/* must be last because of the way we do wiphy_priv(), * and it should at least be aligned to NETDEV_ALIGN */ struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN)));
include/net/cfg80211.h +0 -7
@@ -66,9 +66,6 @@ struct wiphy;* All callbacks except where otherwise noted should return 0 * on success or a negative error code. * -* @list_interfaces: Call the one() function with the given data and the -* ifindex for each interface belonging to the wiphy. -* This callback is required. * @inject_packet: inject the given frame with the NL80211_FLAG_* * flags onto the given queue. *
@@ -118,10 +115,6 @@ struct wiphy;* is to be passed to that callback */ struct cfg80211_ops { -int (*list_interfaces)(struct wiphy *wiphy,void *data, -int (*one)(void *data,int ifindex)); - -int (*inject_packet)(struct wiphy *wiphy,void *frame,int framelen,u32 flags,int queue);
net/mac80211/ieee80211_cfg.c +0 -18
@@ -24,23 +24,6 @@ static inline int rtnl_lock_local(struct } -static int ieee80211_list_interfaces (struct wiphy *wiphy,void *data, -int (*one)(void *data,int ifindex)) -{ -struct ieee80211_local *local =wiphy_priv (wiphy); -struct ieee80211_sub_if_data *subif; -int err =0 ; - -spin_lock_bh (&local->sub_if_lock); -list_for_each_entry (subif, &local->sub_if_list, list) { - err =one (data, subif->dev->ifindex); -if (err) -break ; - } -spin_unlock_bh (&local->sub_if_lock); -return err; -} -static int ieee80211_add_iface (struct wiphy *wiphy,char *name,unsigned int type) {
@@ -102,7 +85,6 @@ static int ieee80211_del_iface(struct wi }struct cfg80211_ops mac80211_config_ops = { - .list_interfaces = ieee80211_list_interfaces, .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, };
net/wireless/nl80211.c +18 -24
76 lines not on this page · raw message