Commit 13262ffd authored by Jiri Slaby's avatar Jiri Slaby Committed by David S. Miller
Browse files

[MAC80211]: Remove bitfields from struct ieee80211_sub_if_data



mac80211, remove bitfields from struct ieee80211_sub_if_data
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Acked-by: default avatarMichael Wu <flamingice@sourmilk.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d6f2da5b
...@@ -118,7 +118,7 @@ static ssize_t ieee80211_if_fmt_flags( ...@@ -118,7 +118,7 @@ static ssize_t ieee80211_if_fmt_flags(
sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
sdata->use_protection ? "CTS prot\n" : ""); sdata->flags & IEEE80211_SDATA_USE_PROTECTION ? "CTS prot\n" : "");
} }
__IEEE80211_IF_FILE(flags); __IEEE80211_IF_FILE(flags);
......
...@@ -555,23 +555,21 @@ static void ieee80211_set_multicast_list(struct net_device *dev) ...@@ -555,23 +555,21 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
unsigned short flags; unsigned short flags;
netif_tx_lock_nested(local->mdev, TX_LOCK_MASTER); netif_tx_lock_nested(local->mdev, TX_LOCK_MASTER);
if (((dev->flags & IFF_ALLMULTI) != 0) ^ (sdata->allmulti != 0)) { if (((dev->flags & IFF_ALLMULTI) != 0) ^
if (sdata->allmulti) { ((sdata->flags & IEEE80211_SDATA_ALLMULTI) != 0)) {
sdata->allmulti = 0; if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
local->iff_allmultis--; local->iff_allmultis--;
} else { else
sdata->allmulti = 1;
local->iff_allmultis++; local->iff_allmultis++;
} sdata->flags ^= IEEE80211_SDATA_ALLMULTI;
} }
if (((dev->flags & IFF_PROMISC) != 0) ^ (sdata->promisc != 0)) { if (((dev->flags & IFF_PROMISC) != 0) ^
if (sdata->promisc) { ((sdata->flags & IEEE80211_SDATA_PROMISC) != 0)) {
sdata->promisc = 0; if (sdata->flags & IEEE80211_SDATA_PROMISC)
local->iff_promiscs--; local->iff_promiscs--;
} else { else
sdata->promisc = 1;
local->iff_promiscs++; local->iff_promiscs++;
} sdata->flags ^= IEEE80211_SDATA_PROMISC;
} }
if (dev->mc_count != sdata->mc_count) { if (dev->mc_count != sdata->mc_count) {
local->mc_count = local->mc_count - sdata->mc_count + local->mc_count = local->mc_count - sdata->mc_count +
...@@ -740,16 +738,16 @@ void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes) ...@@ -740,16 +738,16 @@ void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes)
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (local->ops->erp_ie_changed) if (local->ops->erp_ie_changed)
local->ops->erp_ie_changed(local_to_hw(local), changes, local->ops->erp_ie_changed(local_to_hw(local), changes,
sdata->use_protection, !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION),
!sdata->short_preamble); !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE));
} }
void ieee80211_reset_erp_info(struct net_device *dev) void ieee80211_reset_erp_info(struct net_device *dev)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
sdata->short_preamble = 0; sdata->flags &= ~(IEEE80211_SDATA_USE_PROTECTION |
sdata->use_protection = 0; IEEE80211_SDATA_SHORT_PREAMBLE);
ieee80211_erp_info_change_notify(dev, ieee80211_erp_info_change_notify(dev,
IEEE80211_ERP_CHANGE_PROTECTION | IEEE80211_ERP_CHANGE_PROTECTION |
IEEE80211_ERP_CHANGE_PREAMBLE); IEEE80211_ERP_CHANGE_PREAMBLE);
......
...@@ -277,6 +277,14 @@ struct ieee80211_if_sta { ...@@ -277,6 +277,14 @@ struct ieee80211_if_sta {
}; };
/* flags used in struct ieee80211_sub_if_data.flags */
#define IEEE80211_SDATA_ALLMULTI BIT(0)
#define IEEE80211_SDATA_PROMISC BIT(1)
#define IEEE80211_SDATA_USE_PROTECTION BIT(2) /* CTS protect ERP frames */
/* use short preamble with IEEE 802.11b: this flag is set when the AP or beacon
* generator reports that there are no present stations that cannot support short
* preambles */
#define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3)
struct ieee80211_sub_if_data { struct ieee80211_sub_if_data {
struct list_head list; struct list_head list;
unsigned int type; unsigned int type;
...@@ -287,14 +295,8 @@ struct ieee80211_sub_if_data { ...@@ -287,14 +295,8 @@ struct ieee80211_sub_if_data {
struct ieee80211_local *local; struct ieee80211_local *local;
int mc_count; int mc_count;
unsigned int allmulti:1;
unsigned int promisc:1; unsigned int flags;
unsigned int use_protection:1; /* CTS protect ERP frames */
/* use short preamble with IEEE 802.11b: this flag is set when the AP
* or beacon generator reports that there are no present stations that
* cannot support short preambles */
unsigned int short_preamble:1;
struct net_device_stats stats; struct net_device_stats stats;
int drop_unencrypted; int drop_unencrypted;
......
...@@ -1063,8 +1063,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev, ...@@ -1063,8 +1063,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
case PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES: case PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES:
if (sdata->type == IEEE80211_IF_TYPE_AP) { if (sdata->type == IEEE80211_IF_TYPE_AP) {
sdata->use_protection = !!value; if (value)
ieee80211_erp_info_change_notify(dev, IEEE80211_ERP_CHANGE_PROTECTION); sdata->flags |= IEEE80211_SDATA_USE_PROTECTION;
else
sdata->flags &= ~IEEE80211_SDATA_USE_PROTECTION;
ieee80211_erp_info_change_notify(dev,
IEEE80211_ERP_CHANGE_PROTECTION);
} else { } else {
ret = -ENOENT; ret = -ENOENT;
} }
...@@ -1072,8 +1076,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev, ...@@ -1072,8 +1076,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
case PRISM2_PARAM_PREAMBLE: case PRISM2_PARAM_PREAMBLE:
if (sdata->type != IEEE80211_IF_TYPE_AP) { if (sdata->type != IEEE80211_IF_TYPE_AP) {
sdata->short_preamble = !!value; if (value)
ieee80211_erp_info_change_notify(dev, IEEE80211_ERP_CHANGE_PREAMBLE); sdata->flags |= IEEE80211_SDATA_SHORT_PREAMBLE;
else
sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE;
ieee80211_erp_info_change_notify(dev,
IEEE80211_ERP_CHANGE_PREAMBLE);
} else { } else {
ret = -ENOENT; ret = -ENOENT;
} }
...@@ -1167,11 +1175,11 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev, ...@@ -1167,11 +1175,11 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
break; break;
case PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES: case PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES:
*param = sdata->use_protection; *param = !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION);
break; break;
case PRISM2_PARAM_PREAMBLE: case PRISM2_PARAM_PREAMBLE:
*param = sdata->short_preamble; *param = !!(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE);
break; break;
case PRISM2_PARAM_SHORT_SLOT_TIME: case PRISM2_PARAM_SHORT_SLOT_TIME:
......
...@@ -321,7 +321,7 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) ...@@ -321,7 +321,7 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
int preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; int preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0;
u8 changes = 0; u8 changes = 0;
if (use_protection != sdata->use_protection) { if (use_protection != !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION)) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" printk(KERN_DEBUG "%s: CTS protection %s (BSSID="
MAC_FMT ")\n", MAC_FMT ")\n",
...@@ -329,11 +329,14 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) ...@@ -329,11 +329,14 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
use_protection ? "enabled" : "disabled", use_protection ? "enabled" : "disabled",
MAC_ARG(ifsta->bssid)); MAC_ARG(ifsta->bssid));
} }
sdata->use_protection = use_protection; if (use_protection)
sdata->flags |= IEEE80211_SDATA_USE_PROTECTION;
else
sdata->flags &= ~IEEE80211_SDATA_USE_PROTECTION;
changes |= IEEE80211_ERP_CHANGE_PROTECTION; changes |= IEEE80211_ERP_CHANGE_PROTECTION;
} }
if (!preamble_mode != sdata->short_preamble) { if (preamble_mode != !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: switched to %s barker preamble" printk(KERN_DEBUG "%s: switched to %s barker preamble"
" (BSSID=" MAC_FMT ")\n", " (BSSID=" MAC_FMT ")\n",
...@@ -342,7 +345,10 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) ...@@ -342,7 +345,10 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
"short" : "long", "short" : "long",
MAC_ARG(ifsta->bssid)); MAC_ARG(ifsta->bssid));
} }
sdata->short_preamble = !preamble_mode; if (preamble_mode)
sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE;
else
sdata->flags |= IEEE80211_SDATA_SHORT_PREAMBLE;
changes |= IEEE80211_ERP_CHANGE_PREAMBLE; changes |= IEEE80211_ERP_CHANGE_PREAMBLE;
} }
...@@ -2307,8 +2313,9 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, ...@@ -2307,8 +2313,9 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
"for IBSS beacon\n", dev->name); "for IBSS beacon\n", dev->name);
break; break;
} }
control.tx_rate = (sdata->short_preamble && control.tx_rate =
(rate->flags & IEEE80211_RATE_PREAMBLE2)) ? ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
(rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
rate->val2 : rate->val; rate->val2 : rate->val;
control.antenna_sel_tx = local->hw.conf.antenna_sel_tx; control.antenna_sel_tx = local->hw.conf.antenna_sel_tx;
control.power_level = local->hw.conf.power_level; control.power_level = local->hw.conf.power_level;
......
...@@ -1288,7 +1288,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, ...@@ -1288,7 +1288,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
} else if (!multicast && } else if (!multicast &&
compare_ether_addr(sdata->dev->dev_addr, compare_ether_addr(sdata->dev->dev_addr,
hdr->addr1) != 0) { hdr->addr1) != 0) {
if (!sdata->promisc) if (!(sdata->flags & IEEE80211_SDATA_PROMISC))
return 0; return 0;
rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
} }
...@@ -1303,7 +1303,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, ...@@ -1303,7 +1303,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
} else if (!multicast && } else if (!multicast &&
compare_ether_addr(sdata->dev->dev_addr, compare_ether_addr(sdata->dev->dev_addr,
hdr->addr1) != 0) { hdr->addr1) != 0) {
if (!sdata->promisc) if (!(sdata->flags & IEEE80211_SDATA_PROMISC))
return 0; return 0;
rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
} else if (!rx->sta) } else if (!rx->sta)
......
...@@ -173,7 +173,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, ...@@ -173,7 +173,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr,
* to closest integer */ * to closest integer */
dur = ieee80211_frame_duration(local, 10, rate, erp, dur = ieee80211_frame_duration(local, 10, rate, erp,
tx->sdata->short_preamble); tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE);
if (next_frag_len) { if (next_frag_len) {
/* Frame is fragmented: duration increases with time needed to /* Frame is fragmented: duration increases with time needed to
...@@ -181,8 +181,9 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, ...@@ -181,8 +181,9 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr,
dur *= 2; /* ACK + SIFS */ dur *= 2; /* ACK + SIFS */
/* next fragment */ /* next fragment */
dur += ieee80211_frame_duration(local, next_frag_len, dur += ieee80211_frame_duration(local, next_frag_len,
txrate->rate, erp, txrate->rate, erp,
tx->sdata->short_preamble); tx->sdata->flags &
IEEE80211_SDATA_SHORT_PREAMBLE);
} }
return dur; return dur;
...@@ -613,7 +614,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) ...@@ -613,7 +614,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
if (!tx->u.tx.rate) if (!tx->u.tx.rate)
return TXRX_DROP; return TXRX_DROP;
if (tx->u.tx.mode->mode == MODE_IEEE80211G && if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
tx->sdata->use_protection && (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) &&
(tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) { (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) {
tx->u.tx.last_frag_rate = tx->u.tx.rate; tx->u.tx.last_frag_rate = tx->u.tx.rate;
if (extra.probe) if (extra.probe)
...@@ -670,7 +671,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) ...@@ -670,7 +671,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
if (mode->mode == MODE_IEEE80211G && if (mode->mode == MODE_IEEE80211G &&
(tx->u.tx.rate->flags & IEEE80211_RATE_ERP) && (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) &&
(tx->flags & IEEE80211_TXRXD_TXUNICAST) && (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
tx->sdata->use_protection && (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) &&
!(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
...@@ -679,7 +680,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) ...@@ -679,7 +680,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
* available on the network at the current point in time. */ * available on the network at the current point in time. */
if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
(tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) && (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) &&
tx->sdata->short_preamble && (tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
(!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) {
tx->u.tx.control->tx_rate = tx->u.tx.rate->val2; tx->u.tx.control->tx_rate = tx->u.tx.rate->val2;
} }
...@@ -1777,8 +1778,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, ...@@ -1777,8 +1778,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
return NULL; return NULL;
} }
control->tx_rate = (sdata->short_preamble && control->tx_rate =
(rate->flags & IEEE80211_RATE_PREAMBLE2)) ? ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
(rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
rate->val2 : rate->val; rate->val2 : rate->val;
control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
control->power_level = local->hw.conf.power_level; control->power_level = local->hw.conf.power_level;
......
...@@ -329,7 +329,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, ...@@ -329,7 +329,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id,
sdata = IEEE80211_DEV_TO_SUB_IF(bdev); sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); erp = ieee80211_is_erp_rate(hw->conf.phymode, rate);
dur = ieee80211_frame_duration(local, frame_len, rate, dur = ieee80211_frame_duration(local, frame_len, rate,
erp, sdata->short_preamble); erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE);
dev_put(bdev); dev_put(bdev);
return cpu_to_le16(dur); return cpu_to_le16(dur);
...@@ -352,7 +352,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, ...@@ -352,7 +352,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id,
return 0; return 0;
sdata = IEEE80211_DEV_TO_SUB_IF(bdev); sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
short_preamble = sdata->short_preamble; short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
rate = frame_txctl->rts_rate; rate = frame_txctl->rts_rate;
erp = !!(rate->flags & IEEE80211_RATE_ERP); erp = !!(rate->flags & IEEE80211_RATE_ERP);
...@@ -388,7 +388,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, ...@@ -388,7 +388,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id,
return 0; return 0;
sdata = IEEE80211_DEV_TO_SUB_IF(bdev); sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
short_preamble = sdata->short_preamble; short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
rate = frame_txctl->rts_rate; rate = frame_txctl->rts_rate;
erp = !!(rate->flags & IEEE80211_RATE_ERP); erp = !!(rate->flags & IEEE80211_RATE_ERP);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment