aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-12-28 08:32:58 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:43 -0500
commit471b3efdfccc257591331724145f8ccf8b3217e1 (patch)
treec9e576442c7b62c8c667ae1046e560323f0821fd /net/mac80211
parent2bc454b0b30b3645d114689b64321cb49be99923 (diff)
mac80211: add unified BSS configuration
This patch (based on Ron Rindjunsky's) creates a framework for a unified way to pass BSS configuration to drivers that require the information, e.g. for implementing power save mode. This patch introduces new ieee80211_bss_conf structure that is passed to the driver via the new bss_info_changed() callback when the BSS configuration changes. This new BSS configuration infrastructure adds the following new features: * drivers are notified of their association AID * drivers are notified of association status and replaces the erp_ie_changed() callback. The patch also does the relevant driver updates for the latter change. Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/debugfs_netdev.c2
-rw-r--r--net/mac80211/ieee80211.c29
-rw-r--r--net/mac80211/ieee80211_i.h19
-rw-r--r--net/mac80211/ieee80211_sta.c69
-rw-r--r--net/mac80211/tx.c13
-rw-r--r--net/mac80211/util.c12
6 files changed, 77 insertions, 67 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 3500fe0d380b..829872a3ae81 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -118,7 +118,7 @@ static ssize_t ieee80211_if_fmt_flags(
118 sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", 118 sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
119 sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", 119 sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
120 sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", 120 sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
121 sdata->flags & IEEE80211_SDATA_USE_PROTECTION ? "CTS prot\n" : ""); 121 sdata->bss_conf.use_cts_prot ? "CTS prot\n" : "");
122} 122}
123__IEEE80211_IF_FILE(flags); 123__IEEE80211_IF_FILE(flags);
124 124
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 859682eee547..177040218232 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -635,25 +635,30 @@ int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht,
635 return 0; 635 return 0;
636} 636}
637 637
638void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes) 638void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
639 u32 changed)
639{ 640{
640 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 641 struct ieee80211_local *local = sdata->local;
641 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 642
642 if (local->ops->erp_ie_changed) 643 if (!changed)
643 local->ops->erp_ie_changed(local_to_hw(local), changes, 644 return;
644 !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION), 645
645 !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)); 646 if (local->ops->bss_info_changed)
647 local->ops->bss_info_changed(local_to_hw(local),
648 &sdata->vif,
649 &sdata->bss_conf,
650 changed);
646} 651}
647 652
648void ieee80211_reset_erp_info(struct net_device *dev) 653void ieee80211_reset_erp_info(struct net_device *dev)
649{ 654{
650 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 655 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
651 656
652 sdata->flags &= ~(IEEE80211_SDATA_USE_PROTECTION | 657 sdata->bss_conf.use_cts_prot = 0;
653 IEEE80211_SDATA_SHORT_PREAMBLE); 658 sdata->bss_conf.use_short_preamble = 0;
654 ieee80211_erp_info_change_notify(dev, 659 ieee80211_bss_info_change_notify(sdata,
655 IEEE80211_ERP_CHANGE_PROTECTION | 660 BSS_CHANGED_ERP_CTS_PROT |
656 IEEE80211_ERP_CHANGE_PREAMBLE); 661 BSS_CHANGED_ERP_PREAMBLE);
657} 662}
658 663
659void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, 664void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 08a6c0cff690..72ecbf7bf962 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -291,12 +291,7 @@ struct ieee80211_if_sta {
291/* flags used in struct ieee80211_sub_if_data.flags */ 291/* flags used in struct ieee80211_sub_if_data.flags */
292#define IEEE80211_SDATA_ALLMULTI BIT(0) 292#define IEEE80211_SDATA_ALLMULTI BIT(0)
293#define IEEE80211_SDATA_PROMISC BIT(1) 293#define IEEE80211_SDATA_PROMISC BIT(1)
294#define IEEE80211_SDATA_USE_PROTECTION BIT(2) /* CTS protect ERP frames */ 294#define IEEE80211_SDATA_USERSPACE_MLME BIT(2)
295/* use short preamble with IEEE 802.11b: this flag is set when the AP or beacon
296 * generator reports that there are no present stations that cannot support short
297 * preambles */
298#define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3)
299#define IEEE80211_SDATA_USERSPACE_MLME BIT(4)
300struct ieee80211_sub_if_data { 295struct ieee80211_sub_if_data {
301 struct list_head list; 296 struct list_head list;
302 297
@@ -327,6 +322,15 @@ struct ieee80211_sub_if_data {
327 struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; 322 struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
328 struct ieee80211_key *default_key; 323 struct ieee80211_key *default_key;
329 324
325 /*
326 * BSS configuration for this interface.
327 *
328 * FIXME: I feel bad putting this here when we already have a
329 * bss pointer, but the bss pointer is just wrong when
330 * you have multiple virtual STA mode interfaces...
331 * This needs to be fixed.
332 */
333 struct ieee80211_bss_conf bss_conf;
330 struct ieee80211_if_ap *bss; /* BSS that this device belongs to */ 334 struct ieee80211_if_ap *bss; /* BSS that this device belongs to */
331 335
332 union { 336 union {
@@ -770,7 +774,8 @@ struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
770 u8 *addr); 774 u8 *addr);
771int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason); 775int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
772int ieee80211_sta_disassociate(struct net_device *dev, u16 reason); 776int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
773void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes); 777void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
778 u32 changed);
774void ieee80211_reset_erp_info(struct net_device *dev); 779void ieee80211_reset_erp_info(struct net_device *dev);
775int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, 780int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
776 struct ieee80211_ht_info *ht_info); 781 struct ieee80211_ht_info *ht_info);
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index b1e7d17ee253..866eb8078121 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -313,48 +313,42 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
313} 313}
314 314
315 315
316static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) 316static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata,
317 u8 erp_value)
317{ 318{
318 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 319 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
319 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 320 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
320 int use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; 321 bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0;
321 int preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; 322 bool preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0;
322 u8 changes = 0;
323 DECLARE_MAC_BUF(mac); 323 DECLARE_MAC_BUF(mac);
324 u32 changed = 0;
324 325
325 if (use_protection != !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION)) { 326 if (use_protection != bss_conf->use_cts_prot) {
326 if (net_ratelimit()) { 327 if (net_ratelimit()) {
327 printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" 328 printk(KERN_DEBUG "%s: CTS protection %s (BSSID="
328 "%s)\n", 329 "%s)\n",
329 dev->name, 330 sdata->dev->name,
330 use_protection ? "enabled" : "disabled", 331 use_protection ? "enabled" : "disabled",
331 print_mac(mac, ifsta->bssid)); 332 print_mac(mac, ifsta->bssid));
332 } 333 }
333 if (use_protection) 334 bss_conf->use_cts_prot = use_protection;
334 sdata->flags |= IEEE80211_SDATA_USE_PROTECTION; 335 changed |= BSS_CHANGED_ERP_CTS_PROT;
335 else
336 sdata->flags &= ~IEEE80211_SDATA_USE_PROTECTION;
337 changes |= IEEE80211_ERP_CHANGE_PROTECTION;
338 } 336 }
339 337
340 if (preamble_mode != !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)) { 338 if (preamble_mode != bss_conf->use_short_preamble) {
341 if (net_ratelimit()) { 339 if (net_ratelimit()) {
342 printk(KERN_DEBUG "%s: switched to %s barker preamble" 340 printk(KERN_DEBUG "%s: switched to %s barker preamble"
343 " (BSSID=%s)\n", 341 " (BSSID=%s)\n",
344 dev->name, 342 sdata->dev->name,
345 (preamble_mode == WLAN_ERP_PREAMBLE_SHORT) ? 343 (preamble_mode == WLAN_ERP_PREAMBLE_SHORT) ?
346 "short" : "long", 344 "short" : "long",
347 print_mac(mac, ifsta->bssid)); 345 print_mac(mac, ifsta->bssid));
348 } 346 }
349 if (preamble_mode) 347 bss_conf->use_short_preamble = preamble_mode;
350 sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE; 348 changed |= BSS_CHANGED_ERP_PREAMBLE;
351 else
352 sdata->flags |= IEEE80211_SDATA_SHORT_PREAMBLE;
353 changes |= IEEE80211_ERP_CHANGE_PREAMBLE;
354 } 349 }
355 350
356 if (changes) 351 return changed;
357 ieee80211_erp_info_change_notify(dev, changes);
358} 352}
359 353
360int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, 354int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
@@ -458,19 +452,16 @@ static void ieee80211_set_associated(struct net_device *dev,
458 struct ieee80211_if_sta *ifsta, 452 struct ieee80211_if_sta *ifsta,
459 bool assoc) 453 bool assoc)
460{ 454{
461 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 455 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
456 struct ieee80211_local *local = sdata->local;
462 union iwreq_data wrqu; 457 union iwreq_data wrqu;
463 458 u32 changed = BSS_CHANGED_ASSOC;
464 if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc)
465 return;
466 459
467 if (assoc) { 460 if (assoc) {
468 struct ieee80211_sub_if_data *sdata;
469 struct ieee80211_sta_bss *bss; 461 struct ieee80211_sta_bss *bss;
470 462
471 ifsta->flags |= IEEE80211_STA_ASSOCIATED; 463 ifsta->flags |= IEEE80211_STA_ASSOCIATED;
472 464
473 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
474 if (sdata->vif.type != IEEE80211_IF_TYPE_STA) 465 if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
475 return; 466 return;
476 467
@@ -479,7 +470,8 @@ static void ieee80211_set_associated(struct net_device *dev,
479 ifsta->ssid, ifsta->ssid_len); 470 ifsta->ssid, ifsta->ssid_len);
480 if (bss) { 471 if (bss) {
481 if (bss->has_erp_value) 472 if (bss->has_erp_value)
482 ieee80211_handle_erp_ie(dev, bss->erp_value); 473 changed |= ieee80211_handle_erp_ie(
474 sdata, bss->erp_value);
483 ieee80211_rx_bss_put(dev, bss); 475 ieee80211_rx_bss_put(dev, bss);
484 } 476 }
485 477
@@ -499,6 +491,8 @@ static void ieee80211_set_associated(struct net_device *dev,
499 wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); 491 wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
500 ifsta->last_probe = jiffies; 492 ifsta->last_probe = jiffies;
501 ieee80211_led_assoc(local, assoc); 493 ieee80211_led_assoc(local, assoc);
494
495 ieee80211_bss_info_change_notify(sdata, changed);
502} 496}
503 497
504static void ieee80211_set_disassoc(struct net_device *dev, 498static void ieee80211_set_disassoc(struct net_device *dev,
@@ -1536,18 +1530,20 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev,
1536} 1530}
1537 1531
1538 1532
1539static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, 1533static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1540 struct ieee80211_if_sta *ifsta, 1534 struct ieee80211_if_sta *ifsta,
1541 struct ieee80211_mgmt *mgmt, 1535 struct ieee80211_mgmt *mgmt,
1542 size_t len, 1536 size_t len,
1543 int reassoc) 1537 int reassoc)
1544{ 1538{
1545 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1539 struct ieee80211_local *local = sdata->local;
1540 struct net_device *dev = sdata->dev;
1546 struct ieee80211_hw_mode *mode; 1541 struct ieee80211_hw_mode *mode;
1547 struct sta_info *sta; 1542 struct sta_info *sta;
1548 u32 rates; 1543 u32 rates;
1549 u16 capab_info, status_code, aid; 1544 u16 capab_info, status_code, aid;
1550 struct ieee802_11_elems elems; 1545 struct ieee802_11_elems elems;
1546 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
1551 u8 *pos; 1547 u8 *pos;
1552 int i, j; 1548 int i, j;
1553 DECLARE_MAC_BUF(mac); 1549 DECLARE_MAC_BUF(mac);
@@ -1620,6 +1616,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
1620 if (ifsta->assocresp_ies) 1616 if (ifsta->assocresp_ies)
1621 memcpy(ifsta->assocresp_ies, pos, ifsta->assocresp_ies_len); 1617 memcpy(ifsta->assocresp_ies, pos, ifsta->assocresp_ies_len);
1622 1618
1619 /* set AID, ieee80211_set_associated() will tell the driver */
1620 bss_conf->aid = aid;
1623 ieee80211_set_associated(dev, ifsta, 1); 1621 ieee80211_set_associated(dev, ifsta, 1);
1624 1622
1625 /* Add STA entry for the AP */ 1623 /* Add STA entry for the AP */
@@ -2099,6 +2097,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
2099 struct ieee802_11_elems elems; 2097 struct ieee802_11_elems elems;
2100 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 2098 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2101 struct ieee80211_conf *conf = &local->hw.conf; 2099 struct ieee80211_conf *conf = &local->hw.conf;
2100 u32 changed = 0;
2102 2101
2103 ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1); 2102 ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1);
2104 2103
@@ -2119,7 +2118,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
2119 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); 2118 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
2120 2119
2121 if (elems.erp_info && elems.erp_info_len >= 1) 2120 if (elems.erp_info && elems.erp_info_len >= 1)
2122 ieee80211_handle_erp_ie(dev, elems.erp_info[0]); 2121 changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]);
2123 2122
2124 if (elems.ht_cap_elem && elems.ht_info_elem && 2123 if (elems.ht_cap_elem && elems.ht_info_elem &&
2125 elems.wmm_param && local->ops->conf_ht && 2124 elems.wmm_param && local->ops->conf_ht &&
@@ -2142,6 +2141,8 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
2142 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, 2141 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
2143 elems.wmm_param_len); 2142 elems.wmm_param_len);
2144 } 2143 }
2144
2145 ieee80211_bss_info_change_notify(sdata, changed);
2145} 2146}
2146 2147
2147 2148
@@ -2329,10 +2330,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev,
2329 ieee80211_rx_mgmt_auth(dev, ifsta, mgmt, skb->len); 2330 ieee80211_rx_mgmt_auth(dev, ifsta, mgmt, skb->len);
2330 break; 2331 break;
2331 case IEEE80211_STYPE_ASSOC_RESP: 2332 case IEEE80211_STYPE_ASSOC_RESP:
2332 ieee80211_rx_mgmt_assoc_resp(dev, ifsta, mgmt, skb->len, 0); 2333 ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 0);
2333 break; 2334 break;
2334 case IEEE80211_STYPE_REASSOC_RESP: 2335 case IEEE80211_STYPE_REASSOC_RESP:
2335 ieee80211_rx_mgmt_assoc_resp(dev, ifsta, mgmt, skb->len, 1); 2336 ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 1);
2336 break; 2337 break;
2337 case IEEE80211_STYPE_DEAUTH: 2338 case IEEE80211_STYPE_DEAUTH:
2338 ieee80211_rx_mgmt_deauth(dev, ifsta, mgmt, skb->len); 2339 ieee80211_rx_mgmt_deauth(dev, ifsta, mgmt, skb->len);
@@ -2787,7 +2788,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2787 break; 2788 break;
2788 } 2789 }
2789 control.tx_rate = 2790 control.tx_rate =
2790 ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) && 2791 (sdata->bss_conf.use_short_preamble &&
2791 (ratesel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ? 2792 (ratesel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
2792 ratesel.rate->val2 : ratesel.rate->val; 2793 ratesel.rate->val2 : ratesel.rate->val;
2793 control.antenna_sel_tx = local->hw.conf.antenna_sel_tx; 2794 control.antenna_sel_tx = local->hw.conf.antenna_sel_tx;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 51c0f00d02d1..f9088fe34d59 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -176,7 +176,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr,
176 * to closest integer */ 176 * to closest integer */
177 177
178 dur = ieee80211_frame_duration(local, 10, rate, erp, 178 dur = ieee80211_frame_duration(local, 10, rate, erp,
179 tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); 179 tx->sdata->bss_conf.use_short_preamble);
180 180
181 if (next_frag_len) { 181 if (next_frag_len) {
182 /* Frame is fragmented: duration increases with time needed to 182 /* Frame is fragmented: duration increases with time needed to
@@ -185,8 +185,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr,
185 /* next fragment */ 185 /* next fragment */
186 dur += ieee80211_frame_duration(local, next_frag_len, 186 dur += ieee80211_frame_duration(local, next_frag_len,
187 txrate->rate, erp, 187 txrate->rate, erp,
188 tx->sdata->flags & 188 tx->sdata->bss_conf.use_short_preamble);
189 IEEE80211_SDATA_SHORT_PREAMBLE);
190 } 189 }
191 190
192 return dur; 191 return dur;
@@ -605,7 +604,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
605 tx->u.tx.control->alt_retry_rate = -1; 604 tx->u.tx.control->alt_retry_rate = -1;
606 605
607 if (tx->u.tx.mode->mode == MODE_IEEE80211G && 606 if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
608 (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) && 607 tx->sdata->bss_conf.use_cts_prot &&
609 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) { 608 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) {
610 tx->u.tx.last_frag_rate = tx->u.tx.rate; 609 tx->u.tx.last_frag_rate = tx->u.tx.rate;
611 if (rsel.probe) 610 if (rsel.probe)
@@ -667,7 +666,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
667 if (mode->mode == MODE_IEEE80211G && 666 if (mode->mode == MODE_IEEE80211G &&
668 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) && 667 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) &&
669 (tx->flags & IEEE80211_TXRXD_TXUNICAST) && 668 (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
670 (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) && 669 tx->sdata->bss_conf.use_cts_prot &&
671 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) 670 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
672 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; 671 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
673 672
@@ -676,7 +675,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
676 * available on the network at the current point in time. */ 675 * available on the network at the current point in time. */
677 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 676 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
678 (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) && 677 (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) &&
679 (tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) && 678 tx->sdata->bss_conf.use_short_preamble &&
680 (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { 679 (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) {
681 tx->u.tx.control->tx_rate = tx->u.tx.rate->val2; 680 tx->u.tx.control->tx_rate = tx->u.tx.rate->val2;
682 } 681 }
@@ -1754,7 +1753,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1754 } 1753 }
1755 1754
1756 control->tx_rate = 1755 control->tx_rate =
1757 ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) && 1756 (sdata->bss_conf.use_short_preamble &&
1758 (rsel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ? 1757 (rsel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
1759 rsel.rate->val2 : rsel.rate->val; 1758 rsel.rate->val2 : rsel.rate->val;
1760 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; 1759 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index ba81cf542818..5e631ce98d7e 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -312,8 +312,8 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
312 int erp; 312 int erp;
313 313
314 erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); 314 erp = ieee80211_is_erp_rate(hw->conf.phymode, rate);
315 dur = ieee80211_frame_duration(local, frame_len, rate, 315 dur = ieee80211_frame_duration(local, frame_len, rate, erp,
316 erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); 316 sdata->bss_conf.use_short_preamble);
317 317
318 return cpu_to_le16(dur); 318 return cpu_to_le16(dur);
319} 319}
@@ -326,11 +326,11 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
326 struct ieee80211_local *local = hw_to_local(hw); 326 struct ieee80211_local *local = hw_to_local(hw);
327 struct ieee80211_rate *rate; 327 struct ieee80211_rate *rate;
328 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 328 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
329 int short_preamble; 329 bool short_preamble;
330 int erp; 330 int erp;
331 u16 dur; 331 u16 dur;
332 332
333 short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; 333 short_preamble = sdata->bss_conf.use_short_preamble;
334 334
335 rate = frame_txctl->rts_rate; 335 rate = frame_txctl->rts_rate;
336 erp = !!(rate->flags & IEEE80211_RATE_ERP); 336 erp = !!(rate->flags & IEEE80211_RATE_ERP);
@@ -357,11 +357,11 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
357 struct ieee80211_local *local = hw_to_local(hw); 357 struct ieee80211_local *local = hw_to_local(hw);
358 struct ieee80211_rate *rate; 358 struct ieee80211_rate *rate;
359 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 359 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
360 int short_preamble; 360 bool short_preamble;
361 int erp; 361 int erp;
362 u16 dur; 362 u16 dur;
363 363
364 short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; 364 short_preamble = sdata->bss_conf.use_short_preamble;
365 365
366 rate = frame_txctl->rts_rate; 366 rate = frame_txctl->rts_rate;
367 erp = !!(rate->flags & IEEE80211_RATE_ERP); 367 erp = !!(rate->flags & IEEE80211_RATE_ERP);