Skip to contentSkip to conversation

New wireless driver API part 1 for 2.5.3-pre2

PATCH New Jean Tourrilhes 1 participant 1 message Jan 21, 2002

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

PATCH 1/1 New wireless driver API part 1 for 2.5.3-pre2

Hi Linus,

I feel the first part my new driver API for Wireless
Extensions is ready to go in the kernel.

I don't want to bore you too much with details, but for
Wireless Extensions it replace the call to the device driver ioctl function with individual call to handlers functions.
The advantage of the new API are :
o Handling of Extensions in driver broken in small contained functions
o Tighter checks of ioctl before calling the driver
o Flexible commit strategy (at least, the start of it)
o Backward compatibility (can be mixed with old API)
o Remove all ioctl assumptions in the driver
o Driver doesn't have to worry about memory and user-space issues (copy_to/from_user handled by the API, not the driver)
The last point is important for the following reasons :
o You are now able to call the new driver API from any API you want (including from within other parts of the kernel).
o Common mistakes are avoided (buffer overflow, user space copy with irq disabled and so on).
More details available at :
http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html#newapi

Compare to my earlier patch (sent to the list in December), I
made the following changes :
o cleanup comments
o use "return X;" instead of "return(X);" (pointed out to me
by Jeff - thanks).

This has been tested on 2.5.3-pre2. Would you mind adding that
to your kernel ?
Regards,

Jean

P.S. : conversion of drivers to the new API and other parts of the new API (events) will come later on.
P.S.2 : Jeff : I eventually decided to include the return fix because it's only cosmetic ;-)

--------------------------------------------------------------------

include/linux/netdevice.h renamed from include/linux-w12/netdevice.h +4 -0
diff -u -p -r --new-file linux/include/linux-w12/netdevice.h linux/include/linux/netdevice.h
@@ -278,6 +278,10 @@ struct net_device
 	struct net_device_stats* (*get_stats)(struct net_device *dev);
 	struct iw_statistics*	(*get_wireless_stats)(struct net_device *dev);
 
+	/* List of functions to handle Wireless Extensions (instead of ioctl).
+	 * See <net/iw_handler.h> for details. Jean II */
+	struct iw_handler_def *	wireless_handlers;
+
 	/*
 	 * This marks the end of the "visible" part of the structure. All
 	 * fields hereafter are internal to the system, and may change at
include/linux/wireless.h renamed from include/linux-w12/wireless.h +73 -44

180 lines not on this page · raw message

include/net/iw_handler.h renamed from include/net-w12/iw_handler.h +374 -0

374 lines not on this page · raw message

net/core/Makefile renamed from net/core-w12/Makefile +3 -0
diff -u -p -r --new-file linux/net/core-w12/Makefile linux/net/core/Makefile
@@ -26,5 +26,8 @@ obj-$(CONFIG_NET) += dev.o dev_mcast.o d
 obj-$(CONFIG_NETFILTER) += netfilter.o
 obj-$(CONFIG_NET_DIVERT) += dv.o
 obj-$(CONFIG_NET_PROFILE) += profile.o
+obj-$(CONFIG_NET_RADIO) += wireless.o
+# Ugly. I wish all wireless drivers were moved in drivers/net/wireless
+obj-$(CONFIG_NET_PCMCIA_RADIO) += wireless.o
 
 include $(TOPDIR)/Rules.make
net/core/dev.c renamed from net/core-w12/dev.c +4 -133

173 lines not on this page · raw message

net/core/wireless.c renamed from net/core-w12/wireless.c +733 -0

733 lines not on this page · raw message