OSDN Git Service

v22
[android-x86/external-wireless-tools.git] / wireless_tools / wireless.h
index fe42409..4183d4a 100644 (file)
@@ -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 :
  * ----------
  *     - 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 -------------------------- */
 #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 */
  * The "flags" member indicate if the ESSID is active or not (promiscuous).
  */
 
-/* Other parameters usefull in 802.11 and some other devices */
+/* Other parameters useful in 802.11 and some other devices */
 #define SIOCSIWRATE    0x8B20          /* set default bit rate (bps) */
 #define SIOCGIWRATE    0x8B21          /* get default bit rate (bps) */
 #define SIOCSIWRTS     0x8B22          /* set RTS/CTS threshold (bytes) */
 #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))
 /*
  * 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 */
@@ -305,7 +336,7 @@ struct      iw_param
 
 /*
  *     For all data larger than 16 octets, we need to use a
- *     pointer to memory alocated in user space.
+ *     pointer to memory allocated in user space.
  */
 struct iw_point
 {
@@ -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...
+        */
 };
 
 /*