Commit b708e610622cff07f4374a2b4410884f964b8489

Authored by Johannes Berg
Committed by David S. Miller
1 parent d4e46a3d98

[MAC80211]: remove turbo modes

This patch removes all mention of the atheros turbo modes that
can't possibly work properly anyway since in some places we don't
check for them when we should.

I have no idea what the iwlwifi drivers were doing with these but
it can't possibly have been correct.

Cc: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 10 changed files with 59 additions and 61 deletions Side-by-side Diff

include/net/mac80211.h
... ... @@ -73,14 +73,13 @@
73 73 #define IEEE80211_RATE_SUPPORTED 0x00000010
74 74 #define IEEE80211_RATE_OFDM 0x00000020
75 75 #define IEEE80211_RATE_CCK 0x00000040
76   -#define IEEE80211_RATE_TURBO 0x00000080
77 76 #define IEEE80211_RATE_MANDATORY 0x00000100
78 77  
79 78 #define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
80 79 #define IEEE80211_RATE_MODULATION(f) \
81 80 (f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))
82 81  
83   -/* Low-level driver should set PREAMBLE2, OFDM, CCK, and TURBO flags.
  82 +/* Low-level driver should set PREAMBLE2, OFDM and CCK flags.
84 83 * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
85 84 * configuration. */
86 85 struct ieee80211_rate {
87 86  
88 87  
... ... @@ -101,12 +100,10 @@
101 100  
102 101 /* 802.11g is backwards-compatible with 802.11b, so a wlan card can
103 102 * actually be both in 11b and 11g modes at the same time. */
104   -enum {
  103 +enum ieee80211_phymode {
105 104 MODE_IEEE80211A, /* IEEE 802.11a */
106 105 MODE_IEEE80211B, /* IEEE 802.11b only */
107   - MODE_ATHEROS_TURBO, /* Atheros Turbo mode (2x.11a at 5 GHz) */
108 106 MODE_IEEE80211G, /* IEEE 802.11g (and 802.11b compatibility) */
109   - MODE_ATHEROS_TURBOG, /* Atheros Turbo mode (2x.11g at 2.4 GHz) */
110 107  
111 108 /* keep last */
112 109 NUM_IEEE80211_MODES
net/mac80211/debugfs.c
... ... @@ -28,8 +28,6 @@
28 28 return "IEEE 802.11b";
29 29 case MODE_IEEE80211G:
30 30 return "IEEE 802.11g";
31   - case MODE_ATHEROS_TURBO:
32   - return "Atheros Turbo (5 GHz)";
33 31 default:
34 32 return "UNKNOWN";
35 33 }
net/mac80211/ieee80211.c
... ... @@ -118,10 +118,6 @@
118 118 case MODE_IEEE80211G:
119 119 fi->phytype = htonl(ieee80211_phytype_pbcc_dot11_g);
120 120 break;
121   - case MODE_ATHEROS_TURBO:
122   - fi->phytype =
123   - htonl(ieee80211_phytype_dsss_dot11_turbo);
124   - break;
125 121 default:
126 122 fi->phytype = htonl(0xAAAAAAAA);
127 123 break;
... ... @@ -1225,7 +1221,7 @@
1225 1221 local->long_retry_limit = 4;
1226 1222 local->hw.conf.radio_enabled = 1;
1227 1223  
1228   - local->enabled_modes = (unsigned int) -1;
  1224 + local->enabled_modes = ~0;
1229 1225  
1230 1226 INIT_LIST_HEAD(&local->modes_list);
1231 1227  
net/mac80211/ieee80211_common.h
... ... @@ -73,8 +73,6 @@
73 73 ieee80211_phytype_ofdm_dot11_g = 6,
74 74 ieee80211_phytype_pbcc_dot11_g = 7,
75 75 ieee80211_phytype_ofdm_dot11_a = 8,
76   - ieee80211_phytype_dsss_dot11_turbog = 255,
77   - ieee80211_phytype_dsss_dot11_turbo = 256,
78 76 };
79 77  
80 78 enum ieee80211_ssi_type {
net/mac80211/ieee80211_ioctl.c
... ... @@ -26,6 +26,41 @@
26 26 #include "wpa.h"
27 27 #include "aes_ccm.h"
28 28  
  29 +
  30 +/*
  31 + * Wow. This ioctl interface is such crap, it's tied
  32 + * to internal definitions. I hope it dies soon.
  33 + */
  34 +static int mode_to_hostapd_mode(enum ieee80211_phymode mode)
  35 +{
  36 + switch (mode) {
  37 + case MODE_IEEE80211A:
  38 + return 0;
  39 + case MODE_IEEE80211B:
  40 + return 1;
  41 + case MODE_IEEE80211G:
  42 + return 3;
  43 + case NUM_IEEE80211_MODES:
  44 + WARN_ON(1);
  45 + break;
  46 + }
  47 + WARN_ON(1);
  48 + return -1;
  49 +}
  50 +
  51 +static enum ieee80211_phymode hostapd_mode_to_mode(int hostapd_mode)
  52 +{
  53 + switch (hostapd_mode) {
  54 + case 0:
  55 + return MODE_IEEE80211A;
  56 + case 1:
  57 + return MODE_IEEE80211B;
  58 + case 3:
  59 + return MODE_IEEE80211G;
  60 + }
  61 + return NUM_IEEE80211_MODES;
  62 +}
  63 +
29 64 static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
30 65 int idx, int alg, int set_tx_key,
31 66 const u8 *_key, size_t key_len)
... ... @@ -141,9 +176,6 @@
141 176 case MODE_IEEE80211G:
142 177 strcpy(name, "IEEE 802.11g");
143 178 break;
144   - case MODE_ATHEROS_TURBO:
145   - strcpy(name, "5GHz Turbo");
146   - break;
147 179 default:
148 180 strcpy(name, "IEEE 802.11");
149 181 break;
... ... @@ -594,9 +626,6 @@
594 626 struct ieee80211_rate *rates = &mode->rates[i];
595 627 int this_rate = rates->rate;
596 628  
597   - if (mode->mode == MODE_ATHEROS_TURBO ||
598   - mode->mode == MODE_ATHEROS_TURBOG)
599   - this_rate *= 2;
600 629 if (target_rate == this_rate) {
601 630 sdata->bss->max_ratectrl_rateidx = i;
602 631 if (rate->fixed)
... ... @@ -786,6 +815,7 @@
786 815 int param = *i;
787 816 int value = *(i + 1);
788 817 int ret = 0;
  818 + int mode;
789 819  
790 820 if (!capable(CAP_NET_ADMIN))
791 821 return -EPERM;
... ... @@ -840,7 +870,7 @@
840 870 break;
841 871  
842 872 case PRISM2_PARAM_NEXT_MODE:
843   - local->next_mode = value;
  873 + local->next_mode = hostapd_mode_to_mode(value);
844 874 break;
845 875  
846 876 case PRISM2_PARAM_KEY_TX_RX_THRESHOLD:
... ... @@ -868,7 +898,15 @@
868 898 break;
869 899  
870 900 case PRISM2_PARAM_HW_MODES:
871   - local->enabled_modes = value;
  901 + mode = 1;
  902 + local->enabled_modes = 0;
  903 + while (value) {
  904 + if (value & 1)
  905 + local->enabled_modes |=
  906 + hostapd_mode_to_mode(mode);
  907 + mode <<= 1;
  908 + value >>= 1;
  909 + }
872 910 break;
873 911  
874 912 case PRISM2_PARAM_CREATE_IBSS:
... ... @@ -909,6 +947,7 @@
909 947 struct ieee80211_sub_if_data *sdata;
910 948 int *param = (int *) extra;
911 949 int ret = 0;
  950 + int mode;
912 951  
913 952 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
914 953  
... ... @@ -946,7 +985,13 @@
946 985 break;
947 986  
948 987 case PRISM2_PARAM_HW_MODES:
949   - *param = local->enabled_modes;
  988 + mode = 0;
  989 + *param = 0;
  990 + while (mode < NUM_IEEE80211_MODES) {
  991 + if (local->enabled_modes & (1<<mode))
  992 + *param |= mode_to_hostapd_mode(1<<mode);
  993 + mode++;
  994 + }
950 995 break;
951 996  
952 997 case PRISM2_PARAM_CREATE_IBSS:
net/mac80211/ieee80211_sta.c
... ... @@ -618,8 +618,6 @@
618 618 *pos++ = len;
619 619 for (i = 0; i < len; i++) {
620 620 int rate = mode->rates[i].rate;
621   - if (mode->mode == MODE_ATHEROS_TURBO)
622   - rate /= 2;
623 621 *pos++ = (u8) (rate / 5);
624 622 }
625 623  
... ... @@ -629,8 +627,6 @@
629 627 *pos++ = mode->num_rates - len;
630 628 for (i = len; i < mode->num_rates; i++) {
631 629 int rate = mode->rates[i].rate;
632   - if (mode->mode == MODE_ATHEROS_TURBO)
633   - rate /= 2;
634 630 *pos++ = (u8) (rate / 5);
635 631 }
636 632 }
... ... @@ -889,10 +885,7 @@
889 885 pos = skb_put(skb, 1);
890 886 supp_rates[1]++;
891 887 }
892   - if (mode->mode == MODE_ATHEROS_TURBO)
893   - *pos = rate->rate / 10;
894   - else
895   - *pos = rate->rate / 5;
  888 + *pos = rate->rate / 5;
896 889 }
897 890  
898 891 ieee80211_sta_tx(dev, skb, 0);
899 892  
... ... @@ -1285,16 +1278,12 @@
1285 1278 mode = local->oper_hw_mode;
1286 1279 for (i = 0; i < elems.supp_rates_len; i++) {
1287 1280 int rate = (elems.supp_rates[i] & 0x7f) * 5;
1288   - if (mode->mode == MODE_ATHEROS_TURBO)
1289   - rate *= 2;
1290 1281 for (j = 0; j < mode->num_rates; j++)
1291 1282 if (mode->rates[j].rate == rate)
1292 1283 rates |= BIT(j);
1293 1284 }
1294 1285 for (i = 0; i < elems.ext_supp_rates_len; i++) {
1295 1286 int rate = (elems.ext_supp_rates[i] & 0x7f) * 5;
1296   - if (mode->mode == MODE_ATHEROS_TURBO)
1297   - rate *= 2;
1298 1287 for (j = 0; j < mode->num_rates; j++)
1299 1288 if (mode->rates[j].rate == rate)
1300 1289 rates |= BIT(j);
... ... @@ -1514,8 +1503,6 @@
1514 1503 rate = elems.ext_supp_rates
1515 1504 [i - elems.supp_rates_len];
1516 1505 own_rate = 5 * (rate & 0x7f);
1517   - if (mode->mode == MODE_ATHEROS_TURBO)
1518   - own_rate *= 2;
1519 1506 for (j = 0; j < num_rates; j++)
1520 1507 if (rates[j].rate == own_rate)
1521 1508 supp_rates |= BIT(j);
... ... @@ -2344,8 +2331,6 @@
2344 2331 mode = local->oper_hw_mode;
2345 2332 for (i = 0; i < bss->supp_rates_len; i++) {
2346 2333 int bitrate = (bss->supp_rates[i] & 0x7f) * 5;
2347   - if (mode->mode == MODE_ATHEROS_TURBO)
2348   - bitrate *= 2;
2349 2334 for (j = 0; j < mode->num_rates; j++)
2350 2335 if (mode->rates[j].rate == bitrate)
2351 2336 rates |= BIT(j);
... ... @@ -2418,8 +2403,6 @@
2418 2403 pos = bss->supp_rates;
2419 2404 for (i = 0; i < mode->num_rates; i++) {
2420 2405 int rate = mode->rates[i].rate;
2421   - if (mode->mode == MODE_ATHEROS_TURBO)
2422   - rate /= 2;
2423 2406 *pos++ = (u8) (rate / 5);
2424 2407 }
2425 2408  
net/mac80211/regdomain.c
... ... @@ -82,12 +82,6 @@
82 82  
83 83 chan->flag = 0;
84 84  
85   - if (ieee80211_regdom == 64 &&
86   - (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) {
87   - /* Do not allow Turbo modes in Japan. */
88   - return;
89   - }
90   -
91 85 for (i = 0; channel_range[i].start_freq; i++) {
92 86 const struct ieee80211_channel_range *r = &channel_range[i];
93 87 if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) {
... ... @@ -94,8 +94,6 @@
94 94 * 1 usec = 1/8 * (1080 / 10) = 13.5 */
95 95  
96 96 if (mode->mode == MODE_IEEE80211A ||
97   - mode->mode == MODE_ATHEROS_TURBO ||
98   - mode->mode == MODE_ATHEROS_TURBOG ||
99 97 (mode->mode == MODE_IEEE80211G &&
100 98 rate->flags & IEEE80211_RATE_ERP))
101 99 hdrtime = CHAN_UTIL_HDR_SHORT;
... ... @@ -747,8 +747,6 @@
747 747 * 1 usec = 1/8 * (1080 / 10) = 13.5 */
748 748  
749 749 if (mode->mode == MODE_IEEE80211A ||
750   - mode->mode == MODE_ATHEROS_TURBO ||
751   - mode->mode == MODE_ATHEROS_TURBOG ||
752 750 (mode->mode == MODE_IEEE80211G &&
753 751 tx->u.tx.rate->flags & IEEE80211_RATE_ERP))
754 752 hdrtime = CHAN_UTIL_HDR_SHORT;
... ... @@ -93,11 +93,6 @@
93 93 if (rate->rate == 10 || rate->rate == 20)
94 94 rate->flags |= IEEE80211_RATE_BASIC;
95 95 break;
96   - case MODE_ATHEROS_TURBO:
97   - if (rate->rate == 120 || rate->rate == 240 ||
98   - rate->rate == 480)
99   - rate->flags |= IEEE80211_RATE_BASIC;
100   - break;
101 96 case MODE_IEEE80211G:
102 97 if (rate->rate == 10 || rate->rate == 20 ||
103 98 rate->rate == 55 || rate->rate == 110)
... ... @@ -116,8 +111,6 @@
116 111 if (rate->rate == 10)
117 112 rate->flags |= IEEE80211_RATE_MANDATORY;
118 113 break;
119   - case MODE_ATHEROS_TURBO:
120   - break;
121 114 case MODE_IEEE80211G:
122 115 if (rate->rate == 10 || rate->rate == 20 ||
123 116 rate->rate == 55 || rate->rate == 110 ||
... ... @@ -273,8 +266,7 @@
273 266 * DIV_ROUND_UP() operations.
274 267 */
275 268  
276   - if (local->hw.conf.phymode == MODE_IEEE80211A || erp ||
277   - local->hw.conf.phymode == MODE_ATHEROS_TURBO) {
  269 + if (local->hw.conf.phymode == MODE_IEEE80211A || erp) {
278 270 /*
279 271 * OFDM:
280 272 *
... ... @@ -288,7 +280,6 @@
288 280 * 802.11g - 19.8.4: aSIFSTime = 10 usec +
289 281 * signal ext = 6 usec
290 282 */
291   - /* FIX: Atheros Turbo may have different (shorter) duration? */
292 283 dur = 16; /* SIFS + signal ext */
293 284 dur += 16; /* 17.3.2.3: T_PREAMBLE = 16 usec */
294 285 dur += 4; /* 17.3.2.3: T_SIGNAL = 4 usec */