iw: add support for dynamic distance selection (supported by ath9k now)
authorFelix Fietkau <nbd@openwrt.org>
Sat, 27 Sep 2014 21:19:27 +0000 (21:19 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 27 Sep 2014 21:19:27 +0000 (21:19 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42689

package/network/utils/iw/patches/010-dynack.patch [new file with mode: 0644]
package/network/utils/iw/patches/120-antenna_gain.patch
package/network/utils/iw/patches/200-reduce_size.patch

diff --git a/package/network/utils/iw/patches/010-dynack.patch b/package/network/utils/iw/patches/010-dynack.patch
new file mode 100644 (file)
index 0000000..00e4bf2
--- /dev/null
@@ -0,0 +1,94 @@
+
+
+Add auto parameter to set distance command in order to enable ACK timeout
+estimation algorithm (dynack). Dynack is automatically disabled setting valid
+value for coverage class. Currently dynack is supported just by ath9k
+
+This patch is based on "configure dynack through mac80211/cfg80211 stack"
+patchset sent on linux-wireless
+
+Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
+---
+ info.c    |  2 ++
+ nl80211.h | 12 ++++++++++++
+ phy.c     | 43 +++++++++++++++++++++++++------------------
+ 3 files changed, 39 insertions(+), 18 deletions(-)
+
+--- a/info.c
++++ b/info.c
+@@ -551,6 +551,8 @@ broken_combination:
+                       printf("\tDevice supports scan flush.\n");
+               if (features & NL80211_FEATURE_AP_SCAN)
+                       printf("\tDevice supports AP scan.\n");
++              if (features & NL80211_FEATURE_ACKTO_ESTIMATION)
++                      printf("\tDevice supports ACK timeout estimation.\n");
+       }
+       if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
+--- a/phy.c
++++ b/phy.c
+@@ -362,39 +362,46 @@ static int handle_distance(struct nl8021
+                       int argc, char **argv,
+                       enum id_input id)
+ {
+-      char *end;
+-      unsigned int distance, coverage;
+-
+       if (argc != 1)
+               return 1;
+       if (!*argv[0])
+               return 1;
+-      distance = strtoul(argv[0], &end, 10);
++      if (strcmp("auto", argv[0]) == 0) {
++              NLA_PUT_FLAG(msg, NL80211_ATTR_WIPHY_DYN_ACK);
++      } else {
++              char *end;
++              unsigned int distance, coverage;
+-      if (*end)
+-              return 1;
++              distance = strtoul(argv[0], &end, 10);
+-      /*
+-       * Divide double the distance by the speed of light in m/usec (300) to
+-       * get round-trip time in microseconds and then divide the result by
+-       * three to get coverage class as specified in IEEE 802.11-2007 table
+-       * 7-27. Values are rounded upwards.
+-       */
+-      coverage = (distance + 449) / 450;
+-      if (coverage > 255)
+-              return 1;
++              if (*end)
++                      return 1;
++
++              /*
++               * Divide double the distance by the speed of light
++               * in m/usec (300) to get round-trip time in microseconds
++               * and then divide the result by three to get coverage class
++               * as specified in IEEE 802.11-2007 table 7-27.
++               * Values are rounded upwards.
++               */
++              coverage = (distance + 449) / 450;
++              if (coverage > 255)
++                      return 1;
+-      NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, coverage);
++              NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, coverage);
++      }
+       return 0;
+  nla_put_failure:
+       return -ENOBUFS;
+ }
+-COMMAND(set, distance, "<distance>",
++COMMAND(set, distance, "<auto|distance>",
+       NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_distance,
+-      "Set appropriate coverage class for given link distance in meters.\n"
++      "Enable ACK timeout estimation algorithm (dynack) or set appropriate\n"
++      "coverage class for given link distance in meters.\n"
++      "To disable dynack set valid value for coverage class.\n"
+       "Valid values: 0 - 114750");
+ static int handle_txpower(struct nl80211_state *state,
index 2c11a150dee3b20740ac34fa5bd76ca95775960c..cf6a3fa221664dff02d16e90f55eb7cc622ec53d 100644 (file)
@@ -1,6 +1,6 @@
 --- a/phy.c
 +++ b/phy.c
-@@ -488,3 +488,31 @@ COMMAND(set, antenna, "<bitmap> | all | 
+@@ -495,3 +495,31 @@ COMMAND(set, antenna, "<bitmap> | all | 
        NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna,
        "Set a bitmap of allowed antennas to use for TX and RX.\n"
        "The driver may reject antenna configurations it cannot support.");
index 8f5c0eb76d1804bc5056cc2979fc719a213d15db..a6499b3017085a07da2f620c0dfd2f75273d7ceb 100644 (file)
        if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
                unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
  
-@@ -552,6 +561,7 @@ broken_combination:
-               if (features & NL80211_FEATURE_AP_SCAN)
-                       printf("\tDevice supports AP scan.\n");
+@@ -554,6 +563,7 @@ broken_combination:
+               if (features & NL80211_FEATURE_ACKTO_ESTIMATION)
+                       printf("\tDevice supports ACK timeout estimation.\n");
        }
 +#endif
  
        if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
                printf("\tDevice supports T-DLS.\n");
-@@ -601,6 +611,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
+@@ -603,6 +613,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
         "List all wireless devices and their capabilities.");
  TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
  
@@ -99,7 +99,7 @@
  static int handle_commands(struct nl80211_state *state,
                           struct nl_cb *cb, struct nl_msg *msg,
                           int argc, char **argv, enum id_input id)
-@@ -613,6 +624,7 @@ static int handle_commands(struct nl8021
+@@ -615,6 +626,7 @@ static int handle_commands(struct nl8021
  }
  TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
         "list all known commands and their decimal & hex value");