Skip to contentSkip to conversation

cfg80211 merge

RFC In review John W. Linville 11 participants 52 messages Jan 31, 2007 – Feb 9, 2007 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

In London we agreed that it would be good to go ahead and merge cfg80211. This provides some exposure to the API and eases some of the pain for driver maintainers (who won't have to follow wireless-dev to get it).

I have refactored the cfg80211-related patches down to three patches. This eliminates some of the churn in the series from wireless-dev, and each patch leaves a buildable tree.

Let me know if I've left anything out, screwed anything up, or if you no longer think a cfg80211 merge is appropriate at this time.

Thanks,

John

Signature · 6 lines
John W. Linville
[email protected]
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#1 lore raw

RFC PATCH 1/3 cfg80211 and nl80211

From: Johannes Berg <[email protected]>

This patch adds cfg80211, a new configuration system for wireless hardware as well as nl80211, the netlink-based userspace interface for it.

It currently features a bunch of configuration requests, support for adding and removing virtual interfaces, the ability to inject packets and more.

---
 include/linux/Kbuild       |    1 +
 include/linux/netdevice.h  |    1 +
 include/linux/nl80211.h    |  276 ++++++++++++
 include/net/cfg80211.h     |  193 ++++++++
 net/Kconfig                |    3 +
 net/Makefile               |    1 +
 net/wireless/Makefile      |    4 +
 net/wireless/core.c        |  235 ++++++++++
 net/wireless/core.h        |   57 +++
 net/wireless/nl80211.c     | 1049 ++++++++++++++++++++++++++++++++++++++++++++
 net/wireless/nl80211.h     |    7 +
 net/wireless/wext-compat.c |   25 +
 12 files changed, 1852 insertions(+), 0 deletions(-)
include/linux/Kbuild +1 -0
index 157db77..a0657c6 100644
@@ -115,6 +115,7 @@ header-y += netrom.h
 header-y += nfs2.h
 header-y += nfs4_mount.h
 header-y += nfs_mount.h
+header-y += nl80211.h
 header-y += oom.h
 header-y += param.h
 header-y += pci_regs.h
include/linux/netdevice.h +1 -0
index fea0d9d..c1e9962 100644
@@ -398,6 +398,7 @@ struct net_device
 	void                    *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 */
 
 /*
  * Cache line mostly used on receive path (including eth_type_trans())
include/linux/nl80211.h new file +276 -0

276 lines not on this page · raw message

include/net/cfg80211.h new file +193 -0

193 lines not on this page · raw message

net/Kconfig +3 -0
index 7dfc949..8d121a5 100644
@@ -226,6 +226,9 @@ config WIRELESS_EXT
 config FIB_RULES
 	bool
 
+config CFG80211
+	tristate "Improved wireless configuration API"
+
 endif   # if NET
 endmenu # Networking
 
net/Makefile +1 -0
index ad4d14f..278d6bf 100644
@@ -44,6 +44,7 @@ obj-$(CONFIG_ECONET)		+= econet/
 obj-$(CONFIG_VLAN_8021Q)	+= 8021q/
 obj-$(CONFIG_IP_DCCP)		+= dccp/
 obj-$(CONFIG_IP_SCTP)		+= sctp/
+obj-$(CONFIG_CFG80211)		+= wireless/
 obj-$(CONFIG_IEEE80211)		+= ieee80211/
 obj-$(CONFIG_TIPC)		+= tipc/
 obj-$(CONFIG_NETLABEL)		+= netlabel/
net/wireless/Makefile new file +4 -0
new file mode 100644
index 0000000..c030b12
@@ -0,0 +1,4 @@
+obj-$(CONFIG_CFG80211) += cfg80211.o
+
+cfg80211-objs := \
+	core.o nl80211.o
net/wireless/core.c new file +235 -0

235 lines not on this page · raw message

net/wireless/core.h new file +57 -0

57 lines not on this page · raw message

net/wireless/nl80211.c new file +1049 -0

1,049 lines not on this page · raw message

net/wireless/nl80211.h new file +7 -0
new file mode 100644
index 0000000..0edc7a4
@@ -0,0 +1,7 @@
+#ifndef __NET_WIRELESS_NL80211_H
+#define __NET_WIRELESS_NL80211_H
+
+extern int nl80211_init(void);
+extern void nl80211_exit(void);
+
+#endif /* __NET_WIRELESS_NL80211_H */
net/wireless/wext-compat.c new file +25 -0
new file mode 100644
index 0000000..1c7c361
@@ -0,0 +1,25 @@
+/* NOT YET */
+
+To implement compatibility, we add a new field to struct net_device
+that contains the pending configuration structure. This is dynamically
+allocated when needed and freed when committed.
+In a way it replaces the wireless_handlers field in there which is now
+done by dynamic lookup. No worries. No one is going to have thousands
+of wireless devices, and if that changes we can still trivially change
+this assumption :)
+
+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.
+
+compatibility mappings:
+
+SIOCSIWAP
+  -> if bssid is all-ones: set roaming to kernel, reassociate
+  -> if bssid is all-zeroes: set roaming to kernel
+  -> otherwise: set roaming to userspace, set bssid
+
+SIOCGIWAP
+  -> get association parameters and fill return bssid appropriately
+
Signature · 9 lines
1.4.4.2

-- 
John W. Linville
[email protected]
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#2 lore raw

RFC PATCH 2/3 wireless: move wext to net/wireless/

From: Johannes Berg <[email protected]>

This patch moves net/core/wireless.c to net/wireless/wext.c. I refrained from further cleanups though I was tempted. Hence this is a pure file move plus various build system adjustments.

---
 net/Makefile            |    2 +-
 net/core/Makefile       |    1 -
 net/core/dev.c          |    2 +-
 net/core/wireless.c     | 2353 -----------------------------------------------
 net/wireless/Makefile   |    2 +
 net/wireless/wext-old.c | 2353 +++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 2357 insertions(+), 2356 deletions(-)
net/Makefile +1 -1
index 278d6bf..ed07ec0 100644
@@ -44,7 +44,7 @@ obj-$(CONFIG_ECONET)		+= econet/
 obj-$(CONFIG_VLAN_8021Q)	+= 8021q/
 obj-$(CONFIG_IP_DCCP)		+= dccp/
 obj-$(CONFIG_IP_SCTP)		+= sctp/
-obj-$(CONFIG_CFG80211)		+= wireless/
+obj-y				+= wireless/
 obj-$(CONFIG_IEEE80211)		+= ieee80211/
 obj-$(CONFIG_TIPC)		+= tipc/
 obj-$(CONFIG_NETLABEL)		+= netlabel/
net/core/Makefile +0 -1
index 73272d5..4751613 100644
@@ -13,7 +13,6 @@ obj-y		     += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
 obj-$(CONFIG_XFRM) += flow.o
 obj-$(CONFIG_SYSFS) += net-sysfs.o
 obj-$(CONFIG_NET_PKTGEN) += pktgen.o
-obj-$(CONFIG_WIRELESS_EXT) += wireless.o
 obj-$(CONFIG_NETPOLL) += netpoll.o
 obj-$(CONFIG_NET_DMA) += user_dma.o
 obj-$(CONFIG_FIB_RULES) += fib_rules.o
net/core/dev.c +1 -1
index e660cb5..c8822aa 100644
@@ -2811,7 +2811,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
 				}
 				dev_load(ifr.ifr_name);
 				rtnl_lock();
-				/* Follow me in net/core/wireless.c */
+				/* Follow me in net/wireless/wext-old.c */
 				ret = wireless_process_ioctl(&ifr, cmd);
 				rtnl_unlock();
 				if (IW_IS_GET(cmd) &&
net/core/wireless.c deleted +0 -2353

2,353 lines not on this page · raw message

net/wireless/Makefile +2 -0
index c030b12..b039edd 100644
@@ -2,3 +2,5 @@ obj-$(CONFIG_CFG80211) += cfg80211.o
 
 cfg80211-objs := \
 	core.o nl80211.o
+
+obj-$(CONFIG_WIRELESS_EXT) += wext-old.o
net/wireless/wext-old.c new file +2353 -0

619 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 9 lines
1.4.4.2

-- 
John W. Linville
[email protected]
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

Part of the diff is not shown here. View the raw message.

#3 lore raw

RFC PATCH 3/3 cfg80211: add wext-compatible client

From: Johannes Berg <[email protected]>

---
 include/linux/netdevice.h  |    7 +-
 include/net/cfg80211.h     |   34 +-
 net/Kconfig                |   28 +
 net/core/dev.c             |   38 +-
 net/core/net-sysfs.c       |    4 +-
 net/core/rtnetlink.c       |   42 ++-
 net/wireless/Makefile      |   10 +
 net/wireless/core.c        |   16 +-
 net/wireless/core.h        |   21 +
 net/wireless/wext-common.c |  610 ++++++++++++++++
 net/wireless/wext-compat.c | 1646 +++++++++++++++++++++++++++++++++++++++++++-
 net/wireless/wext-old.c    |  629 +-----------------
 net/wireless/wext.h        |   13 +
 13 files changed, 2433 insertions(+), 665 deletions(-)
include/linux/netdevice.h +6 -1
index c1e9962..6a9b4c8 100644
@@ -348,12 +348,17 @@ struct net_device
 
 	struct net_device_stats* (*get_stats)(struct net_device *dev);
 
+#ifdef CONFIG_WIRELESS_EXT
 	/* List of functions to handle Wireless Extensions (instead of ioctl).
 	 * See <net/iw_handler.h> for details. Jean II */
 	const struct iw_handler_def *	wireless_handlers;
 	/* 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 +23 -11
index d83c47f..2a78a6d 100644
@@ -6,6 +6,7 @@
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <net/genetlink.h>
+#include <linux/wireless.h>
 
 /*
  * 802.11 configuration in-kernel interface
@@ -17,21 +18,12 @@
  * struct cfg80211_config - description of a configuration (request)
  */
 struct cfg80211_config {
-	/* first fields with 'internal' validity */
+	/* see below */
+	u32 valid;
 
-	/* SSID to use, valid if not NULL, ssid_len then
-	 * contains the length. change forces reassociation */
 	s8 ssid_len;
 	u8 *ssid;
 
-	/* now fields with explicit validity */
-#define CFG80211_CFG_VALID_NWID			(1<<0)
-#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)
-	unsigned int valid;
-
 	u16 network_id;
 	s32 rx_sensitivity;
 	u32 transmit_power;
@@ -39,6 +31,13 @@ struct cfg80211_config {
 	u32 channel;
 };
 
+#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)
+
 struct scan_channel {
 	u32 channel;
 	int active;
@@ -87,6 +86,9 @@ struct scan_params {
  *
  * @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.
+ *
  * @reassociate: reassociate with current settings (SSID, BSSID if
  *		 userspace roaming is enabled)
  *
@@ -133,6 +135,7 @@ struct cfg80211_ops {
 			     struct cfg80211_config *cfg);
 	void	(*get_config)(void *priv, struct net_device *dev,
 			      struct cfg80211_config *cfg);
+	u32	(*get_config_valid)(void *priv, struct net_device *dev);
 
 
 	int	(*reassociate)(void *priv, struct net_device *dev);
@@ -190,4 +193,13 @@ extern void *nl80211hdr_put(struct sk_buff *skb, u32 pid,
 extern 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);
+#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/Kconfig +28 -0
index 8d121a5..fade3fd 100644
@@ -229,6 +229,34 @@ config FIB_RULES
 config CFG80211
 	tristate "Improved wireless configuration API"
 
+config CFG80211_WEXT_COMPAT
+	bool "cfg80211 Wireless Extensions compatibility"
+	depends CFG80211
+	default y
+	---help---
+	This option allows using devices whose drivers have been
+	converted to use the new cfg80211 with wireless extensions,
+	providing WE-20 compatibility. Note that cfg80211's "native"
+	interface is nl80211 using generic netlink. The wireless
+	extensions are being deprecated, but userspace tools may still
+	be using them.
+
+	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/core/dev.c +36 -2
index c8822aa..8584046 100644
@@ -116,6 +116,7 @@
 #include <linux/dmaengine.h>
 #include <linux/err.h>
 #include <linux/ctype.h>
+#include <net/cfg80211.h>
 
 /*
  *	The list of packet types we will receive (as opposed to discard)
@@ -2228,7 +2229,7 @@ static struct file_operations softnet_seq_fops = {
 	.release = seq_release,
 };
 
-#ifdef CONFIG_WIRELESS_EXT
+#if defined(CONFIG_WIRELESS_EXT) || defined(CFG80211_WEXT_COMPAT)
 extern int wireless_proc_init(void);
 #else
 #define wireless_proc_init() 0
@@ -2798,6 +2799,39 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
 					ret = -EFAULT;
 				return ret;
 			}
+#ifdef CONFIG_CFG80211_WEXT_COMPAT
+			/* Take care of cfg80211 WE compatibility */
+			if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
+				/* If command is `set a parameter', or
+				 * `get the encoding parameters', check if
+				 * the user has the right to do it */
+				if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE
+				    || cmd == SIOCGIWENCODEEXT) {
+					if (!capable(CAP_NET_ADMIN))
+						return -EPERM;
+				}
+				dev_load(ifr.ifr_name);
+				rtnl_lock();
+				/* Follow me in net/wireless/wext-compat.c */
+				ret = cfg80211_wext_ioctl(&ifr, cmd);
+				rtnl_unlock();
+				if (ret == 0 && IW_IS_GET(cmd) &&
+				    copy_to_user(arg, &ifr,
+					    	 sizeof(struct ifreq)))
+					ret = -EFAULT;
+				/* haha, I cheat here by allowing a driver or
+				 * stack to have both WE or CFG80211-WE for
+				 * a little while during conversion... hope that
+				 * ENOSYS is only used to indicate not implemented
+				 *
+				 * if wireless extensions are not configured
+				 * then this is the last thing here so that
+				 * if we fall through we return -EINVAL
+				 */
+				if (ret != -ENOSYS)
+					return ret;
+			}
+#endif
 #ifdef CONFIG_WIRELESS_EXT
 			/* Take care of Wireless Extensions */
 			if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
@@ -2814,7 +2848,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
 				/* Follow me in net/wireless/wext-old.c */
 				ret = wireless_process_ioctl(&ifr, cmd);
 				rtnl_unlock();
-				if (IW_IS_GET(cmd) &&
+				if (ret == 0 && IW_IS_GET(cmd) &&
 				    copy_to_user(arg, &ifr,
 					    	 sizeof(struct ifreq)))
 					ret = -EFAULT;
net/core/net-sysfs.c +2 -2
index f47f319..44e69a2 100644
@@ -329,7 +329,7 @@ static struct attribute_group netstat_group = {
 	.attrs  = netstat_attrs,
 };
 
-#ifdef WIRELESS_EXT
+#ifdef CONFIG_WIRELESS_EXT
 /* helper function that does all the locking etc for wireless stats */
 static ssize_t wireless_show(struct class_device *cd, char *buf,
 			     ssize_t (*format)(const struct iw_statistics *,
@@ -462,7 +462,7 @@ int netdev_register_sysfs(struct net_device *net)
 	if (net->get_stats)
 		*groups++ = &netstat_group;
 
-#ifdef WIRELESS_EXT
+#ifdef CONFIG_WIRELESS_EXT
 	if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
 		*groups++ = &wireless_group;
 #endif
net/core/rtnetlink.c +41 -1

73 lines not on this page · raw message

net/wireless/Makefile +10 -0
index b039edd..f285440 100644
@@ -4,3 +4,13 @@ cfg80211-objs := \
 	core.o nl80211.o
 
 obj-$(CONFIG_WIRELESS_EXT) += wext-old.o
+
+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)
net/wireless/core.c +13 -3
index 4a10ec2..ebf312a 100644
@@ -131,7 +131,7 @@ cfg80211_get_drv_from_ifindex(int ifindex)
 	if (drv)
 		mutex_lock(&drv->mtx);
 	else
-		drv = ERR_PTR(-ENODEV);
+		drv = ERR_PTR(-ENOSYS);
 	dev_put(dev);
  out:
 	mutex_unlock(&cfg80211_drv_mutex);
@@ -221,13 +221,23 @@ EXPORT_SYMBOL_GPL(cfg80211_unregister);
 
 static int cfg80211_init(void)
 {
-	/* possibly need to do more later */
+#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)
 {
-	/* possibly need to do more later */
+#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/core.h +21 -0
index 562c476..595f184 100644
@@ -9,6 +9,7 @@
 #include <linux/mutex.h>
 #include <linux/list.h>
 #include <net/genetlink.h>
+#include <linux/module.h>
 
 struct cfg80211_registered_driver {
 	struct cfg80211_ops *ops;
@@ -25,6 +26,26 @@ struct cfg80211_registered_driver {
 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/wext-common.c new file +610 -0

610 lines not on this page · raw message

net/wireless/wext-compat.c +1627 -19

1,652 lines not on this page · raw message

net/wireless/wext-old.c +3 -626

384 lines not on this page · raw message

net/wireless/wext.h new file +13 -0
new file mode 100644
index 0000000..fcf1c5a

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 9 lines
1.4.4.2

-- 
John W. Linville
[email protected]
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

Part of the diff is not shown here. View the raw message.

#4 lore raw

Re: [RFC PATCH 2/3] wireless: move wext to net/wireless/

In reply to John W. Linville
Quoted 5 lines · John W. Linville

From: Johannes Berg <[email protected]>

This patch moves net/core/wireless.c to net/wireless/wext.c. I refrained from further cleanups though I was tempted. Hence this is a pure file move plus various build system adjustments.

Is this the right name? Shouldn't it be wext-ioctl.c given that we'll hopefull soon grow a wext implementation with a proper method table interface for drivers.

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

maintainer
#5 lore raw

Re: [RFC PATCH 2/3] wireless: move wext to net/wireless/

Quoted 3 lines · Christoph Hellwig

Is this the right name? Shouldn't it be wext-ioctl.c given that we'll hopefull soon grow a wext implementation with a proper method table interface for drivers.

No, wext is dead, the replacement is a mix of cfg80211 and nl80211. Besides, wext isn't strictly ioctl-based, it does netlink too (but just puts the ioctl data into netlink messages and has the same braindamage.)

johannes

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

#6 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

In reply to John W. Linville

include/linux/nl80211.h line 27

Quoted 7 lines · John W. Linville

From: Johannes Berg <[email protected]>

include/linux/nl80211.h new file +5 -0
+	/* Inject a frame using NL80211_ATTR_FLAGS and NL80211_ATTR_FRAME.
+	 * If kernel sends this, it's a status notification for the injected
+	 * frame. */
+	NL80211_CMD_INJECT,
+

I think drivers that currently support frame injection do it by allowing TX on a monitor interface w/ AVS or radiotap header. I would rather have this than requiring the use of NL80211 to inject frames since userspace won't have to do as much to continue supporting frame injection. It also makes more sense to me. Status notification can be done by a 802.11 ACK frame. Radiotap might need to be extended to support toggling the ACK frame reporting for TX and whatever else userspace wants to set.

[snip]

include/linux/nl80211.h line 56

Quoted 9 lines
include/linux/nl80211.h new file +9 -0
+	/* configure device */
+	NL80211_CMD_CONFIGURE,
+
+	/* request configuration */
+	NL80211_CMD_GET_CONFIG,
+
+	/* configuration sent from kernel */
+	NL80211_CMD_NEW_CONFIG,
+

Why NEW?

[snip]

include/linux/nl80211.h line 87

Quoted 3 lines
include/linux/nl80211.h new file +3 -0
+	/* currently set roaming BSSID */
+	NL80211_CMD_FIXED_BSSID,
+

Wasn't immediately obvious to me that this is from GET_FIXED_BSSID.

include/linux/nl80211.h line 94

Quoted 7 lines
include/linux/nl80211.h new file +7 -0
+	/* get current association information, if not associated then
+	 * the BSSID attribute is not present in response */
+	NL80211_CMD_GET_ASSOCIATION,
+
+	/* association notification and response to GET_BSSID */
+	NL80211_CMD_ASSOCIATION_CHANGED,
+

I don't see a GET_BSSID. Did you mean GET_ASSOCIATION?

[snip]

include/linux/nl80211.h line 164

Quoted 4 lines
include/linux/nl80211.h new file +4 -0
+	/* attributes used for configuration */
+	/* network ID (pre 802.11 HW) */
+	NL80211_ATTR_NETWORK_ID,
+

We really want to support (and port) pre 802.11 drivers?

[snip]

include/linux/nl80211.h line 185

Quoted 1 line
include/linux/nl80211.h new file +1 -0
+	/* SSID of ESS to associate to */

BSS?

Quoted 2 lines
include/linux/nl80211.h new file +2 -0
+	NL80211_ATTR_SSID,
+

[snip]

Quoted 4 lines

+ * @list_interfaces: for each interfaces belonging to the wiphy identified
+ * by the priv pointer, call the one() function with the
+ * given data and the ifindex. This callback is required.
+ *

Do we really have to have this?

Thanks,
-Michael Wu

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

#7 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 7 lines · Michael Wu

I think drivers that currently support frame injection do it by allowing TX on a monitor interface w/ AVS or radiotap header. I would rather have this than requiring the use of NL80211 to inject frames since userspace won't have to do as much to continue supporting frame injection. It also makes more sense to me. Status notification can be done by a 802.11 ACK frame. Radiotap might need to be extended to support toggling the ACK frame reporting for TX and whatever else userspace wants to set.

Please, don't do that. You need to get a success/failure report from the driver/stack. Doing that by dumping fake frames through the network interfaces isn't something I could consider as a right behaviour. Also, you need to match the sent frame and the report from the driver. This gets really tricky when you use network interfaces.

Jiri

Signature · 6 lines
Jiri Benc
SUSE Labs
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#8 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 9 lines · Jiri Benc
Quoted 7 lines · Michael Wu

I think drivers that currently support frame injection do it by allowing TX on a monitor interface w/ AVS or radiotap header. I would rather have this than requiring the use of NL80211 to inject frames since userspace won't have to do as much to continue supporting frame injection. It also makes more sense to me. Status notification can be done by a 802.11 ACK frame. Radiotap might need to be extended to support toggling the ACK frame reporting for TX and whatever else userspace wants to set.

Quoted 5 lines

Please, don't do that. You need to get a success/failure report from the driver/stack. Doing that by dumping fake frames through the network interfaces isn't something I could consider as a right behaviour. Also, you need to match the sent frame and the report from the driver. This gets really tricky when you use network interfaces.

TX control information also needs to be passed somehow. So you would require some TXcontrol header or something like that for the injected data. Not really scalable.

Signature · 5 lines
Greetings Michael.
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
maintainer
#9 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

In reply to Michael Wu
Quoted 7 lines · Michael Wu

I think drivers that currently support frame injection do it by allowing TX on a monitor interface w/ AVS or radiotap header. I would rather have this than requiring the use of NL80211 to inject frames since userspace won't have to do as much to continue supporting frame injection. It also makes more sense to me. Status notification can be done by a 802.11 ACK frame. Radiotap might need to be extended to support toggling the ACK frame reporting for TX and whatever else userspace wants to set.

I disagree. Generic netlink is trivially extensible while radiotap isn't, and I really don't want a radiotap parser in the kernel. Secondly, a lot of notification items will only be given via netlink anyway, like failed decryption or whatever, and we don't want to keep all this in fake management frames.

Quoted 4 lines

include/linux/nl80211.h line 56

Quoted 3 lines
include/linux/nl80211.h new file +3 -0
+	/* configuration sent from kernel */
+	NL80211_CMD_NEW_CONFIG,
+

Why NEW?

I think Thomas suggested the scheme GET/SET/NEW but I don't really care.

Quoted 5 lines

[snip]

include/linux/nl80211.h line 87

Quoted 3 lines
include/linux/nl80211.h new file +3 -0
+	/* currently set roaming BSSID */
+	NL80211_CMD_FIXED_BSSID,
+

Wasn't immediately obvious to me that this is from GET_FIXED_BSSID.

should get a NEW prefix as well then? :)

Quoted 8 lines

include/linux/nl80211.h line 94

Quoted 7 lines
include/linux/nl80211.h new file +7 -0
+	/* get current association information, if not associated then
+	 * the BSSID attribute is not present in response */
+	NL80211_CMD_GET_ASSOCIATION,
+
+	/* association notification and response to GET_BSSID */
+	NL80211_CMD_ASSOCIATION_CHANGED,
+

I don't see a GET_BSSID. Did you mean GET_ASSOCIATION?

Yeah, I suppose I do.

Quoted 6 lines

[snip]

include/linux/nl80211.h line 164

Quoted 4 lines
include/linux/nl80211.h new file +4 -0
+	/* attributes used for configuration */
+	/* network ID (pre 802.11 HW) */
+	NL80211_ATTR_NETWORK_ID,
+

We really want to support (and port) pre 802.11 drivers?

Not really sure. Do we? This is probably the only thing required for that... We can leave it out and if someone wants to port them later add it in.

Quoted 3 lines

[snip]

include/linux/nl80211.h line 185

Quoted 1 line
include/linux/nl80211.h new file +1 -0
+	/* SSID of ESS to associate to */

BSS?

Well, I think that comes down to what happens if we don't set a BSSID but do set an SSID and then tell it to associate. In that case, it should chose a BSS from the ESS with that SSID.

Quoted 5 lines
Quoted 4 lines

+ * @list_interfaces: for each interfaces belonging to the wiphy identified
+ * by the priv pointer, call the one() function with the
+ * given data and the ifindex. This callback is required.
+ *

Do we really have to have this?

We can only not have this if we mandate that all add/remove interface operations go through cfg80211. I was afraid that wouldn't be too popular. If we do mandate that then we can keep the list in cfg80211 instead of having to query the driver/stack.
However, d80211 at least will need access to the list. So then we have to add API for that. And all the legacy non-d80211 drivers (except for ipw2200) will ever only return a single interface so it's trivial to implement there. Hence, I stuck with this. I'm open for changes, of course.

If I now misunderstood the question... Yes, we do need to know the list of devices associated to a certain wiphy, if only to be able to have userspace print it out :)

johannes

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

#10 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 6 lines · Johannes Berg

I disagree. Generic netlink is trivially extensible while radiotap isn't, and I really don't want a radiotap parser in the kernel. Secondly, a lot of notification items will only be given via netlink anyway, like failed decryption or whatever, and we don't want to keep all this in fake management frames.

Okay then, let's not use fake frames then. Let's make monitor interfaces resemble monitoring ethernet a little more by reporting both RXed frames and TXed frames. *BSD does this too and it makes running ethereal on monitor interfaces much more useful. TX frame reporting can be done simply in the ieee80211_tx_status call, allowing the TX status to be reported on real frames.

Doing this is actually somewhat orthogonal to packet injection via netlink or monitor interface, but if we are reporting TXed frames with a radiotap header, we might as well allow frame injection with a radiotap frame for consistency. It seems far better than receiving frames on one interface and then using netlink to TX on some wiphy. Not to mention that using a configuration interface to send data doesn't make much sense when there's a perfectly fine network interface available. Radiotap parsing isn't much harder than EID parsing, allows current frame injection programs to continue working, and might even make it easier to run those programs on BSD too. (I don't know what mechanism BSD uses for frame injection)

-Michael Wu

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

maintainer
#11 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 1 line · Michael Wu

Okay then, let's not use fake frames then.

:)

Quoted 4 lines

Let's make monitor interfaces
resemble monitoring ethernet a little more by reporting both RXed frames and TXed frames. *BSD does this too and it makes running ethereal on monitor interfaces much more useful.

We do this right now afaik.

Quoted 3 lines

TX frame reporting can be done simply in the ieee80211_tx_status call, allowing the TX status to be reported on real frames.

I don't quite understand this comment. TX status reporting should go via nl80211.

Quoted 4 lines

Doing this is actually somewhat orthogonal to packet injection via netlink or monitor interface, but if we are reporting TXed frames with a radiotap header, we might as well allow frame injection with a radiotap frame for consistency.

Well, it hasn't got much merit because for anything useful you'll need to get state information on nl80211.

johannes

#12 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 7 lines · Johannes Berg
Quoted 4 lines

Let's make monitor interfaces
resemble monitoring ethernet a little more by reporting both RXed frames and TXed frames. *BSD does this too and it makes running ethereal on monitor interfaces much more useful.

We do this right now afaik.

Where? I don't remember getting TX frames when running ethereal on a monitor interface.

Quoted 7 lines
Quoted 3 lines

TX frame reporting can be done simply in the ieee80211_tx_status call, allowing the TX status to be reported on real frames.

I don't quite understand this comment. TX status reporting should go via nl80211.

If we report TXed frames at the point when the driver calls ieee80211_tx_status, we know whether or not an ack was received. This information can be added to the TX frame that is reported to the monitor interface.

Quoted 8 lines
Quoted 4 lines

Doing this is actually somewhat orthogonal to packet injection via netlink or monitor interface, but if we are reporting TXed frames with a radiotap header, we might as well allow frame injection with a radiotap frame for consistency.

Well, it hasn't got much merit because for anything useful you'll need to get state information on nl80211.

I'm not sure what you mean. The program can get the configuration info it needs from nl80211/cfg80211/WE and send/inject frames through the monitor interface.

-Michael Wu

maintainer
#13 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 2 lines · Michael Wu

Where? I don't remember getting TX frames when running ethereal on a monitor interface.

Ok, maybe it's missing. I think I saw them, but not sure. They do show up on wmaster ;)

Quoted 4 lines

If we report TXed frames at the point when the driver calls ieee80211_tx_status, we know whether or not an ack was received. This information can be added to the TX frame that is reported to the monitor interface.

Oh but do we really want to report them that late? I wouldn't think so. That would give us out-of-order issues wrt. the air...

Quoted 3 lines

I'm not sure what you mean. The program can get the configuration info it needs from nl80211/cfg80211/WE and send/inject frames through the monitor interface.

Well, I guess I'm saying that wpa_supplicant shouldn't need the monitor iface at all since it wants just management frames and we should give those to it via netlink to avoid having to add more radiotap foo.

johannes

#14 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 2 lines · Johannes Berg

Oh but do we really want to report them that late? I wouldn't think so. That would give us out-of-order issues wrt. the air...

No. It's the other way around, when they're reported immediately, they will be out of order. ieee80211_tx_status is called from the interrupt handler as the result of the frame being actually sent. Before that, a frame can sit for an arbitrary long time in the hw queue or not sent at all. Reporting only frames confirmed by ieee80211_tx_status as successfully sent at the time the function is called reflects better what is on the air (it's still not perfect as things like retransmissions are not caught).

Quoted 3 lines

Well, I guess I'm saying that wpa_supplicant shouldn't need the monitor iface at all since it wants just management frames and we should give those to it via netlink to avoid having to add more radiotap foo.

Agreed.

Jiri

Signature · 2 lines
Jiri Benc
SUSE Labs
maintainer
#15 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 8 lines · Jiri Benc

No. It's the other way around, when they're reported immediately, they will be out of order. ieee80211_tx_status is called from the interrupt handler as the result of the frame being actually sent. Before that, a frame can sit for an arbitrary long time in the hw queue or not sent at all. Reporting only frames confirmed by ieee80211_tx_status as successfully sent at the time the function is called reflects better what is on the air (it's still not perfect as things like retransmissions are not caught).

Yeah, you're right. Then again, it doesn't matter all that much since if you want exact timing you need a card that never transmits in monitor mode anyway.

johannes

#16 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

In reply to Jiri Benc
Quoted 8 lines · Jiri Benc

No. It's the other way around, when they're reported immediately, they will be out of order. ieee80211_tx_status is called from the interrupt handler as the result of the frame being actually sent. Before that, a frame can sit for an arbitrary long time in the hw queue or not sent at all. Reporting only frames confirmed by ieee80211_tx_status as successfully sent at the time the function is called reflects better what is on the air (it's still not perfect as things like retransmissions are not caught).

What is your definition for "successfully sent" in this context? I would probably also include frames that did not receive ACK, but did have some transmit tries. If there is place for reporting TX status (ack/no ack, number of retries) that could be added here. In addition, some hardware designs may also return the timestamp of the transmission in TX status, so that could also be added. This would actually make it possible to figure out the exact sequence of frames (in userspace app), if needed.

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#17 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

In reply to Johannes Berg
Quoted 8 lines · Johannes Berg
Quoted 3 lines

I'm not sure what you mean. The program can get the configuration info it needs from nl80211/cfg80211/WE and send/inject frames through the monitor interface.

Well, I guess I'm saying that wpa_supplicant shouldn't need the monitor iface at all since it wants just management frames and we should give those to it via netlink to avoid having to add more radiotap foo.

Yeah, a monitor interface is overkill for wpa_supplicant. We can make the IEEE80211_IF_TYPE_MGMT be a sort of filtered monitor interface optimized for userspace MLME. Or maybe add some sort of filtering configuration for monitor interfaces.. might be overkill. Anyway, netlink does not seem appropriate for sending or receiving frames.

-Michael Wu

maintainer
#18 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 2 lines · Michael Wu

Anyway, netlink does not seem appropriate for
sending or receiving frames.

Care to explain why you think so?

johannes

#19 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 6 lines · Johannes Berg
Quoted 2 lines · Michael Wu

Anyway, netlink does not seem appropriate for
sending or receiving frames.

Care to explain why you think so?

1. Userspace usually expects to send things on network interfaces. The kernel usually receives frames from userspace on network interfaces. I don't see the point of making an exception for 802.11 frames. (or rather, the potential for simpler frame injection code is not enough to justify inventing a new interface for doing it)
2. nl80211/cfg80211 is for configuring interfaces. Everything there is related to configuration of wireless interfaces except for the frame injection hook. It doesn't look right.

-Michael Wu

maintainer
#20 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

Quoted 5 lines · Michael Wu

1. Userspace usually expects to send things on network interfaces. The kernel usually receives frames from userspace on network interfaces. I don't see the point of making an exception for 802.11 frames. (or rather, the potential for simpler frame injection code is not enough to justify inventing a new interface for doing it)

I guess I'm a purist here and would expect to be able to push frames of whatever type the interface says it supports, if any. But this breaks, you'll be pushing some sort of extensible format down there. [1]

Also, assuming that we do transmit software in userspace then has to parse the

Quoted 3 lines

2. nl80211/cfg80211 is for configuring interfaces. Everything there is related to configuration of wireless interfaces except for the frame injection hook. It doesn't look right.

Ok, well, I've removed it for now.

johannes

[1] it would have to be, I'm sure new frame injection requirements will come up at some point and we can't break old apps

#21 lore raw

Re: [RFC PATCH 1/3] cfg80211 and nl80211

In reply to Johannes Berg
Quoted 6 lines · Johannes Berg
Quoted 4 lines

Let's make monitor interfaces
resemble monitoring ethernet a little more by reporting both RXed frames and TXed frames. *BSD does this too and it makes running ethereal on monitor interfaces much more useful.

We do this right now afaik.

AFAIK we report RXed frames only.

Quoted 6 lines
Quoted 3 lines

TX frame reporting can be done simply in the ieee80211_tx_status call, allowing the TX status to be reported on real frames.

I don't quite understand this comment. TX status reporting should go via nl80211.

I think Michael meant that an elegant way for sending also TXed frames to monitor interfaces is to do that in ieee80211_tx_status. Makes sense to me.

Jiri

Signature · 2 lines
Jiri Benc
SUSE Labs
#22 lore raw
In reply to John W. Linville
Quoted 5 lines · John W. Linville

In London we agreed that it would be good to go ahead and merge cfg80211.

Let me know if I've left anything out, screwed anything up, or if you no longer think a cfg80211 merge is appropriate at this time.

Merge to the mainline kernel? Do we really believe that this is ready for this now? I have to admit that I have not personally tested this, but based on what I've heard, this does not seem to be complete yet and there are some areas that may need to be changed or at least there has been some comments on desire to change something in the design, e.g., for the MLME requests and recently for the SSID handling. In addition, I have not heard of any user space programs that would actually be using this interface.

What would happen if this gets merged in now and some major problems are found when people start implementing programs using this interface? Would we be stuck with maintaining this user space interface as-is for years without having a chance of easily fixing something?

I'm all for getting this into the mainline kernel as soon as possible, but I do not think that this should happen before there are user space programs that demonstrate that cfg80211 can be used without problems and that the kernel side implementation is complete enough to allow some meaningful operations to be completed with cfg80211 (likely with WEXT disabled, i.e., cfg80211 being feature complete for, say, WPA authentication).

I have been waiting for cfg80211 to become bit more stable and functional before implementing support for it as an alternative driver interface in wpa_supplicant. Based on what I heard in London, this would not work yet, but maybe now would be a suitable time to at least start experimenting with this by making a copy of the WEXT interface code and starting to change operations one by one from WEXT to cfg80211 based on what actually is available in the kernel.

Signature · 5 lines
Jouni Malinen                                            PGP id EFC895FA
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#23 lore raw
Quoted 7 lines · Jouni Malinen

I'm all for getting this into the mainline kernel as soon as possible, but I do not think that this should happen before there are user space programs that demonstrate that cfg80211 can be used without problems and that the kernel side implementation is complete enough to allow some meaningful operations to be completed with cfg80211 (likely with WEXT disabled, i.e., cfg80211 being feature complete for, say, WPA authentication).

I fully agree with Jouni.

Jiri

Signature · 6 lines
Jiri Benc
SUSE Labs
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#24 lore raw
Quoted 10 lines · Jiri Benc
Quoted 7 lines · Jouni Malinen

I'm all for getting this into the mainline kernel as soon as possible, but I do not think that this should happen before there are user space programs that demonstrate that cfg80211 can be used without problems and that the kernel side implementation is complete enough to allow some meaningful operations to be completed with cfg80211 (likely with WEXT disabled, i.e., cfg80211 being feature complete for, say, WPA authentication).

I fully agree with Jouni.

OK, where were you guys in London? I don't recall any disagreement there?

The WEXT compat code should be enough to drive the cfg80211 code. And we would mark it CONFIG_EXPERIMENTAL (which I left out of the patch) for now. I suppose we could leave-out the nl80211 part to avoid userland lock-in for now?

This also has the advantage of including the ieee80211_ptr in the net_device structure, hopefully easing the task of packaging the rest of the stack for external builds.

I suppose we could wait for at least one driver to be cfg80211-capable. Would that satisfy everyone?

John

Signature · 6 lines
John W. Linville
[email protected]
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#25 lore raw
Quoted 2 lines · John W. Linville

OK, where were you guys in London? I don't recall any disagreement there?

Hm, I remember we agreed that merging of d80211 and cfg80211/nl80211 are two separate things. And a discussion about cfg80211/nl80211 not being quite ready yet (if I remember correctly, Jouni participated in that discussion). But well, it was just informal and maybe I missed something else.

Quoted 4 lines

The WEXT compat code should be enough to drive the cfg80211 code. And we would mark it CONFIG_EXPERIMENTAL (which I left out of the patch) for now. I suppose we could leave-out the nl80211 part to avoid userland lock-in for now?

Yes, that could solve that I think.

Quoted 3 lines

This also has the advantage of including the ieee80211_ptr in the net_device structure, hopefully easing the task of packaging the rest of the stack for external builds.

Definitely.

Quoted 2 lines

I suppose we could wait for at least one driver to be cfg80211-capable. Would that satisfy everyone?

If cfg80211-capable means also WPA-capable and if nl80211 is left out until user space counterpart exists, yes, I'm okay with that.

Thanks,

Jiri

Signature · 6 lines
Jiri Benc
SUSE Labs
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#26 lore raw
Quoted 9 lines · Jiri Benc
Quoted 2 lines · John W. Linville

OK, where were you guys in London? I don't recall any disagreement there?

Hm, I remember we agreed that merging of d80211 and cfg80211/nl80211 are two separate things. And a discussion about cfg80211/nl80211 not being quite ready yet (if I remember correctly, Jouni participated in that discussion). But well, it was just informal and maybe I missed something else.

Yes, cfg80211 should go in first so we can use it to avoid all the boilerplate code in existing and new drivers. Once we have netlink-capable userspace nl80211 can be added ontop of that. This also allows for possibly needed adjustments of the nl interface when writing the tools actually using it.

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

#27 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 9 lines · Jiri Benc
Quoted 2 lines · John W. Linville

OK, where were you guys in London? I don't recall any disagreement there?

Hm, I remember we agreed that merging of d80211 and cfg80211/nl80211 are two separate things. And a discussion about cfg80211/nl80211 not being quite ready yet (if I remember correctly, Jouni participated in that discussion). But well, it was just informal and maybe I missed something else.

Quoted 5 lines

Yes, cfg80211 should go in first so we can use it to avoid all the boilerplate code in existing and new drivers. Once we have netlink-capable userspace nl80211 can be added ontop of that. This also allows for possibly needed adjustments of the nl interface when writing the tools actually using it.

Agreed. I (and/or Johannes?) will rework the patches to remove the nl bits.

Thanks,

John

Signature · 6 lines
John W. Linville
[email protected]
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#29 lore raw

As far as I tested cfg80211 compatibility mode is incomplete. You cannot run hostapd over it
If I recall correctly PRISM2_IOCTL_PRISM2_PARAM and friends are not passed to d80211

Tomas.

Quoted 10 lines · Johannes Berg
Quoted 2 lines · John W. Linville

Agreed. I (and/or Johannes?) will rework the patches to remove the nl bits.

Starting tomorrow I can devote some time again.

Maybe we should resurrect those wiphy patches I had first?

Quoted 11 lines

johannes

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

maintainer
#30 lore raw
Quoted 4 lines · Tomas Winkler

As far as I tested cfg80211 compatibility mode is incomplete. You cannot run hostapd over it
If I recall correctly PRISM2_IOCTL_PRISM2_PARAM and friends are not passed to d80211

It's a priv ioctl, it's not supposed to be passed on.

johannes (who is getting positively pissed off about such requests)

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

#31 lore raw

Can you elaborate shortly. I'm not from time 0 on this list. Thanks.

Quoted 13 lines · Johannes Berg
Quoted 4 lines · Tomas Winkler

As far as I tested cfg80211 compatibility mode is incomplete. You cannot run hostapd over it
If I recall correctly PRISM2_IOCTL_PRISM2_PARAM and friends are not passed to d80211

It's a priv ioctl, it's not supposed to be passed on.

johannes (who is getting positively pissed off about such requests)

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

maintainer
#32 lore raw
Quoted 1 line · Tomas Winkler

Can you elaborate shortly. I'm not from time 0 on this list.

Well. cfg80211 will replace the common wext ioctls. All the private wext ioctls will not be handled there.

The rationale is that
(1) it doesn't delete priv ioctls, they'll still work for the migration period
(2) you can't rely on private ioctls having a certain meaning for each driver, ie. other drivers are free the reassign numbers of sub-ioctls
(3) any behaviour that is generally useful should be standardised.

johannes

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

#33 lore raw

Johannes
I don't know who is missing something here, but what I'm saying that (1) is not correct. priv ioctls don't work with compatibility set on. In any case I'll check it again to be sure and I will apologize if I'm not correct.
I definitely agree on two other points.

Thanks
Tomas

Quoted 15 lines · Johannes Berg
Quoted 1 line · Tomas Winkler

Can you elaborate shortly. I'm not from time 0 on this list.

Well. cfg80211 will replace the common wext ioctls. All the private wext ioctls will not be handled there.

The rationale is that
(1) it doesn't delete priv ioctls, they'll still work for the migration period
(2) you can't rely on private ioctls having a certain meaning for each driver, ie. other drivers are free the reassign numbers of sub-ioctls
(3) any behaviour that is generally useful should be standardised.

Quoted 4 lines

johannes

_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless

maintainer
#34 lore raw
Quoted 3 lines · Tomas Winkler

I don't know who is missing something here, but what I'm saying that
(1) is not correct. priv ioctls don't work with compatibility set on.

Yup, looks like a bug. This should fix it.

johannes

net/wireless/wext-compat.c +2 -2
@@ -1395,7 +1395,7 @@ int cfg80211_wext_nl_get(struct net_devi
 					      &iw_handler_get_iwstats,
 					      p_buf, p_len);
 	if(request->cmd == SIOCGIWPRIV)
-		return -EOPNOTSUPP;
+		return -ENOSYS;
 
 	/* Basic check */
 	if (!netif_device_present(dev))
@@ -1618,7 +1618,7 @@ int cfg80211_wext_ioctl(struct ifreq *if
 						   &iw_handler_get_iwstats);
 
 		case SIOCGIWPRIV:
-			return -EOPNOTSUPP;
+			return -ENOSYS;
 		default:
 			/* Basic check */
 			if (!netif_device_present(dev))
#35 lore raw
In reply to Tomas Winkler
Quoted 2 lines · Tomas Winkler

Can you elaborate shortly. I'm not from time 0 on this list. Thanks.

Use Google and list archives, that's why their exist.

Jiri

Signature · 6 lines
Jiri Benc
SUSE Labs
_______________________________________________
wireless mailing list
[email protected]
http://lists.tuxdriver.org/mailman/listinfo/wireless
#36 lore raw
In reply to John W. Linville

In London we agreed that it would be good to go ahead and merge cfg80211. This provides some exposure to the API and eases some of the pain for driver maintainers (who won't have to follow wireless-dev to get it). It also adds the ieee80211_ptr to the net_device struct.

I have refactored the cfg80211-related patches down to three patches. This eliminates some of the churn in the series from wireless-dev, and each patch leaves a buildable tree. This version also removes the nl80211 bits to a separate patch (available in wireless-dev on the mm-master branch).

Let me know if I've left anything out, screwed anything up, etc...

Thanks,

John

Signature · 2 lines
John W. Linville
[email protected]
#37 lore raw

RFC PATCH 1/3 wireless: add cfg80211

From: Johannes Berg <[email protected]>

This patch adds cfg80211, a new configuration system for wireless hardware.

It currently features a bunch of configuration requests, support for adding and removing virtual interfaces, the ability to inject packets and more.

---
 include/linux/netdevice.h  |    1 +
 include/net/cfg80211.h     |  186 ++++++++++++++++++++++++++++++++++++++++++++
 net/Kconfig                |    3 +
 net/Makefile               |    1 +
 net/wireless/Makefile      |    4 +
 net/wireless/core.c        |  158 +++++++++++++++++++++++++++++++++++++
 net/wireless/core.h        |   57 ++++++++++++++
 net/wireless/wext-compat.c |   25 ++++++
 8 files changed, 435 insertions(+), 0 deletions(-)
include/linux/netdevice.h +1 -0
index fea0d9d..c1e9962 100644
@@ -398,6 +398,7 @@ struct net_device
 	void                    *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 */
 
 /*
  * Cache line mostly used on receive path (including eth_type_trans())
include/net/cfg80211.h new file +186 -0

186 lines not on this page · raw message

net/Kconfig +3 -0
index 7dfc949..8d121a5 100644
@@ -226,6 +226,9 @@ config WIRELESS_EXT
 config FIB_RULES
 	bool
 
+config CFG80211
+	tristate "Improved wireless configuration API"
+
 endif   # if NET
 endmenu # Networking
 
net/Makefile +1 -0
index ad4d14f..278d6bf 100644
@@ -44,6 +44,7 @@ obj-$(CONFIG_ECONET)		+= econet/
 obj-$(CONFIG_VLAN_8021Q)	+= 8021q/
 obj-$(CONFIG_IP_DCCP)		+= dccp/
 obj-$(CONFIG_IP_SCTP)		+= sctp/
+obj-$(CONFIG_CFG80211)		+= wireless/
 obj-$(CONFIG_IEEE80211)		+= ieee80211/
 obj-$(CONFIG_TIPC)		+= tipc/
 obj-$(CONFIG_NETLABEL)		+= netlabel/
net/wireless/Makefile new file +4 -0
new file mode 100644
index 0000000..4a87dce
@@ -0,0 +1,4 @@
+obj-$(CONFIG_CFG80211) += cfg80211.o
+
+cfg80211-objs := \
+	core.o
net/wireless/core.c new file +158 -0

158 lines not on this page · raw message

net/wireless/core.h new file +57 -0

57 lines not on this page · raw message

net/wireless/wext-compat.c new file +25 -0
new file mode 100644
index 0000000..1c7c361
@@ -0,0 +1,25 @@
+/* NOT YET */
+
+To implement compatibility, we add a new field to struct net_device
+that contains the pending configuration structure. This is dynamically
+allocated when needed and freed when committed.
+In a way it replaces the wireless_handlers field in there which is now
+done by dynamic lookup. No worries. No one is going to have thousands
+of wireless devices, and if that changes we can still trivially change
+this assumption :)
+
+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.
+
+compatibility mappings:
+
+SIOCSIWAP
+  -> if bssid is all-ones: set roaming to kernel, reassociate
+  -> if bssid is all-zeroes: set roaming to kernel
+  -> otherwise: set roaming to userspace, set bssid
+
+SIOCGIWAP
+  -> get association parameters and fill return bssid appropriately
+
Signature · 5 lines
1.4.4.2

-- 
John W. Linville
[email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#39 lore raw

RFC PATCH 3/3 cfg80211: add wext-compatible client

From: Johannes Berg <[email protected]>

---
 include/linux/netdevice.h  |    7 +-
 include/net/cfg80211.h     |   34 +-
 net/Kconfig                |   28 +
 net/core/dev.c             |   38 +-
 net/core/net-sysfs.c       |    4 +-
 net/core/rtnetlink.c       |   42 ++-
 net/wireless/Makefile      |   10 +
 net/wireless/core.c        |   15 +-
 net/wireless/core.h        |   21 +
 net/wireless/wext-common.c |  610 ++++++++++++++++
 net/wireless/wext-compat.c | 1646 +++++++++++++++++++++++++++++++++++++++++++-
 net/wireless/wext-old.c    |  629 +-----------------
 net/wireless/wext.h        |   13 +
 13 files changed, 2433 insertions(+), 664 deletions(-)
include/linux/netdevice.h +6 -1
index c1e9962..6a9b4c8 100644
@@ -348,12 +348,17 @@ struct net_device
 
 	struct net_device_stats* (*get_stats)(struct net_device *dev);
 
+#ifdef CONFIG_WIRELESS_EXT
 	/* List of functions to handle Wireless Extensions (instead of ioctl).
 	 * See <net/iw_handler.h> for details. Jean II */
 	const struct iw_handler_def *	wireless_handlers;
 	/* 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 +23 -11
index c0bc9d4..353d3ce 100644
@@ -5,6 +5,7 @@
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <net/genetlink.h>
+#include <linux/wireless.h>
 
 /*
  * 802.11 configuration in-kernel interface
@@ -16,21 +17,12 @@
  * struct cfg80211_config - description of a configuration (request)
  */
 struct cfg80211_config {
-	/* first fields with 'internal' validity */
+	/* see below */
+	u32 valid;
 
-	/* SSID to use, valid if not NULL, ssid_len then
-	 * contains the length. change forces reassociation */
 	s8 ssid_len;
 	u8 *ssid;
 
-	/* now fields with explicit validity */
-#define CFG80211_CFG_VALID_NWID			(1<<0)
-#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)
-	unsigned int valid;
-
 	u16 network_id;
 	s32 rx_sensitivity;
 	u32 transmit_power;
@@ -38,6 +30,13 @@ struct cfg80211_config {
 	u32 channel;
 };
 
+#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)
+
 struct scan_channel {
 	u32 channel;
 	int active;
@@ -86,6 +85,9 @@ struct scan_params {
  *
  * @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.
+ *
  * @reassociate: reassociate with current settings (SSID, BSSID if
  *		 userspace roaming is enabled)
  *
@@ -132,6 +134,7 @@ struct cfg80211_ops {
 			     struct cfg80211_config *cfg);
 	void	(*get_config)(void *priv, struct net_device *dev,
 			      struct cfg80211_config *cfg);
+	u32	(*get_config_valid)(void *priv, struct net_device *dev);
 
 
 	int	(*reassociate)(void *priv, struct net_device *dev);
@@ -183,4 +186,13 @@ extern int cfg80211_register(struct cfg80211_ops *ops, void *priv);
  */
 extern void cfg80211_unregister(void *priv);
 
+#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/Kconfig +28 -0
index 8d121a5..fade3fd 100644
@@ -229,6 +229,34 @@ config FIB_RULES
 config CFG80211
 	tristate "Improved wireless configuration API"
 
+config CFG80211_WEXT_COMPAT
+	bool "cfg80211 Wireless Extensions compatibility"
+	depends CFG80211
+	default y
+	---help---
+	This option allows using devices whose drivers have been
+	converted to use the new cfg80211 with wireless extensions,
+	providing WE-20 compatibility. Note that cfg80211's "native"
+	interface is nl80211 using generic netlink. The wireless
+	extensions are being deprecated, but userspace tools may still
+	be using them.
+
+	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/core/dev.c +36 -2
index c8822aa..31a3cba 100644
@@ -116,6 +116,7 @@
 #include <linux/dmaengine.h>
 #include <linux/err.h>
 #include <linux/ctype.h>
+#include <net/cfg80211.h>
 
 /*
  *	The list of packet types we will receive (as opposed to discard)
@@ -2228,7 +2229,7 @@ static struct file_operations softnet_seq_fops = {
 	.release = seq_release,
 };
 
-#ifdef CONFIG_WIRELESS_EXT
+#if defined(CONFIG_WIRELESS_EXT) || defined(CFG80211_WEXT_COMPAT)
 extern int wireless_proc_init(void);
 #else
 #define wireless_proc_init() 0
@@ -2798,6 +2799,39 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
 					ret = -EFAULT;
 				return ret;
 			}
+#ifdef CONFIG_CFG80211_WEXT_COMPAT
+			/* Take care of cfg80211 WE compatibility */
+			if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
+				/* If command is `set a parameter', or
+				 * `get the encoding parameters', check if
+				 * the user has the right to do it */
+				if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE
+				    || cmd == SIOCGIWENCODEEXT) {
+					if (!capable(CAP_NET_ADMIN))
+						return -EPERM;
+				}
+				dev_load(ifr.ifr_name);
+				rtnl_lock();
+				/* Follow me in net/wireless/wext-compat.c */
+				ret = cfg80211_wext_ioctl(&ifr, cmd);
+				rtnl_unlock();
+				if (ret == 0 && IW_IS_GET(cmd) &&
+				    copy_to_user(arg, &ifr,
+						 sizeof(struct ifreq)))
+					ret = -EFAULT;
+				/* haha, I cheat here by allowing a driver or
+				 * stack to have both WE or CFG80211-WE for
+				 * a little while during conversion... hope that
+				 * ENOSYS is only used to indicate not implemented
+				 *
+				 * if wireless extensions are not configured
+				 * then this is the last thing here so that
+				 * if we fall through we return -EINVAL
+				 */
+				if (ret != -ENOSYS)
+					return ret;
+			}
+#endif
 #ifdef CONFIG_WIRELESS_EXT
 			/* Take care of Wireless Extensions */
 			if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
@@ -2814,7 +2848,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
 				/* Follow me in net/wireless/wext-old.c */
 				ret = wireless_process_ioctl(&ifr, cmd);
 				rtnl_unlock();
-				if (IW_IS_GET(cmd) &&
+				if (ret == 0 && IW_IS_GET(cmd) &&
 				    copy_to_user(arg, &ifr,
 					    	 sizeof(struct ifreq)))
 					ret = -EFAULT;
net/core/net-sysfs.c +2 -2
index f47f319..44e69a2 100644
@@ -329,7 +329,7 @@ static struct attribute_group netstat_group = {
 	.attrs  = netstat_attrs,
 };
 
-#ifdef WIRELESS_EXT
+#ifdef CONFIG_WIRELESS_EXT
 /* helper function that does all the locking etc for wireless stats */
 static ssize_t wireless_show(struct class_device *cd, char *buf,
 			     ssize_t (*format)(const struct iw_statistics *,
@@ -462,7 +462,7 @@ int netdev_register_sysfs(struct net_device *net)
 	if (net->get_stats)
 		*groups++ = &netstat_group;
 
-#ifdef WIRELESS_EXT
+#ifdef CONFIG_WIRELESS_EXT
 	if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
 		*groups++ = &wireless_group;
 #endif
net/core/rtnetlink.c +41 -1

73 lines not on this page · raw message

net/wireless/Makefile +10 -0
index 663a7d8..62e67b7 100644
@@ -4,3 +4,13 @@ cfg80211-objs := \
 	core.o
 
 obj-$(CONFIG_WIRELESS_EXT) += wext-old.o
+
+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)
net/wireless/core.c +13 -2
index 60b280e..ce50ae4 100644
@@ -56,7 +56,7 @@ cfg80211_get_drv_from_ifindex(int ifindex)
 	if (drv)
 		mutex_lock(&drv->mtx);
 	else
-		drv = ERR_PTR(-ENODEV);
+		drv = ERR_PTR(-ENOSYS);
 	dev_put(dev);
  out:
 	mutex_unlock(&cfg80211_drv_mutex);
@@ -146,12 +146,23 @@ EXPORT_SYMBOL_GPL(cfg80211_unregister);
 
 static int cfg80211_init(void)
 {
-	/* possibly need to do more later */
+#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 0;
 }
 
 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
 }
 
 module_init(cfg80211_init);
net/wireless/core.h +21 -0
index 562c476..595f184 100644
@@ -9,6 +9,7 @@
 #include <linux/mutex.h>
 #include <linux/list.h>
 #include <net/genetlink.h>
+#include <linux/module.h>
 
 struct cfg80211_registered_driver {
 	struct cfg80211_ops *ops;
@@ -25,6 +26,26 @@ struct cfg80211_registered_driver {
 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/wext-common.c new file +610 -0

610 lines not on this page · raw message

net/wireless/wext-compat.c +1627 -19

1,652 lines not on this page · raw message

net/wireless/wext-old.c +3 -626

385 lines not on this page · raw message

net/wireless/wext.h new file +13 -0
new file mode 100644
index 0000000..fcf1c5a

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 5 lines
1.4.4.2

-- 
John W. Linville
[email protected]

Part of the diff is not shown here. View the raw message.

#40 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

Quoted 10 lines
include/linux/netdevice.h +1 -0
index c1e9962..6a9b4c8 100644
@@ -348,12 +348,17 @@ struct net_device
 
 	struct net_device_stats* (*get_stats)(struct net_device *dev);
 
+#ifdef CONFIG_WIRELESS_EXT
 	/* List of functions to handle Wireless Extensions (instead of ioctl).

include/linux/netdevice.h struct net_device · line 361

Quoted 10 lines
include/linux/netdevice.h +5 -1
 	 * See <net/iw_handler.h> for details. Jean II */
 	const struct iw_handler_def *	wireless_handlers;
 	/* 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

Do we really have to add this directly to struct net_device and bloat it for all users? I'd put this behind ieee80211_ptr instead unless there's a good reason against that.

include/linux/netdevice.h struct net_device

Quoted 8 lines
include/linux/netdevice.h +8 -0
+#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

Please chose either to use the extern prefix or not, but stick to one choice for a single file :) Also we don't need to ifdef out prototypes.

include/linux/netdevice.h

Quoted 13 lines
include/linux/netdevice.h +13 -0
+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.

Should we really put this code in? It seems like unessecary bloat to me.

Quoted 26 lines
include/linux/netdevice.h +22 -0
@@ -2798,6 +2799,39 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
 					ret = -EFAULT;
 				return ret;
 			}
+#ifdef CONFIG_CFG80211_WEXT_COMPAT
+			/* Take care of cfg80211 WE compatibility */
+			if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
+				/* If command is `set a parameter', or
+				 * `get the encoding parameters', check if
+				 * the user has the right to do it */
+				if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE
+				    || cmd == SIOCGIWENCODEEXT) {
+					if (!capable(CAP_NET_ADMIN))
+						return -EPERM;
+				}
+				dev_load(ifr.ifr_name);
+				rtnl_lock();
+				/* Follow me in net/wireless/wext-compat.c */
+				ret = cfg80211_wext_ioctl(&ifr, cmd);
+				rtnl_unlock();
+				if (ret == 0 && IW_IS_GET(cmd) &&
+				    copy_to_user(arg, &ifr,
+						 sizeof(struct ifreq)))
+					ret = -EFAULT;
+				/* haha, I cheat here by allowing a driver or
+				 * stack to have both WE or CFG80211-WE for

include/linux/netdevice.h int dev_ioctl(unsigned int cmd, void __user *arg) · line 2833

Quoted 10 lines
include/linux/netdevice.h +10 -0
+				 * a little while during conversion... hope that
+				 * ENOSYS is only used to indicate not implemented
+				 *
+				 * if wireless extensions are not configured
+				 * then this is the last thing here so that
+				 * if we fall through we return -EINVAL
+				 */
+				if (ret != -ENOSYS)
+					return ret;
+			}

Can we split this into a nice little helper function in wext-compat.c or a dummy macro if it's not configured?

net/core/rtnetlink.c line 61

Quoted 9 lines
net/core/rtnetlink.c +3 -0
@@ -56,6 +56,9 @@
 #include <linux/wireless.h>
 #include <net/iw_handler.h>
 #endif	/* CONFIG_NET_WIRELESS_RTNETLINK */
+#ifdef CONFIG_CFG80211_WEXTNL_COMPAT
+#include <net/cfg80211.h>
+#endif

There's not point in including headers conditionally.

Quoted 8 lines
net/wireless/Makefile +0 -0
index 663a7d8..62e67b7 100644
@@ -4,3 +4,13 @@ cfg80211-objs := \
 	core.o
 
 obj-$(CONFIG_WIRELESS_EXT) += wext-old.o

net/wireless/Makefile cfg80211-objs := \ · line 16

Quoted 10 lines
net/wireless/Makefile +10 -0
+
+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)

This looks odd. Kbuild filters out duplicate objects, so something like the snipplet below should work aswell:

obj-$(CONFIG_WIRELESS_EXT) += wext-common.o wext-old.o
obj-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-common.o wext-compat.o

net/wireless/Makefile

Quoted 3 lines
net/wireless/Makefile +3 -0
+#ifdef CONFIG_CFG80211_WEXT_COMPAT
+/* wext compatibility must be compiled in...
+ * this extern is in wext-compat.c */

Is there really a point in making cfg80211 a loadable module? This whle operation vector stuff looks like a lot of unnessecary complexity to me.

net/wireless/wext-common.c line 1

Quoted 6 lines

new file mode 100644
index 0000000..c1de1d7

net/wireless/wext-common.c new file +1 -0
@@ -0,0 +1,610 @@
+/* common wext support routines, proc interface and events */

This is mostly Jean's old code, right? Probably wants at least some attribution.

net/wireless/wext-common.c line 6

Quoted 5 lines
net/wireless/wext-common.c new file +5 -0
+static void cfg80211_ensure_netdev_pending_cfg(struct net_device *dev)
+{
+	struct cfg80211_config *cfg = dev->cfg80211_wext_pending_config;
+	if (!cfg) {
+		cfg = kmalloc(sizeof(*cfg)+32, GFP_KERNEL);

kmalloc return values need to be checked.

net/wireless/wext-common.c line 7

Quoted 1 line
net/wireless/wext-common.c new file +1 -0
+/* operations we implement. whew, I machine-generated these */

So should we put the shell-script to generate them intree instead? :) Well, probably not, but then again we probably don't want this comment either as it won't be true anymore as soon as someone touches the code.

Btw, if we submit cfg80211 for inclusion there should be at least one patch in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

maintainer
#41 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

Quoted 3 lines · Christoph Hellwig

Do we really have to add this directly to struct net_device and bloat it for all users? I'd put this behind ieee80211_ptr instead unless there's a good reason against that.

Well, the reason currently is that cfg80211 treats ieee80211_ptr as an opaque cookie, it doesn't need to know what it points to.

Of course, I intend to change that too...

Quoted 7 lines
Quoted 7 lines
net/Kconfig +7 -0
+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
Quoted 8 lines

net/Kconfig config FIB_RULES · line 258

Quoted 6 lines
net/Kconfig +6 -0
+	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.

Should we really put this code in? It seems like unessecary bloat to me.

Yeah. Jean disappeared anyway, I'll kill it.

Quoted 31 lines
Quoted 31 lines
net/core/dev.c +27 -0
@@ -2798,6 +2799,39 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
 					ret = -EFAULT;
 				return ret;
 			}
+#ifdef CONFIG_CFG80211_WEXT_COMPAT
+			/* Take care of cfg80211 WE compatibility */
+			if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
+				/* If command is `set a parameter', or
+				 * `get the encoding parameters', check if
+				 * the user has the right to do it */
+				if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE
+				    || cmd == SIOCGIWENCODEEXT) {
+					if (!capable(CAP_NET_ADMIN))
+						return -EPERM;
+				}
+				dev_load(ifr.ifr_name);
+				rtnl_lock();
+				/* Follow me in net/wireless/wext-compat.c */
+				ret = cfg80211_wext_ioctl(&ifr, cmd);
+				rtnl_unlock();
+				if (ret == 0 && IW_IS_GET(cmd) &&
+				    copy_to_user(arg, &ifr,
+						 sizeof(struct ifreq)))
+					ret = -EFAULT;
+				/* haha, I cheat here by allowing a driver or
+				 * stack to have both WE or CFG80211-WE for
+				 * a little while during conversion... hope that
+				 * ENOSYS is only used to indicate not implemented
+				 *
+				 * if wireless extensions are not configured
+				 * then this is the last thing here so that
Quoted 8 lines

net/core/dev.c int dev_ioctl(unsigned int cmd, void __user *arg) · line 2833

Quoted 5 lines
net/core/dev.c +5 -0
+				 * if we fall through we return -EINVAL
+				 */
+				if (ret != -ENOSYS)
+					return ret;
+			}

Can we split this into a nice little helper function in wext-compat.c or a dummy macro if it's not configured?

I guess I can do that. Maybe I'll do the same with wext too.

Quoted 11 lines

net/core/rtnetlink.c line 61

Quoted 9 lines
net/core/rtnetlink.c +3 -0
@@ -56,6 +56,9 @@
 #include <linux/wireless.h>
 #include <net/iw_handler.h>
 #endif	/* CONFIG_NET_WIRELESS_RTNETLINK */
+#ifdef CONFIG_CFG80211_WEXTNL_COMPAT
+#include <net/cfg80211.h>
+#endif

There's not point in including headers conditionally.

It helps ccache when you change that header, but yeah, let's just include it.

Quoted 5 lines

This looks odd. Kbuild filters out duplicate objects, so something like the snipplet below should work aswell:

obj-$(CONFIG_WIRELESS_EXT) += wext-common.o wext-old.o
obj-$(CONFIG_CFG80211_WEXT_COMPAT) += wext-common.o wext-compat.o

Hah, good point, I never even thought of something that would just duplicate it.

Quoted 7 lines

net/core/rtnetlink.c line 64

Quoted 3 lines
net/core/rtnetlink.c +3 -0
+#ifdef CONFIG_CFG80211_WEXT_COMPAT
+/* wext compatibility must be compiled in...
+ * this extern is in wext-compat.c */

Is there really a point in making cfg80211 a loadable module? This whle operation vector stuff looks like a lot of unnessecary complexity to me.

I think there is point in doing it as it allows us to replace it with an out-of-tree newer version for getting it into the hands of users who might not want to replace their whole kernel.

Quoted 9 lines

net/wireless/wext-common.c line 1

Quoted 6 lines

new file mode 100644
index 0000000..c1de1d7

net/wireless/wext-common.c new file +1 -0
@@ -0,0 +1,610 @@
+/* common wext support routines, proc interface and events */

This is mostly Jean's old code, right? Probably wants at least some attribution.

Yeah, good point, it's mostly code that moved from that file to here.

Quoted 4 lines

Btw, if we submit cfg80211 for inclusion there should be at least one patch in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

I guess I could make softmac use it.

johannes

#42 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

Quoted 7 lines · Johannes Berg
Quoted 4 lines · Christoph Hellwig

Btw, if we submit cfg80211 for inclusion there should be at least one patch in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

I guess I could make softmac use it.

Another idea here is we can provide a configfs frontend to cfg80211 therefore any device which implements cfg80211 will automagically have a userspace frontend (/configfs/wireless/foo) ready to test cfg80211. With this we wouldn't have to wait for the next userspace nl80211 application to start testing cfg80211 directly (without wireless extensions compat). A configfs frontend can also allow more rapid development of userspace interfaces to configure wireless devices through cfg80211. Comments?

Luis

#43 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

Quoted 10 lines · Luis R. Rodriguez
Quoted 8 lines · Johannes Berg
Quoted 1 line · Christoph Hellwig

Btw, if we submit cfg80211 for inclusion there should be at least one

patch

Quoted 3 lines

in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

I guess I could make softmac use it.

Quoted 8 lines

Another idea here is we can provide a configfs frontend to cfg80211 therefore any device which implements cfg80211 will automagically have a userspace frontend (/configfs/wireless/foo) ready to test cfg80211. With this we wouldn't have to wait for the next userspace nl80211 application to start testing cfg80211 directly (without wireless extensions compat). A configfs frontend can also allow more rapid development of userspace interfaces to configure wireless devices through cfg80211. Comments?

Luis,

You have mentioned this before, and FWIW I think it is a decent idea. Let's see some code! :-)

Still, I don't think it changes the issue that we need a driver (or stack) plugged-in to the bottom end. I have this on my personal list of "soon TODO", although I haven't picked a driver yet.

If anyone is working on a cfg80211 driver conversion, please speak-up so we can avoid duplicating work.

Thanks,

John

Signature · 2 lines
John W. Linville
[email protected]
#44 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

Quoted 20 lines · John W. Linville
Quoted 10 lines · Luis R. Rodriguez
Quoted 8 lines · Johannes Berg
Quoted 1 line · Christoph Hellwig

Btw, if we submit cfg80211 for inclusion there should be at least one

patch

Quoted 3 lines

in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

I guess I could make softmac use it.

Quoted 8 lines

Another idea here is we can provide a configfs frontend to cfg80211 therefore any device which implements cfg80211 will automagically have a userspace frontend (/configfs/wireless/foo) ready to test cfg80211. With this we wouldn't have to wait for the next userspace nl80211 application to start testing cfg80211 directly (without wireless extensions compat). A configfs frontend can also allow more rapid development of userspace interfaces to configure wireless devices through cfg80211. Comments?

Quoted 4 lines

Luis,

You have mentioned this before, and FWIW I think it is a decent idea. Let's see some code! :-)

I know, I know, talk is cheap, trust me, I abide by this motto every day. I actually wanted to just code this up and send this as part of my comment but do have other responsibilities I have to attend to first. I figured I'd throw it out though in case someone who does have time is willing to pick it up as I think it would be great for us.

Quoted 6 lines

Still, I don't think it changes the issue that we need a driver (or stack) plugged-in to the bottom end. I have this on my personal list of "soon TODO", although I haven't picked a driver yet.

If anyone is working on a cfg80211 driver conversion, please speak-up so we can avoid duplicating work.

Luis

maintainer
#45 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

Quoted 23 lines · Luis R. Rodriguez
Quoted 22 lines · John W. Linville
Quoted 10 lines · Luis R. Rodriguez
Quoted 8 lines · Johannes Berg
Quoted 1 line · Christoph Hellwig

Btw, if we submit cfg80211 for inclusion there should be at least one

patch

Quoted 3 lines

in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

I guess I could make softmac use it.

Quoted 8 lines

Another idea here is we can provide a configfs frontend to cfg80211 therefore any device which implements cfg80211 will automagically have a userspace frontend (/configfs/wireless/foo) ready to test cfg80211. With this we wouldn't have to wait for the next userspace nl80211 application to start testing cfg80211 directly (without wireless extensions compat). A configfs frontend can also allow more rapid development of userspace interfaces to configure wireless devices through cfg80211. Comments?

Luis,

Quoted 8 lines
Quoted 2 lines

You have mentioned this before, and FWIW I think it is a decent idea. Let's see some code! :-)

I know, I know, talk is cheap, trust me, I abide by this motto every day. I actually wanted to just code this up and send this as part of my comment but do have other responsibilities I have to attend to first. I figured I'd throw it out though in case someone who does have time is willing to pick it up as I think it would be great for us.

Last time I tried configfs didn't support the group commit stuff yet so it'd be only useful for *showing* things rather than changing...

johannes

#46 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

In reply to Luis R. Rodriguez
Quoted 9 lines · Luis R. Rodriguez
Quoted 5 lines
Quoted 3 lines

in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

I guess I could make softmac use it.

Another idea here is we can provide a configfs frontend to cfg80211 therefore any device which implements cfg80211 will automagically have a userspace frontend (/configfs/wireless/foo) ready to test cfg80211.

Huh? We already have a wext fronted to nicely test cfg80211, what we need are backends. In addition to that I think we should agree on one primary userspace configuration method for the future instead of adding lots of them just because it's so easy. If the public opinion has changed 180 degrees and configs is preferred over nl80211 that's fine by me as long as the implementation is sane..

#47 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Luis R. Rodriguez
Quoted 4 lines
Quoted 3 lines

in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I guess I could make softmac use it.

Another idea here is we can provide a configfs frontend to cfg80211 therefore any device which implements cfg80211 will automagically have a userspace frontend (/configfs/wireless/foo) ready to test cfg80211.

Huh? We already have a wext fronted to nicely test cfg80211, what we need are backends.

Yes, this is true.

Quoted 3 lines

In addition to that I think we should agree on
one primary userspace configuration method for the future instead of adding lots of them just because it's so easy.

Its not just that its provides a means to allow easy development of userspace applications, that's just the cherry on top of the cake. The real benefit of this is entirely architectural. Here are two examples:

a. Handling of private data

That is non-standard data, ie that doesn't go in the cfg80211_config struct. Think of how iwpriv works and how nasty that was. Now granted cfg80211 would still need to have some infrastructure for handling of private data and nl80211 can be used as well but I find it would be more convenient to scrape the available private set/get information through a configfs tree on the device than have userspace applications use nl80211 all the time.

b. Radiotap field selectivity

Although we currently do not fully support radiotap and although radiotap currently works by tacking on ALL the supported fields onto the beginning of the skb if we want to provide selectivity of fields I think configfs would provide an elegant way of dealing with this. Think of echo'ing 0 or 1 to some /config/wireless/foo/radiotap/bar. Alternative solutions to provide selectivity for radiotap can also be to provide different levels of verbosity for wanted data, which would make selectivity implementation much easier.

Quoted 3 lines

If the public opinion
has changed 180 degrees and configs is preferred over nl80211 that's fine by me as long as the implementation is sane..

I don't think the opinion has changed at all. I just think a configfs frontend would be good as well, specially for some cases as illustrated above.

Luis

#48 lore raw

Re: [RFC PATCH 3/3] cfg80211: add wext-compatible client

In reply to Christoph Hellwig
Quoted 11 lines · Christoph Hellwig
Quoted 9 lines · Luis R. Rodriguez
Quoted 5 lines
Quoted 3 lines

in the series actually converts a driver to use it. Both to make this code not dead and give people and example on how to use the cfg80211 infrastructure.

I guess I could make softmac use it.

Another idea here is we can provide a configfs frontend to cfg80211 therefore any device which implements cfg80211 will automagically have a userspace frontend (/configfs/wireless/foo) ready to test cfg80211.

Quoted 6 lines

Huh? We already have a wext fronted to nicely test cfg80211, what we need are backends. In addition to that I think we should agree on one primary userspace configuration method for the future instead of adding lots of them just because it's so easy. If the public opinion has changed 180 degrees and configs is preferred over nl80211 that's fine by me as long as the implementation is sane..

I'd prefer to keep the netlink based API for use from userspace tools like NetworkManager and wpa_supplicant... configfs is nice for scripts and screenscrapers but not really appropriate for desktop stuff.

Dan

#49 lore raw

Re: [RFC PATCH 1/3] wireless: add cfg80211

In reply to John W. Linville
Quoted 38 lines · John W. Linville

From: Johannes Berg <[email protected]>

This patch adds cfg80211, a new configuration system for wireless hardware.

It currently features a bunch of configuration requests, support for adding and removing virtual interfaces, the ability to inject packets and more.

---
 include/linux/netdevice.h  |    1 +
 include/net/cfg80211.h     |  186 ++++++++++++++++++++++++++++++++++++++++++++
 net/Kconfig                |    3 +
 net/Makefile               |    1 +
 net/wireless/Makefile      |    4 +
 net/wireless/core.c        |  158 +++++++++++++++++++++++++++++++++++++
 net/wireless/core.h        |   57 ++++++++++++++
 net/wireless/wext-compat.c |   25 ++++++
 8 files changed, 435 insertions(+), 0 deletions(-)
include/linux/netdevice.h +1 -0
index fea0d9d..c1e9962 100644
@@ -398,6 +398,7 @@ struct net_device
 	void                    *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 */
 
 /*
  * Cache line mostly used on receive path (including eth_type_trans())

net/wireless/Makefile line 4

Quoted 4 lines
net/wireless/Makefile new file +4 -0
@@ -0,0 +1,4 @@
+obj-$(CONFIG_CFG80211) += cfg80211.o
+
+cfg80211-objs := \
+	core.o

the contents of this file should be:

obj-$(CONFIG_CFG80211) += cfg80211.o
cfg80211-y += core.o

net/wireless/Makefile line 2

Quoted 3 lines
net/wireless/Makefile new file +2 -0
@@ -0,0 +1,158 @@
+/*
+ * This is the new wireless configuration interface.

I don't think new makes a lot of sense here, it's hopefully the standad one soon.

net/wireless/Makefile line 14

Quoted 12 lines
net/wireless/Makefile new file +12 -0
+ *
+ * Copyright 2006 Johannes Berg <[email protected]>
+ */
+
+#include "core.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>

This include order seems odd. We normally include local headers last and net/ after linux/

net/wireless/Makefile line 16

Quoted 2 lines
net/wireless/Makefile new file +2 -0
+MODULE_AUTHOR("Johannes Berg");
+MODULE_LICENSE("GPL");

Can you please add a MODULE_DESCRIPTION aswell?

net/wireless/Makefile line 22

Quoted 6 lines
net/wireless/Makefile new file +6 -0
+
+/* RCU might be appropriate here since we usually
+ * only read the list, and that can happen quite
+ * often because we need to do it for each command */
+LIST_HEAD(cfg80211_drv_list);
+DEFINE_MUTEX(cfg80211_drv_mutex);

Any reason these are non-static? They aren't actually used outside of this file, and in general having non-static lists isn't very nice, we prefer having proper accessor functions.

net/wireless/Makefile line 34

Quoted 12 lines
net/wireless/Makefile new file +12 -0
+static int cfg80211_init(void)
+{
+	/* possibly need to do more later */
+	return 0;
+}
+
+static void cfg80211_exit(void)
+{
+}
+
+module_init(cfg80211_init);
+module_exit(cfg80211_exit);

Just drop these two, there's not point in adding dead code.

net/wireless/wext-compat.c line 2

Quoted 5 lines
net/wireless/wext-compat.c new file +2 -0
@@ -0,0 +1,25 @@
+/* NOT YET */
+

huh? this file isn't added to the build process and only contains a (non-standard formatted) comment. No point in adding it in this patch.

maintainer
#50 lore raw

Re: [RFC PATCH 1/3] wireless: add cfg80211

Quoted 5 lines
Quoted 2 lines

+/*
+ * This is the new wireless configuration interface.

I don't think new makes a lot of sense here, it's hopefully the standad one soon.

Heh. I suppose it'll need a better description anyway.

Quoted 7 lines
Quoted 7 lines

+ *
+ * Copyright 2006 Johannes Berg <[email protected]>
+ */

net/wireless/core.c new file +4 -0
+
+#include "core.h"
+#include <linux/if.h>
+#include <linux/module.h>
Quoted 8 lines

net/wireless/core.c line 14

Quoted 5 lines
net/wireless/core.c new file +5 -0
+#include <linux/err.h>
+#include <net/genetlink.h>
+#include <net/cfg80211.h>
+#include <linux/mutex.h>
+#include <linux/list.h>

This include order seems odd. We normally include local headers last and net/ after linux/

Oh well. I often just stick in what I need in the order I needed it ;) I'll change it.

Quoted 4 lines

net/wireless/core.c line 17

Quoted 2 lines
net/wireless/core.c new file +2 -0
+MODULE_AUTHOR("Johannes Berg");
+MODULE_LICENSE("GPL");

Can you please add a MODULE_DESCRIPTION aswell?

Sure. Then again, didn't you just ask for "why can this be a module at all" too? :)

Quoted 10 lines

net/wireless/core.c line 23

Quoted 6 lines
net/wireless/core.c new file +6 -0
+
+/* RCU might be appropriate here since we usually
+ * only read the list, and that can happen quite
+ * often because we need to do it for each command */
+LIST_HEAD(cfg80211_drv_list);
+DEFINE_MUTEX(cfg80211_drv_mutex);

Any reason these are non-static? They aren't actually used outside of this file, and in general having non-static lists isn't very nice, we prefer having proper accessor functions.

They'll be used in nl80211 which wasn't part of this patchset. Having accessor functions for lists is nice as long as it's add/remove, but I don't like having iterator functions with callbacks and all that much. And in fact, a list_for_each() is the only thing done with this list... I'd prefer keeping it this way.

Quoted 9 lines

net/wireless/wext-compat.c line 2

Quoted 5 lines
net/wireless/wext-compat.c new file +2 -0
@@ -0,0 +1,25 @@
+/* NOT YET */
+

huh? this file isn't added to the build process and only contains a (non-standard formatted) comment. No point in adding it in this patch.

Heh, yeah, it's replaced right away in the next one. I just had wanted to document the thoughts that went into that.

johannes

#51 lore raw

Re: [RFC PATCH 1/3] wireless: add cfg80211

Quoted 7 lines · Johannes Berg
Quoted 4 lines

net/wireless/core.c line 17

Quoted 2 lines
net/wireless/core.c new file +2 -0
+MODULE_AUTHOR("Johannes Berg");
+MODULE_LICENSE("GPL");

Can you please add a MODULE_DESCRIPTION aswell?

Sure. Then again, didn't you just ask for "why can this be a module at all" too? :)

True. Then again I try to stick MODULE_DESCRIPTIONS in wherever I can :)

#52 lore raw
In reply to John W. Linville
Quoted 10 lines · John W. Linville

In London we agreed that it would be good to go ahead and merge cfg80211. This provides some exposure to the API and eases some of the pain for driver maintainers (who won't have to follow wireless-dev to get it). It also adds the ieee80211_ptr to the net_device struct.

I have refactored the cfg80211-related patches down to three patches. This eliminates some of the churn in the series from wireless-dev, and each patch leaves a buildable tree. This version also removes the nl80211 bits to a separate patch (available in wireless-dev on the mm-master branch).

Hmmm...looks like 2/3 got dropped, probably due to size. FWIW, it is basically identical to the last round and is really just a rename of wireless.c to wext-old.c.

John

Signature · 2 lines
John W. Linville
[email protected]