wifi: mac80211: change QoS settings API to take link into account
[linux-block.git] / net / mac80211 / ibss.c
index 3b68e9f4345b6e70892a3af761abf3e5d3e19da2..0a1d51c60530ef2a0d32fd1c984bd4b0a3df961f 100644 (file)
@@ -255,8 +255,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
                drv_leave_ibss(local, sdata);
        }
 
-       presp = rcu_dereference_protected(ifibss->presp,
-                                         lockdep_is_held(&sdata->wdev.mtx));
+       presp = sdata_dereference(ifibss->presp, sdata);
        RCU_INIT_POINTER(ifibss->presp, NULL);
        if (presp)
                kfree_rcu(presp, rcu_head);
@@ -301,8 +300,8 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
        radar_required = err;
 
        mutex_lock(&local->mtx);
-       if (ieee80211_vif_use_channel(sdata, &chandef,
-                                     ifibss->fixed_channel ?
+       if (ieee80211_link_use_channel(&sdata->deflink, &chandef,
+                                      ifibss->fixed_channel ?
                                        IEEE80211_CHANCTX_SHARED :
                                        IEEE80211_CHANCTX_EXCLUSIVE)) {
                sdata_info(sdata, "Failed to join IBSS, no channel context\n");
@@ -357,7 +356,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
        else
                sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
 
-       ieee80211_set_wmm_default(sdata, true, false);
+       ieee80211_set_wmm_default(&sdata->deflink, true, false);
 
        sdata->vif.cfg.ibss_joined = true;
        sdata->vif.cfg.ibss_creator = creator;
@@ -371,7 +370,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
                RCU_INIT_POINTER(ifibss->presp, NULL);
                kfree_rcu(presp, rcu_head);
                mutex_lock(&local->mtx);
-               ieee80211_vif_release_channel(sdata);
+               ieee80211_link_release_channel(&sdata->deflink);
                mutex_unlock(&local->mtx);
                sdata_info(sdata, "Failed to join IBSS, driver failure: %d\n",
                           err);
@@ -509,8 +508,7 @@ int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
        rcu_read_unlock();
        cfg80211_put_bss(sdata->local->hw.wiphy, cbss);
 
-       old_presp = rcu_dereference_protected(ifibss->presp,
-                                         lockdep_is_held(&sdata->wdev.mtx));
+       old_presp = sdata_dereference(ifibss->presp, sdata);
 
        presp = ieee80211_ibss_build_presp(sdata,
                                           sdata->vif.bss_conf.beacon_int,
@@ -629,7 +627,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
        scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
        rcu_read_unlock();
 
-       sta = sta_info_alloc(sdata, addr, GFP_KERNEL);
+       sta = sta_info_alloc(sdata, addr, -1, GFP_KERNEL);
        if (!sta) {
                rcu_read_lock();
                return NULL;
@@ -714,8 +712,7 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
        sdata->vif.cfg.ssid_len = 0;
 
        /* remove beacon */
-       presp = rcu_dereference_protected(ifibss->presp,
-                                         lockdep_is_held(&sdata->wdev.mtx));
+       presp = sdata_dereference(ifibss->presp, sdata);
        RCU_INIT_POINTER(sdata->u.ibss.presp, NULL);
        if (presp)
                kfree_rcu(presp, rcu_head);
@@ -725,7 +722,7 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
                                                BSS_CHANGED_IBSS);
        drv_leave_ibss(local, sdata);
        mutex_lock(&local->mtx);
-       ieee80211_vif_release_channel(sdata);
+       ieee80211_link_release_channel(&sdata->deflink);
        mutex_unlock(&local->mtx);
 }
 
@@ -773,20 +770,21 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
        enum nl80211_channel_type ch_type;
        int err;
-       u32 sta_flags;
+       ieee80211_conn_flags_t conn_flags;
        u32 vht_cap_info = 0;
 
        sdata_assert_lock(sdata);
 
-       sta_flags = IEEE80211_STA_DISABLE_VHT;
+       conn_flags = IEEE80211_CONN_DISABLE_VHT;
+
        switch (ifibss->chandef.width) {
        case NL80211_CHAN_WIDTH_5:
        case NL80211_CHAN_WIDTH_10:
        case NL80211_CHAN_WIDTH_20_NOHT:
-               sta_flags |= IEEE80211_STA_DISABLE_HT;
+               conn_flags |= IEEE80211_CONN_DISABLE_HT;
                fallthrough;
        case NL80211_CHAN_WIDTH_20:
-               sta_flags |= IEEE80211_STA_DISABLE_40MHZ;
+               conn_flags |= IEEE80211_CONN_DISABLE_40MHZ;
                break;
        default:
                break;
@@ -799,7 +797,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
        err = ieee80211_parse_ch_switch_ie(sdata, elems,
                                           ifibss->chandef.chan->band,
                                           vht_cap_info,
-                                          sta_flags, ifibss->bssid, &csa_ie);
+                                          conn_flags, ifibss->bssid, &csa_ie);
        /* can't switch to destination channel, fail */
        if (err < 0)
                goto disconnect;
@@ -842,7 +840,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
                }
                break;
        default:
-               /* should not happen, sta_flags should prevent VHT modes. */
+               /* should not happen, conn_flags should prevent VHT modes. */
                WARN_ON(1);
                goto disconnect;
        }
@@ -1051,7 +1049,7 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata,
                memcpy(&htcap_ie, elems->ht_cap_elem, sizeof(htcap_ie));
                rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
                                                                   &htcap_ie,
-                                                                  sta);
+                                                                  &sta->deflink);
 
                if (elems->vht_operation && elems->vht_cap_elem &&
                    sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_20 &&
@@ -1068,7 +1066,8 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata,
                                                   &chandef);
                        memcpy(&cap_ie, elems->vht_cap_elem, sizeof(cap_ie));
                        ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
-                                                           &cap_ie, sta);
+                                                           &cap_ie,
+                                                           &sta->deflink);
                        if (memcmp(&cap, &sta->sta.deflink.vht_cap, sizeof(cap)))
                                rates_updated |= true;
                }
@@ -1229,7 +1228,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
        scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
        rcu_read_unlock();
 
-       sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
+       sta = sta_info_alloc(sdata, addr, -1, GFP_ATOMIC);
        if (!sta)
                return;
 
@@ -1529,8 +1528,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
 
        sdata_assert_lock(sdata);
 
-       presp = rcu_dereference_protected(ifibss->presp,
-                                         lockdep_is_held(&sdata->wdev.mtx));
+       presp = sdata_dereference(ifibss->presp, sdata);
 
        if (ifibss->state != IEEE80211_IBSS_MLME_JOINED ||
            len < 24 + 2 || !presp)
@@ -1851,7 +1849,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
                | IEEE80211_HT_PARAM_RIFS_MODE;
 
        changed |= BSS_CHANGED_HT | BSS_CHANGED_MCAST_RATE;
-       ieee80211_link_info_change_notify(sdata, 0, changed);
+       ieee80211_link_info_change_notify(sdata, &sdata->deflink, changed);
 
        sdata->deflink.smps_mode = IEEE80211_SMPS_OFF;
        sdata->deflink.needed_rx_chains = local->rx_chains;