linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Wireless Extension update
@ 2000-12-20  0:59 Jean Tourrilhes
  0 siblings, 0 replies; 12+ messages in thread
From: Jean Tourrilhes @ 2000-12-20  0:59 UTC (permalink / raw)
  To: Linus Torvalds, Alan Cox; +Cc: Linux kernel mailing list

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

	Hi Linus and Alan,

	This is a totally trivial update of the Wireless Extensions
definition. It just adds a few more #define, so no troubles or pain
expected.
	The patch attached applies cleanly to *both* 2.4.0-test12 and
2.2.18 (tested), and I would suggest including it in both kernel
series...

	Changes :
		o Power Management update (max, min & capa)
			-> Needed by the Symbol/Intel/3Com 802.11b driver
		o Support for read only "encoding" keys
		o Support for TxPower parameter
			-> Both needed by the Cisco/Aironet 802.11b driver

	By the way, don't look in the kernel for the driver mentionned
above, the majority of the Wireless LAN drivers are not in the kernel
(but in the Pcmcia package or elsewhere), and some in the kernel are
not up to date with the version in the Pcmcia package.

	Thanks...

	Jean

[-- Attachment #2: w-ext.10.diff --]
[-- Type: text/plain, Size: 5637 bytes --]

diff -u -p linux/include/linux/wireless.9.h linux/include/linux/wireless.h
--- linux/include/linux/wireless.9.h	Tue Nov 14 10:55:46 2000
+++ linux/include/linux/wireless.h	Tue Dec 19 14:42:02 2000
@@ -63,7 +63,7 @@
  * (there is some stuff that will be added in the future...)
  * I just plan to increment with each new version.
  */
-#define WIRELESS_EXT	9
+#define WIRELESS_EXT	10
 
 /*
  * Changes :
@@ -104,26 +104,33 @@
  *	- Change encoding to support larger tokens (>64 bits)
  *	- Updated iw_params (disable, flags) and use it for NWID
  *	- Extracted iw_point from iwreq for clarity
+ *
+ * V9 to V10
+ * ---------
+ *	- Add PM capability to range structure
+ *	- Add PM modifier : MAX/MIN/RELATIVE
+ *	- Add encoding option : IW_ENCODE_NOKEY
+ *	- Add TxPower ioctls (work like TxRate)
  */
 
 /* -------------------------- IOCTL LIST -------------------------- */
 
 /* Basic operations */
-#define SIOCSIWNAME	0x8B00		/* Unused ??? */
-#define SIOCGIWNAME	0x8B01		/* get name */
+#define SIOCSIWNAME	0x8B00		/* Unused */
+#define SIOCGIWNAME	0x8B01		/* get name == wireless protocol */
 #define SIOCSIWNWID	0x8B02		/* set network id (the cell) */
 #define SIOCGIWNWID	0x8B03		/* get network id */
-#define SIOCSIWFREQ	0x8B04		/* set channel/frequency */
-#define SIOCGIWFREQ	0x8B05		/* get channel/frequency */
+#define SIOCSIWFREQ	0x8B04		/* set channel/frequency (Hz) */
+#define SIOCGIWFREQ	0x8B05		/* get channel/frequency (Hz) */
 #define SIOCSIWMODE	0x8B06		/* set operation mode */
 #define SIOCGIWMODE	0x8B07		/* get operation mode */
-#define SIOCSIWSENS	0x8B08		/* set sensitivity */
-#define SIOCGIWSENS	0x8B09		/* get sensitivity */
+#define SIOCSIWSENS	0x8B08		/* set sensitivity (dBm) */
+#define SIOCGIWSENS	0x8B09		/* get sensitivity (dBm) */
 
 /* Informative stuff */
-#define SIOCSIWRANGE	0x8B0A		/* Unused ??? */
+#define SIOCSIWRANGE	0x8B0A		/* Unused */
 #define SIOCGIWRANGE	0x8B0B		/* Get range of parameters */
-#define SIOCSIWPRIV	0x8B0C		/* Unused ??? */
+#define SIOCSIWPRIV	0x8B0C		/* Unused */
 #define SIOCGIWPRIV	0x8B0D		/* get private ioctl interface info */
 
 /* Mobile IP support */
@@ -153,6 +160,8 @@
 #define SIOCGIWRTS	0x8B23		/* get RTS/CTS threshold (bytes) */
 #define SIOCSIWFRAG	0x8B24		/* set fragmentation thr (bytes) */
 #define SIOCGIWFRAG	0x8B25		/* get fragmentation thr (bytes) */
+#define SIOCSIWTXPOW	0x8B26		/* set transmit power (dBm) */
+#define SIOCGIWTXPOW	0x8B27		/* get transmit power (dBm) */
 
 /* Encoding stuff (scrambling, hardware security, WEP...) */
 #define SIOCSIWENCODE	0x8B2A		/* set encoding token & mode */
@@ -205,6 +214,9 @@
 /* Maximum bit rates in the range struct */
 #define IW_MAX_BITRATES		8
 
+/* Maximum tx powers in the range struct */
+#define IW_MAX_TXPOWER		8
+
 /* Maximum of address that you may set with SPY */
 #define IW_MAX_SPY		8
 
@@ -232,11 +244,13 @@
 
 /* Flags for encoding (along with the token) */
 #define IW_ENCODE_INDEX		0x00FF	/* Token index (if needed) */
-#define IW_ENCODE_FLAGS		0xF000	/* Flags defined below */
+#define IW_ENCODE_FLAGS		0xFF00	/* Flags defined below */
+#define IW_ENCODE_MODE		0xF000	/* Modes defined below */
 #define IW_ENCODE_DISABLED	0x8000	/* Encoding disabled */
 #define IW_ENCODE_ENABLED	0x0000	/* Encoding enabled */
 #define IW_ENCODE_RESTRICTED	0x4000	/* Refuse non-encoded packets */
 #define IW_ENCODE_OPEN		0x2000	/* Accept non-encoded packets */
+#define IW_ENCODE_NOKEY         0x0800  /* Key is write only, so not present */
 
 /* Power management flags available (along with the value, if any) */
 #define IW_POWER_ON		0x0000	/* No details... */
@@ -249,6 +263,14 @@
 #define IW_POWER_ALL_R		0x0300	/* Receive all messages though PM */
 #define IW_POWER_FORCE_S	0x0400	/* Force PM procedure for sending unicast */
 #define IW_POWER_REPEATER	0x0800	/* Repeat broadcast messages in PM period */
+#define IW_POWER_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_POWER_MIN		0x0001	/* Value is a minimum  */
+#define IW_POWER_MAX		0x0002	/* Value is a maximum */
+#define IW_POWER_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+
+/* Transmit Power flags available */
+#define IW_TXPOW_DBM		0x0000	/* Value is in dBm */
+#define IW_TXPOW_MWATT		0x0001	/* Value is in mW */
 
 /****************************** TYPES ******************************/
 
@@ -359,6 +381,7 @@ struct	iwreq 
 
 		struct iw_param	sens;		/* signal level threshold */
 		struct iw_param	bitrate;	/* default bit rate */
+		struct iw_param	txpower;	/* default transmit power */
 		struct iw_param	rts;		/* RTS threshold threshold */
 		struct iw_param	frag;		/* Fragmentation threshold */
 		__u32		mode;		/* Operation mode */
@@ -422,15 +445,23 @@ struct	iw_range
 	__s32		max_frag;	/* Maximal frag threshold */
 
 	/* Power Management duration & timeout */
-	__s32		min_pmd;	/* Minimal PM duration */
-	__s32		max_pmd;	/* Maximal PM duration */
+	__s32		min_pmp;	/* Minimal PM period */
+	__s32		max_pmp;	/* Maximal PM period */
 	__s32		min_pmt;	/* Minimal PM timeout */
 	__s32		max_pmt;	/* Maximal PM timeout */
+	__u16		pmp_flags;	/* How to decode max/min PM period */
+	__u16		pmt_flags;	/* How to decode max/min PM timeout */
+	__u16		pm_capa;	/* What PM options are supported */
 
 	/* Encoder stuff */
 	__u16	encoding_size[IW_MAX_ENCODING_SIZES];	/* Different token sizes */
 	__u8	num_encoding_sizes;	/* Number of entry in the list */
 	__u8	max_encoding_tokens;	/* Max number of tokens */
+
+	/* Transmit power */
+	__u16		txpower_capa;	/* What options are supported */
+	__u8		num_txpower;	/* Number of entries in the list */
+	__s32		txpower[IW_MAX_TXPOWER];	/* list, in bps */
 };
 
 /*

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-15 19:31         ` H. Peter Anvin
@ 2001-10-15 21:02           ` Tobias Ringstrom
  0 siblings, 0 replies; 12+ messages in thread
From: Tobias Ringstrom @ 2001-10-15 21:02 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Roeland Th. Jansen, linux-kernel

On Mon, 15 Oct 2001, H. Peter Anvin wrote:

> Roeland Th. Jansen wrote:
> 
> > On Sun, Oct 14, 2001 at 05:07:53PM -0700, H. Peter Anvin wrote:
> >
> > > YYYY-MM-DD is also unambiguous, and has the nice properties of being
> > > (a) sortable and (b) language-independent.
> > 
> > it only is unambiguous if you happen to know the format beforehand.
> 
> It is, but unlike all other numeric formats there is no conflicting format
> in use.

Plus, the most significant part is to the left, as in "42", "3.1415",
"17:23", "1.1.1.2", etc.  This does not only makes it sortable, but also
consistant and logical.  Why should dates be the only exception?  The
problem with three letter month abbreviations is that they are language
dependant, and a bit hard to sort chronologically.

[Insert your favourite Mr. Spock quote about logic here!]

/Tobias - towards world domination or sleep - still undecided


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-15 19:26       ` Roeland Th. Jansen
@ 2001-10-15 19:31         ` H. Peter Anvin
  2001-10-15 21:02           ` Tobias Ringstrom
  0 siblings, 1 reply; 12+ messages in thread
From: H. Peter Anvin @ 2001-10-15 19:31 UTC (permalink / raw)
  To: Roeland Th. Jansen; +Cc: linux-kernel

Roeland Th. Jansen wrote:

> On Sun, Oct 14, 2001 at 05:07:53PM -0700, H. Peter Anvin wrote:
> 
>>YYYY-MM-DD is also unambiguous, and has the nice properties of being
>>(a) sortable and (b) language-independent.
>>
> 
> it only is unambiguous if you happen to know the format beforehand.
> 


It is, but unlike all other numeric formats there is no conflicting format
in use.


> 20011001 is ?
> 
> 10 oct 2001 ?
> 01 jan 2001 ?
> 


1 Oct 2001, whereas "01/10/2001" would be read as Jan 10, 2001 or Oct 1,
2001 in differents part of the world.

Using language-specific codes are fine and well only if you know for sure
which language was used.

	-hpa


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-15  0:07     ` H. Peter Anvin
@ 2001-10-15 19:26       ` Roeland Th. Jansen
  2001-10-15 19:31         ` H. Peter Anvin
  0 siblings, 1 reply; 12+ messages in thread
From: Roeland Th. Jansen @ 2001-10-15 19:26 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: linux-kernel

On Sun, Oct 14, 2001 at 05:07:53PM -0700, H. Peter Anvin wrote:
> YYYY-MM-DD is also unambiguous, and has the nice properties of being
> (a) sortable and (b) language-independent.

it only is unambiguous if you happen to know the format beforehand.

20011001 is ?

10 oct 2001 ?
01 jan 2001 ?

for the fun :

it's a known practise in aircraft complaint handling that there should
be a definition written at the place where complaints are signed off. if
there is no such thing, we always have to revert to the unambigous
dd-mmm-yyyy where the mmm is the three letter code for the month.


-- 
Grobbebol's Home                      |  Don't give in to spammers.   -o)
http://www.xs4all.nl/~bengel          | Use your real e-mail address   /\
Linux 2.4.10 (apic) SMP 466MHz/768 MB |        on Usenet.             _\_v  

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
       [not found] ` <200110150008.RAA09482@cesium.transmeta.com>
@ 2001-10-15 16:37   ` Jean Tourrilhes
  0 siblings, 0 replies; 12+ messages in thread
From: Jean Tourrilhes @ 2001-10-15 16:37 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Linux kernel mailing list

On Sun, Oct 14, 2001 at 05:08:16PM -0700, H. Peter Anvin wrote:
> Followup to:  <20011008191247.B6816@bougret.hpl.hp.com>
> By author:    Jean Tourrilhes <jt@bougret.hpl.hp.com>
> In newsgroup: linux.dev.kernel
> >  /* -------------------------- IOCTL LIST -------------------------- */
> > @@ -137,6 +144,8 @@
> >  #define SIOCGIWRANGE	0x8B0B		/* Get range of parameters */
> >  #define SIOCSIWPRIV	0x8B0C		/* Unused */
> >  #define SIOCGIWPRIV	0x8B0D		/* get private ioctl interface info */
> > +#define SIOCSIWSTATS	0x8B0E		/* Unused */
> > +#define SIOCGIWSTATS	0x8B0F		/* Get /proc/net/wireless stats */
> >  
> >  /* Mobile IP support */
> >  #define SIOCSIWSPY	0x8B10		/* set spy addresses */
> > @@ -177,11 +186,33 @@
> >  #define SIOCSIWPOWER	0x8B2C		/* set Power Management settings */
> >  #define SIOCGIWPOWER	0x8B2D		/* get Power Management settings */
> >  
> 
> Please, pretty please, use _IOC() macros...
> 
> 	-hpa

	Already discussed countless times since 96, same answer as
before : not possible.
	For normal devices, you have the full ioctl range, so you can
afford to "waste" this space by coding type/direction in the ioctl
number.
	For networking devices, only a *very* small portion of the
ioctl space goes to the driver (because the various networking
components grab tons of them), so we are required to be more
efficient.
	In summary : if you convert all the regular ifconfig ioctls
(see .../include/linux/sockios.h) to use _IOC() macros and workaround
ioctl space limitation for networking devices, then I'll fix the
wireless ioctls.
	Regards,

	Jean

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-09  2:12 Jean Tourrilhes
  2001-10-09 16:22 ` Randy.Dunlap
@ 2001-10-15  0:08 ` H. Peter Anvin
       [not found] ` <200110150008.RAA09482@cesium.transmeta.com>
  2 siblings, 0 replies; 12+ messages in thread
From: H. Peter Anvin @ 2001-10-15  0:08 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <20011008191247.B6816@bougret.hpl.hp.com>
By author:    Jean Tourrilhes <jt@bougret.hpl.hp.com>
In newsgroup: linux.dev.kernel
>  /* -------------------------- IOCTL LIST -------------------------- */
> @@ -137,6 +144,8 @@
>  #define SIOCGIWRANGE	0x8B0B		/* Get range of parameters */
>  #define SIOCSIWPRIV	0x8B0C		/* Unused */
>  #define SIOCGIWPRIV	0x8B0D		/* get private ioctl interface info */
> +#define SIOCSIWSTATS	0x8B0E		/* Unused */
> +#define SIOCGIWSTATS	0x8B0F		/* Get /proc/net/wireless stats */
>  
>  /* Mobile IP support */
>  #define SIOCSIWSPY	0x8B10		/* set spy addresses */
> @@ -177,11 +186,33 @@
>  #define SIOCSIWPOWER	0x8B2C		/* set Power Management settings */
>  #define SIOCGIWPOWER	0x8B2D		/* get Power Management settings */
>  

Please, pretty please, use _IOC() macros...

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-14 21:58   ` Riley Williams
@ 2001-10-15  0:07     ` H. Peter Anvin
  2001-10-15 19:26       ` Roeland Th. Jansen
  0 siblings, 1 reply; 12+ messages in thread
From: H. Peter Anvin @ 2001-10-15  0:07 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <Pine.LNX.4.21.0110142252270.6433-100000@Consulate.UFP.CX>
By author:    Riley Williams <rhw@MemAlpha.cx>
In newsgroup: linux.dev.kernel
> 
> 	DD.MM.YYYY	(European)
> 	MM/DD/YYYY	(American)
> 	YYYY-MM-DD	(Japanese)
> 
> ...with the punctuation character specifying the one in use. I note that
> the dates as originally quoted above are clearly consistant with this
> standard, so see no problem myself.
> 
> Personally, I prefer to use the DD-MMM-YYYY format myself, where MMM in
> the three-letter English abbreviation for the month in question, and
> there is thus no room for misreading it as something else.
> 

YYYY-MM-DD is also unambiguous, and has the nice properties of being
(a) sortable and (b) language-independent.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-09 16:22 ` Randy.Dunlap
  2001-10-09 16:35   ` Jean Tourrilhes
@ 2001-10-14 21:58   ` Riley Williams
  2001-10-15  0:07     ` H. Peter Anvin
  1 sibling, 1 reply; 12+ messages in thread
From: Riley Williams @ 2001-10-14 21:58 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Jean Tourrilhes, Linux kernel mailing list

Hi Randy.

>> - * Version :   11      28.3.01
>> + * Version :   12      5.10.01

> nitpicking, i'm sure, but:

> 5.10.01 could have several meanings, usually depending on geographic
> location etc., and there is an ISO standard (8601) which says:

>	The international standard date notation is YYYY-MM-DD

There is also another ISO standard (I forget the number) which states
that the international standard date notation is any of...

	DD.MM.YYYY	(European)
	MM/DD/YYYY	(American)
	YYYY-MM-DD	(Japanese)

...with the punctuation character specifying the one in use. I note that
the dates as originally quoted above are clearly consistant with this
standard, so see no problem myself.

Personally, I prefer to use the DD-MMM-YYYY format myself, where MMM in
the three-letter English abbreviation for the month in question, and
there is thus no room for misreading it as something else.

> I'd prefer not to be confused by the '>' quoted notation above,
> although I don't mind the dots instead of hyphens.

I'm so used to > quoting in emails that anything else gets me confused.

Best wishes from Riley.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-09 16:22 ` Randy.Dunlap
@ 2001-10-09 16:35   ` Jean Tourrilhes
  2001-10-14 21:58   ` Riley Williams
  1 sibling, 0 replies; 12+ messages in thread
From: Jean Tourrilhes @ 2001-10-09 16:35 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Linux kernel mailing list

On Tue, Oct 09, 2001 at 09:22:18AM -0700, Randy.Dunlap wrote:
> Jean Tourrilhes wrote:
> > 
> >         Hi,
> 
> Hi-
> 
> > - * Version :   11      28.3.01
> > + * Version :   12      5.10.01
> 
> nitpicking, i'm sure, but:
> 
> 5.10.01 could have several meanings, usually depending
> on geographic location etc., and there is an ISO
> standard (8601) which says:
> 
>   The international standard date notation is 
>   YYYY-MM-DD
> 
> I'd prefer not to be confused by the '>' quoted notation
> above, although I don't mind the dots instead of hyphens.
> 
> ~Randy

	If it was visible to the user or other part of the kernel, I
would worry. Consider this string as a random arbitrary string (an
opaque data type) that has meaning only to the original developer.
	On the other hand, the version (12) is what matters...
	C'est la vie, ne se prenons pas trop au serieux... Ho meglio
da fare che di cambiare questa data...

	Ciao...

	Jean

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Wireless Extension update
  2001-10-09  2:12 Jean Tourrilhes
@ 2001-10-09 16:22 ` Randy.Dunlap
  2001-10-09 16:35   ` Jean Tourrilhes
  2001-10-14 21:58   ` Riley Williams
  2001-10-15  0:08 ` H. Peter Anvin
       [not found] ` <200110150008.RAA09482@cesium.transmeta.com>
  2 siblings, 2 replies; 12+ messages in thread
From: Randy.Dunlap @ 2001-10-09 16:22 UTC (permalink / raw)
  To: jt; +Cc: Linux kernel mailing list

Jean Tourrilhes wrote:
> 
>         Hi,

Hi-

> - * Version :   11      28.3.01
> + * Version :   12      5.10.01

nitpicking, i'm sure, but:

5.10.01 could have several meanings, usually depending
on geographic location etc., and there is an ISO
standard (8601) which says:

  The international standard date notation is 
  YYYY-MM-DD

I'd prefer not to be confused by the '>' quoted notation
above, although I don't mind the dots instead of hyphens.

~Randy

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Wireless Extension update
@ 2001-10-09  2:12 Jean Tourrilhes
  2001-10-09 16:22 ` Randy.Dunlap
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jean Tourrilhes @ 2001-10-09  2:12 UTC (permalink / raw)
  To: Linus Torvalds, Alan Cox, Linux kernel mailing list

	Hi,

	Surprise, it's not an IrDA patch ! Just a quick update of the
Wireless Extensions definitions. Drivers are comming next...

	Changelog :
	o Define our own wireless device private ioctl range to avoid
name space collisions with stuff like 'mii-tools'.
	o Update various statistics bits

	Would you mind pushing that in the kernel ? That would allow
me to push out the new Wireless Tools and send driver patches to the
various maintainers..
	Thanks...

	Jean

diff -u -p linux/include/linux/wireless.w11.h linux/include/linux/wireless.h
--- linux/include/linux/wireless.w11.h	Fri Oct  5 18:36:40 2001
+++ linux/include/linux/wireless.h	Tue Oct  9 00:22:03 2001
@@ -1,7 +1,7 @@
 /*
  * This file define a set of standard wireless extensions
  *
- * Version :	11	28.3.01
+ * Version :	12	5.10.01
  *
  * Authors :	Jean Tourrilhes - HPL - <jt@hpl.hp.com>
  */
@@ -63,7 +63,7 @@
  * (there is some stuff that will be added in the future...)
  * I just plan to increment with each new version.
  */
-#define WIRELESS_EXT	11
+#define WIRELESS_EXT	12
 
 /*
  * Changes :
@@ -116,6 +116,13 @@
  * ----------
  *	- Add WE version in range (help backward/forward compatibility)
  *	- Add retry ioctls (work like PM)
+ *
+ * V11 to V12
+ * ----------
+ *	- Add SIOCSIWSTATS to get /proc/net/wireless programatically
+ *	- Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
+ *	- Add new statistics (frag, retry, beacon)
+ *	- Add average quality (for user space calibration)
  */
 
 /* -------------------------- IOCTL LIST -------------------------- */
@@ -137,6 +144,8 @@
 #define SIOCGIWRANGE	0x8B0B		/* Get range of parameters */
 #define SIOCSIWPRIV	0x8B0C		/* Unused */
 #define SIOCGIWPRIV	0x8B0D		/* get private ioctl interface info */
+#define SIOCSIWSTATS	0x8B0E		/* Unused */
+#define SIOCGIWSTATS	0x8B0F		/* Get /proc/net/wireless stats */
 
 /* Mobile IP support */
 #define SIOCSIWSPY	0x8B10		/* set spy addresses */
@@ -177,11 +186,33 @@
 #define SIOCSIWPOWER	0x8B2C		/* set Power Management settings */
 #define SIOCGIWPOWER	0x8B2D		/* get Power Management settings */
 
+/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
+
+/* These 16 ioctl are wireless device private.
+ * Each driver is free to use them for whatever purpose it chooses,
+ * however the driver *must* export the description of those ioctls
+ * with SIOCGIWPRIV and *must* use arguments as defined below.
+ * If you don't follow those rules, DaveM is going to hate you (reason :
+ * it make mixed 32/64bit operation impossible).
+ */
+#define SIOCIWFIRSTPRIV	0x8BE0
+#define SIOCIWLASTPRIV	0x8BFF
+/* Previously, we were using SIOCDEVPRIVATE, but we know have our
+ * separate range because of collisions with other tools such as
+ * 'mii-tool'.
+ * We now have 32 commands, so a bit more space ;-).
+ * Also, all 'odd' commands are only usable by root and don't return the
+ * content of ifr/iwr to user (but you are not obliged to use the set/get
+ * convention, just use every other two command).
+ * And I repeat : you are not obliged to use them with iwspy, but you
+ * must be compliant with it.
+ */
+
 /* ------------------------- IOCTL STUFF ------------------------- */
 
 /* The first and the last (range) */
 #define SIOCIWFIRST	0x8B00
-#define SIOCIWLAST	0x8B30
+#define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */
 
 /* Even : get (world access), odd : set (root access) */
 #define IW_IS_SET(cmd)	(!((cmd) & 0x1))
@@ -191,7 +222,7 @@
 /*
  * The following is used with SIOCGIWPRIV. It allow a driver to define
  * the interface (name, type of data) for its private ioctl.
- * Privates ioctl are SIOCDEVPRIVATE -> SIOCDEVPRIVATE + 0xF
+ * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
  */
 
 #define IW_PRIV_TYPE_MASK	0x7000	/* Type of arguments */
@@ -334,23 +365,38 @@ struct	iw_freq
  */
 struct	iw_quality
 {
-	__u8		qual;		/* link quality (%retries, SNR or better...) */
-	__u8		level;		/* signal level */
-	__u8		noise;		/* noise level */
+	__u8		qual;		/* link quality (%retries, SNR,
+					   %missed beacons or better...) */
+	__u8		level;		/* signal level (dBm) */
+	__u8		noise;		/* noise level (dBm) */
 	__u8		updated;	/* Flags to know if updated */
 };
 
 /*
  *	Packet discarded in the wireless adapter due to
  *	"wireless" specific problems...
+ *	Note : the list of counter and statistics in net_device_stats
+ *	is already pretty exhaustive, and you should use that first.
+ *	This is only additional stats...
  */
 struct	iw_discarded
 {
-	__u32		nwid;		/* Wrong nwid */
-	__u32		code;		/* Unable to code/decode */
+	__u32		nwid;		/* Rx : Wrong nwid/essid */
+	__u32		code;		/* Rx : Unable to code/decode (WEP) */
+	__u32		fragment;	/* Rx : Can't perform MAC reassembly */
+	__u32		retries;	/* Tx : Max MAC retries num reached */
 	__u32		misc;		/* Others cases */
 };
 
+/*
+ *	Packet/Time period missed in the wireless adapter due to
+ *	"wireless" specific problems...
+ */
+struct	iw_missed
+{
+	__u32		beacon;		/* Missed beacons/superframe */
+};
+
 /* ------------------------ WIRELESS STATS ------------------------ */
 /*
  * Wireless statistics (used for /proc/net/wireless)
@@ -363,6 +409,7 @@ struct	iw_statistics
 	struct iw_quality	qual;		/* Quality of the link
 						 * (instant/mean/max) */
 	struct iw_discarded	discard;	/* Packet discarded counts */
+	struct iw_missed	miss;		/* Packet missed counts */
 };
 
 /* ------------------------ IOCTL REQUEST ------------------------ */
@@ -493,6 +540,19 @@ struct	iw_range
 	__s32		max_retry;	/* Maximal number of retries */
 	__s32		min_r_time;	/* Minimal retry lifetime */
 	__s32		max_r_time;	/* Maximal retry lifetime */
+
+	/* Average quality of link & SNR */
+	struct iw_quality	avg_qual;	/* Quality of the link */
+	/* This should contain the average/typical values of the quality
+	 * indicator. This should be the threshold between a "good" and
+	 * a "bad" link (example : monitor going from green to orange).
+	 * Currently, user space apps like quality monitors don't have any
+	 * way to calibrate the measurement. With this, they can split
+	 * the range between 0 and max_qual in different quality level
+	 * (using a geometric subdivision centered on the average).
+	 * I expect that people doing the user space apps will feedback
+	 * us on which value we need to put in each driver...
+	 */
 };
 
 /*
diff -u -p linux/net/core/dev.w11.c linux/net/core/dev.c
--- linux/net/core/dev.w11.c	Fri Oct  5 18:39:10 2001
+++ linux/net/core/dev.c	Mon Oct  8 18:36:03 2001
@@ -1817,7 +1817,7 @@ static int sprintf_wireless_stats(char *
 
 	if (stats != (struct iw_statistics *) NULL) {
 		size = sprintf(buffer,
-			       "%6s: %04x  %3d%c  %3d%c  %3d%c  %6d %6d %6d\n",
+			       "%6s: %04x  %3d%c  %3d%c  %3d%c  %6d %6d %6d %6d %6d   %6d\n",
 			       dev->name,
 			       stats->status,
 			       stats->qual.qual,
@@ -1828,7 +1828,10 @@ static int sprintf_wireless_stats(char *
 			       stats->qual.updated & 4 ? '.' : ' ',
 			       stats->discard.nwid,
 			       stats->discard.code,
-			       stats->discard.misc);
+			       stats->discard.fragment,
+			       stats->discard.retries,
+			       stats->discard.misc,
+			       stats->miss.beacon);
 		stats->qual.updated = 0;
 	}
 	else
@@ -1852,8 +1855,8 @@ static int dev_get_wireless_info(char * 
 	struct net_device *	dev;
 
 	size = sprintf(buffer,
-		       "Inter-| sta-|   Quality        |   Discarded packets\n"
-		       " face | tus | link level noise |  nwid  crypt   misc\n"
+		       "Inter-| sta-|   Quality        |   Discarded packets               | Missed\n"
+		       " face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon\n"
 			);
 	
 	pos += size;
@@ -1884,6 +1887,33 @@ static int dev_get_wireless_info(char * 
 	return len;
 }
 #endif	/* CONFIG_PROC_FS */
+
+/*
+ *	Allow programatic access to /proc/net/wireless even if /proc
+ *	doesn't exist... Also more efficient...
+ */
+static inline int dev_iwstats(struct net_device *dev, struct ifreq *ifr)
+{
+	/* Get stats from the driver */
+	struct iw_statistics *stats = (dev->get_wireless_stats ?
+				       dev->get_wireless_stats(dev) :
+				       (struct iw_statistics *) NULL);
+
+	if (stats != (struct iw_statistics *) NULL) {
+		struct iwreq *	wrq = (struct iwreq *)ifr;
+
+		/* Copy statistics to the user buffer */
+		if(copy_to_user(wrq->u.data.pointer, stats,
+				sizeof(struct iw_statistics)))
+			return -EFAULT;
+
+		/* Check if we need to clear the update flag */
+		if(wrq->u.data.flags != 0)
+			stats->qual.updated = 0;
+		return(0);
+	} else
+		return -EOPNOTSUPP;
+}
 #endif	/* WIRELESS_EXT */
 
 /**
@@ -2182,6 +2212,11 @@ static int dev_ifsioc(struct ifreq *ifr,
 			dev->name[IFNAMSIZ-1] = 0;
 			notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
 			return 0;
+
+#ifdef WIRELESS_EXT
+		case SIOCGIWSTATS:
+			return dev_iwstats(dev, ifr);
+#endif	/* WIRELESS_EXT */
 
 		/*
 		 *	Unknown or private ioctl

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Wireless Extension update...
@ 2001-03-29  2:12 Jean Tourrilhes
  0 siblings, 0 replies; 12+ messages in thread
From: Jean Tourrilhes @ 2001-03-29  2:12 UTC (permalink / raw)
  To: Linus Torvalds, Alan Cox, Linux kernel mailing list

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

	Hi,

	Now that I got away from IrDA, I've been taking care of my
todo list on the Wireless side.
	The most critical feature is versionning. Since distributions
started shipping separate kernel header in /usr/include/linux, drivers
and tools can be out of sync (== core dump when reading iwrange). A
lot of user have been caught by that moving from 2.2.X to 2.4.X. This
patch provide a way to detect that and to fix the problem.
	Also, I added a new extension (retry), and implemented it in
the orinoco_cs driver. However, it is not enabled in orinoco_cs
(has_retry=0) because we are in stable kernels ;-)

	Would you mind adding that in the kernel ?

	Thanks...

	Jean

P.S. : A new version of Wireless Tools with all those goodies will be
soon on my web page...

[-- Attachment #2: wireless.v11.diff --]
[-- Type: text/plain, Size: 15145 bytes --]

diff -u -p linux/include/linux/wireless.25.h linux/include/linux/wireless.h
--- linux/include/linux/wireless.25.h	Wed Mar 28 10:33:47 2001
+++ linux/include/linux/wireless.h	Wed Mar 28 17:31:42 2001
@@ -1,7 +1,7 @@
 /*
  * This file define a set of standard wireless extensions
  *
- * Version :	9	16.10.99
+ * Version :	11	28.3.01
  *
  * Authors :	Jean Tourrilhes - HPL - <jt@hpl.hp.com>
  */
@@ -63,7 +63,7 @@
  * (there is some stuff that will be added in the future...)
  * I just plan to increment with each new version.
  */
-#define WIRELESS_EXT	10
+#define WIRELESS_EXT	11
 
 /*
  * Changes :
@@ -111,6 +111,11 @@
  *	- Add PM modifier : MAX/MIN/RELATIVE
  *	- Add encoding option : IW_ENCODE_NOKEY
  *	- Add TxPower ioctls (work like TxRate)
+ *
+ * V10 to V11
+ * ----------
+ *	- Add WE version in range (help backward/forward compatibility)
+ *	- Add retry ioctls (work like PM)
  */
 
 /* -------------------------- IOCTL LIST -------------------------- */
@@ -162,6 +167,8 @@
 #define SIOCGIWFRAG	0x8B25		/* get fragmentation thr (bytes) */
 #define SIOCSIWTXPOW	0x8B26		/* set transmit power (dBm) */
 #define SIOCGIWTXPOW	0x8B27		/* get transmit power (dBm) */
+#define SIOCSIWRETRY	0x8B28		/* set retry limits and lifetime */
+#define SIOCGIWRETRY	0x8B29		/* get retry limits and lifetime */
 
 /* Encoding stuff (scrambling, hardware security, WEP...) */
 #define SIOCSIWENCODE	0x8B2A		/* set encoding token & mode */
@@ -272,6 +279,16 @@
 #define IW_TXPOW_DBM		0x0000	/* Value is in dBm */
 #define IW_TXPOW_MWATT		0x0001	/* Value is in mW */
 
+/* Retry limits and lifetime flags available */
+#define IW_RETRY_ON		0x0000	/* No details... */
+#define IW_RETRY_TYPE		0xF000	/* Type of parameter */
+#define IW_RETRY_LIMIT		0x1000	/* Maximum number of retries*/
+#define IW_RETRY_LIFETIME	0x2000	/* Maximum duration of retries in us */
+#define IW_RETRY_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_RETRY_MIN		0x0001	/* Value is a minimum  */
+#define IW_RETRY_MAX		0x0002	/* Value is a maximum */
+#define IW_RETRY_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+
 /****************************** TYPES ******************************/
 
 /* --------------------------- SUBTYPES --------------------------- */
@@ -385,6 +402,7 @@ struct	iwreq 
 		struct iw_param	rts;		/* RTS threshold threshold */
 		struct iw_param	frag;		/* Fragmentation threshold */
 		__u32		mode;		/* Operation mode */
+		struct iw_param	retry;		/* Retry limits & lifetime */
 
 		struct iw_point	encoding;	/* Encoding stuff : tokens */
 		struct iw_param	power;		/* PM duration/timeout */
@@ -462,6 +480,19 @@ struct	iw_range
 	__u16		txpower_capa;	/* What options are supported */
 	__u8		num_txpower;	/* Number of entries in the list */
 	__s32		txpower[IW_MAX_TXPOWER];	/* list, in bps */
+
+	/* Wireless Extension version info */
+	__u8		we_version_compiled;	/* Must be WIRELESS_EXT */
+	__u8		we_version_source;	/* Last update of source */
+
+	/* Retry limits and lifetime */
+	__u16		retry_capa;	/* What retry options are supported */
+	__u16		retry_flags;	/* How to decode max/min retry limit */
+	__u16		r_time_flags;	/* How to decode max/min retry life */
+	__s32		min_retry;	/* Minimal number of retries */
+	__s32		max_retry;	/* Maximal number of retries */
+	__s32		min_r_time;	/* Minimal retry lifetime */
+	__s32		max_r_time;	/* Maximal retry lifetime */
 };
 
 /*
diff -u -p linux/drivers/net/wireless.25/wavelan.c linux/drivers/net/wavelan.c
--- linux/drivers/net/wireless.25/wavelan.c	Wed Mar 28 17:27:27 2001
+++ linux/drivers/net/wavelan.c	Wed Mar 28 17:28:34 2001
@@ -2028,8 +2028,17 @@ static int wavelan_ioctl(struct net_devi
 		if (wrq->u.data.pointer != (caddr_t) 0) {
 			struct iw_range range;
 
-			/* Set the length (useless:  it's constant). */
+			/* Set the length (very important for backward
+			 * compatibility) */
 			wrq->u.data.length = sizeof(struct iw_range);
+
+			/* Set all the info we don't care or don't know
+			 * about to zero */
+			memset(&range, 0, sizeof(range));
+
+			/* Set the Wireless Extension versions */
+			range.we_version_compiled = WIRELESS_EXT;
+			range.we_version_source = 9;
 
 			/* Set information in the range struct.  */
 			range.throughput = 1.6 * 1000 * 1000;	/* don't argue on this ! */
diff -u -p linux/drivers/net/pcmcia/wireless.25/wavelan_cs.c linux/drivers/net/pcmcia/wavelan_cs.c
--- linux/drivers/net/pcmcia/wireless.25/wavelan_cs.c	Wed Mar 28 17:21:02 2001
+++ linux/drivers/net/pcmcia/wavelan_cs.c	Wed Mar 28 17:23:19 2001
@@ -2233,8 +2233,15 @@ wavelan_ioctl(struct net_device *	dev,	/
 	{
 	  struct iw_range	range;
 
-	  /* Set the length (useless : its constant...) */
+	  /* Set the length (very important for backward compatibility) */
 	  wrq->u.data.length = sizeof(struct iw_range);
+
+	  /* Set all the info we don't care or don't know about to zero */
+	  memset(&range, 0, sizeof(range));
+
+	  /* Set the Wireless Extension versions */
+	  range.we_version_compiled = WIRELESS_EXT;
+	  range.we_version_source = 9;	/* Nothing for us in v10 and v11 */
 
 	  /* Set information in the range struct */
 	  range.throughput = 1.4 * 1000 * 1000;	/* don't argue on this ! */
diff -u -p linux/drivers/net/pcmcia/wireless.25/netwave_cs.c linux/drivers/net/pcmcia/netwave_cs.c
--- linux/drivers/net/pcmcia/wireless.25/netwave_cs.c	Wed Mar 28 17:24:40 2001
+++ linux/drivers/net/pcmcia/netwave_cs.c	Wed Mar 28 17:29:39 2001
@@ -710,8 +710,17 @@ static int netwave_ioctl(struct net_devi
        if(wrq->u.data.pointer != (caddr_t) 0) {
 	   struct iw_range	range;
 		   
-	   /* Set the length (useless : its constant...) */
+	   /* Set the length (very important for backward compatibility) */
 	   wrq->u.data.length = sizeof(struct iw_range);
+
+	   /* Set all the info we don't care or don't know about to zero */
+	   memset(&range, 0, sizeof(range));
+
+#if WIRELESS_EXT > 10
+	   /* Set the Wireless Extension versions */
+	   range.we_version_compiled = WIRELESS_EXT;
+	   range.we_version_source = 9;	/* Nothing for us in v10 and v11 */
+#endif /* WIRELESS_EXT > 10 */
 		   
 	   /* Set information in the range struct */
 	   range.throughput = 450 * 1000;	/* don't argue on this ! */
diff -u -p linux/drivers/net/pcmcia/wireless.25/ray_cs.c linux/drivers/net/pcmcia/ray_cs.c
--- linux/drivers/net/pcmcia/wireless.25/ray_cs.c	Wed Mar 28 17:21:57 2001
+++ linux/drivers/net/pcmcia/ray_cs.c	Wed Mar 28 17:30:16 2001
@@ -1332,8 +1332,14 @@ static int ray_dev_ioctl(struct net_devi
 	  struct iw_range	range;
 	  memset((char *) &range, 0, sizeof(struct iw_range));
 
-	  /* Set the length (useless : its constant...) */
+	  /* Set the length (very important for backward compatibility) */
 	  wrq->u.data.length = sizeof(struct iw_range);
+
+#if WIRELESS_EXT > 10
+	  /* Set the Wireless Extension versions */
+	  range.we_version_compiled = WIRELESS_EXT;
+	  range.we_version_source = 9;
+#endif /* WIRELESS_EXT > 10 */
 
 	  /* Set information in the range struct */
 	  range.throughput = 1.1 * 1000 * 1000;	/* Put the right number here */
diff -u -p linux/drivers/net/pcmcia/wireless.25/hermes.h linux/drivers/net/pcmcia/hermes.h
--- linux/drivers/net/pcmcia/wireless.25/hermes.h	Wed Mar 28 10:31:35 2001
+++ linux/drivers/net/pcmcia/hermes.h	Wed Mar 28 10:43:20 2001
@@ -196,6 +196,9 @@
 #define		HERMES_RID_CURRENT_BSSID	((uint16_t)0xfd42)
 #define		HERMES_RID_COMMSQUALITY		((uint16_t)0xfd43)
 #define 	HERMES_RID_CURRENT_TX_RATE	((uint16_t)0xfd44)
+#define 	HERMES_RID_SHORT_RETRY_LIMIT	((uint16_t)0xfd48)
+#define 	HERMES_RID_LONG_RETRY_LIMIT	((uint16_t)0xfd49)
+#define 	HERMES_RID_MAX_TX_LIFETIME	((uint16_t)0xfd4A)
 #define		HERMES_RID_WEP_AVAIL		((uint16_t)0xfd4f)
 #define		HERMES_RID_CURRENT_CHANNEL	((uint16_t)0xfdc1)
 #define		HERMES_RID_DATARATES		((uint16_t)0xfdc6)
diff -u -p linux/drivers/net/pcmcia/wireless.25/orinoco_cs.c linux/drivers/net/pcmcia/orinoco_cs.c
--- linux/drivers/net/pcmcia/wireless.25/orinoco_cs.c	Wed Mar 28 10:31:35 2001
+++ linux/drivers/net/pcmcia/orinoco_cs.c	Wed Mar 28 17:16:36 2001
@@ -239,6 +239,7 @@ typedef struct dldwd_priv {
 	int has_wep, has_big_wep;
 	int has_mwo;
 	int has_pm;
+	int has_retry;
 	int broken_reset, broken_allocate;
 	uint16_t channel_mask;
 
@@ -254,6 +255,7 @@ typedef struct dldwd_priv {
 	uint16_t ap_density, rts_thresh;
 	uint16_t tx_rate_ctrl;
 	uint16_t pm_on, pm_mcast, pm_period, pm_timeout;
+	uint16_t retry_short, retry_long, retry_time;
 
 	int promiscuous, allmulti, mc_count;
 
@@ -645,6 +647,24 @@ ESSID in IBSS-Ad-Hoc mode.\n", dev->name
 			goto out;
 	}
 
+	/* Set retry settings - will fail on lot's of firmwares */
+	if (priv->has_retry) {
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT,
+					   priv->retry_short);
+		if (err) {
+			printk(KERN_WARNING "%s: Can't set retry limit!\n", dev->name);
+			goto out;
+		}
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_LONG_RETRY_LIMIT,
+					   priv->retry_long);
+		if (err)
+			goto out;
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_MAX_TX_LIFETIME,
+					   priv->retry_time);
+		if (err)
+			goto out;
+	}
+
 	/* Set promiscuity / multicast*/
 	priv->promiscuous = 0;
 	priv->allmulti = 0;
@@ -1267,6 +1287,7 @@ static int dldwd_init(struct net_device 
 					  Gold cards from the others? */
 		priv->has_mwo = (firmver >= 0x60000);
 		priv->has_pm = (firmver >= 0x40020);
+		priv->has_retry = 0;
 		/* Tested with Lucent firmware :
 		 *	1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 => Jean II
 		 * Tested CableTron firmware : 4.32 => Anton */
@@ -1285,6 +1306,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 1;
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000);
+		priv->has_retry = 0;
 		/* Tested with Intel firmware : 1.01 => Jean II */
 		/* Note : firmware 1.01 is *seriously* broken */
 		break;
@@ -1301,6 +1323,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 0; /* FIXME */
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000); /* FIXME */
+		priv->has_retry = 0;
 		break;
 	case 0x6:
 		vendor_str = "LinkSys/D-Link";
@@ -1315,6 +1338,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000); /* FIXME */
+		priv->has_retry = 0;
 		break;
 #if 0
 	case 0x???:		/* Could someone help here ??? */
@@ -1330,6 +1354,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 1;	/* Probably RID_SYMBOL_KEY_LENGTH */
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000);
+		priv->has_retry = 0;
 		break;
 #endif
 	default:
@@ -1344,6 +1369,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
 		priv->has_pm = 0;
+		priv->has_retry = 0;
 	}
 
 	printk(KERN_INFO "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n",
@@ -1453,6 +1479,21 @@ static int dldwd_init(struct net_device 
 		}
 	}
 		
+	/* Retry setup */
+	if (priv->has_retry) {
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT, &priv->retry_short);
+		if (err)
+			goto out;
+
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONG_RETRY_LIMIT, &priv->retry_long);
+		if (err)
+			goto out;
+
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAX_TX_LIFETIME, &priv->retry_time);
+		if (err)
+			goto out;
+	}
+		
 	/* Set up the default configuration */
 	priv->iw_mode = IW_MODE_INFRA;
 	/* By default use IEEE/IBSS ad-hoc mode if we have it */
@@ -1802,6 +1843,11 @@ static int dldwd_ioctl_getiwrange(struct
 
 	/* Much of this shamelessly taken from wvlan_cs.c. No idea
 	 * what it all means -dgibson */
+#if WIRELESS_EXT > 10
+	range.we_version_compiled = WIRELESS_EXT;
+	range.we_version_source = 11;
+#endif /* WIRELESS_EXT > 10 */
+
 	range.min_nwid = range.max_nwid = 0; /* We don't use nwids */
 
 	/* Set available channels/frequencies */
@@ -1881,6 +1927,16 @@ static int dldwd_ioctl_getiwrange(struct
 	range.txpower[0] = 15; /* 15dBm */
 	range.txpower_capa = IW_TXPOW_DBM;
 
+#if WIRELESS_EXT > 10
+	range.retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
+	range.retry_flags = IW_RETRY_LIMIT;
+	range.r_time_flags = IW_RETRY_LIFETIME;
+	range.min_retry = 0;
+	range.max_retry = 65535;	/* ??? */
+	range.min_r_time = 0;
+	range.max_r_time = 65535 * 1000;	/* ??? */
+#endif /* WIRELESS_EXT > 10 */
+
 	if (copy_to_user(rrq->pointer, &range, sizeof(range)))
 		return -EFAULT;
 
@@ -2520,6 +2576,92 @@ static int dldwd_ioctl_getpower(struct n
 	return err;
 }
 
+#if WIRELESS_EXT > 10
+static int dldwd_ioctl_setretry(struct net_device *dev, struct iw_param *rrq)
+{
+	dldwd_priv_t *priv = dev->priv;
+	int err = 0;
+
+
+	dldwd_lock(priv);
+
+	if ((rrq->disabled) || (!priv->has_retry)){
+		err = -EOPNOTSUPP;
+		goto out;
+	} else {
+		if (rrq->flags & IW_RETRY_LIMIT) {
+			if (rrq->flags & IW_RETRY_MAX)
+				priv->retry_long = rrq->value;
+			else if (rrq->flags & IW_RETRY_MIN)
+				priv->retry_short = rrq->value;
+			else {
+				/* No modifier : set both */
+				priv->retry_long = rrq->value;
+				priv->retry_short = rrq->value;
+			}
+		}
+		if (rrq->flags & IW_RETRY_LIFETIME) {
+			priv->retry_time = rrq->value / 1000;
+		}
+		if ((rrq->flags & IW_RETRY_TYPE) == 0) {
+			err = -EINVAL;
+			goto out;
+		}			
+	}
+
+ out:
+	dldwd_unlock(priv);
+
+	return err;
+}
+
+static int dldwd_ioctl_getretry(struct net_device *dev, struct iw_param *rrq)
+{
+	dldwd_priv_t *priv = dev->priv;
+	hermes_t *hw = &priv->hw;
+	int err = 0;
+	uint16_t short_limit, long_limit, lifetime;
+
+	dldwd_lock(priv);
+	
+	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT, &short_limit);
+	if (err)
+		goto out;
+
+	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONG_RETRY_LIMIT, &long_limit);
+	if (err)
+		goto out;
+
+	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAX_TX_LIFETIME, &lifetime);
+	if (err)
+		goto out;
+
+	rrq->disabled = 0;		/* Can't be disabled */
+
+	/* Note : by default, display the retry number */
+	if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
+		rrq->flags = IW_RETRY_LIFETIME;
+		rrq->value = lifetime * 1000;	/* ??? */
+	} else {
+		/* By default, display the min number */
+		if ((rrq->flags & IW_RETRY_MAX)) {
+			rrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
+			rrq->value = long_limit;
+		} else {
+			rrq->flags = IW_RETRY_LIMIT;
+			rrq->value = short_limit;
+			if(short_limit != long_limit)
+				rrq->flags |= IW_RETRY_MIN;
+		}
+	}
+
+ out:
+	dldwd_unlock(priv);
+
+	return err;
+}
+#endif /* WIRELESS_EXT > 10 */
+
 static int dldwd_ioctl_setport3(struct net_device *dev, struct iwreq *wrq)
 {
 	dldwd_priv_t *priv = dev->priv;
@@ -2857,6 +2999,20 @@ static int dldwd_ioctl(struct net_device
 		wrq->u.txpower.disabled = 0;
 		wrq->u.txpower.flags = IW_TXPOW_DBM;
 		break;
+
+#if WIRELESS_EXT > 10
+	case SIOCSIWRETRY:
+		DEBUG(1, "%s: SIOCSIWRETRY\n", dev->name);
+		err = dldwd_ioctl_setretry(dev, &wrq->u.retry);
+		if (! err)
+			changed = 1;
+		break;
+
+	case SIOCGIWRETRY:
+		DEBUG(1, "%s: SIOCGIWRETRY\n", dev->name);
+		err = dldwd_ioctl_getretry(dev, &wrq->u.retry);
+		break;
+#endif /* WIRELESS_EXT > 10 */
 
 	case SIOCSIWSPY:
 		DEBUG(1, "%s: SIOCSIWSPY\n", dev->name);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2001-10-15 21:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20  0:59 Wireless Extension update Jean Tourrilhes
2001-03-29  2:12 Jean Tourrilhes
2001-10-09  2:12 Jean Tourrilhes
2001-10-09 16:22 ` Randy.Dunlap
2001-10-09 16:35   ` Jean Tourrilhes
2001-10-14 21:58   ` Riley Williams
2001-10-15  0:07     ` H. Peter Anvin
2001-10-15 19:26       ` Roeland Th. Jansen
2001-10-15 19:31         ` H. Peter Anvin
2001-10-15 21:02           ` Tobias Ringstrom
2001-10-15  0:08 ` H. Peter Anvin
     [not found] ` <200110150008.RAA09482@cesium.transmeta.com>
2001-10-15 16:37   ` Jean Tourrilhes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).