]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: add auto parameter to set distance command
authorLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Sun, 7 Sep 2014 17:32:20 +0000 (19:32 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 9 Oct 2014 14:20:30 +0000 (16:20 +0200)
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>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
info.c
phy.c

diff --git a/info.c b/info.c
index 97ff39d8d1ea272186bb35fe446a6b74922d4f38..b72801bc65030837e684c33debfa968a04209e62 100644 (file)
--- 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])
diff --git a/phy.c b/phy.c
index 517d20339357a887966b836b82084daac2f01978..aab462d2ed41b0285b5aef56b4cae09ace580d54 100644 (file)
--- a/phy.c
+++ b/phy.c
@@ -362,39 +362,46 @@ static int handle_distance(struct nl80211_state *state,
                        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;
 
-       NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, coverage);
+               /*
+                * 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);
+       }
 
        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,