Skip to content

Commit

Permalink
[MAC80211]: remove turbo modes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg authored and David S. Miller committed Oct 10, 2007
1 parent d4e46a3 commit b708e61
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 61 deletions.
7 changes: 2 additions & 5 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ struct ieee80211_channel {
#define IEEE80211_RATE_SUPPORTED 0x00000010
#define IEEE80211_RATE_OFDM 0x00000020
#define IEEE80211_RATE_CCK 0x00000040
#define IEEE80211_RATE_TURBO 0x00000080
#define IEEE80211_RATE_MANDATORY 0x00000100

#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
#define IEEE80211_RATE_MODULATION(f) \
(f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))

/* Low-level driver should set PREAMBLE2, OFDM, CCK, and TURBO flags.
/* Low-level driver should set PREAMBLE2, OFDM and CCK flags.
* BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
* configuration. */
struct ieee80211_rate {
Expand All @@ -101,12 +100,10 @@ struct ieee80211_rate {

/* 802.11g is backwards-compatible with 802.11b, so a wlan card can
* actually be both in 11b and 11g modes at the same time. */
enum {
enum ieee80211_phymode {
MODE_IEEE80211A, /* IEEE 802.11a */
MODE_IEEE80211B, /* IEEE 802.11b only */
MODE_ATHEROS_TURBO, /* Atheros Turbo mode (2x.11a at 5 GHz) */
MODE_IEEE80211G, /* IEEE 802.11g (and 802.11b compatibility) */
MODE_ATHEROS_TURBOG, /* Atheros Turbo mode (2x.11g at 2.4 GHz) */

/* keep last */
NUM_IEEE80211_MODES
Expand Down
2 changes: 0 additions & 2 deletions net/mac80211/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ static const char *ieee80211_mode_str(int mode)
return "IEEE 802.11b";
case MODE_IEEE80211G:
return "IEEE 802.11g";
case MODE_ATHEROS_TURBO:
return "Atheros Turbo (5 GHz)";
default:
return "UNKNOWN";
}
Expand Down
6 changes: 1 addition & 5 deletions net/mac80211/ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ ieee80211_fill_frame_info(struct ieee80211_local *local,
case MODE_IEEE80211G:
fi->phytype = htonl(ieee80211_phytype_pbcc_dot11_g);
break;
case MODE_ATHEROS_TURBO:
fi->phytype =
htonl(ieee80211_phytype_dsss_dot11_turbo);
break;
default:
fi->phytype = htonl(0xAAAAAAAA);
break;
Expand Down Expand Up @@ -1225,7 +1221,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
local->long_retry_limit = 4;
local->hw.conf.radio_enabled = 1;

local->enabled_modes = (unsigned int) -1;
local->enabled_modes = ~0;

INIT_LIST_HEAD(&local->modes_list);

Expand Down
2 changes: 0 additions & 2 deletions net/mac80211/ieee80211_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ enum ieee80211_phytype {
ieee80211_phytype_ofdm_dot11_g = 6,
ieee80211_phytype_pbcc_dot11_g = 7,
ieee80211_phytype_ofdm_dot11_a = 8,
ieee80211_phytype_dsss_dot11_turbog = 255,
ieee80211_phytype_dsss_dot11_turbo = 256,
};

enum ieee80211_ssi_type {
Expand Down
63 changes: 54 additions & 9 deletions net/mac80211/ieee80211_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,41 @@
#include "wpa.h"
#include "aes_ccm.h"


/*
* Wow. This ioctl interface is such crap, it's tied
* to internal definitions. I hope it dies soon.
*/
static int mode_to_hostapd_mode(enum ieee80211_phymode mode)
{
switch (mode) {
case MODE_IEEE80211A:
return 0;
case MODE_IEEE80211B:
return 1;
case MODE_IEEE80211G:
return 3;
case NUM_IEEE80211_MODES:
WARN_ON(1);
break;
}
WARN_ON(1);
return -1;
}

static enum ieee80211_phymode hostapd_mode_to_mode(int hostapd_mode)
{
switch (hostapd_mode) {
case 0:
return MODE_IEEE80211A;
case 1:
return MODE_IEEE80211B;
case 3:
return MODE_IEEE80211G;
}
return NUM_IEEE80211_MODES;
}

static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
int idx, int alg, int set_tx_key,
const u8 *_key, size_t key_len)
Expand Down Expand Up @@ -141,9 +176,6 @@ static int ieee80211_ioctl_giwname(struct net_device *dev,
case MODE_IEEE80211G:
strcpy(name, "IEEE 802.11g");
break;
case MODE_ATHEROS_TURBO:
strcpy(name, "5GHz Turbo");
break;
default:
strcpy(name, "IEEE 802.11");
break;
Expand Down Expand Up @@ -594,9 +626,6 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev,
struct ieee80211_rate *rates = &mode->rates[i];
int this_rate = rates->rate;

if (mode->mode == MODE_ATHEROS_TURBO ||
mode->mode == MODE_ATHEROS_TURBOG)
this_rate *= 2;
if (target_rate == this_rate) {
sdata->bss->max_ratectrl_rateidx = i;
if (rate->fixed)
Expand Down Expand Up @@ -786,6 +815,7 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
int param = *i;
int value = *(i + 1);
int ret = 0;
int mode;

if (!capable(CAP_NET_ADMIN))
return -EPERM;
Expand Down Expand Up @@ -840,7 +870,7 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
break;

case PRISM2_PARAM_NEXT_MODE:
local->next_mode = value;
local->next_mode = hostapd_mode_to_mode(value);
break;

case PRISM2_PARAM_KEY_TX_RX_THRESHOLD:
Expand Down Expand Up @@ -868,7 +898,15 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
break;

case PRISM2_PARAM_HW_MODES:
local->enabled_modes = value;
mode = 1;
local->enabled_modes = 0;
while (value) {
if (value & 1)
local->enabled_modes |=
hostapd_mode_to_mode(mode);
mode <<= 1;
value >>= 1;
}
break;

case PRISM2_PARAM_CREATE_IBSS:
Expand Down Expand Up @@ -909,6 +947,7 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
struct ieee80211_sub_if_data *sdata;
int *param = (int *) extra;
int ret = 0;
int mode;

sdata = IEEE80211_DEV_TO_SUB_IF(dev);

Expand Down Expand Up @@ -946,7 +985,13 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
break;

case PRISM2_PARAM_HW_MODES:
*param = local->enabled_modes;
mode = 0;
*param = 0;
while (mode < NUM_IEEE80211_MODES) {
if (local->enabled_modes & (1<<mode))
*param |= mode_to_hostapd_mode(1<<mode);
mode++;
}
break;

case PRISM2_PARAM_CREATE_IBSS:
Expand Down
19 changes: 1 addition & 18 deletions net/mac80211/ieee80211_sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,6 @@ static void ieee80211_send_assoc(struct net_device *dev,
*pos++ = len;
for (i = 0; i < len; i++) {
int rate = mode->rates[i].rate;
if (mode->mode == MODE_ATHEROS_TURBO)
rate /= 2;
*pos++ = (u8) (rate / 5);
}

Expand All @@ -629,8 +627,6 @@ static void ieee80211_send_assoc(struct net_device *dev,
*pos++ = mode->num_rates - len;
for (i = len; i < mode->num_rates; i++) {
int rate = mode->rates[i].rate;
if (mode->mode == MODE_ATHEROS_TURBO)
rate /= 2;
*pos++ = (u8) (rate / 5);
}
}
Expand Down Expand Up @@ -889,10 +885,7 @@ static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
pos = skb_put(skb, 1);
supp_rates[1]++;
}
if (mode->mode == MODE_ATHEROS_TURBO)
*pos = rate->rate / 10;
else
*pos = rate->rate / 5;
*pos = rate->rate / 5;
}

ieee80211_sta_tx(dev, skb, 0);
Expand Down Expand Up @@ -1285,16 +1278,12 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
mode = local->oper_hw_mode;
for (i = 0; i < elems.supp_rates_len; i++) {
int rate = (elems.supp_rates[i] & 0x7f) * 5;
if (mode->mode == MODE_ATHEROS_TURBO)
rate *= 2;
for (j = 0; j < mode->num_rates; j++)
if (mode->rates[j].rate == rate)
rates |= BIT(j);
}
for (i = 0; i < elems.ext_supp_rates_len; i++) {
int rate = (elems.ext_supp_rates[i] & 0x7f) * 5;
if (mode->mode == MODE_ATHEROS_TURBO)
rate *= 2;
for (j = 0; j < mode->num_rates; j++)
if (mode->rates[j].rate == rate)
rates |= BIT(j);
Expand Down Expand Up @@ -1514,8 +1503,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
rate = elems.ext_supp_rates
[i - elems.supp_rates_len];
own_rate = 5 * (rate & 0x7f);
if (mode->mode == MODE_ATHEROS_TURBO)
own_rate *= 2;
for (j = 0; j < num_rates; j++)
if (rates[j].rate == own_rate)
supp_rates |= BIT(j);
Expand Down Expand Up @@ -2344,8 +2331,6 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
mode = local->oper_hw_mode;
for (i = 0; i < bss->supp_rates_len; i++) {
int bitrate = (bss->supp_rates[i] & 0x7f) * 5;
if (mode->mode == MODE_ATHEROS_TURBO)
bitrate *= 2;
for (j = 0; j < mode->num_rates; j++)
if (mode->rates[j].rate == bitrate)
rates |= BIT(j);
Expand Down Expand Up @@ -2418,8 +2403,6 @@ static int ieee80211_sta_create_ibss(struct net_device *dev,
pos = bss->supp_rates;
for (i = 0; i < mode->num_rates; i++) {
int rate = mode->rates[i].rate;
if (mode->mode == MODE_ATHEROS_TURBO)
rate /= 2;
*pos++ = (u8) (rate / 5);
}

Expand Down
6 changes: 0 additions & 6 deletions net/mac80211/regdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ static void ieee80211_unmask_channel(int mode, struct ieee80211_channel *chan)

chan->flag = 0;

if (ieee80211_regdom == 64 &&
(mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) {
/* Do not allow Turbo modes in Japan. */
return;
}

for (i = 0; channel_range[i].start_freq; i++) {
const struct ieee80211_channel_range *r = &channel_range[i];
if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) {
Expand Down
2 changes: 0 additions & 2 deletions net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
* 1 usec = 1/8 * (1080 / 10) = 13.5 */

if (mode->mode == MODE_IEEE80211A ||
mode->mode == MODE_ATHEROS_TURBO ||
mode->mode == MODE_ATHEROS_TURBOG ||
(mode->mode == MODE_IEEE80211G &&
rate->flags & IEEE80211_RATE_ERP))
hdrtime = CHAN_UTIL_HDR_SHORT;
Expand Down
2 changes: 0 additions & 2 deletions net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,6 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
* 1 usec = 1/8 * (1080 / 10) = 13.5 */

if (mode->mode == MODE_IEEE80211A ||
mode->mode == MODE_ATHEROS_TURBO ||
mode->mode == MODE_ATHEROS_TURBOG ||
(mode->mode == MODE_IEEE80211G &&
tx->u.tx.rate->flags & IEEE80211_RATE_ERP))
hdrtime = CHAN_UTIL_HDR_SHORT;
Expand Down
11 changes: 1 addition & 10 deletions net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ void ieee80211_prepare_rates(struct ieee80211_local *local,
if (rate->rate == 10 || rate->rate == 20)
rate->flags |= IEEE80211_RATE_BASIC;
break;
case MODE_ATHEROS_TURBO:
if (rate->rate == 120 || rate->rate == 240 ||
rate->rate == 480)
rate->flags |= IEEE80211_RATE_BASIC;
break;
case MODE_IEEE80211G:
if (rate->rate == 10 || rate->rate == 20 ||
rate->rate == 55 || rate->rate == 110)
Expand All @@ -116,8 +111,6 @@ void ieee80211_prepare_rates(struct ieee80211_local *local,
if (rate->rate == 10)
rate->flags |= IEEE80211_RATE_MANDATORY;
break;
case MODE_ATHEROS_TURBO:
break;
case MODE_IEEE80211G:
if (rate->rate == 10 || rate->rate == 20 ||
rate->rate == 55 || rate->rate == 110 ||
Expand Down Expand Up @@ -273,8 +266,7 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
* DIV_ROUND_UP() operations.
*/

if (local->hw.conf.phymode == MODE_IEEE80211A || erp ||
local->hw.conf.phymode == MODE_ATHEROS_TURBO) {
if (local->hw.conf.phymode == MODE_IEEE80211A || erp) {
/*
* OFDM:
*
Expand All @@ -288,7 +280,6 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
* 802.11g - 19.8.4: aSIFSTime = 10 usec +
* signal ext = 6 usec
*/
/* FIX: Atheros Turbo may have different (shorter) duration? */
dur = 16; /* SIFS + signal ext */
dur += 16; /* 17.3.2.3: T_PREAMBLE = 16 usec */
dur += 4; /* 17.3.2.3: T_SIGNAL = 4 usec */
Expand Down

0 comments on commit b708e61

Please sign in to comment.