iw: add support for the new survey data
authorFelix Fietkau <nbd@openwrt.org>
Sat, 9 Oct 2010 00:36:59 +0000 (00:36 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 9 Oct 2010 00:36:59 +0000 (00:36 +0000)
SVN-Revision: 23351

package/iw/patches/001-nl80211_sync.patch
package/iw/patches/100-survey_freq_in_use.patch
package/iw/patches/110-survey_phy_stats.patch [new file with mode: 0644]

index ef3bd15dd67ceca961eaf1a542108d3d35bfe8b8..83da75e07cd8174fca950725d36b88446273c890 100644 (file)
   *    It is also sent as an event, with the BSSID and response IEs when the
   *    connection is established or failed to be established. This can be
   *    determined by the STATUS_CODE attribute.
-@@ -686,6 +688,15 @@ enum nl80211_commands {
+@@ -313,8 +315,8 @@
+  *    channel for the specified amount of time. This can be used to do
+  *    off-channel operations like transmit a Public Action frame and wait for
+  *    a response while being associated to an AP on another channel.
+- *    %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify which
+- *    radio is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
++ *    %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
++ *    radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
+  *    frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be
+  *    optionally used to specify additional channel parameters.
+  *    %NL80211_ATTR_DURATION is used to specify the duration in milliseconds
+@@ -385,6 +387,8 @@
+  *    of any other interfaces, and other interfaces will again take
+  *    precedence when they are used.
+  *
++ * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.
++ *
+  * @NL80211_CMD_MAX: highest used command number
+  * @__NL80211_CMD_AFTER_LAST: internal use
+  */
+@@ -487,6 +491,7 @@ enum nl80211_commands {
+       NL80211_CMD_NOTIFY_CQM,
+       NL80211_CMD_SET_CHANNEL,
++      NL80211_CMD_SET_WDS_PEER,
+       /* add new commands above here */
+@@ -686,6 +691,15 @@ enum nl80211_commands {
   *    request, the driver will assume that the port is unauthorized until
   *    authorized by user space. Otherwise, port is marked authorized by
   *    default in station mode.
   *
   * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
   *    We recommend using nested, driver-specific attributes within this.
-@@ -951,6 +962,9 @@ enum nl80211_attrs {
+@@ -787,6 +801,9 @@ enum nl80211_commands {
+  *      This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING
+  *      for non-automatic settings.
+  *
++ * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly
++ *    means support for per-station GTKs.
++ *
+  * @NL80211_ATTR_MAX: highest attribute number currently defined
+  * @__NL80211_ATTR_AFTER_LAST: internal use
+  */
+@@ -951,6 +968,11 @@ enum nl80211_attrs {
        NL80211_ATTR_RX_FRAME_TYPES,
        NL80211_ATTR_FRAME_TYPE,
  
 +      NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
 +      NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
++
++      NL80211_ATTR_SUPPORT_IBSS_RSN,
 +
        /* add attributes here, update the policy in nl80211.c */
  
        __NL80211_ATTR_AFTER_LAST,
-@@ -1006,6 +1020,8 @@ enum nl80211_attrs {
+@@ -1006,6 +1028,8 @@ enum nl80211_attrs {
   * @NL80211_IFTYPE_WDS: wireless distribution interface
   * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
   * @NL80211_IFTYPE_MESH_POINT: mesh point
@@ -46,7 +86,7 @@
   * @NL80211_IFTYPE_MAX: highest interface type number currently defined
   * @NUM_NL80211_IFTYPES: number of defined interface types
   *
-@@ -1022,6 +1038,8 @@ enum nl80211_iftype {
+@@ -1022,6 +1046,8 @@ enum nl80211_iftype {
        NL80211_IFTYPE_WDS,
        NL80211_IFTYPE_MONITOR,
        NL80211_IFTYPE_MESH_POINT,
  
        /* keep last */
        NUM_NL80211_IFTYPES,
-@@ -1382,6 +1400,7 @@ enum nl80211_reg_rule_flags {
+@@ -1111,6 +1137,8 @@ enum nl80211_rate_info {
+  * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
+  * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
+  *    station)
++ * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station)
++ * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station)
+  */
+ enum nl80211_sta_info {
+       __NL80211_STA_INFO_INVALID,
+@@ -1124,6 +1152,8 @@ enum nl80211_sta_info {
+       NL80211_STA_INFO_TX_BITRATE,
+       NL80211_STA_INFO_RX_PACKETS,
+       NL80211_STA_INFO_TX_PACKETS,
++      NL80211_STA_INFO_TX_RETRIES,
++      NL80211_STA_INFO_TX_FAILED,
+       /* keep last */
+       __NL80211_STA_INFO_AFTER_LAST,
+@@ -1382,6 +1412,17 @@ enum nl80211_reg_rule_flags {
   * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved
   * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel
   * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm)
 + * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used
++ * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio
++ *    spent on this channel
++ * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary
++ *    channel was sensed busy (either due to activity or energy detect)
++ * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension
++ *    channel was sensed busy
++ * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent
++ *    receiving data
++ * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent
++ *    transmitting data
   * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
   *    currently defined
   * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
-@@ -1390,6 +1409,7 @@ enum nl80211_survey_info {
+@@ -1390,6 +1431,12 @@ enum nl80211_survey_info {
        __NL80211_SURVEY_INFO_INVALID,
        NL80211_SURVEY_INFO_FREQUENCY,
        NL80211_SURVEY_INFO_NOISE,
 +      NL80211_SURVEY_INFO_IN_USE,
++      NL80211_SURVEY_INFO_CHANNEL_TIME,
++      NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY,
++      NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY,
++      NL80211_SURVEY_INFO_CHANNEL_TIME_RX,
++      NL80211_SURVEY_INFO_CHANNEL_TIME_TX,
  
        /* keep last */
        __NL80211_SURVEY_INFO_AFTER_LAST,
+@@ -1636,11 +1683,14 @@ enum nl80211_auth_type {
+  * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key
+  * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key
+  * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS)
++ * @NUM_NL80211_KEYTYPES: number of defined key types
+  */
+ enum nl80211_key_type {
+       NL80211_KEYTYPE_GROUP,
+       NL80211_KEYTYPE_PAIRWISE,
+       NL80211_KEYTYPE_PEERKEY,
++
++      NUM_NL80211_KEYTYPES
+ };
+ /**
+@@ -1671,6 +1721,9 @@ enum nl80211_wpa_versions {
+  *    CCMP keys, each six bytes in little endian
+  * @NL80211_KEY_DEFAULT: flag indicating default key
+  * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key
++ * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not
++ *    specified the default depends on whether a MAC address was
++ *    given with the command using the key or not (u32)
+  * @__NL80211_KEY_AFTER_LAST: internal
+  * @NL80211_KEY_MAX: highest key attribute
+  */
+@@ -1682,6 +1735,7 @@ enum nl80211_key_attributes {
+       NL80211_KEY_SEQ,
+       NL80211_KEY_DEFAULT,
+       NL80211_KEY_DEFAULT_MGMT,
++      NL80211_KEY_TYPE,
+       /* keep last */
+       __NL80211_KEY_AFTER_LAST,
index e6e7eafdf4e75cd35e8251f5a2740db05d1a98a0..3933ae379f3e32782ce5966d8acae5a6cbaa280f 100644 (file)
@@ -1,11 +1,14 @@
 --- a/survey.c
 +++ b/survey.c
-@@ -46,6 +46,8 @@ static int print_survey_handler(struct n
+@@ -44,8 +44,9 @@ static int print_survey_handler(struct n
+       }
        if (sinfo[NL80211_SURVEY_INFO_FREQUENCY])
-               printf("\tfrequency:\t%u MHz\n",
-                       nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]));
-+      if (sinfo[NL80211_SURVEY_INFO_IN_USE])
-+              printf("\tin use\n");
+-              printf("\tfrequency:\t%u MHz\n",
+-                      nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]));
++              printf("\tfrequency:\t%u MHz%s\n",
++                      nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]),
++                      sinfo[NL80211_SURVEY_INFO_IN_USE] ? " [in use]" : "");
        if (sinfo[NL80211_SURVEY_INFO_NOISE])
                printf("\tnoise:\t\t%d dBm\n",
                        (int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]));
diff --git a/package/iw/patches/110-survey_phy_stats.patch b/package/iw/patches/110-survey_phy_stats.patch
new file mode 100644 (file)
index 0000000..cdd5c2e
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/survey.c
++++ b/survey.c
+@@ -44,12 +44,27 @@ static int print_survey_handler(struct n
+       }
+       if (sinfo[NL80211_SURVEY_INFO_FREQUENCY])
+-              printf("\tfrequency:\t%u MHz%s\n",
++              printf("\tfrequency:\t\t\t%u MHz%s\n",
+                       nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]),
+                       sinfo[NL80211_SURVEY_INFO_IN_USE] ? " [in use]" : "");
+       if (sinfo[NL80211_SURVEY_INFO_NOISE])
+-              printf("\tnoise:\t\t%d dBm\n",
++              printf("\tnoise:\t\t\t\t%d dBm\n",
+                       (int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]));
++      if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME])
++              printf("\tchannel active time:\t\t%lld ms\n",
++                      (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME]));
++      if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY])
++              printf("\tchannel busy time:\t\t%lld ms\n",
++                      (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY]));
++      if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY])
++              printf("\textension channel busy time:\t%lld ms\n",
++                      (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY]));
++      if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX])
++              printf("\tchannel receive time:\t\t%lld ms\n",
++                      (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX]));
++      if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX])
++              printf("\tchannel transmit time:\t\t%lld ms\n",
++                      (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX]));
+       return NL_SKIP;
+ }