mac80211: move bss_conf into vif
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 10 Oct 2008 23:51:51 +0000 (01:51 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 31 Oct 2008 23:00:15 +0000 (19:00 -0400)
Move bss_conf into the vif struct so that drivers can
access it during ->tx without having to store it in
the private data or similar. No driver updates because
this is only for when they want to start using it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/mac80211.h
net/mac80211/cfg.c
net/mac80211/debugfs_netdev.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/main.c
net/mac80211/mlme.c
net/mac80211/tx.c
net/mac80211/util.c

index fd52300b96d0dce4e9b7e2fb8df6829da7e1aa07..94ff3eface499a35d50f7d39de44d4a610f8dd57 100644 (file)
@@ -529,11 +529,14 @@ struct ieee80211_conf {
  * use during the life of a virtual interface.
  *
  * @type: type of this virtual interface
+ * @bss_conf: BSS configuration for this interface, either our own
+ *     or the BSS we're associated to
  * @drv_priv: data area for driver use, will always be aligned to
  *     sizeof(void *).
  */
 struct ieee80211_vif {
        enum nl80211_iftype type;
+       struct ieee80211_bss_conf bss_conf;
        /* must be last */
        u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
 };
index 8ea30902d5db1d26a797320ae82bb9c5ba737fa0..28382b5c7c256cee3cbf209d14a9347ea8864679 100644 (file)
@@ -964,16 +964,16 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
                return -EINVAL;
 
        if (params->use_cts_prot >= 0) {
-               sdata->bss_conf.use_cts_prot = params->use_cts_prot;
+               sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
                changed |= BSS_CHANGED_ERP_CTS_PROT;
        }
        if (params->use_short_preamble >= 0) {
-               sdata->bss_conf.use_short_preamble =
+               sdata->vif.bss_conf.use_short_preamble =
                        params->use_short_preamble;
                changed |= BSS_CHANGED_ERP_PREAMBLE;
        }
        if (params->use_short_slot_time >= 0) {
-               sdata->bss_conf.use_short_slot =
+               sdata->vif.bss_conf.use_short_slot =
                        params->use_short_slot_time;
                changed |= BSS_CHANGED_ERP_SLOT;
        }
index 56f3f29385cb901433502c9578d03df16c8051f1..c54219301724e1198c824294550edf77d7cc6bdb 100644 (file)
@@ -119,7 +119,7 @@ static ssize_t ieee80211_if_fmt_flags(
                 sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
                 sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
                 sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
-                sdata->bss_conf.use_cts_prot ? "CTS prot\n" : "");
+                sdata->vif.bss_conf.use_cts_prot ? "CTS prot\n" : "");
 }
 __IEEE80211_IF_FILE(flags);
 
index f1ef522bfe07834696b5f713a56b6ea777974884..859b5b001f2263a2bd83439d8220d6b445a2c693 100644 (file)
@@ -440,9 +440,6 @@ struct ieee80211_sub_if_data {
 
        u16 sequence_number;
 
-       /* BSS configuration for this interface. */
-       struct ieee80211_bss_conf bss_conf;
-
        /*
         * AP this belongs to: self in AP mode and
         * corresponding AP in VLAN mode, NULL for
index df28c5f7c9c0a2695f049fb6bb910b11a9886d62..cde145221b61ba1900d6acd7697660504bd376ab 100644 (file)
@@ -695,7 +695,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
        ieee80211_setup_sdata(sdata, type);
 
        /* reset some values that shouldn't be kept across type changes */
-       sdata->bss_conf.basic_rates =
+       sdata->vif.bss_conf.basic_rates =
                ieee80211_mandatory_rates(sdata->local,
                        sdata->local->hw.conf.channel->band);
        sdata->drop_unencrypted = 0;
index 59be9e782699321195497fd2d3f83b814b1dbedb..ab8a860444af48d51a144cf8983db9710faf8fa8 100644 (file)
@@ -249,15 +249,15 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
        if (local->ops->bss_info_changed)
                local->ops->bss_info_changed(local_to_hw(local),
                                             &sdata->vif,
-                                            &sdata->bss_conf,
+                                            &sdata->vif.bss_conf,
                                             changed);
 }
 
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
 {
-       sdata->bss_conf.use_cts_prot = false;
-       sdata->bss_conf.use_short_preamble = false;
-       sdata->bss_conf.use_short_slot = false;
+       sdata->vif.bss_conf.use_cts_prot = false;
+       sdata->vif.bss_conf.use_short_preamble = false;
+       sdata->vif.bss_conf.use_short_slot = false;
        return BSS_CHANGED_ERP_CTS_PROT |
               BSS_CHANGED_ERP_PREAMBLE |
               BSS_CHANGED_ERP_SLOT;
index 196dd39f62861c04afadac1abeb21a8bbb8b93e2..9c5f5c37a49e4cc5ddf01fb9649aa33b2ba5cdf0 100644 (file)
@@ -572,7 +572,7 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
 static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
                                           u16 capab, bool erp_valid, u8 erp)
 {
-       struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
+       struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
        struct ieee80211_if_sta *ifsta = &sdata->u.sta;
 #endif
@@ -718,9 +718,9 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
                                   ifsta->ssid, ifsta->ssid_len);
        if (bss) {
                /* set timing information */
-               sdata->bss_conf.beacon_int = bss->beacon_int;
-               sdata->bss_conf.timestamp = bss->timestamp;
-               sdata->bss_conf.dtim_period = bss->dtim_period;
+               sdata->vif.bss_conf.beacon_int = bss->beacon_int;
+               sdata->vif.bss_conf.timestamp = bss->timestamp;
+               sdata->vif.bss_conf.dtim_period = bss->dtim_period;
 
                changed |= ieee80211_handle_bss_capability(sdata,
                        bss->capability, bss->has_erp_value, bss->erp_value);
@@ -730,9 +730,9 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
 
        if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
                changed |= BSS_CHANGED_HT;
-               sdata->bss_conf.assoc_ht = 1;
-               sdata->bss_conf.ht_cap = &conf->ht_cap;
-               sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
+               sdata->vif.bss_conf.assoc_ht = 1;
+               sdata->vif.bss_conf.ht_cap = &conf->ht_cap;
+               sdata->vif.bss_conf.ht_bss_conf = &conf->ht_bss_conf;
        }
 
        ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
@@ -742,7 +742,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
        ifsta->last_probe = jiffies;
        ieee80211_led_assoc(local, 1);
 
-       sdata->bss_conf.assoc = 1;
+       sdata->vif.bss_conf.assoc = 1;
        /*
         * For now just always ask the driver to update the basic rateset
         * when we have associated, we aren't checking whether it actually
@@ -847,15 +847,15 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
        changed |= ieee80211_reset_erp_info(sdata);
 
-       if (sdata->bss_conf.assoc_ht)
+       if (sdata->vif.bss_conf.assoc_ht)
                changed |= BSS_CHANGED_HT;
 
-       sdata->bss_conf.assoc_ht = 0;
-       sdata->bss_conf.ht_cap = NULL;
-       sdata->bss_conf.ht_bss_conf = NULL;
+       sdata->vif.bss_conf.assoc_ht = 0;
+       sdata->vif.bss_conf.ht_cap = NULL;
+       sdata->vif.bss_conf.ht_bss_conf = NULL;
 
        ieee80211_led_assoc(local, 0);
-       sdata->bss_conf.assoc = 0;
+       sdata->vif.bss_conf.assoc = 0;
 
        ieee80211_sta_send_apinfo(sdata, ifsta);
 
@@ -1182,7 +1182,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        u64 rates, basic_rates;
        u16 capab_info, status_code, aid;
        struct ieee802_11_elems elems;
-       struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
+       struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
        u8 *pos;
        int i, j;
        bool have_higher_than_11mbit = false;
@@ -1324,7 +1324,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        }
 
        sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
-       sdata->bss_conf.basic_rates = basic_rates;
+       sdata->vif.bss_conf.basic_rates = basic_rates;
 
        /* cf. IEEE 802.11 9.2.12 */
        if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
index dd440a07634e5f13b33182731e31410b5901a99e..6f3e4be976310e3def89dac69d980ebcf284c522 100644 (file)
@@ -116,7 +116,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
                if (r->bitrate > txrate->bitrate)
                        break;
 
-               if (tx->sdata->bss_conf.basic_rates & BIT(i))
+               if (tx->sdata->vif.bss_conf.basic_rates & BIT(i))
                        rate = r->bitrate;
 
                switch (sband->band) {
@@ -150,7 +150,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
         * to closest integer */
 
        dur = ieee80211_frame_duration(local, 10, rate, erp,
-                               tx->sdata->bss_conf.use_short_preamble);
+                               tx->sdata->vif.bss_conf.use_short_preamble);
 
        if (next_frag_len) {
                /* Frame is fragmented: duration increases with time needed to
@@ -159,7 +159,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
                /* next fragment */
                dur += ieee80211_frame_duration(local, next_frag_len,
                                txrate->bitrate, erp,
-                               tx->sdata->bss_conf.use_short_preamble);
+                               tx->sdata->vif.bss_conf.use_short_preamble);
        }
 
        return cpu_to_le16(dur);
@@ -463,7 +463,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
        } else
                info->control.retries[0].rate_idx = -1;
 
-       if (tx->sdata->bss_conf.use_cts_prot &&
+       if (tx->sdata->vif.bss_conf.use_cts_prot &&
            (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) {
                tx->last_frag_rate_idx = tx->rate_idx;
                if (rsel.probe_idx >= 0)
@@ -529,7 +529,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
        if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) &&
            (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) &&
            (tx->flags & IEEE80211_TX_UNICAST) &&
-           tx->sdata->bss_conf.use_cts_prot &&
+           tx->sdata->vif.bss_conf.use_cts_prot &&
            !(info->flags & IEEE80211_TX_CTL_USE_RTS_CTS))
                info->flags |= IEEE80211_TX_CTL_USE_CTS_PROTECT;
 
@@ -538,7 +538,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
         * available on the network at the current point in time. */
        if (ieee80211_is_data(hdr->frame_control) &&
            (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) &&
-           tx->sdata->bss_conf.use_short_preamble &&
+           tx->sdata->vif.bss_conf.use_short_preamble &&
            (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) {
                info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
        }
@@ -558,7 +558,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
                for (idx = 0; idx < sband->n_bitrates; idx++) {
                        if (sband->bitrates[idx].bitrate > rate->bitrate)
                                continue;
-                       if (tx->sdata->bss_conf.basic_rates & BIT(idx) &&
+                       if (tx->sdata->vif.bss_conf.basic_rates & BIT(idx) &&
                            (baserate < 0 ||
                             (sband->bitrates[baserate].bitrate
                              < sband->bitrates[idx].bitrate)))
@@ -1977,7 +1977,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
        info->flags |= IEEE80211_TX_CTL_NO_ACK;
        info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
        info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
-       if (sdata->bss_conf.use_short_preamble &&
+       if (sdata->vif.bss_conf.use_short_preamble &&
            sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE)
                info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
 
index 3288c3de67ca24bce94000d44f8a746e5a818931..ec8b6335f0c143b5250872e39e12308cd55cb08f 100644 (file)
@@ -239,7 +239,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
        erp = 0;
        if (vif) {
                sdata = vif_to_sdata(vif);
-               short_preamble = sdata->bss_conf.use_short_preamble;
+               short_preamble = sdata->vif.bss_conf.use_short_preamble;
                if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
                        erp = rate->flags & IEEE80211_RATE_ERP_G;
        }
@@ -272,7 +272,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
        erp = 0;
        if (vif) {
                sdata = vif_to_sdata(vif);
-               short_preamble = sdata->bss_conf.use_short_preamble;
+               short_preamble = sdata->vif.bss_conf.use_short_preamble;
                if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
                        erp = rate->flags & IEEE80211_RATE_ERP_G;
        }
@@ -312,7 +312,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
        erp = 0;
        if (vif) {
                sdata = vif_to_sdata(vif);
-               short_preamble = sdata->bss_conf.use_short_preamble;
+               short_preamble = sdata->vif.bss_conf.use_short_preamble;
                if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
                        erp = rate->flags & IEEE80211_RATE_ERP_G;
        }