Skip to contentSkip to conversation

New wireless driver API part 1

PATCH In review Jean Tourrilhes 7 participants 16 messages Mar 14, 2002 – Mar 29, 2002

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

PATCH 1/1 New wireless driver API part 1

Hi Marcelo,

Some Wireless LAN driver authors have requested me to backport
the new Wireless Extension API to 2.4.X so that they can hack their drivers without having to deal with 2.5.X. This patch just do that, so could you please add that to your tree ?

This patch is *very* safe, especially compared to other stuff
that made it's way in your kernel :
o was integrated in 2.5.3-pre2, straight backport (same patch)
o tested with various drivers in 2.5.X
o reviewed by Jeff Garzik ;-)
o doesn't change anything for driver still using the old API
(so current kernel/pcmcia drivers won't get broken).
o no part of the kernel using the new API, only outside drivers

For stability reason, I won't change any of the current driver
in the kernel, and those will continue to use the old API (unless you or Jeff request me to update them).
Also, I may send you in the future the second part of the new
API (that got just integrated in 2.5.7-pre1), but I'm not in a hurry... So, for now, first part only ;-)
Below, you will find the original blurb I sent to Linus...

Thanks in advance...

Jean

---------------------------------------------------------
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
---------------------------------------------------------

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

#1 lore raw
Quoted 3 lines

the new Wireless Extension API to 2.4.X so that they can hack their drivers without having to deal with 2.5.X. This patch just do that, so could you please add that to your tree ?

Would it be better to leave the patch where said driver people can get it, and when they submit drivers needing it (if ever) then merge it ?

#2 lore raw
In reply to Jean Tourrilhes

Tangential question, what's up with the prism2 driver?

It seems like everybody I meet these days has a wireless card which uses the prism2 driver from linux-wlan.org. And since I just got two of these cards (D-Link DWL-650), I am strongly tempted to merge the driver into the kernel.

How well does the prism2 driver work with the current wireless driver API? Is there any particular reason why it is not in the kernel now?

Jeff

#8 lore raw
In reply to Jean Tourrilhes
Quoted 6 lines · Alan Cox
Quoted 3 lines

the new Wireless Extension API to 2.4.X so that they can hack their drivers without having to deal with 2.5.X. This patch just do that, so could you please add that to your tree ?

Would it be better to leave the patch where said driver people can get it, and when they submit drivers needing it (if ever) then merge it ?

Maybe, maybe not.
1) Most Wireless LAN driver live outside the kernel. So, their
evolution is somewhat decoupled to the kernel, so the earlier the patch goes it the better it is for those.
2) David Gibson, maintainer of the Orinoco driver, told me
that he would merge my new-API orinoco patches in his driver only when the new API would be in 2.4.x (as you may have noticed, he hasn't updated 2.5.X for a while). Chicken and Eggs.
3) Risk is minimal, bloat is minimal. What's the penality of
merging it now ?

I'm open to suggestions and will do what's best for
everybody. What other people think ?
But I feel now is a good time (as it seem that 2.4.19 will
have to go through some stabilisation process).

Thanks for the comment ;-)

Jean

#9 lore raw
Quoted 3 lines

updated 2.5.X for a while). Chicken and Eggs.
3) Risk is minimal, bloat is minimal. What's the penality of
merging it now ?

Sounds good reason to me

#10 lore raw
In reply to Jean Tourrilhes
Quoted 4 lines · Jean Tourrilhes

1) Most Wireless LAN driver live outside the kernel. So, their evolution is somewhat decoupled to the kernel, so the earlier the patch goes it the better it is for those.

As you may have gathered from my last email, this is a bit annoying when trying to find and stabalize a driver for a card you just got :)

Quoted 5 lines

2) David Gibson, maintainer of the Orinoco driver, told me
that he would merge my new-API orinoco patches in his driver only when the new API would be in 2.4.x (as you may have noticed, he hasn't updated 2.5.X for a while). Chicken and Eggs.

Does that mean orinoco updates are coming for 2.5.x?

Any idea if the other drivers are getting updates too, like airo?

Quoted 5 lines

I'm open to suggestions and will do what's best for everybody. What other people think ?
But I feel now is a good time (as it seem that 2.4.19 will
have to go through some stabilisation process).

My standard rule of thumb is turning out to be, deploy something 2.4.x-worthy in 2.5.x, wait a while, and then deploy it in 2.4.x. I have no particular opinion about whether your patch should go in -right now- but it seems like a fair patch for 2.4.x sooner or later.

Jeff

#11 lore raw
In reply to Jean Tourrilhes
Quoted 1 line · Jeff Garzik

Tangential question, what's up with the prism2 driver?

	Which one ? ;-)
	Orinoco can work sometime with those cards, David may have

some updates in the pipeline (especially for WEP). The Prism2 driver from Jouni is actually pretty nice and dedicated for those cards.

Quoted 4 lines

It seems like everybody I meet these days has a wireless card which uses the prism2 driver from linux-wlan.org. And since I just got two of these cards (D-Link DWL-650), I am strongly tempted to merge the driver into the kernel.

Before doing that, have a chat with Alan that had a close look
with it for a partial opinion. And you may want to go through the source yourself.
My personal take is that linux-wlan-ng is nice, does a lot,
but is huge and complex, and it seems that Mark is not that interested in merging it in the kernel. Keeping it as a separate module may make most sense.
BTW, there was a thread about this on the linux-wlan mailing
lists.

Quoted 1 line

How well does the prism2 driver work with the current wireless driver API?

Very basic support (mostly read only). linux-wlan-ng has it's
own set of tools and MIB.

Quoted 1 line

Is there any particular reason why it is not in the kernel now?

Nobody ever pushed it in. I can't force people to add their
driver int he kernel (hint : compare the list on my web page with the list in the kernel).

Quoted 1 line

Jeff

	Have fun...

	Jean
#12 lore raw
In reply to Jean Tourrilhes
Quoted 8 lines · Jeff Garzik
Quoted 4 lines · Jean Tourrilhes

1) Most Wireless LAN driver live outside the kernel. So, their evolution is somewhat decoupled to the kernel, so the earlier the patch goes it the better it is for those.

As you may have gathered from my last email, this is a bit annoying when trying to find and stabalize a driver for a card you just got :)

Especially that there are so many driver to choose from, and
each is broken in some unique way.

Quoted 6 lines
Quoted 5 lines

2) David Gibson, maintainer of the Orinoco driver, told me
that he would merge my new-API orinoco patches in his driver only when the new API would be in 2.4.x (as you may have noticed, he hasn't updated 2.5.X for a while). Chicken and Eggs.

Does that mean orinoco updates are coming for 2.5.x?

I asked him a couple of times, but so far nothing. He is
working hard on various issues in the driver.

Quoted 1 line

Any idea if the other drivers are getting updates too, like airo?

I think the CVS has a new version, including change to the
monitoring mode, but airo list is pretty quiet lately. airo.c is pretty stable and bug free, so updates are not critical. I still need to finish to convert it to the new API.

Quoted 4 lines

My standard rule of thumb is turning out to be, deploy something 2.4.x-worthy in 2.5.x, wait a while, and then deploy it in 2.4.x. I have no particular opinion about whether your patch should go in -right now- but it seems like a fair patch for 2.4.x sooner or later.

Yes, you are right, it has been in 2.5.X for only two months,
which is quite short.

Quoted 1 line

Jeff

	Have fun...

	Jean
#3 lore raw
In reply to Jeff Garzik
Quoted 6 lines · Jeff Garzik

Tangential question, what's up with the prism2 driver?

It seems like everybody I meet these days has a wireless card which uses the prism2 driver from linux-wlan.org. And since I just got two of these cards (D-Link DWL-650), I am strongly tempted to merge the driver into the kernel.

Just a datapoint:

The orinico driver (already in the kernel) works fine with the DWL-650 card. Tried it some days ago.. not a very big field trial but I inserted the card and I got an eth0 from it and it worked, so thats the way I like it :)

On the other hand, the driver from linux-wlan (also for prism2-based cards) did not compile because it required the external pcmcia-cs source-code etc.. it was not really "drop and compile". Anyway, I'm just happy one of them worked :)

/Bjorn

#4 lore raw
Quoted 4 lines · Bjorn Wesen

Just a datapoint:

The orinico driver (already in the kernel) works fine with the DWL-650 card. Tried it some days ago.. not a very big field trial but I inserted the card and I got an eth0 from it and it worked, so thats the way I like it :)

Not "just" a datapoint, a useful one. Thanks.

Jeff

#7 lore raw
In reply to Jeff Garzik

In article <[email protected]>,

Quoted 3 lines · Bjorn Wesen

The orinico driver (already in the kernel) works fine with the DWL-650 card. Tried it some days ago.. not a very big field trial but I inserted the card and I got an eth0 from it and it worked, so thats the way I like it :)

Last time I tried the orinoco driver it failed to see my Lucent orinoco card. The wlan-cs driver from the pcmcia sources works just fine though.

Wichert.

Signature · 4 lines
  _________________________________________________________________
 /       Nothing is fool-proof to a sufficiently talented fool     \
| [email protected]                   http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0  2805 3CB8 9250 2FA3 BC2D |
#13 lore raw
In reply to Jean Tourrilhes
Quoted 9 lines · Jeff Garzik
Quoted 4 lines · Jean Tourrilhes

1) Most Wireless LAN driver live outside the kernel. So, their evolution is somewhat decoupled to the kernel, so the earlier the patch goes it the better it is for those.

As you may have gathered from my last email, this is a bit annoying when trying to find and stabalize a driver for a card you just got :)

Quoted 6 lines
Quoted 5 lines

2) David Gibson, maintainer of the Orinoco driver, told me
that he would merge my new-API orinoco patches in his driver only when the new API would be in 2.4.x (as you may have noticed, he hasn't updated 2.5.X for a while). Chicken and Eggs.

Does that mean orinoco updates are coming for 2.5.x?

Yes, I'll try to send some in. When 2.5 had just started I figured Linus was busy enough with the bio stuff and the driver updates could wait, since then I've been busy with other things so I haven't gotten around to sending patches.

AFAIK none of the APIs which are relevant to me have changed so it should just be a matter of copying the files across from 2.4.

Signature · 4 lines
David Gibson			| For every complex problem there is a
[email protected]	| solution which is simple, neat and
				| wrong.  -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
#14 lore raw
In reply to Jean Tourrilhes
Quoted 8 lines · David Gibson

Yes, I'll try to send some in. When 2.5 had just started I figured Linus was busy enough with the bio stuff and the driver updates could wait, since then I've been busy with other things so I haven't gotten around to sending patches.

AFAIK none of the APIs which are relevant to me have changed so it should just be a matter of copying the files across from 2.4.

Hu ho... You are reading LKML. I'd better be careful about
what I'm saying ;-)
By the way, you are right, I've been using 9b in 2.5.6 without
any trouble. But, it seem that my patch will get in 2.4.X, so you will have it both way.

By the way, what's the situation regarding our famous ALLOC
irq handling ? Any improvement ? I haven't tried v10, so I just wonder if it's worth upgrading ;-)

	Have fun...

	Jean
#5 lore raw
In reply to Bjorn Wesen
Quoted 11 lines · Jeff Garzik
Quoted 6 lines · Bjorn Wesen

Just a datapoint:

The orinico driver (already in the kernel) works fine with the DWL-650 card. Tried it some days ago.. not a very big field trial but I inserted the card and I got an eth0 from it and it worked, so thats the way I like it :)

Not "just" a datapoint, a useful one. Thanks.

Sadly not everybody is having as much luck. A lot of people are reporting terribly throughput on Intersil cards like the DWL-650 and I haven't managed to track the problem down yet.

Signature · 4 lines
David Gibson			| For every complex problem there is a
[email protected]	| solution which is simple, neat and
				| wrong.  -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
#6 lore raw
Quoted 11 lines · David Gibson
Quoted 10 lines · Jeff Garzik
Quoted 6 lines · Bjorn Wesen

Just a datapoint:

The orinico driver (already in the kernel) works fine with the DWL-650 card. Tried it some days ago.. not a very big field trial but I inserted the card and I got an eth0 from it and it worked, so thats the way I like it :)

Quoted 5 lines
Quoted 1 line

Not "just" a datapoint, a useful one. Thanks.

Sadly not everybody is having as much luck. A lot of people are reporting terribly throughput on Intersil cards like the DWL-650 and I haven't managed to track the problem down yet.

Here's some further datapoints:

Vaio Z505SX, kernels through 2.4.16 - works great IBM T22, 2.4.16+sound, 2.4.17+lowlatency-sound - works great T22, 2.4.18+ and 2.5.5 - 2-3K/s

Signature · 1 line
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.."
#15 lore raw

PATCH 1/1 New wireless driver API part 1

In reply to Jean Tourrilhes

Hi again Marcelo,

Sorry to insist, but I need to get this patch in 2.4.X. I'm
now blocked on two wireless driver (orinoco.c and airo.c) because their maintainers can't/won't use 2.5.X. And I hate to see all those patches bitroting.

The deal : new driver API for Wireless Extensions (first
part). More details below.
Patch *attached*. I re-diffed against 2.4.19-pre4, and tested
with both 2.4.19-pre4 and 2.4.19-pre4-ac2 (for ac2, the patch applies with fuzz).
Why would you accept the patch :
o More than 2 month already in 2.5.X
o Jeff says it's 2.4.X material :
http://marc.theaimsgroup.com/?l=linux-kernel&m=101607595127684&w=2
o Alan says "sounds good" :
http://marc.theaimsgroup.com/?l=linux-kernel&m=101607595327690&w=2

	Tell me if there is any complications...

	Have fun...

	Jean
Quoted 59 lines · jt

Hi Marcelo,

Some Wireless LAN driver authors have requested me to backport
the new Wireless Extension API to 2.4.X so that they can hack their drivers without having to deal with 2.5.X. This patch just do that, so could you please add that to your tree ?

This patch is *very* safe, especially compared to other stuff
that made it's way in your kernel :
o was integrated in 2.5.3-pre2, straight backport (same patch)
o tested with various drivers in 2.5.X
o reviewed by Jeff Garzik ;-)
o doesn't change anything for driver still using the old API
(so current kernel/pcmcia drivers won't get broken).
o no part of the kernel using the new API, only outside drivers

For stability reason, I won't change any of the current driver
in the kernel, and those will continue to use the old API (unless you or Jeff request me to update them).
Also, I may send you in the future the second part of the new
API (that got just integrated in 2.5.7-pre1), but I'm not in a hurry... So, for now, first part only ;-)
Below, you will find the original blurb I sent to Linus...

Thanks in advance...

Jean

---------------------------------------------------------
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).

Quoted 5 lines

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

Jean

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
@@ -279,6 +279,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
@@ -27,5 +27,8 @@ obj-$(CONFIG_NETFILTER) += netfilter.o
 obj-$(CONFIG_NET_DIVERT) += dv.o
 obj-$(CONFIG_NET_PROFILE) += profile.o
 obj-$(CONFIG_NET_PKTGEN) += pktgen.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