Skip to contentSkip to conversation

Wireless extensions rethink

RFC Gertjan van Wingerde 2 participants 2 messages Jun 7, 2004

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

Hi Scott,

I was thinking along the same lines, however I was taking the ethtool interface as the starting point (using a single ioctl for all wireless operations). The private handlers would just have to be converted to plain ioctls handled by the driver itself.

The attached patch can be used as a starting point for this. It is not complete (not by far), but it shows the basic structure. I've called the structure wlantool_ops, again using the example set by ethtool.

Comments?

--- Gertjan.

Quoted 41 lines · Scott

Jeff suggested in an earlier post that there is an opportunity to totally rethink the wireless extensions now that we have wireless-2.6.

Let's get rid of the iotcl and /proc interfaces as Jeff suggests:

1) iw_handler API goes away and is replaced by struct net_device::wireless_ops (ala ethtool_ops).
2) sysfs get/set mapping for wireless_ops.
3) iw_statistics just becomes one of the wireless_ops.
4) Remove /proc/net/wireless support from wireless.c. (Already have sysfs support for the same :)
5) No private handler support. If you need private support, pass it in some other way (custom sysfs of modparam). Or, better yet, make a case that others could benefit and move into wireless_ops as standard.
6) Convert drivers from iw_handler and iw_statistics to wireless_ops.
7) Rewrite iw* tools to use sysfs interface rather than ioctl. (scriptable tools?)
8) [Optional] Remove iotcl interface. May want to keep for backward compat with legacy tools? Easy to map between ioctl and wireless_ops in wireless.c.
9) [Open] What to do about wireless events? Any ideas?

Proposed sysfs layout:

	class/
	`-- net
	    |-- eth[x]
	        |-- wireless
	            |-- statistics
	            |   |-- beacon
			|   |-- crypt
	            |   `-- ...
	            `-- control
	                |-- commit
	                |-- name
	                |-- network_id
	                |-- freq
	                `-- ...
Quoted 5 lines

Is someone already working on this???

Comments?

-scott

include/linux/netdevice.h +4 -0
diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
@@ -41,6 +41,7 @@
 struct divert_blk;
 struct vlan_group;
 struct ethtool_ops;
+struct wlantool_ops;
 
 					/* source back-compat hooks */
 #define SET_ETHTOOL_OPS(netdev,ops) \
@@ -308,6 +309,8 @@
 
 	struct ethtool_ops *ethtool_ops;
 
+    struct wlantool_ops *wlantool_ops;
+
 	/*
 	 * This marks the end of the "visible" part of the structure. All
 	 * fields hereafter are internal to the system, and may change at
@@ -678,6 +681,7 @@
 extern int		netif_receive_skb(struct sk_buff *skb);
 extern int		dev_ioctl(unsigned int cmd, void __user *);
 extern int		dev_ethtool(struct ifreq *);
+extern int      dev_wlantool(struct ifreq *);
 extern unsigned		dev_get_flags(const struct net_device *);
 extern int		dev_change_flags(struct net_device *, unsigned);
 extern int		dev_set_mtu(struct net_device *, int);
include/linux/sockios.h +2 -0
diff -Nru a/include/linux/sockios.h b/include/linux/sockios.h
@@ -83,6 +83,8 @@
 
 #define SIOCWANDEV	0x894A		/* get/set netdev parameters	*/
 
+#define SIOCWLANTOOL	0x894B		/* WLANtool interface		*/
+
 /* ARP cache control calls. */
 		    /*  0x8950 - 0x8952  * obsolete calls, don't re-use */
 #define SIOCDARP	0x8953		/* delete ARP table entry	*/
include/linux/wlantool.h new file +72 -0

72 lines not on this page · raw message

net/core/Makefile +2 -1
diff -Nru a/net/core/Makefile b/net/core/Makefile
@@ -7,7 +7,8 @@
 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
 
 obj-y		     += flow.o dev.o ethtool.o dev_mcast.o dst.o \
-			neighbour.o rtnetlink.o utils.o link_watch.o filter.o
+			neighbour.o rtnetlink.o utils.o link_watch.o filter.o \
+            wlantool.o
 
 obj-$(CONFIG_SYSFS) += net-sysfs.o
 obj-$(CONFIG_NETFILTER) += netfilter.o
net/core/dev.c +14 -0
diff -Nru a/net/core/dev.c b/net/core/dev.c
@@ -2700,6 +2700,20 @@
 		case SIOCSIFLINK:
 			return -EINVAL;
 
+		case SIOCWLANTOOL:
+			dev_load(ifr.ifr_name);
+			rtnl_lock();
+			ret = dev_wlantool(&ifr);
+			rtnl_unlock();
+			if (!ret) {
+				if (colon)
+					*colon = ':';
+				if (copy_to_user(arg, &ifr,
+						 sizeof(struct ifreq)))
+					ret = -EFAULT;
+			}
+			return ret;
+
 		/*
 		 *	Unknown or private ioctl.
 		 */
net/core/wlantool.c new file +221 -0

221 lines not on this page · raw message

#1 lore raw
Quoted 7 lines · Gertjan van Wingerde

Hi Scott,

I was thinking along the same lines, however I was taking the ethtool interface as the starting point (using a single ioctl for all wireless operations). The private handlers would just have to be converted to plain ioctls handled by the driver itself.

Quoted 6 lines

The attached patch can be used as a starting point for this. It is not complete (not by far), but it shows the basic structure. I've called the structure wlantool_ops, again using the example set by ethtool.

Comments?

For what it's worth, I like the idea of using a single IOCTL similar to ethtool...

Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com