cfg80211 updates
Subsystems (4)
Johannes Berg
maintainercover cfg80211 updates
This series updates/changes cfg80211 and associated things a lot and finally introduces the wiphy stuff we've talked about a long time ago. Also a number of bugfixes.
It's not perfect, it seems to for example that bcm43xx's debugfs stuff doesn't work afterwards (but I haven't checked if it worked before and I think it may be broken before too). Also, the wiphy concept patch contains a few notes.
I'd like to ask that you merge it anyway, it's getting unwieldy to maintain it as-is because there are quite large interdependencies here. Besides, until the code is in the tree nobody apparently bothers looking at it, only after they complain...
johannes
Johannes Berg
maintainerPATCH 1/10 remove cfg80211/wext-nl compatibility
Wireless extensions over netlink can't reliably be used anyway (and probably never will be used...) so remove the code that would allow cfg80211 to be compatible with that.
--- include/net/cfg80211.h | 5 net/Kconfig | 14 - net/core/rtnetlink.c | 42 ----- net/wireless/wext-compat.c | 333 --------------------------------------------- 4 files changed, 1 insertion(+), 393 deletions(-)
net/Kconfig +0 -14
@@ -244,20 +244,6 @@ config CFG80211_WEXT_COMPAT If unsure, say Y. -config CFG80211_WEXTNL_COMPAT - bool "cfg80211 WE-netlink compatibility" - depends CFG80211 && CFG80211_WEXT_COMPAT - ---help--- - This option allows using devices whose drivers have been - converted to use the new cfg80211 with wireless extensions - over rtnetlink, providing WE-20 compatibility. Note that - cfg80211's "native" interface is nl80211 using generic netlink. - The wireless extensions are being deprecated and the netlink - based API for WE was never configured by default, nor do any - userspace tools use this feature. - - This option exists only to make Jean happy. Say N. - endif # if NET endmenu # Networking
net/wireless/wext-compat.c +0 -333
339 lines not on this page · raw message
include/net/cfg80211.h +0 -5
@@ -195,11 +195,6 @@ extern void *nl80211msg_new(struct sk_bu#ifdef CONFIG_CFG80211_WEXT_COMPAT extern int cfg80211_wext_ioctl (struct ifreq *ifr,unsigned int cmd); -#ifdef CONFIG_CFG80211_WEXTNL_COMPAT -int cfg80211_wext_nl_set (struct net_device *dev,char *data,int len); -int cfg80211_wext_nl_get (struct net_device *dev,char *data,int len, -char **p_buf,int *p_len); -#endif #endif #endif /* __NET_CFG80211_H */
net/core/rtnetlink.c +1 -41
73 lines not on this page · raw message
--
Johannes Berg
maintainerPATCH 2/10 update cfg80211/wext and wext code
In reply to Johannes BergThis patch updates the cfg80211/wext compat code as well as the original wext code. To ease development/testing, it allows having cfg80211 including all the compat code as a module, only a registration hook for the wext ioctls needs to be built-in.
--- include/linux/netdevice.h | 4 include/net/cfg80211.h | 4 include/net/iw_handler.h | 3 include/net/wireless.h | 23 + net/core/dev.c | 67 --- net/wireless/Makefile | 24 - net/wireless/core.c | 28 - net/wireless/core.h | 25 - net/wireless/wext-common.c | 67 ++- net/wireless/wext-compat.c | 923 +++++++++++---------------------------------- net/wireless/wext-export.c | 29 + net/wireless/wext-mod.c | 20 net/wireless/wext-old.c | 13 net/wireless/wext.h | 42 +- 14 files changed, 445 insertions(+), 827 deletions(-)
net/wireless/wext-compat.c +238 -685
@@ -4,7 +4,7 @@* Lots of code from the original wireless.c: * Copyright 1997-2006 Jean Tourrilhes <[email protected]> * -* Copyright 2006 Johannes Berg <[email protected]> +* Copyright 2006,2007 Johannes Berg <[email protected]> * * GPLv2. *
@@ -45,7 +45,6 @@#include <linux/if_arp.h> #include <linux/etherdevice.h> #include <linux/wireless.h> -#include <net/iw_handler.h> #include <net/netlink.h> #include <asm/uaccess.h> #include <net/cfg80211.h>
@@ -53,29 +52,6 @@#include "core.h" #include "wext.h" -/* The cfg80211 driver assigns callbacks in this -* if it is loaded. If not, then we can't config -* anything anyway... */ -struct cfg80211_core_ops cfg80211_core_ops; -EXPORT_SYMBOL_GPL (cfg80211_core_ops); - -static struct cfg80211_registered_driver *cfg80211_wx_setup (int ifindex) -{ -if (!cfg80211_core_ops.loaded) -return ERR_PTR (-ENOSYS ); -if (!try_module_get (cfg80211_core_ops.module)) -return ERR_PTR (-ENOSYS ); - -return cfg80211_core_ops.get_drv_from_ifidx (ifindex); -} - -static void cfg80211_wx_teardown (struct cfg80211_registered_driver *drv) -{ -if (!IS_ERR (drv)) - cfg80211_core_ops.put_drv (drv); -module_put (cfg80211_core_ops.module); -} -/* internal API: use this function when changing * some parameter that needs to be committed */ static void cfg80211_wx_start_commit_timer (int ifindex)
@@ -91,302 +67,170 @@ static void cfg80211_wx_start_commit_tim* as well as taking the rtnl lock (due to wext)! */ } -static void cfg80211_ensure_netdev_pending_cfg (struct net_device *dev) +static struct cfg80211_config *cfg80211_ensure_pending_cfg ( +struct cfg80211_registered_driver *drv) { -struct cfg80211_config *cfg = dev->cfg80211_wext_pending_config; -if (!cfg) { +struct cfg80211_config *cfg = drv->wext_pending_config; +if (!cfg) cfg =kmalloc (sizeof (*cfg)+32 ,GFP_KERNEL ); +if (cfg) { cfg->ssid = (char *)cfg +sizeof (*cfg); - dev->cfg80211_wext_pending_config = cfg; + drv->wext_pending_config = cfg; } +return cfg; } -/* operations we implement. whew, I machine-generated these */ -static int cfg80211_wx_set_commit (struct net_device *net_dev, +static int cfg80211_wx_set_commit (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv;int err; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -if (!net_dev->cfg80211_wext_pending_config) { +if (!drv->wext_pending_config) { err =0 ; goto out; } - err = drv->ops->configure (drv->priv, net_dev, - net_dev->cfg80211_wext_pending_config); + err = drv->ops->configure (&drv->wiphy, net_dev, + drv->wext_pending_config); -kfree (net_dev->cfg80211_wext_pending_config); - net_dev->cfg80211_wext_pending_config =NULL ; +kfree (drv->wext_pending_config); + drv->wext_pending_config =NULL ; out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_name (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_name (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_nwid (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_nwid (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_nwid (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_nwid (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_freq (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_freq (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_freq (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_freq (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_mode (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_mode (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_mode (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_mode (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_sens (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_sens (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_sens (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_sens (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_range (struct net_device *net_dev, +static int cfg80211_wx_set_range (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_range (struct net_device *net_dev, +static int cfg80211_wx_get_range (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_ap (struct net_device *net_dev, +static int cfg80211_wx_set_ap (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ;/* TODO: DO SOMETHING */ /* SIOCSIWAP
@@ -394,150 +238,86 @@ static int cfg80211_wx_set_ap(struct net* -> if bssid is all-zeroes: set roaming to kernel * -> otherwise: set roaming to userspace, set bssid */ - err = -ENOSYS ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_ap (struct net_device *net_dev, +static int cfg80211_wx_get_ap (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ;/* TODO: DO SOMETHING */ /* SIOCGIWAP * -> get association parameters and fill return bssid appropriately */ - err = -ENOSYS ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_mlme (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_mlme (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_waplist (struct net_device *net_dev, +static int cfg80211_wx_get_waplist (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_scan (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_scan (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_scan (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_scan (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_essid (struct net_device *net_dev, +static int cfg80211_wx_set_essid (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ;struct cfg80211_config *cfg; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - - err = -ENOSYS ;if (!drv->ops->configure || !drv->ops->get_config_valid) goto out; -if (!(drv->ops->get_config_valid (drv->priv, net_dev) +if (!(drv->ops->get_config_valid (&drv->wiphy, net_dev) &CFG80211_CFG_VALID_SSID )) goto out; -cfg80211_ensure_netdev_pending_cfg (net_dev); - cfg = net_dev->cfg80211_wext_pending_config; + cfg =cfg80211_ensure_pending_cfg (drv);if (!cfg) { err = -ENOMEM ; goto out;
@@ -550,502 +330,264 @@ static int cfg80211_wx_set_essid(structcfg80211_wx_start_commit_timer (net_dev->ifindex); err =0 ; out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_essid (struct net_device *net_dev, +static int cfg80211_wx_get_essid (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_rate (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_rate (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ; -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_rate (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_rate (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_rts (struct net_device *net_dev, +static int cfg80211_wx_set_rts (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ; -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_rts (struct net_device *net_dev, +static int cfg80211_wx_get_rts (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_frag (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_frag (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ; -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_frag (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_frag (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ; -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_txpow (struct net_device *net_dev, +static int cfg80211_wx_set_txpow (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_txpow (struct net_device *net_dev, +static int cfg80211_wx_get_txpow (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_retry (struct net_device *net_dev, +static int cfg80211_wx_set_retry (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_retry (struct net_device *net_dev, +static int cfg80211_wx_get_retry (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_encode (struct net_device *net_dev, +static int cfg80211_wx_set_encode (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_encode (struct net_device *net_dev, +static int cfg80211_wx_get_encode (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_power (struct net_device *net_dev, +static int cfg80211_wx_set_power (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_power (struct net_device *net_dev, +static int cfg80211_wx_get_power (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_genie (struct net_device *net_dev, +static int cfg80211_wx_set_genie (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_genie (struct net_device *net_dev, +static int cfg80211_wx_get_genie (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; +int err = -EOPNOTSUPP ; - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_auth (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_set_auth (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_auth (struct net_device *net_dev, -struct iw_request_info *info, -union iwreq_data *data, -char *extra) +static int cfg80211_wx_get_auth (struct cfg80211_registered_driver *drv, +struct net_device *net_dev, +struct iw_request_info *info, +union iwreq_data *data, +char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_encodeext (struct net_device *net_dev, +static int cfg80211_wx_set_encodeext (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ; -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_get_encodeext (struct net_device *net_dev, +static int cfg80211_wx_get_encodeext (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; - - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } +int err = -EOPNOTSUPP ; -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } -static int cfg80211_wx_set_wpmksa (struct net_device *net_dev, +static int cfg80211_wx_set_wpmksa (struct cfg80211_registered_driver *drv, +struct net_device *net_dev,struct iw_request_info *info,union iwreq_data *data,char *extra) { -struct cfg80211_registered_driver *drv; -int err; +int err = -EOPNOTSUPP ; - drv =cfg80211_wx_setup (net_dev->ifindex); -if (IS_ERR (drv)) { - err =PTR_ERR (drv); - goto out; - } - -/* TODO: DO SOMETHING */ - err = -ENOSYS ; - - out: -cfg80211_wx_teardown (drv);return err; } +typedef int (*iw_compat_handler )(struct cfg80211_registered_driver *drv, +struct net_device *dev, +struct iw_request_info *info, +union iwreq_data *wrqu, +char *extra);/* operations array */ #ifdef WX # undef WX#endif #define WX (ioctl) [(ioctl) - SIOCIWFIRST] -static const iw_handler cfg80211_wx_handlers[] = { +static const iw_compat_handler cfg80211_wx_handlers[] = {WX (SIOCSIWCOMMIT ) = cfg80211_wx_set_commit,WX (SIOCGIWNAME ) = cfg80211_wx_get_name,WX (SIOCSIWNWID ) = cfg80211_wx_set_nwid,
@@ -1090,7 +632,7 @@ static const iw_handler cfg80211_wx_hand };/* dummy so I didn't have to change that much code... */ -static iw_handler get_handler (struct net_device *dev,unsigned int cmd) +static iw_compat_handler get_handler (unsigned int cmd) {int idx = cmd -SIOCIWFIRST ;if (idx <ARRAY_SIZE (cfg80211_wx_handlers))
@@ -1102,10 +644,11 @@ static iw_handler get_handler(struct net* this is sort of backwards and wouldn't need to call * get_wireless_stats, but it was easier to just copy the code... */ -static int iw_handler_get_iwstats (struct net_device * dev, -struct iw_request_info * info, -union iwreq_data * wrqu, -char * extra) +static int iw_handler_get_iwstats (struct cfg80211_registered_driver *drv, +struct net_device *dev, +struct iw_request_info *info, +union iwreq_data *wrqu, +char *extra) {/* Get stats from the driver */ struct iw_statistics stats_buf;
@@ -1131,10 +674,11 @@ static int iw_handler_get_iwstats(struct* We do various checks and also take care of moving data between * user space and kernel space. */ -static int ioctl_standard_call (struct net_device * dev, -struct ifreq * ifr, -unsigned int cmd, -iw_handler handler) +static int ioctl_standard_call (struct cfg80211_registered_driver *drv, +struct net_device *dev, +struct ifreq *ifr, +unsigned int cmd, +iw_compat_handler handler) {struct iwreq * iwr = (struct iwreq *) ifr;const struct iw_ioctl_description * descr;
@@ -1142,9 +686,9 @@ static int ioctl_standard_call(struct neint ret = -EINVAL ;/* Get the description of the IOCTL */ -if ((cmd -SIOCIWFIRST ) >= standard_ioctl_num) +if ((cmd -SIOCIWFIRST ) >= wext_standard_ioctl_num)return -EOPNOTSUPP ; - descr = &(standard_ioctl[cmd -SIOCIWFIRST ]); + descr = &(wext_standard_ioctl[cmd -SIOCIWFIRST ]);/* Prepare the call */ info.cmd = cmd;
@@ -1154,7 +698,7 @@ static int ioctl_standard_call(struct neif (descr->header_type !=IW_HEADER_TYPE_POINT ) {/* No extra arguments. Trivial to handle */ - ret =handler (dev, &info, &(iwr->u),NULL ); + ret =handler (drv, dev, &info, &(iwr->u),NULL );/* Generate an event to notify listeners of the change */ if((descr->flags & IW_DESCR_FLAG_EVENT) &&
@@ -1224,7 +768,7 @@ static int ioctl_standard_call(struct ne }/* Call the handler */ - ret =handler (dev, &info, &(iwr->u), extra); + ret =handler (drv, dev, &info, &(iwr->u), extra);/* If we have something to return to the user */ if (!ret &&IW_IS_GET (cmd)) {
@@ -1264,37 +808,46 @@ static int ioctl_standard_call(struct neint cfg80211_wext_ioctl (struct ifreq *ifr,unsigned int cmd) {struct net_device *dev; -iw_handler handler; +iw_compat_handler handler; +struct cfg80211_registered_driver *drv; +int err;/* Permissions are already checked in dev_ioctl() before calling us. * The copy_to/from_user() of ifr is also dealt with in there */ -/* Make sure the device exist */ -if ((dev =__dev_get_by_name (ifr->ifr_name)) ==NULL ) + dev =dev_get_by_name (ifr->ifr_name); +if (!dev)return -ENODEV ; + drv =cfg80211_get_drv_from_ifindex (dev->ifindex); +if (IS_ERR (drv)) { + err =PTR_ERR (drv); + goto out_put_dev; + } +/* A bunch of special cases, then the generic case... * Note that 'cmd' is already filtered in dev_ioctl() with * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ switch (cmd) {case SIOCGIWSTATS :/* Get Wireless Stats */ -return ioctl_standard_call (dev, - ifr, - cmd, - &iw_handler_get_iwstats); - + err =ioctl_standard_call (drv, dev, ifr, cmd, + &iw_handler_get_iwstats); +break ;case SIOCGIWPRIV : -return -EOPNOTSUPP ; + err = -EOPNOTSUPP ; +break ;default : -/* Basic check */ -if (!netif_device_present (dev)) -return -ENODEV ; - handler =get_handler (dev, cmd); + handler =get_handler (cmd);if (cmd <SIOCIWFIRSTPRIV && handler !=NULL ) -return ioctl_standard_call (dev, ifr, cmd, - handler); -return -EOPNOTSUPP ; + err =ioctl_standard_call (drv, dev, ifr, cmd, + handler); +else + err = -EOPNOTSUPP ; } -return -EINVAL ; + +cfg80211_put_drv (drv); + out_put_dev: +dev_put (dev); +return err; }
include/linux/netdevice.h +0 -4
@@ -355,10 +355,6 @@ struct net_device/* Instance data managed by the core of Wireless Extensions. */ struct iw_public_data * wireless_data;#endif -#ifdef CONFIG_CFG80211_WEXT_COMPAT -/* pending config used by cfg80211/wext compat code only */ -void *cfg80211_wext_pending_config; -#endif const struct ethtool_ops *ethtool_ops;/*
include/net/cfg80211.h +0 -4
@@ -193,8 +193,4 @@ extern void *nl80211hdr_put(struct sk_buextern void *nl80211msg_new (struct sk_buff **skb,u32 pid,u32 seq,int flags,u8 cmd); -#ifdef CONFIG_CFG80211_WEXT_COMPAT -extern int cfg80211_wext_ioctl (struct ifreq *ifr,unsigned int cmd); -#endif -#endif /* __NET_CFG80211_H */
include/net/iw_handler.h +0 -3
@@ -433,9 +433,6 @@ struct iw_public_data {extern int dev_get_wireless_info (char * buffer,char **start,off_t offset,int length); -/* Handle IOCTLs, called in net/core/dev.c */ -extern int wireless_process_ioctl (struct ifreq *ifr,unsigned int cmd); -/* Handle RtNetlink requests, called in net/core/rtnetlink.c */ extern int wireless_rtnetlink_set(struct net_device * dev, char * data,
include/net/wireless.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef __NET_WIRELESS_H +#define __NET_WIRELESS_H + +/* +* internal definitions for wireless +*/ + +#if defined(CONFIG_CFG80211_WEXT_COMPAT ) || defined(CONFIG_WIRELESS_EXT ) +int wext_ioctl (unsigned int cmd,struct ifreq *ifreq,void __user *arg); +int wireless_proc_init (void ); +#else +static inline +int wext_ioctl (unsigned int cmd,struct ifreq *ifreq,void __user *arg) +{ +return -EINVAL ; +} +static inline int wireless_proc_init (void ) +{ +return 0 ; +} +#endif + +#endif /* __NET_WIRELESS_H */
net/core/dev.c +4 -63
85 lines not on this page · raw message
net/wireless/core.c +9 -19
@@ -1,21 +1,24 @@/* -* This is the new wireless configuration interface. +* This is the linux wireless configuration interface. * -* Copyright 2006 Johannes Berg <[email protected]> +* Copyright 2006, 2007 Johannes Berg <[email protected]> */ -#include "core.h" -#include "nl80211.h" #include <linux/if.h> #include <linux/module.h> #include <linux/err.h> -#include <net/genetlink.h> -#include <net/cfg80211.h> #include <linux/mutex.h> #include <linux/list.h> +#include <linux/nl80211.h> +#include <net/genetlink.h> +#include <net/cfg80211.h> +#include "nl80211.h" +#include "core.h" +#include "wext.h" MODULE_AUTHOR ("Johannes Berg" );MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("wireless configuration support" );/* RCU might be appropriate here since we usually * only read the list, and that can happen quite
@@ -116,7 +119,6 @@ cfg80211_get_drv_from_info(struct genl_ireturn drv; } -/* wext will need this */ struct cfg80211_registered_driver *cfg80211_get_drv_from_ifindex (int ifindex) {
@@ -221,23 +223,11 @@ EXPORT_SYMBOL_GPL(cfg80211_unregister);static int cfg80211_init (void ) { -#ifdef CONFIG_CFG80211_WEXT_COMPAT - cfg80211_core_ops.get_drv_from_ifidx = cfg80211_get_drv_from_ifindex; - cfg80211_core_ops.put_drv = cfg80211_put_drv; - cfg80211_core_ops.module =THIS_MODULE ; - cfg80211_core_ops.loaded =1 ; -#endif return nl80211_init (); }static void cfg80211_exit (void ) { -#ifdef CONFIG_CFG80211_WEXT_COMPAT - cfg80211_core_ops.loaded =0 ; - cfg80211_core_ops.module =NULL ; - cfg80211_core_ops.get_drv_from_ifidx =NULL ; - cfg80211_core_ops.put_drv =NULL ; -#endif nl80211_exit (); }
net/wireless/wext-common.c +61 -6
91 lines not on this page · raw message
net/wireless/wext-export.c new file +29 -0
@@ -0,0 +1,29 @@ +/* +* things we only need in the kernel when cfg80211 is modular. +* +* Copyright 2007 Johannes Berg <[email protected]> +*/ + +#include "wext.h" + +EXPORT_SYMBOL_GPL (wext_standard_ioctl); +EXPORT_SYMBOL_GPL (wext_standard_ioctl_num); +EXPORT_SYMBOL_GPL (get_wireless_stats); + +struct cfg80211_ioctl_ops cfg80211_ioctl_ops; +EXPORT_SYMBOL_GPL (cfg80211_ioctl_ops); + +int call_cfg80211_wext_ioctl (struct ifreq *ifr,unsigned int cmd) +{ +int err = -ENOSYS ; + +if (!try_module_get (cfg80211_ioctl_ops.module)) +return -ENOSYS ; + +if (cfg80211_ioctl_ops.do_wext_ioctl) + err = cfg80211_ioctl_ops.do_wext_ioctl (ifr, cmd); + +module_put (cfg80211_ioctl_ops.module); + +return err; +}
net/wireless/wext.h +38 -4
49 lines not on this page · raw message
net/wireless/wext-mod.c new file +20 -0
@@ -0,0 +1,20 @@ +/* +* things we only need in cfg80211 when it is modular. +* +* Copyright 2007 Johannes Berg <[email protected]> +*/ + +#include "wext.h" + +int cfg80211_wext_init (void ) +{ + cfg80211_ioctl_ops.do_wext_ioctl = cfg80211_wext_ioctl; + cfg80211_ioctl_ops.module =THIS_MODULE ; +return 0 ; +} + +void cfg80211_wext_exit (void ) +{ + cfg80211_ioctl_ops.module =NULL ; + cfg80211_ioctl_ops.do_wext_ioctl =NULL ; +}
net/wireless/wext-old.c +6 -7
@@ -308,9 +308,9 @@ static int ioctl_standard_call(struct neint ret = -EINVAL ;/* Get the description of the IOCTL */ -if ((cmd -SIOCIWFIRST ) >= standard_ioctl_num) +if ((cmd -SIOCIWFIRST ) >= wext_standard_ioctl_num)return -EOPNOTSUPP ; - descr = &(standard_ioctl[cmd -SIOCIWFIRST ]); + descr = &(wext_standard_ioctl[cmd -SIOCIWFIRST ]);#ifdef WE_IOCTL_DEBUG printk(KERN_DEBUG "%s (WE) : Found standard handler for 0x%04X\n",
@@ -769,9 +769,9 @@ static int rtnetlink_standard_get(struct/* Get the description of the Request */ cmd = request->cmd; -if ((cmd -SIOCIWFIRST ) >= standard_ioctl_num) +if ((cmd -SIOCIWFIRST ) >= wext_standard_ioctl_num)return -EOPNOTSUPP ; - descr = &(standard_ioctl[cmd -SIOCIWFIRST ]); + descr = &(wext_standard_ioctl[cmd -SIOCIWFIRST ]);#ifdef WE_RTNETLINK_DEBUG printk(KERN_DEBUG "%s (WE.r) : Found standard handler for 0x%04X\n",
@@ -911,9 +911,9 @@ static inline int rtnetlink_standard_set/* Get the description of the Request */ cmd = request->cmd; -if ((cmd -SIOCIWFIRST ) >= standard_ioctl_num) +if ((cmd -SIOCIWFIRST ) >= wext_standard_ioctl_num)return -EOPNOTSUPP ; - descr = &(standard_ioctl[cmd -SIOCIWFIRST ]); + descr = &(wext_standard_ioctl[cmd -SIOCIWFIRST ]);#ifdef WE_RTNETLINK_DEBUG printk(KERN_DEBUG "%s (WE.r) : Found standard SET handler for 0x%04X\n",
@@ -1726,5 +1726,4 @@ EXPORT_SYMBOL(iw_handler_get_spy);EXPORT_SYMBOL (iw_handler_get_thrspy);EXPORT_SYMBOL (iw_handler_set_spy);EXPORT_SYMBOL (iw_handler_set_thrspy); -EXPORT_SYMBOL (wireless_send_event);EXPORT_SYMBOL (wireless_spy_update);
net/wireless/core.h +5 -20
@@ -21,31 +21,16 @@ struct cfg80211_registered_driver {* to avoid the deregister call to proceed while * any call is in progress */ struct mutex mtx; + +#ifdef CONFIG_CFG80211_WEXT_COMPAT +/* wext compat */ +struct cfg80211_config *wext_pending_config; +#endif };extern struct mutex cfg80211_drv_mutex;extern struct list_head cfg80211_drv_list; -#ifdef CONFIG_CFG80211_WEXT_COMPAT -/* wext compatibility must be compiled in... -* this extern is in wext-compat.c */ -struct cfg80211_core_ops { -/* flag to see if cfg80211 is there. -* FIXME: isn't that racy? */ -int loaded; - -/* used to make sure the module isn't going away -* can't really happen, except if no driver has cfg80211 -* in use, but in that case */ -struct module *module; - -/* and finally these are used to do work */ -struct cfg80211_registered_driver *(*get_drv_from_ifidx)(int ifidx); -void (*put_drv)(struct cfg80211_registered_driver *drv); -}; -extern struct cfg80211_core_ops cfg80211_core_ops; -#endif -/* * This function returns a pointer to the driver * that the genl_info item that is passed refers to.
net/wireless/Makefile +12 -12
@@ -1,16 +1,16 @@ obj-$(CONFIG_CFG80211) += cfg80211.o -cfg80211-objs := \ - core.o nl80211.o +cfg80211-y += core.o nl80211.o +cfg80211-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-compat.o -obj-$(CONFIG_WIRELESS_EXT) += wext-old.o +ifeq ($(CONFIG_CFG80211),m) +obj-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-export.o +cfg80211-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-mod.o +# we need something to tell us what's up... +# but we can't use #ifdef MODULE because we also need to +# know in the part that is built in (namely wext-common.c) +CFLAGS += -DCFG80211_MODULE +endif -obj-nn := -obj-yy := -obj-yn := -obj-ny := - -# this needs to be compiled in... -obj-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-compat.o -obj-$(CONFIG_CFG80211_WEXT_COMPAT)$(CONFIG_NET_WIRELESS) += wext-common.o -obj-y += $(obj-yy) $(obj-yn) $(obj-ny) +obj-$(CONFIG_WIRELESS_EXT) += wext-common.o wext-old.o +obj-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-common.o
--
Johannes Berg
maintainerPATCH 3/10 introduce wiphy concept
In reply to Johannes BergThis patch introduces struct wiphy and struct wireless_dev. The latter is added to struct net_device as ieee80211_ptr and keeps wireless per-netdev state, the wiphy keeps wireless per-device (hardware) state and is accessible from struct wireless_dev.
---
I think we should go with this for now. I've tested it quite a bit and it all seems to work pretty well.
For the future:
Maybe instead of having ieee80211_ptr point to a struct wireless_dev (which can be allocated along with the netdev) we should mandate that each wireless netdev is allocated via a new function that puts the wireless_dev struct as the first part of the private area of the netdev, that way getting to it is just a simple addition instead of following a pointer... and we can also drop ieee80211_ptr from struct net_device.
We'd provide functions to go from netdev to wdev and from wdev to priv. Also, we could then keep track of all wdevs that have been added to a certain wiphy and get rid of the cfg80211 list_interfaces callback. And we could pass a wdev to all calls there...
Another thing to do is allowing renaming of the wiphy via cfg80211...
Well, if anybody read this far I'd appreciate comments, if not, well, who cares? :)
--- include/linux/netdevice.h | 4 include/net/cfg80211.h | 73 +++++------------ include/net/wireless.h | 124 ++++++++++++++++++++++++++++++ net/wireless/Makefile | 2 net/wireless/core.c | 184 ++++++++++++++++++++++++++------------------- net/wireless/core.h | 39 ++++++--- net/wireless/nl80211.c | 115 ++++++++++++++-------------- net/wireless/sysfs.c | 85 ++++++++++++++++++++ net/wireless/sysfs.h | 10 ++ net/wireless/wext-compat.c | 96 +++++++++++------------ 10 files changed, 489 insertions(+), 243 deletions(-)
net/wireless/core.h +27 -12
@@ -5,16 +5,15 @@*/ #ifndef __NET_WIRELESS_CORE_H #define __NET_WIRELESS_CORE_H -#include <net/cfg80211.h> #include <linux/mutex.h> #include <linux/list.h> +#include <linux/netdevice.h> #include <net/genetlink.h> -#include <linux/module.h> +#include <net/wireless.h> +#include <net/cfg80211.h> -struct cfg80211_registered_driver { +struct cfg80211_registered_device { struct cfg80211_ops *ops; - int wiphy; - void *priv; struct list_head list; /* we hold this mutex during any call so that * we cannot do multiple calls at once, and also
@@ -22,12 +21,25 @@ struct cfg80211_registered_driver {* any call is in progress */ struct mutex mtx; +/* wiphy index, internal only */ +int idx; +#ifdef CONFIG_CFG80211_WEXT_COMPAT /* wext compat */ struct cfg80211_config *wext_pending_config;#endif + +/* 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))); }; +static inline struct cfg80211_registered_device *wiphy_to_dev (struct wiphy *wiphy) +{ +BUG_ON (!wiphy); + return container_of(wiphy, struct cfg80211_registered_device, wiphy); +} +extern struct mutex cfg80211_drv_mutex;extern struct list_head cfg80211_drv_list;
@@ -37,7 +49,7 @@ extern struct list_head cfg80211_drv_lis* If successful, it returns non-NULL and also locks * the driver's mutex! * -* This means that you need to call cfg80211_put_drv() +* This means that you need to call cfg80211_put_dev() * before being allowed to acquire &cfg80211_drv_mutex! * * This is necessary because we need to lock the global
@@ -51,13 +63,16 @@ extern struct list_head cfg80211_drv_lis* The result of this can be a PTR_ERR and hence must * be checked with IS_ERR() for errors. */ -extern struct cfg80211_registered_driver * -cfg80211_get_drv_from_info (struct genl_info *info); +extern struct cfg80211_registered_device * +cfg80211_get_dev_from_info (struct genl_info *info); + +/* identical to cfg80211_get_dev_from_info but only operate on ifindex */ +extern struct cfg80211_registered_device * +cfg80211_get_dev_from_ifindex (int ifindex); -/* identical to cfg80211_get_drv_from_info but only operate on ifindex */ -extern struct cfg80211_registered_driver * -cfg80211_get_drv_from_ifindex (int ifindex); +extern void cfg80211_put_dev (struct cfg80211_registered_device *drv); -extern void cfg80211_put_drv (struct cfg80211_registered_driver *drv); +/* free object */ +extern void cfg80211_dev_free (struct cfg80211_registered_device *drv);#endif /* __NET_WIRELESS_CORE_H */
include/linux/netdevice.h +3 -1
@@ -42,6 +42,8 @@struct vlan_group ;struct ethtool_ops ;struct netpoll_info ; +/* 802.11 specific */ +struct wireless_dev ;/* source back-compat hooks */ #define SET_ETHTOOL_OPS (netdev,ops) \ ( (netdev)->ethtool_ops = (ops) )
@@ -399,7 +401,7 @@ struct net_devicevoid *ip6_ptr;/* IPv6 specific data */ void *ec_ptr;/* Econet specific data */ void *ax25_ptr;/* AX.25 specific data */ -void *ieee80211_ptr;/* IEEE 802.11 specific data */ +struct wireless_dev *ieee80211_ptr;/* IEEE 802.11 specific data */ /* * Cache line mostly used on receive path (including eth_type_trans())
include/net/cfg80211.h +24 -49
131 lines not on this page · raw message
net/wireless/core.c +109 -75
294 lines not on this page · raw message
net/wireless/nl80211.c +58 -57
414 lines not on this page · raw message
net/wireless/sysfs.c new file +85 -0
85 lines not on this page · raw message
net/wireless/sysfs.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef __WIRELESS_SYSFS_H +#define __WIRELESS_SYSFS_H + +extern int wiphy_sysfs_init (void ); +extern void wiphy_sysfs_exit (void ); + +extern int wiphy_sysfs_add (struct wiphy *wiphy); +extern void wiphy_sysfs_del (struct wiphy *wiphy); + +#endif /* __WIRELESS_SYSFS_H */
net/wireless/Makefile +1 -1
@@ -1,6 +1,6 @@ obj-$(CONFIG_CFG80211) += cfg80211.o -cfg80211-y += core.o nl80211.o +cfg80211-y += core.o sysfs.o nl80211.o cfg80211-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-compat.o ifeq ($(CONFIG_CFG80211),m)
include/net/wireless.h +124 -0
130 lines not on this page · raw message
net/wireless/wext-compat.c +48 -48
384 lines not on this page · raw message
--
Re: [PATCH 03/10] introduce wiphy concept
Quoted 8 lines · Johannes Berg
For the future:
Maybe instead of having
ieee80211_ptrpoint to a structwireless_dev(which can be allocated along with the netdev) we should mandate that each wireless netdev is allocated via a new function that puts thewireless_devstruct as the first part of the private area of the netdev, that way getting to it is just a simple addition instead of following a pointer... and we can also dropieee80211_ptrfrom structnet_device.
Currently, you need to distinguish whether some random net_device is wireless device or not at some places. At least d80211 needs that (yes, ifindex doesn't wrap often, so those are just safety checks, but - well
- I'd like to be safe).
How can this be effectively achieved if ieee80211_ptr is dropped?
Thanks,
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Johannes Berg
maintainerRe: [PATCH 03/10] introduce wiphy concept
Quoted 6 lines · Jiri Benc
Currently, you need to distinguish whether some random
net_deviceis wireless device or not at some places. At least d80211 needs that (yes, ifindex doesn't wrap often, so those are just safety checks, but - well
- I'd like to be safe).How can this be effectively achieved if
ieee80211_ptris dropped?
Not easily at all. Just thoughts anyway :)
johannes
Johannes Berg
maintainerPATCH 4/10 cfg/nl80211: make association explicit
In reply to Johannes BergThis patch makes association explicit.
--- include/linux/nl80211.h | 3 +++ include/net/cfg80211.h | 7 ++++++- net/wireless/nl80211.c | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-)
include/net/cfg80211.h +6 -1
@@ -78,13 +78,17 @@ struct wiphy;* * @configure: configure the given interface as requested in the config struct. * must not ignore any configuration item, if something is -* is requested that cannot be fulfilled return an error +* is requested that cannot be fulfilled return an error. +* This call does not actually initiate any association or such. * * @get_config: fill the given config structure with the current configuration * * @get_config_valid: return a bitmask of CFG80211_CFG_VALID_* indicating * which parameters can be set. * +* @associate: associate with previously given settings (SSID, BSSID +* if userspace roaming is enabled) +* * @reassociate: reassociate with current settings (SSID, BSSID if * userspace roaming is enabled) *
@@ -135,6 +139,7 @@ struct cfg80211_ops { struct net_device *dev); +int (*associate)(struct wiphy *wiphy,struct net_device *dev);int (*reassociate)(struct wiphy *wiphy,struct net_device *dev);int (*disassociate)(struct wiphy *wiphy,struct net_device *dev);int (*deauth)(struct wiphy *wiphy,struct net_device *dev);
include/linux/nl80211.h +3 -0
@@ -98,6 +98,9 @@ enum {/* deauth from current AP */ NL80211_CMD_DEAUTH , +/* associate with current settings */ +NL80211_CMD_ASSOCIATE , +/* re-associate with current settings * (SSID and BSSID if roaming control in userspace) */ NL80211_CMD_REASSOCIATE,
net/wireless/nl80211.c +10 -0
@@ -130,6 +130,7 @@ static int nl80211_get_cmdlist(struct skCHECK_CMD (del_virtual_intf,DEL_VIRTUAL_INTERFACE );CHECK_CMD (configure,CONFIGURE );CHECK_CMD (get_config,GET_CONFIG ); +CHECK_CMD (associate,ASSOCIATE );CHECK_CMD (reassociate,REASSOCIATE );CHECK_CMD (disassociate,DISASSOCIATE );CHECK_CMD (deauth,DEAUTH );
@@ -699,6 +700,9 @@ static int nl80211_assoc_deauth(struct sreturn err;switch (info->genlhdr->cmd) { +case NL80211_CMD_ASSOCIATE : + act = drv->ops->associate; +break ;case NL80211_CMD_DISASSOCIATE : act = drv->ops->disassociate;break ;
@@ -964,6 +968,12 @@ static struct genl_ops nl80211_ops[] = {/* can be retrieved by unprivileged users */ }, { + .cmd = NL80211_CMD_ASSOCIATE, + .doit = nl80211_assoc_deauth, + .policy = nl80211_policy, + .flags = GENL_ADMIN_PERM, + }, + { .cmd = NL80211_CMD_DISASSOCIATE, .doit = nl80211_assoc_deauth, .policy = nl80211_policy,
--
Johannes Berg
maintainerPATCH 5/10 wext: clean up
In reply to Johannes BergThis cleans up wext.
--- net/wireless/wext-old.c | 302 ++---------------------------------------------- 1 file changed, 17 insertions(+), 285 deletions(-)
net/wireless/wext-old.c +17 -285
@@ -7,79 +7,6 @@* (As all part of the Linux kernel, this file is GPL) */ -/************************** DOCUMENTATION **************************/ -/* -* API definition : -* -------------- -* See <linux/wireless.h> for details of the APIs and the rest. -* -* History : -* ------- -* -* v1 - 5.12.01 - Jean II -* o Created this file. -* -* v2 - 13.12.01 - Jean II -* o Move /proc/net/wireless stuff from net/core/dev.c to here -* o Make Wireless Extension IOCTLs go through here -* o Added iw_handler handling ;-) -* o Added standard ioctl description -* o Initial dumb commit strategy based on orinoco.c -* -* v3 - 19.12.01 - Jean II -* o Make sure we don't go out of standard_ioctl[] in ioctl_standard_call -* o Add event dispatcher function -* o Add event description -* o Propagate events as rtnetlink IFLA_WIRELESS option -* o Generate event on selected SET requests -* -* v4 - 18.04.02 - Jean II -* o Fix stupid off by one in iw_ioctl_description : IW_ESSID_MAX_SIZE + 1 -* -* v5 - 21.06.02 - Jean II -* o Add IW_PRIV_TYPE_ADDR in priv_type_size (+cleanup) -* o Reshuffle IW_HEADER_TYPE_XXX to map IW_PRIV_TYPE_XXX changes -* o Add IWEVCUSTOM for driver specific event/scanning token -* o Turn on WE_STRICT_WRITE by default + kernel warning -* o Fix WE_STRICT_WRITE in ioctl_export_private() (32 => iw_num) -* o Fix off-by-one in test (extra_size <= IFNAMSIZ) -* -* v6 - 9.01.03 - Jean II -* o Add common spy support : iw_handler_set_spy(), wireless_spy_update() -* o Add enhanced spy support : iw_handler_set_thrspy() and event. -* o Add WIRELESS_EXT version display in /proc/net/wireless -* -* v6 - 18.06.04 - Jean II -* o Change get_spydata() method for added safety -* o Remove spy #ifdef, they are always on -> cleaner code -* o Allow any size GET request if user specifies length > max -* and if request has IW_DESCR_FLAG_NOMAX flag or is SIOCGIWPRIV -* o Start migrating get_wireless_stats to struct iw_handler_def -* o Add wmb() in iw_handler_set_spy() for non-coherent archs/cpus -* Based on patch from Pavel Roskin <[email protected]> : -* o Fix kernel data leak to user space in private handler handling -* -* v7 - 18.3.05 - Jean II -* o Remove (struct iw_point *)->pointer from events and streams -* o Remove spy_offset from struct iw_handler_def -* o Start deprecating dev->get_wireless_stats, output a warning -* o If IW_QUAL_DBM is set, show dBm values in /proc/net/wireless -* o Don't loose INVALID/DBM flags when clearing UPDATED flags (iwstats) -* -* v8 - 17.02.06 - Jean II -* o RtNetlink requests support (SET/GET) -* -* v8b - 03.08.06 - Herbert Xu -* o Fix Wireless Event locking issues. -* -* v9 - 14.3.06 - Jean II -* o Change length in ESSID and NICK to strlen() instead of strlen()+1 -* o Make standard_ioctl_num and standard_event_num unsigned -* o Remove (struct net_device *)->get_wireless_stats() -*/ - -/***************************** INCLUDES *****************************/ -#include <linux/module.h> #include <linux/types.h> /* off_t */ #include <linux/netdevice.h> /* struct ifreq, dev_get_by_name() */
@@ -97,19 +24,6 @@#include "wext.h" -/**************************** CONSTANTS ****************************/ - -/* Debugging stuff */ -#undef WE_IOCTL_DEBUG/* Debug IOCTL API */ -#undef WE_RTNETLINK_DEBUG/* Debug RtNetlink API */ -#undef WE_EVENT_DEBUG/* Debug Event dispatcher */ -#undef WE_SPY_DEBUG/* Debug enhanced spy support */ - -/* Options */ -//CONFIG_NET_WIRELESS_RTNETLINK /* Wireless requests over RtNetlink */ -#define WE_EVENT_RTNETLINK /* Propagate events using RtNetlink */ -#define WE_SET_EVENT /* Generate an event on some set commands */ -/************************* GLOBAL VARIABLES *************************/ /* Size (in bytes) of the various private data types */
@@ -312,12 +226,6 @@ static int ioctl_standard_call(struct nereturn -EOPNOTSUPP ; descr = &(wext_standard_ioctl[cmd -SIOCIWFIRST ]); -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Found standard handler for 0x%04X\n" , - ifr->ifr_name, cmd); -printk (KERN_DEBUG "%s (WE) : Header type : %d, Token type : %d, size : %d, token : %d\n" , dev->name, descr->header_type, descr->token_type, descr->token_size, descr->max_tokens); -#endif /* WE_IOCTL_DEBUG */ -/* Prepare the call */ info.cmd = cmd; info.flags =0 ;
@@ -328,12 +236,10 @@ static int ioctl_standard_call(struct ne/* No extra arguments. Trivial to handle */ ret =handler (dev, &info, &(iwr->u),NULL ); -#ifdef WE_SET_EVENT /* Generate an event to notify listeners of the change */ if ((descr->flags &IW_DESCR_FLAG_EVENT ) && ((ret ==0 ) || (ret == -EIWCOMMIT )))wireless_send_event (dev, cmd, &(iwr->u),NULL ); -#endif /* WE_SET_EVENT */ }else {char * extra;int extra_size;
@@ -408,11 +314,6 @@ static int ioctl_standard_call(struct ne } } -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Malloc %d bytes\n" , - dev->name, extra_size); -#endif /* WE_IOCTL_DEBUG */ -/* Create the kernel buffer */ /* kzalloc ensures NULL-termination for essid_compat */ extra =kzalloc (extra_size,GFP_KERNEL );
@@ -429,11 +330,6 @@ static int ioctl_standard_call(struct nekfree (extra);return -EFAULT ; } -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Got %d bytes\n" , - dev->name, - iwr->u.data.length * descr->token_size); -#endif /* WE_IOCTL_DEBUG */ }/* Call the handler */
@@ -453,15 +349,9 @@ static int ioctl_standard_call(struct ne iwr->u.data.length * descr->token_size);if (err) - ret = -EFAULT ; -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Wrote %d bytes\n" , - dev->name, - iwr->u.data.length * descr->token_size); -#endif /* WE_IOCTL_DEBUG */ + ret = -EFAULT ; } -#ifdef WE_SET_EVENT /* Generate an event to notify listeners of the change */ if ((descr->flags &IW_DESCR_FLAG_EVENT ) && ((ret ==0 ) || (ret == -EIWCOMMIT ))) {
@@ -473,7 +363,6 @@ static int ioctl_standard_call(struct newireless_send_event (dev, cmd, &(iwr->u), extra); } -#endif /* WE_SET_EVENT */ /* Cleanup - I told you it wasn't that long ;-) */ kfree (extra);
@@ -523,16 +412,6 @@ static inline int ioctl_private_call(strbreak ; } -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Found private handler for 0x%04X\n" , - ifr->ifr_name, cmd); -if (descr) { -printk (KERN_DEBUG "%s (WE) : Name %s, set %X, get %X\n" , - dev->name, descr->name, - descr->set_args, descr->get_args); - } -#endif /* WE_IOCTL_DEBUG */ -/* Compute the size of the set/get arguments */ if (descr !=NULL ) {if (IW_IS_SET (cmd)) {
@@ -589,11 +468,6 @@ static inline int ioctl_private_call(strreturn -EFAULT ; } -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Malloc %d bytes\n" , - dev->name, extra_size); -#endif /* WE_IOCTL_DEBUG */ -/* Always allocate for max space. Easier, and won't last * long... */ extra =kmalloc (extra_size,GFP_KERNEL );
@@ -609,10 +483,6 @@ static inline int ioctl_private_call(strkfree (extra);return -EFAULT ; } -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Got %d elem\n" , - dev->name, iwr->u.data.length); -#endif /* WE_IOCTL_DEBUG */ }/* Call the handler */
@@ -631,11 +501,7 @@ static inline int ioctl_private_call(str err =copy_to_user (iwr->u.data.pointer, extra, extra_size);if (err) - ret = -EFAULT ; -#ifdef WE_IOCTL_DEBUG -printk (KERN_DEBUG "%s (WE) : Wrote %d elem\n" , - dev->name, iwr->u.data.length); -#endif /* WE_IOCTL_DEBUG */ + ret = -EFAULT ; }/* Cleanup - I told you it wasn't that long ;-) */
@@ -671,8 +537,7 @@ int wireless_process_ioctl(struct ifreq/* A bunch of special cases, then the generic case... * Note that 'cmd' is already filtered in dev_ioctl() with * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ -switch (cmd) - { +switch (cmd) {case SIOCGIWSTATS :/* Get Wireless Stats */ return ioctl_standard_call(dev,
@@ -773,22 +638,10 @@ static int rtnetlink_standard_get(structreturn -EOPNOTSUPP ; descr = &(wext_standard_ioctl[cmd -SIOCIWFIRST ]); -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Found standard handler for 0x%04X\n" , - dev->name, cmd); -printk (KERN_DEBUG "%s (WE.r) : Header type : %d, Token type : %d, size : %d, token : %d\n" , dev->name, descr->header_type, descr->token_type, descr->token_size, descr->max_tokens); -#endif /* WE_RTNETLINK_DEBUG */ -/* Check if wrqu is complete */ hdr_len = event_type_size[descr->header_type]; -if (request_len < hdr_len) { -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG -"%s (WE.r) : Wireless request too short (%d)\n" , - dev->name, request_len); -#endif /* WE_RTNETLINK_DEBUG */ +if (request_len < hdr_len)return -EINVAL ; - }/* Prepare the call */ info.cmd = cmd;
@@ -832,10 +685,6 @@ static int rtnetlink_standard_get(struct extra_size = (wrqu_point.data.length * descr->token_size); buffer_size = extra_size +IW_EV_POINT_LEN +IW_EV_POINT_OFF ; -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n" , - dev->name, extra_size, buffer_size); -#endif /* WE_RTNETLINK_DEBUG */ /* Create the kernel buffer that we will return */ buffer =kmalloc (buffer_size,GFP_KERNEL );
@@ -867,10 +716,6 @@ static int rtnetlink_standard_get(struct* dummy pointer. */ memcpy (buffer +IW_EV_POINT_OFF , request,IW_EV_LCP_LEN ); -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n" , dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size); -#endif /* WE_RTNETLINK_DEBUG */ -/* Check if there is enough buffer up there */ if (wrqu_point.data.length < wrqu->data.length) ret = -E2BIG ;
@@ -915,25 +760,13 @@ static inline int rtnetlink_standard_setreturn -EOPNOTSUPP ; descr = &(wext_standard_ioctl[cmd -SIOCIWFIRST ]); -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Found standard SET handler for 0x%04X\n" , - dev->name, cmd); -printk (KERN_DEBUG "%s (WE.r) : Header type : %d, Token type : %d, size : %d, token : %d\n" , dev->name, descr->header_type, descr->token_type, descr->token_size, descr->max_tokens); -#endif /* WE_RTNETLINK_DEBUG */ -/* Extract fixed header from request. This is properly aligned. */ wrqu = &request->u;/* Check if wrqu is complete */ hdr_len = event_type_size[descr->header_type]; -if (request_len < hdr_len) { -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG -"%s (WE.r) : Wireless request too short (%d)\n" , - dev->name, request_len); -#endif /* WE_RTNETLINK_DEBUG */ +if (request_len < hdr_len)return -EINVAL ; - }/* Prepare the call */ info.cmd = cmd;
@@ -964,18 +797,8 @@ static inline int rtnetlink_standard_set extra_len = wrqu_point.data.length * descr->token_size;/* Check if request is self consistent */ -if ((request_len - hdr_len) < extra_len) { -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Wireless request data too short (%d)\n" , - dev->name, extra_size); -#endif /* WE_RTNETLINK_DEBUG */ +if ((request_len - hdr_len) < extra_len)return -EINVAL ; - } - -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Malloc %d bytes\n" , - dev->name, extra_size); -#endif /* WE_RTNETLINK_DEBUG */ /* Always allocate for max space. Easier, and won't last * long... */
@@ -991,7 +814,6 @@ static inline int rtnetlink_standard_set ret =handler (dev, &info, &wrqu_point, extra); } -#ifdef WE_SET_EVENT /* Generate an event to notify listeners of the change */ if ((descr->flags &IW_DESCR_FLAG_EVENT ) && ((ret ==0 ) || (ret == -EIWCOMMIT ))) {
@@ -1002,7 +824,6 @@ static inline int rtnetlink_standard_setelse wireless_send_event (dev, cmd, wrqu, extra); } -#endif /* WE_SET_EVENT */ /* Cleanup - I told you it wasn't that long ;-) */ if (extra)
@@ -1058,13 +879,6 @@ static inline int rtnetlink_private_get(if (descr ==NULL )return -EOPNOTSUPP ; -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Found private handler for 0x%04X\n" , - dev->name, cmd); -printk (KERN_DEBUG "%s (WE.r) : Name %s, set %X, get %X\n" , - dev->name, descr->name, descr->set_args, descr->get_args); -#endif /* WE_RTNETLINK_DEBUG */ -/* Compute the max size of the get arguments */ extra_size =get_priv_size (descr->get_args);
@@ -1078,14 +892,8 @@ static inline int rtnetlink_private_get( }/* Check if wrqu is complete */ -if (request_len < hdr_len) { -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG -"%s (WE.r) : Wireless request too short (%d)\n" , - dev->name, request_len); -#endif /* WE_RTNETLINK_DEBUG */ +if (request_len < hdr_len)return -EINVAL ; - }/* Prepare the call */ info.cmd = cmd;
@@ -1116,11 +924,6 @@ static inline int rtnetlink_private_get(/* Buffer for full reply */ buffer_size = extra_size +IW_EV_POINT_LEN +IW_EV_POINT_OFF ; -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n" , - dev->name, extra_size, buffer_size); -#endif /* WE_RTNETLINK_DEBUG */ -/* Create the kernel buffer that we will return */ buffer =kmalloc (buffer_size,GFP_KERNEL );if (buffer ==NULL ) {
@@ -1152,10 +955,6 @@ static inline int rtnetlink_private_get(/* Put the iwe header where it should, i.e. scrap the * dummy pointer. */ memcpy (buffer +IW_EV_POINT_OFF , request,IW_EV_LCP_LEN ); - -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n" , dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size); -#endif /* WE_RTNETLINK_DEBUG */ }/* Return the buffer to the caller */
@@ -1213,13 +1012,6 @@ static inline int rtnetlink_private_set(if (descr ==NULL )return -EOPNOTSUPP ; -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Found private handler for 0x%04X\n" , - ifr->ifr_name, cmd); -printk (KERN_DEBUG "%s (WE.r) : Name %s, set %X, get %X\n" , - dev->name, descr->name, descr->set_args, descr->get_args); -#endif /* WE_RTNETLINK_DEBUG */ -/* Compute the size of the set arguments */ /* Check for sub-ioctl handler */ if (descr->name[0 ] =='\0' )
@@ -1242,14 +1034,8 @@ static inline int rtnetlink_private_set( wrqu = &request->u;/* Check if wrqu is complete */ -if (request_len < hdr_len) { -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG -"%s (WE.r) : Wireless request too short (%d)\n" , - dev->name, request_len); -#endif /* WE_RTNETLINK_DEBUG */ +if (request_len < hdr_len)return -EINVAL ; - }/* Prepare the call */ info.cmd = cmd;
@@ -1277,18 +1063,8 @@ static inline int rtnetlink_private_set( extra_len =adjust_priv_size (descr->set_args, &wrqu_point);/* Check if request is self consistent */ -if ((request_len - hdr_len) < extra_len) { -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Wireless request data too short (%d)\n" , - dev->name, extra_size); -#endif /* WE_RTNETLINK_DEBUG */ +if ((request_len - hdr_len) < extra_len)return -EINVAL ; - } - -#ifdef WE_RTNETLINK_DEBUG -printk (KERN_DEBUG "%s (WE.r) : Malloc %d bytes\n" , - dev->name, extra_size); -#endif /* WE_RTNETLINK_DEBUG */ /* Always allocate for max space. Easier, and won't last * long... */
@@ -1329,18 +1105,12 @@ int wireless_rtnetlink_get(struct net_deiw_handler handler;/* Check length */ -if (len <IW_EV_LCP_LEN ) { -printk (KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n" , - dev->name, len); +if (len <IW_EV_LCP_LEN )return -EINVAL ; - }/* ReCheck length (len may have padding) */ -if (request->len > len) { -printk (KERN_DEBUG "%s (WE.r) : RtNetlink request len invalid (%d-%d)\n" , - dev->name, request->len, len); +if (request->len > len)return -EINVAL ; - }/* Only accept GET requests in here */ if (!IW_IS_GET (request->cmd))
@@ -1413,18 +1183,12 @@ int wireless_rtnetlink_set(struct net_deiw_handler handler;/* Check length */ -if (len <IW_EV_LCP_LEN ) { -printk (KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n" , - dev->name, len); +if (len <IW_EV_LCP_LEN )return -EINVAL ; - }/* ReCheck length (len may have padding) */ -if (request->len > len) { -printk (KERN_DEBUG "%s (WE.r) : RtNetlink request len invalid (%d-%d)\n" , - dev->name, request->len, len); +if (request->len > len)return -EINVAL ; - }/* Only accept SET requests in here */ if (!IW_IS_SET (request->cmd))
@@ -1520,19 +1284,6 @@ int iw_handler_set_spy(struct net_device/* Reset stats */ memset (spydata->spy_stat,0 ,sizeof (struct iw_quality ) *IW_MAX_SPY ); - -#ifdef WE_SPY_DEBUG -printk (KERN_DEBUG "iw_handler_set_spy() : wireless_data %p, spydata %p, num %d\n" , dev->wireless_data, spydata, wrqu->data.length); -for (i =0 ; i < wrqu->data.length; i++) -printk (KERN_DEBUG -"%02X:%02X:%02X:%02X:%02X:%02X \n" , - spydata->spy_address[i][0 ], - spydata->spy_address[i][1 ], - spydata->spy_address[i][2 ], - spydata->spy_address[i][3 ], - spydata->spy_address[i][4 ], - spydata->spy_address[i][5 ]); -#endif /* WE_SPY_DEBUG */ }/* Make sure above is updated before re-enabling */
@@ -1543,6 +1294,7 @@ int iw_handler_set_spy(struct net_devicereturn 0 ; } +EXPORT_SYMBOL (iw_handler_set_spy);/*------------------------------------------------------------------*/ /*
@@ -1578,6 +1330,7 @@ int iw_handler_get_spy(struct net_device spydata->spy_stat[i].updated &= ~IW_QUAL_ALL_UPDATED ;return 0 ; } +EXPORT_SYMBOL (iw_handler_get_spy);/*------------------------------------------------------------------*/ /*
@@ -1602,12 +1355,9 @@ int iw_handler_set_thrspy(struct net_dev/* Clear flag */ memset (spydata->spy_thr_under,'\0' ,sizeof (spydata->spy_thr_under)); -#ifdef WE_SPY_DEBUG -printk (KERN_DEBUG "iw_handler_set_thrspy() : low %d ; high %d\n" , spydata->spy_thr_low.level, spydata->spy_thr_high.level); -#endif /* WE_SPY_DEBUG */ -return 0 ; } +EXPORT_SYMBOL (iw_handler_set_thrspy);/*------------------------------------------------------------------*/ /*
@@ -1631,6 +1381,7 @@ int iw_handler_get_thrspy(struct net_devreturn 0 ; } +EXPORT_SYMBOL (iw_handler_get_thrspy);/*------------------------------------------------------------------*/ /*
@@ -1656,16 +1407,6 @@ static void iw_send_thrspy_event(structmemcpy (&(threshold.low), &(spydata->spy_thr_low),2 *sizeof (struct iw_quality )); -#ifdef WE_SPY_DEBUG -printk (KERN_DEBUG "iw_send_thrspy_event() : address %02X:%02X:%02X:%02X:%02X:%02X, level %d, up = %d\n" , - threshold.addr.sa_data[0 ], - threshold.addr.sa_data[1 ], - threshold.addr.sa_data[2 ], - threshold.addr.sa_data[3 ], - threshold.addr.sa_data[4 ], - threshold.addr.sa_data[5 ], threshold.qual.level); -#endif /* WE_SPY_DEBUG */ -/* Send event to user space */ wireless_send_event (dev,SIOCGIWTHRSPY , &wrqu, (char *) &threshold); }
@@ -1689,10 +1430,6 @@ void wireless_spy_update(struct net_deviif (!spydata)return ; -#ifdef WE_SPY_DEBUG -printk (KERN_DEBUG "wireless_spy_update() : wireless_data %p, spydata %p, address %02X:%02X:%02X:%02X:%02X:%02X\n" , dev->wireless_data, spydata, address[0 ], address[1 ], address[2 ], address[3 ], address[4 ], address[5 ]); -#endif /* WE_SPY_DEBUG */ -/* Update all records that match */ for (i =0 ; i < spydata->spy_number; i++)if (!compare_ether_addr (address, spydata->spy_address[i])) {
@@ -1721,9 +1458,4 @@ void wireless_spy_update(struct net_devi } } } - -EXPORT_SYMBOL (iw_handler_get_spy); -EXPORT_SYMBOL (iw_handler_get_thrspy); -EXPORT_SYMBOL (iw_handler_set_spy); -EXPORT_SYMBOL (iw_handler_set_thrspy);EXPORT_SYMBOL (wireless_spy_update);
--
Johannes Berg
maintainerPATCH 6/10 d80211: update for wiphy api
In reply to Johannes BergThis patch lets d80211 use the new wiphy stuff from cfg80211.
Patch is large because cfg80211 requires the net_dev->ieee80211_ptr now. Net code removal due to cfg80211 handling sysfs for us.
--- include/net/d80211.h | 25 ++++-- net/d80211/Kconfig | 1 net/d80211/Makefile | 2 net/d80211/ieee80211.c | 154 +++++++++++++++++-------------------- net/d80211/ieee80211_cfg.c | 32 +++++++ net/d80211/ieee80211_cfg.h | 9 ++ net/d80211/ieee80211_dev.c | 117 ---------------------------- net/d80211/ieee80211_i.h | 25 ------ net/d80211/ieee80211_iface.c | 29 +++--- net/d80211/ieee80211_ioctl.c | 104 ++++++++++++------------- net/d80211/ieee80211_led.c | 4 net/d80211/ieee80211_sta.c | 62 +++++++------- net/d80211/ieee80211_sysfs.c | 162 +++++++++++---------------------------- net/d80211/ieee80211_sysfs.h | 12 ++ net/d80211/ieee80211_sysfs_sta.c | 4 net/d80211/rc80211_simple.c | 4 net/d80211/wme.c | 26 +++--- 17 files changed, 313 insertions(+), 459 deletions(-)
include/net/d80211.h +18 -7
@@ -16,6 +16,8 @@#include <linux/wireless.h> #include <linux/device.h> #include <linux/ieee80211.h> +#include <net/wireless.h> +#include <net/cfg80211.h> /* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be * called in hardware interrupt context. The low-level driver must not call any
@@ -457,8 +459,12 @@ typedef enum {/* This is driver-visible part of the per-hw state the stack keeps. */ struct ieee80211_hw { -/* these are assigned by d80211, don't write */ -int index; +/* points to the cfg80211 wiphy for this piece. Note +* that you must fill in the perm_addr and dev fields +* of this structure, use the macros provided below. */ +struct wiphy *wiphy; + +/* assigned by d80211, don't write */ struct ieee80211_conf conf;/* Pointer to the private area that was
@@ -467,11 +473,6 @@ struct ieee80211_hw {/* The rest is information about your hardware */ -struct device *dev; - -/* permanent mac address */ -u8 perm_addr[ETH_ALEN ]; -/* TODO: frame_type 802.11/802.3, sw_encryption requirements */ /* Some wireless LAN chipsets generate beacons in the hardware/firmware
@@ -550,6 +551,16 @@ struct ieee80211_hw {int queues; }; +static inline void SET_IEEE80211_DEV (struct ieee80211_hw *hw,struct device *dev) +{ +set_wiphy_dev (hw->wiphy, dev); +} + +static inline void SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw,u8 *addr) +{ +memcpy (hw->wiphy->perm_addr, addr,ETH_ALEN ); +} +/* Configuration block used by the low-level driver to tell the 802.11 code * about supported hardware features and to pass function pointers to callback * functions. */
net/d80211/ieee80211.c +72 -82
374 lines not on this page · raw message
net/d80211/Makefile +1 -1
@@ -10,7 +10,6 @@ obj-$(CONFIG_D80211) += 80211.o rc80211_ wpa.o \ ieee80211_scan.o \ ieee80211_sta.o \ - ieee80211_dev.o \ ieee80211_iface.o \ ieee80211_rate.o \ ieee80211_sysfs.o \
@@ -19,6 +18,7 @@ obj-$(CONFIG_D80211) += 80211.o rc80211_ tkip.o \ aes_ccm.o \ wme.o \ + ieee80211_cfg.o \ $(80211-objs-y) ifeq ($(CONFIG_NET_SCHED),)
net/d80211/ieee80211_dev.c deleted +0 -117
117 lines not on this page · raw message
net/d80211/ieee80211_iface.c +16 -13
@@ -14,6 +14,7 @@#include <net/d80211.h> #include "ieee80211_i.h" #include "sta_info.h" +#include "ieee80211_sysfs.h" void ieee80211_if_sdata_init (struct ieee80211_sub_if_data *sdata) {
@@ -40,7 +41,7 @@ int ieee80211_if_add(struct net_device * int format, struct net_device **new_dev) { struct net_device *ndev, *tmp_dev; -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_sub_if_data *sdata =NULL ;int ret;int i;
@@ -51,7 +52,6 @@ int ieee80211_if_add(struct net_device *if (!ndev)return -ENOMEM ; - ndev->ieee80211_ptr = local;if (strlen (name) ==0 ) { i =0 ; do {
@@ -70,14 +70,16 @@ int ieee80211_if_add(struct net_device *snprintf (ndev->name,IFNAMSIZ ,"%s" , name); } -memcpy (ndev->dev_addr, local->hw.perm_addr,ETH_ALEN ); +memcpy (ndev->dev_addr, local->hw.wiphy->perm_addr,ETH_ALEN ); ndev->base_addr = dev->base_addr; ndev->irq = dev->irq; ndev->mem_start = dev->mem_start; ndev->mem_end = dev->mem_end; -SET_NETDEV_DEV (ndev, local->hw.dev); +SET_NETDEV_DEV (ndev,wiphy_dev (local->hw.wiphy)); sdata =IEEE80211_DEV_TO_SUB_IF (ndev); + ndev->ieee80211_ptr = &sdata->wdev; + sdata->wdev.wiphy = local->hw.wiphy; sdata->type =IEEE80211_IF_TYPE_AP ; sdata->dev = ndev; sdata->local = local;
@@ -121,11 +123,12 @@ int ieee80211_if_add_mgmt(struct ieee802if (ret <0 ) goto fail; - ndev->ieee80211_ptr = local; -memcpy (ndev->dev_addr, local->hw.perm_addr,ETH_ALEN ); -SET_NETDEV_DEV (ndev, local->hw.dev); +memcpy (ndev->dev_addr, local->hw.wiphy->perm_addr,ETH_ALEN ); +SET_NETDEV_DEV (ndev,wiphy_dev (local->hw.wiphy)); nsdata =IEEE80211_DEV_TO_SUB_IF (ndev); + ndev->ieee80211_ptr = &nsdata->wdev; + nsdata->wdev.wiphy = local->hw.wiphy; nsdata->type =IEEE80211_IF_TYPE_MGMT ; nsdata->dev = ndev; nsdata->local = local;
@@ -163,7 +166,7 @@ void ieee80211_if_del_mgmt(struct ieee80void ieee80211_if_set_type (struct net_device *dev,int type) {struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); sdata->type = type;switch (type) {
@@ -211,7 +214,7 @@ void ieee80211_if_set_type(struct net_de/* Must be called with rtnl lock held. */ void ieee80211_if_reinit (struct net_device *dev) { -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev);struct sta_info *sta;int i;
@@ -317,7 +320,7 @@ void __ieee80211_if_del(struct ieee80211/* Must be called with rtnl lock held. */ int ieee80211_if_remove (struct net_device *dev,const char *name,int id) { -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_sub_if_data *sdata, *n;ASSERT_RTNL ();
@@ -336,7 +339,7 @@ int ieee80211_if_remove(struct net_devicvoid ieee80211_if_free (struct net_device *dev) { -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev);/* local->apdev must be NULL when freeing management interface */
@@ -348,7 +351,7 @@ void ieee80211_if_free(struct net_device/* Must be called with rtnl lock held. */ void ieee80211_if_flush (struct net_device *dev) { -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_sub_if_data *sdata, *n;ASSERT_RTNL ();
@@ -359,7 +362,7 @@ void ieee80211_if_flush(struct net_devicvoid ieee80211_if_del (struct net_device *dev) { -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev);rtnl_lock ();
net/d80211/ieee80211_i.h +3 -22
@@ -20,6 +20,7 @@#include <linux/workqueue.h> #include <linux/types.h> #include <linux/spinlock.h> +#include <net/wireless.h> #include "ieee80211_key.h" #include "sta_info.h"
@@ -290,6 +291,8 @@ struct ieee80211_sub_if_data {struct list_head list;unsigned int type; +struct wireless_dev wdev; +struct net_device *dev;struct ieee80211_local *local;
@@ -347,8 +350,6 @@ struct ieee80211_local {int monitors;struct iw_statistics wstats; -struct class_device class_dev; -enum {IEEE80211_DEV_UNITIALIZED =0 ,IEEE80211_DEV_REGISTERED ,
@@ -599,7 +600,6 @@ static inline void bss_tim_clear(struct }/* ieee80211.c */ -void ieee80211_release_hw (struct ieee80211_local *local);int ieee80211_hw_config (struct ieee80211_local *local);int ieee80211_if_config (struct net_device *dev);int ieee80211_if_config_beacon (struct net_device *dev);
@@ -683,14 +683,6 @@ struct sta_info * ieee80211_ibss_add_staint ieee80211_sta_deauthenticate (struct net_device *dev,u16 reason);int ieee80211_sta_disassociate (struct net_device *dev,u16 reason); -/* ieee80211_dev.c */ -int ieee80211_dev_alloc_index (struct ieee80211_local *local); -void ieee80211_dev_free_index (struct ieee80211_local *local); -struct ieee80211_local *ieee80211_dev_find (int index); -int ieee80211_dev_find_index (struct ieee80211_local *local); -struct ieee80211_local *ieee80211_dev_alloc (gfp_t flags); -void ieee80211_dev_free (struct ieee80211_local *local); -/* ieee80211_iface.c */ int ieee80211_if_add (struct net_device *dev,const char *name,int format,struct net_device **new_dev);
@@ -706,17 +698,6 @@ void ieee80211_if_sdata_init(struct ieeeint ieee80211_if_add_mgmt (struct ieee80211_local *local);void ieee80211_if_del_mgmt (struct ieee80211_local *local); -/* ieee80211_sysfs.c */ -int ieee80211_sysfs_add_netdevice (struct net_device *dev); -void ieee80211_sysfs_remove_netdevice (struct net_device *dev); -void ieee80211_dev_sysfs_init (struct ieee80211_local *local); -void ieee80211_dev_sysfs_put (struct ieee80211_local *local); -int ieee80211_dev_sysfs_add (struct ieee80211_local *local); -void ieee80211_dev_sysfs_del (struct ieee80211_local *local); -int ieee80211_sysfs_init (void ); -void ieee80211_sysfs_deinit (void ); -int ieee80211_sysfs_change_if_type (struct net_device *dev); -/* ieee80211_sysfs_sta.c */ int ieee80211_sta_kset_sysfs_register (struct ieee80211_local *local);void ieee80211_sta_kset_sysfs_unregister (struct ieee80211_local *local);
net/d80211/ieee80211_led.c +2 -2
@@ -39,7 +39,7 @@ void ieee80211_led_init(struct ieee80211if (!local->rx_led)return ;snprintf (local->rx_led_name,sizeof (local->rx_led_name), -"wiphy%drx" , local->hw.index); +"wiphy%drx" , local->hw.wiphy->wiphy_index); local->rx_led->name = local->rx_led_name;if (led_trigger_register (local->rx_led)) {kfree (local->rx_led);
@@ -50,7 +50,7 @@ void ieee80211_led_init(struct ieee80211if (!local->tx_led)return ;snprintf (local->tx_led_name,sizeof (local->tx_led_name), -"wiphy%dtx" , local->hw.index); +"wiphy%dtx" , local->hw.wiphy->wiphy_index); local->tx_led->name = local->tx_led_name;if (led_trigger_register (local->tx_led)) {kfree (local->tx_led);
net/d80211/ieee80211_sysfs.c +47 -115
225 lines not on this page · raw message
net/d80211/Kconfig +1 -0
@@ -6,6 +6,7 @@ config D80211 select CRYPTO_AES select CRC32 select WIRELESS_EXT + select CFG80211 ---help--- This option enables the hardware independent IEEE 802.11 networking stack.
net/d80211/ieee80211_cfg.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* d80211 configuration hooks for cfg80211 +* +* Copyright 2006 Johannes Berg <[email protected]> +* +* This file is GPLv2 as found in COPYING. +*/ + +#include <net/cfg80211.h> +#include "ieee80211_i.h" +#include "ieee80211_cfg.h" + +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; + +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; +} + +struct cfg80211_ops d80211_config_ops = { + .list_interfaces = ieee80211_list_interfaces, +};
net/d80211/ieee80211_cfg.h new file +9 -0
@@ -0,0 +1,9 @@ +/* +* d80211 configuration hooks for cfg80211 +*/ +#ifndef __IEEE80211_CFG_H +#define __IEEE80211_CFG_H + +extern struct cfg80211_ops d80211_config_ops; + +#endif /* __IEEE80211_CFG_H */
net/d80211/ieee80211_sysfs_sta.c +2 -2
@@ -39,7 +39,7 @@ static ssize_t show_sta_##name(const str#define STA_SHOW_RATE (name, field) \ static ssize_t show_sta_##name(const struct sta_info *sta, char *buf) \ { \ - struct ieee80211_local *local = sta->dev->ieee80211_ptr; \ + struct ieee80211_local *local = wdev_priv(sta->dev->ieee80211_ptr);\ return sprintf(buf, "%d\n", \ (sta->field >= 0 && \ sta->field < local->num_curr_rates) ? \
@@ -370,7 +370,7 @@ int ieee80211_sta_kset_sysfs_register(st res =kobject_set_name (&local->sta_kset.kobj,"sta" );if (res)return res; - local->sta_kset.kobj.parent = &local->class_dev.kobj; + local->sta_kset.kobj.parent = &local->hw.wiphy->class_dev.kobj; local->sta_kset.ktype = &sta_ktype;return kset_register (&local->sta_kset); }
net/d80211/ieee80211_sysfs.h new file +12 -0
@@ -0,0 +1,12 @@ +/* routines exported for sysfs handling */ + +#ifndef __IEEE80211_SYSFS_H +#define __IEEE80211_SYSFS_H + +int ieee80211_sysfs_add_netdevice (struct net_device *dev); +void ieee80211_sysfs_remove_netdevice (struct net_device *dev); +int ieee80211_sysfs_change_if_type (struct net_device *dev); +int ieee80211_dev_sysfs_add (struct ieee80211_local *local); +void ieee80211_dev_sysfs_del (struct ieee80211_local *local); + +#endif /* __IEEE80211_SYSFS_H */
net/d80211/ieee80211_ioctl.c +52 -52
413 lines not on this page · raw message
net/d80211/ieee80211_sta.c +31 -31
248 lines not on this page · raw message
net/d80211/rc80211_simple.c +2 -2
@@ -124,7 +124,7 @@ static void rate_control_simple_tx_statustruct sk_buff *skb, struct ieee80211_tx_status *status) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;struct sta_info *sta;struct sta_rate_control *srctrl;
@@ -216,7 +216,7 @@ rate_control_simple_get_rate(void *priv,struct sk_buff *skb, struct rate_control_extra *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);struct ieee80211_sub_if_data *sdata;struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;struct sta_info *sta;
net/d80211/wme.c +13 -13
@@ -160,7 +160,7 @@ static inline int wme_downgrade_ac(struc* negative return value indicates to drop the frame */ static inline int classify80211 (struct sk_buff *skb,struct Qdisc *qd) { -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_tx_packet_data *pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -211,7 +211,7 @@ static inline int classify80211(struct sstatic int wme_qdiscop_enqueue (struct sk_buff *skb,struct Qdisc * qd) { -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_sched_data *q =qdisc_priv (qd);struct ieee80211_tx_packet_data *pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
@@ -298,7 +298,7 @@ static struct sk_buff *wme_qdiscop_deque {struct ieee80211_sched_data *q =qdisc_priv (qd);struct net_device *dev = qd->dev; -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;struct sk_buff *skb;struct Qdisc *qdisc;
@@ -334,7 +334,7 @@ static struct sk_buff *wme_qdiscop_dequestatic void wme_qdiscop_reset (struct Qdisc * qd) {struct ieee80211_sched_data *q =qdisc_priv (qd); -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;int queue;
@@ -351,7 +351,7 @@ static void wme_qdiscop_reset(struct Qdistatic void wme_qdiscop_destroy (struct Qdisc * qd) {struct ieee80211_sched_data *q =qdisc_priv (qd); -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;struct tcf_proto *tp;int queue;
@@ -392,7 +392,7 @@ static int wme_qdiscop_init(struct Qdisc {struct ieee80211_sched_data *q =qdisc_priv (qd);struct net_device *dev = qd->dev; -struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);int queues = local->hw.queues;int err =0 , i;
@@ -448,7 +448,7 @@ static int wme_classop_graft(struct Qdis struct Qdisc *new, struct Qdisc **old) { struct ieee80211_sched_data *q = qdisc_priv(qd); -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;unsigned long queue = arg -1 ;
@@ -472,7 +472,7 @@ static struct Qdisc * wme_classop_leaf(struct Qdisc *qd, unsigned long arg) {struct ieee80211_sched_data *q =qdisc_priv (qd); -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;unsigned long queue = arg -1 ;
@@ -485,7 +485,7 @@ wme_classop_leaf(struct Qdisc *qd, unsigstatic unsigned long wme_classop_get (struct Qdisc *qd,u32 classid) { -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;unsigned long queue =TC_H_MIN (classid);
@@ -513,7 +513,7 @@ static int wme_classop_change(struct Qdi struct rtattr **tca, unsigned long *arg) { unsigned long cl = *arg; -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;/* printk(KERN_DEBUG "entering %s\n", __func__); */
@@ -531,7 +531,7 @@ static int wme_classop_change(struct Qdi* when we add WMM-SA support - TSPECs may be deleted here */ static int wme_classop_delete (struct Qdisc *qd,unsigned long cl) { -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;/* printk(KERN_DEBUG "entering %s\n", __func__); */
@@ -545,7 +545,7 @@ static int wme_classop_dump_class(struct struct sk_buff *skb, struct tcmsg *tcm) { struct ieee80211_sched_data *q = qdisc_priv(qd); -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;/* printk(KERN_DEBUG "entering %s\n", __func__); */
@@ -560,7 +560,7 @@ static int wme_classop_dump_class(structstatic void wme_classop_walk (struct Qdisc *qd,struct qdisc_walker *arg) { -struct ieee80211_local *local = qd->dev->ieee80211_ptr; +struct ieee80211_local *local =wdev_priv (qd->dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw;int queue;/* printk(KERN_DEBUG "entering %s\n", __func__); */
--
Johannes Berg
maintainerRe: [PATCH 06/10] d80211: update for wiphy api
As a follow up to this, I may post a patch that moves all the sysfs stuff d80211 currently does into debugfs where I think most of it should actually be. Then we can decide on a case-by-case basis which ones should really be part of the userspace API.
johannes
Re: [PATCH 06/10] d80211: update for wiphy api
In reply to Johannes BergQuoted 17 lines · Johannes Berg
include/net/d80211.h +2
-1@@ -16,6 +16,8 @@#include <linux/wireless.h> #include <linux/device.h> #include <linux/ieee80211.h> +#include <net/wireless.h> +#include <net/cfg80211.h> /* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be * called in hardware interrupt context. The low-level driver must not call any @@ -457,8 +459,12 @@ typedef enum {/* This is driver-visible part of the per-hw state the stack keeps. */ struct ieee80211_hw { -/* these are assigned by d80211, don't write */
include/net/d80211.h typedef enum { · line 470
Quoted 10 lines
include/net/d80211.h +6
-1-int index; +/* points to the cfg80211 wiphy for this piece. Note +* that you must fill in the perm_addr and dev fields +* of this structure, use the macros provided below. */ +struct wiphy *wiphy; + +/* assigned by d80211, don't write */ struct ieee80211_conf conf;/* Pointer to the private area that was
Couldn't we just allow embedding of wiphy into a custom structure? Something like:
struct ieee80211_hw {
struct wiphy wiphy;
...
}This way the memory could become less fragmented and less pointer dereferencing would be needed.
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Johannes Berg
maintainerRe: [PATCH 06/10] d80211: update for wiphy api
Quoted 10 lines · Jiri Benc
Couldn't we just allow embedding of wiphy into a custom structure? Something like:
struct ieee80211_hw { struct wiphy wiphy; ... }This way the memory could become less fragmented and less pointer dereferencing would be needed.
Actually, if you look at the memory layout in ieee80211.c, struct ieee80211_hw is part of the private area allocated along with the struct wiphy, so it really is:
[internal stuff]
struct wiphy {
...
}
struct ieee80211_hw {
...
}
What we could do is add
static inline struct wiphy *priv_to_wiphy(void *priv)
{
return container_of(priv, struct wiphy, priv);
}to the net/wireless.h header. Then we could drop the wiphy field completely.
johannes
Johannes Berg
maintainerPATCH 7/10 bcm43xx-d80211: update for wiphy api
In reply to Johannes Bergupdate bcm43xx-d80211.
---
Really bcm43xx should be using the new wiphy debugfs stuff as well, but I can't figure out what the hell it is doing when multiple devices exist in a system. Thing is the new debugfs dir is only created for d80211 drivers when calling register_hw() and all items must be gone from it when calling free_hw()...
--- drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c | 2 +- drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-)
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +6 -9
@@ -3282,7 +3282,7 @@ static int bcm43xx_wireless_core_init(stssb_bus_powerup (bus,1 );/* Enable dynamic PCTL */ bcm43xx_macfilter_clear (dev, BCM43xx_MACFILTER_ASSOC);bcm43xx_macfilter_set (dev, BCM43xx_MACFILTER_SELF, - (u8 *)(wl->hw->perm_addr)); + (u8 *)(wl->hw->wiphy->perm_addr));bcm43xx_security_init (dev);bcm43xx_measure_channel_change_time (dev);
@@ -3743,14 +3743,11 @@ static int bcm43xx_wireless_init(structIEEE80211_HW_WEP_INCLUDE_IV ; hw->maxssi = BCM43xx_RX_MAX_SSI; hw->queues =1 ; - hw->dev = &dev->dev; -if (is_valid_ether_addr (sprom->r1.et1mac)) { -memcpy (hw->perm_addr, sprom->r1.et1mac, -ARRAY_SIZE (hw->perm_addr)); - }else { -memcpy (hw->perm_addr, sprom->r1.il0mac, -ARRAY_SIZE (hw->perm_addr)); - } +SET_IEEE80211_DEV (hw, &dev->dev); +if (is_valid_ether_addr (sprom->r1.et1mac)) +SET_IEEE80211_PERM_ADDR (hw, sprom->r1.et1mac); +else +SET_IEEE80211_PERM_ADDR (hw, sprom->r1.il0mac);/* Get and initialize struct bcm43xx_wl */ wl =hw_to_bcm43xx_wl (hw);
drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +1 -1
@@ -308,7 +308,7 @@ void bcm43xx_debugfs_add_device(struct b dev->dfsentry = e; -snprintf (devdir,sizeof (devdir),"wiphy%d" , dev->wl->hw->index); +snprintf (devdir,sizeof (devdir),"%s" ,wiphy_name (dev->wl->hw->wiphy)); e->subdir =debugfs_create_dir (devdir, fs.root); e->dentry_tsf =debugfs_create_file ("tsf" ,0666 , e->subdir, dev, &tsf_fops);
--
Re: [PATCH 07/10] bcm43xx-d80211: update for wiphy api
Quoted 3 lines · Johannes Berg
update bcm43xx-d80211.
Signed-off-by Johannes Berg <[email protected]>
ACK for this.
Quoted 4 lines
---
Really bcm43xx should be using the new wiphy debugfs stuff as well, but I can't figure out what the hell it is doing when multiple devices exist in a system. Thing is the new debugfs dir is only
What do you mean? It registers multiple ieee80211_hw, of course. Look at bcm43xx_wireless_init(), that's per-card (not per core).
Quoted 59 lines
created for d80211 drivers when calling
register_hw()and all items must be gone from it when callingfree_hw()...--- drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c | 2 +- drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-)drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +6
-9@@ -3282,7 +3282,7 @@ static int bcm43xx_wireless_core_init(stssb_bus_powerup (bus,1 );/* Enable dynamic PCTL */ bcm43xx_macfilter_clear (dev, BCM43xx_MACFILTER_ASSOC);bcm43xx_macfilter_set (dev, BCM43xx_MACFILTER_SELF, - (u8 *)(wl->hw->perm_addr)); + (u8 *)(wl->hw->wiphy->perm_addr));bcm43xx_security_init (dev);bcm43xx_measure_channel_change_time (dev);@@ -3743,14 +3743,11 @@ static int bcm43xx_wireless_init(structIEEE80211_HW_WEP_INCLUDE_IV ; hw->maxssi = BCM43xx_RX_MAX_SSI; hw->queues =1 ; - hw->dev = &dev->dev; -if (is_valid_ether_addr (sprom->r1.et1mac)) { -memcpy (hw->perm_addr, sprom->r1.et1mac, -ARRAY_SIZE (hw->perm_addr)); - }else { -memcpy (hw->perm_addr, sprom->r1.il0mac, -ARRAY_SIZE (hw->perm_addr)); - } +SET_IEEE80211_DEV (hw, &dev->dev); +if (is_valid_ether_addr (sprom->r1.et1mac)) +SET_IEEE80211_PERM_ADDR (hw, sprom->r1.et1mac); +else +SET_IEEE80211_PERM_ADDR (hw, sprom->r1.il0mac);/* Get and initialize struct bcm43xx_wl */ wl =hw_to_bcm43xx_wl (hw);drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +1
-3@@ -308,7 +308,7 @@ void bcm43xx_debugfs_add_device(struct b dev->dfsentry = e; -snprintf (devdir,sizeof (devdir),"wiphy%d" , dev->wl->hw->index); +snprintf (devdir,sizeof (devdir),"%s" ,wiphy_name (dev->wl->hw->wiphy)); e->subdir =debugfs_create_dir (devdir, fs.root); e->dentry_tsf =debugfs_create_file ("tsf" ,0666 , e->subdir, dev, &tsf_fops); -- -To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Greetings Michael.
Johannes Berg
maintainerRe: [PATCH 07/10] bcm43xx-d80211: update for wiphy api
Quoted 7 lines · Michael Buesch
Quoted 4 lines
---
Really bcm43xx should be using the new wiphy debugfs stuff as well, but I can't figure out what the hell it is doing when multiple devices exist in a system. Thing is the new debugfs dir is onlyWhat do you mean? It registers multiple
ieee80211_hw, of course. Look atbcm43xx_wireless_init(), that's per-card (not per core).
Ok. I was confused with all the different structs and didn't find the proper point to register stuff in debugfs after ieee80211_hw_register()
johannes
Johannes Berg
maintainerPATCH 8/10 zd1211rw-d80211: update for wiphy api
In reply to Johannes Bergupdate zd1211rw-d80211.
--- drivers/net/wireless/d80211/zd1211rw/zd_mac.c | 6 +++--- drivers/net/wireless/d80211/zd1211rw/zd_usb.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/d80211/zd1211rw/zd_mac.c +3 -3
@@ -53,7 +53,7 @@ int zd_mac_init_hw(struct ieee80211_hw * goto disable_int;ZD_ASSERT (!irqs_disabled ());spin_lock_irq (&mac->lock); -memcpy (dev->perm_addr, addr,ETH_ALEN ); +SET_IEEE80211_PERM_ADDR (dev, addr);spin_unlock_irq (&mac->lock); r =zd_read_regdomain (chip, &default_regdomain);
@@ -628,7 +628,7 @@ struct ieee80211_hw *zd_mac_alloc(struct mac->dev = dev; mac->mode =IEEE80211_IF_TYPE_MGMT ; - mac->hwaddr = dev->perm_addr; + mac->hwaddr = dev->wiphy->perm_addr; mac->requested_channel =1 ;memcpy (mac->channels, zd_channels,sizeof (zd_channels));
@@ -664,7 +664,7 @@ struct ieee80211_hw *zd_mac_alloc(structhousekeeping_init (mac);INIT_WORK (&mac->set_multicast_hash_work, set_multicast_hash_handler); - dev->dev = &intf->dev; +SET_IEEE80211_DEV (dev, &intf->dev);return dev; }
drivers/net/wireless/d80211/zd1211rw/zd_usb.c +1 -1
@@ -955,7 +955,7 @@ static int probe(struct usb_interface *i }dev_dbg_f (&intf->dev,"successful\n" ); -dev_info (&intf->dev,"wiphy%d\n" , dev->index); +dev_info (&intf->dev,"%s\n" ,wiphy_name (dev->wiphy));return 0 ; error:usb_reset_device (interface_to_usbdev (intf));
--
Johannes Berg
maintainerPATCH 9/10 cfg80211: pending config
In reply to Johannes BergThis introduces the pending config (not used yet) and by doing so fixes the memory leak in the wext compat code.
--- include/net/cfg80211.h | 4 ++- include/net/wireless.h | 3 ++ net/wireless/core.h | 5 ---- net/wireless/nl80211.c | 2 - net/wireless/wext-compat.c | 46 +++++---------------------------------------- 5 files changed, 13 insertions(+), 47 deletions(-)
include/net/wireless.h +3 -0
@@ -45,6 +45,9 @@ struct wiphy {*/ struct wireless_dev {struct wiphy *wiphy; + +/* private to the generic wireless code */ +struct cfg80211_config pending_config; };/**
include/net/cfg80211.h +3 -1
@@ -11,6 +11,8 @@* Copyright 2006 Johannes Berg <[email protected]> */ +#define SSID_MAX_LEN 32 +/** * struct cfg80211_config - description of a configuration (request) */
@@ -19,7 +21,7 @@ struct cfg80211_config {u32 valid;s8 ssid_len; -u8 *ssid; +u8 ssid[SSID_MAX_LEN ];u16 network_id;s32 rx_sensitivity;
net/wireless/core.h +0 -5
@@ -24,11 +24,6 @@ struct cfg80211_registered_device {/* wiphy index, internal only */ int idx; -#ifdef CONFIG_CFG80211_WEXT_COMPAT -/* wext compat */ -struct cfg80211_config *wext_pending_config; -#endif -/* 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)));
net/wireless/nl80211.c +1 -1
@@ -389,8 +389,8 @@ static int nl80211_configure(struct sk_b attr = info->attrs[NL80211_ATTR_SSID ];if (attr) { - config.ssid =nla_data (attr); config.ssid_len =nla_len (attr); +memcpy (config.ssid,nla_data (attr), config.ssid_len); } attr = info->attrs[NL80211_ATTR_NETWORK_ID ];
net/wireless/wext-compat.c +6 -40
80 lines not on this page · raw message
--
Re: [PATCH 09/10] cfg80211: pending config
Quoted 29 lines · Johannes Berg
plain text document attachment (009-pending-config.patch) This introduces the pending config (not used yet) and by doing so fixes the memory leak in the wext compat code.
Signed-off-by Johannes Berg <[email protected]>--- include/net/cfg80211.h | 4 ++- include/net/wireless.h | 3 ++ net/wireless/core.h | 5 ---- net/wireless/nl80211.c | 2 - net/wireless/wext-compat.c | 46 +++++---------------------------------------- 5 files changed, 13 insertions(+), 47 deletions(-)include/net/wireless.h +3
-0@@ -45,6 +45,9 @@ struct wiphy {*/ struct wireless_dev {struct wiphy *wiphy; + +/* private to the generic wireless code */ +struct cfg80211_config pending_config; };/**
include/net/cfg80211.h line 15
Quoted 5 lines
include/net/cfg80211.h +2
-0@@ -11,6 +11,8 @@* Copyright 2006 Johannes Berg <[email protected]> */ +#define SSID_MAX_LEN 32 +
This has _got_ to be defined somewhere else in the stack? Can we use that define, or is it being moved to here? Seems a shame to have it more than one place.
On a side note, many many drivers need something like this, and many many drivers redefine it internally. Is there some header that all drivers (even fullmac like airo, orinoco, atmel, and libertas) can get this from?
Quoted 57 lines
include/net/cfg80211.h +1
-1/** * struct cfg80211_config - description of a configuration (request) */ @@ -19,7 +21,7 @@ struct cfg80211_config {u32 valid;s8 ssid_len; -u8 *ssid; +u8 ssid[SSID_MAX_LEN ];u16 network_id;s32 rx_sensitivity;net/wireless/core.h +0
-5@@ -24,11 +24,6 @@ struct cfg80211_registered_device {/* wiphy index, internal only */ int idx; -#ifdef CONFIG_CFG80211_WEXT_COMPAT -/* wext compat */ -struct cfg80211_config *wext_pending_config; -#endif -/* 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)));net/wireless/nl80211.c +1
-1@@ -389,8 +389,8 @@ static int nl80211_configure(struct sk_b attr = info->attrs[NL80211_ATTR_SSID ];if (attr) { - config.ssid =nla_data (attr); config.ssid_len =nla_len (attr); +memcpy (config.ssid,nla_data (attr), config.ssid_len); } attr = info->attrs[NL80211_ATTR_NETWORK_ID ];net/wireless/wext-compat.c +0
-8@@ -10,26 +10,16 @@* * Theory of operation, so to speak: * -* To implement compatibility, I added a new field to struct net_device -* that contains the pending configuration structure. This is dynamically -* allocated when needed and freed when committed. -* * Commit is done some time after the last parameter was changed * (with each parameter change simply (re-)schedule a timer) or * if explicitly asked for. This is probably not what most people * would expect, but perfectly fine in the WE API. * -* NB: we leak memory if the user -* - changes some settings -* - quickly rmmod's the module so that the net device is destroyed -* Since only root can do it and I don't see a way to hook into
net/wireless/wext-compat.c line 23
Quoted 10 lines
net/wireless/wext-compat.c +2
-4-* the net device's destruction... tough. -* -* NB2: Note that each of the wrappers should check if the cfg80211 +* NB: Note that each of the wrappers should check if the cfg80211 * user provides the command, and for configure() it must also check * if that parameter can be set or not via get_config_valid() * -* NB3: It's really bad that we can't report an error from the timer- +* NB2: It's really bad that we can't report an error from the timer- * based commit... Hopefully get_config_valid() can catch everything?
Well, we'd have two choices; first, a netlink notification that the config was unsuccessful, or second a WEXT SIOCSIWAP event of 00:00:00:xxx for WE compat. Why wouldn't one of those work?
Dan
Quoted 64 lines
net/wireless/wext-compat.c +4
-30* * see set_essid for an example @@ -67,17 +57,9 @@ static void cfg80211_wx_start_commit_tim* as well as taking the rtnl lock (due to wext)! */ } -static struct cfg80211_config *cfg80211_ensure_pending_cfg ( -struct cfg80211_registered_device *drv) +static struct cfg80211_config *get_pending_cfg (struct net_device *dev) { -struct cfg80211_config *cfg = drv->wext_pending_config; -if (!cfg) - cfg =kmalloc (sizeof (*cfg)+32 ,GFP_KERNEL ); -if (cfg) { - cfg->ssid = (char *)cfg +sizeof (*cfg); - drv->wext_pending_config = cfg; - } -return cfg; +return &dev->ieee80211_ptr->pending_config; } static int cfg80211_wx_set_commit(struct cfg80211_registered_device *drv,@@ -86,20 +68,8 @@ static int cfg80211_wx_set_commit(structunion iwreq_data *data, char *extra) { - int err; - -if (!drv->wext_pending_config) { - err =0 ; - goto out; - } - - err = drv->ops->configure (&drv->wiphy, net_dev, - drv->wext_pending_config); - -kfree (drv->wext_pending_config); - drv->wext_pending_config =NULL ; + int err = -EOPNOTSUPP; - out:return err; }@@ -317,11 +287,7 @@ static int cfg80211_wx_set_essid(struct & CFG80211_CFG_VALID_SSID)) goto out; - cfg =cfg80211_ensure_pending_cfg (drv); -if (!cfg) { - err = -ENOMEM ; - goto out; - } + cfg =get_pending_cfg (net_dev);memcpy (cfg->ssid, extra, data->essid.length); cfg->ssid_len = data->essid.length; -- -To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH 09/10] cfg80211: pending config
Quoted 3 lines · Dan Williams
This has _got_ to be defined somewhere else in the stack? Can we use that define, or is it being moved to here? Seems a shame to have it more than one place.
It probably is...
Quoted 4 lines
On a side note, many many drivers need something like this, and many many drivers redefine it internally. Is there some header that all drivers (even fullmac like airo, orinoco, atmel, and libertas) can get this from?
Yeah, we should have some sort of stack/driver agnosting IEEE 802.11 defines header w/o functions in it. Then I'd use that here too.
Quoted 7 lines
Quoted 3 lines
- * NB3: It's really bad that we can't report an error from the timer-
+ * NB2: It's really bad that we can't report an error from the timer-
* based commit... Hopefullyget_config_valid()can catch everything?Well, we'd have two choices; first, a netlink notification that the config was unsuccessful, or second a WEXT SIOCSIWAP event of 00:00:00:xxx for WE compat. Why wouldn't one of those work?
Yes, we can give a notification that it was unsuccessful. For wext, we don't actually need all this I think because we do it with commit anyway.
johannes
Re: [PATCH 09/10] cfg80211: pending config
In reply to Dan WilliamsQuoted 14 lines · Dan Williams
include/net/cfg80211.h line 15
Quoted 9 lines
---
wireless-dev.orig/include/net/cfg80211.h2007-02-15
13:23:41.967940064 +0100 +++wireless-dev/include/net/cfg80211.h2007-02-15 13:23:43.707940064 +0100include/net/cfg80211.h +2
-0@@ -11,6 +11,8 @@* Copyright 2006 Johannes Berg <[email protected]> */ +#define SSID_MAX_LEN 32 +This has _got_ to be defined somewhere else in the stack? Can we use that define, or is it being moved to here? Seems a shame to have it more than one place.
Quoted 5 lines
On a side note, many many drivers need something like this, and many many drivers redefine it internally. Is there some header that all drivers (even fullmac like airo, orinoco, atmel, and libertas) can get this from?
That's what include/linux/ieee80211.h is (or will be) for.
-Michael Wu
Johannes Berg
maintainerPATCH 10/10 cfg/nl80211: remove legacy network id
In reply to Johannes BergThis patch removes the legacy network ID.
--- include/linux/nl80211.h | 4 ---- include/net/cfg80211.h | 10 ++++------ net/wireless/nl80211.c | 10 ---------- 3 files changed, 4 insertions(+), 20 deletions(-)
include/linux/nl80211.h +0 -4
@@ -161,10 +161,6 @@ enum {/* wiphy list */ NL80211_ATTR_WIPHY_LIST , -/* attributes used for configuration */ -/* network ID (pre 802.11 HW) */ -NL80211_ATTR_NETWORK_ID , -/* channel, 1-14 are B/G */ NL80211_ATTR_CHANNEL,
include/net/cfg80211.h +4 -6
@@ -23,7 +23,6 @@ struct cfg80211_config {s8 ssid_len;u8 ssid[SSID_MAX_LEN ]; -u16 network_id;s32 rx_sensitivity;u32 transmit_power;u32 fragmentation_threshold;
@@ -31,11 +30,10 @@ struct cfg80211_config { };#define CFG80211_CFG_VALID_SSID (1<<0) -#define CFG80211_CFG_VALID_NWID (1<<1) -#define CFG80211_CFG_VALID_RX_SENSITIVITY (1<<2) -#define CFG80211_CFG_VALID_TRANSMIT_POWER (1<<3) -#define CFG80211_CFG_VALID_FRAG_THRESHOLD (1<<4) -#define CFG80211_CFG_VALID_CHANNEL (1<<5) +#define CFG80211_CFG_VALID_RX_SENSITIVITY (1<<1) +#define CFG80211_CFG_VALID_TRANSMIT_POWER (1<<2) +#define CFG80211_CFG_VALID_FRAG_THRESHOLD (1<<3) +#define CFG80211_CFG_VALID_CHANNEL (1<<4)struct scan_channel {u32 channel;
net/wireless/nl80211.c +0 -10
@@ -75,7 +75,6 @@ static struct nla_policy nl80211_policy[ .len = NL80211_MAX_FRAME_LEN }, [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, - [NL80211_ATTR_NETWORK_ID] = { .type = NLA_U16 }, [NL80211_ATTR_CHANNEL] = { .type = NLA_U32 }, [NL80211_ATTR_RX_SENSITIVITY] = { .type = NLA_U32 }, [NL80211_ATTR_BSSID] = { .len = ETH_ALEN },
@@ -393,12 +392,6 @@ static int nl80211_configure(struct sk_bmemcpy (config.ssid,nla_data (attr), config.ssid_len); } - attr = info->attrs[NL80211_ATTR_NETWORK_ID ]; -if (attr) { - config.valid |=CFG80211_CFG_VALID_NWID ; - config.network_id =nla_get_u16 (attr); - } - attr = info->attrs[NL80211_ATTR_RX_SENSITIVITY ];if (attr) { config.valid |=CFG80211_CFG_VALID_RX_SENSITIVITY ;
@@ -465,9 +458,6 @@ static int nl80211_get_config(struct sk_if (config.ssid)NLA_PUT_STRING (msg,NL80211_ATTR_SSID , config.ssid); -if (config.valid &CFG80211_CFG_VALID_NWID ) -NLA_PUT_U16 (msg,NL80211_ATTR_NETWORK_ID , config.network_id); -if (config.valid &CFG80211_CFG_VALID_RX_SENSITIVITY )NLA_PUT_U32 (msg,NL80211_ATTR_RX_SENSITIVITY , (u32 )config.rx_sensitivity);
--
Re: [PATCH 10/10] cfg/nl80211: remove legacy network id
Quoted 2 lines · Johannes Berg
plain text document attachment (010-drop-nwid.patch) This patch removes the legacy network ID.
Don't we still need the WEXT compat bits for nwid? Or are we just axing it entirely? What legacy drivers actually use this that are still in the kernel?
Dan
Quoted 87 lines
Signed-off-by Johannes Berg <[email protected]>--- include/linux/nl80211.h | 4 ---- include/net/cfg80211.h | 10 ++++------ net/wireless/nl80211.c | 10 ---------- 3 files changed, 4 insertions(+), 20 deletions(-)include/linux/nl80211.h +0
-4@@ -161,10 +161,6 @@ enum {/* wiphy list */ NL80211_ATTR_WIPHY_LIST , -/* attributes used for configuration */ -/* network ID (pre 802.11 HW) */ -NL80211_ATTR_NETWORK_ID , -/* channel, 1-14 are B/G */ NL80211_ATTR_CHANNEL,include/net/cfg80211.h +4
-6@@ -23,7 +23,6 @@ struct cfg80211_config {s8 ssid_len;u8 ssid[SSID_MAX_LEN ]; -u16 network_id;s32 rx_sensitivity;u32 transmit_power;u32 fragmentation_threshold;@@ -31,11 +30,10 @@ struct cfg80211_config { };#define CFG80211_CFG_VALID_SSID (1<<0) -#define CFG80211_CFG_VALID_NWID (1<<1) -#define CFG80211_CFG_VALID_RX_SENSITIVITY (1<<2) -#define CFG80211_CFG_VALID_TRANSMIT_POWER (1<<3) -#define CFG80211_CFG_VALID_FRAG_THRESHOLD (1<<4) -#define CFG80211_CFG_VALID_CHANNEL (1<<5) +#define CFG80211_CFG_VALID_RX_SENSITIVITY (1<<1) +#define CFG80211_CFG_VALID_TRANSMIT_POWER (1<<2) +#define CFG80211_CFG_VALID_FRAG_THRESHOLD (1<<3) +#define CFG80211_CFG_VALID_CHANNEL (1<<4)struct scan_channel {u32 channel;net/wireless/nl80211.c +0
-12@@ -75,7 +75,6 @@ static struct nla_policy nl80211_policy[ .len = NL80211_MAX_FRAME_LEN }, [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, - [NL80211_ATTR_NETWORK_ID] = { .type = NLA_U16 }, [NL80211_ATTR_CHANNEL] = { .type = NLA_U32 }, [NL80211_ATTR_RX_SENSITIVITY] = { .type = NLA_U32 }, [NL80211_ATTR_BSSID] = { .len = ETH_ALEN },@@ -393,12 +392,6 @@ static int nl80211_configure(struct sk_bmemcpy (config.ssid,nla_data (attr), config.ssid_len); } - attr = info->attrs[NL80211_ATTR_NETWORK_ID ]; -if (attr) { - config.valid |=CFG80211_CFG_VALID_NWID ; - config.network_id =nla_get_u16 (attr); - } - attr = info->attrs[NL80211_ATTR_RX_SENSITIVITY ];if (attr) { config.valid |=CFG80211_CFG_VALID_RX_SENSITIVITY ;@@ -465,9 +458,6 @@ static int nl80211_get_config(struct sk_if (config.ssid)NLA_PUT_STRING (msg,NL80211_ATTR_SSID , config.ssid); -if (config.valid &CFG80211_CFG_VALID_NWID ) -NLA_PUT_U16 (msg,NL80211_ATTR_NETWORK_ID , config.network_id); -if (config.valid &CFG80211_CFG_VALID_RX_SENSITIVITY )NLA_PUT_U32 (msg,NL80211_ATTR_RX_SENSITIVITY , (u32 )config.rx_sensitivity); -- -To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH 10/10] cfg/nl80211: remove legacy network id
Quoted 3 lines · Dan Williams
Don't we still need the WEXT compat bits for nwid? Or are we just axing it entirely? What legacy drivers actually use this that are still in the kernel?
Well, I was thinking that we'll probably never get around to converting those legacy drivers that use nwid to cfg80211. And when/if we do we can add it back.
johannes
Johannes Berg
maintainerQuoted 2 lines · Johannes Berg
it seems to for example that bcm43xx's debugfs
stuff doesn't work afterwards
That's actually wrong, I had the note there and then found the problem...
johannes