wifi: mac80211: make channel context code MLO-aware

Make the channel context code MLO aware, along with some
functions that it uses, so that the chan.c file is now
MLD-clean and no longer uses deflink/bss_conf/etc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2022-05-30 18:35:23 +02:00
parent 7fc83a2ba2
commit b4f85443c1
28 changed files with 608 additions and 413 deletions

View File

@ -8919,6 +8919,7 @@ unlock:
static int
ath10k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct ath10k *ar = hw->priv;
@ -8998,6 +8999,7 @@ err:
static void
ath10k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct ath10k *ar = hw->priv;

View File

@ -7072,6 +7072,7 @@ static int ath11k_start_vdev_delay(struct ieee80211_hw *hw,
static int
ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct ath11k *ar = hw->priv;
@ -7161,6 +7162,7 @@ out:
static void
ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct ath11k *ar = hw->priv;

View File

@ -2596,6 +2596,7 @@ static void ath9k_change_chanctx(struct ieee80211_hw *hw,
static int ath9k_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *conf)
{
struct ath_softc *sc = hw->priv;
@ -2627,6 +2628,7 @@ static int ath9k_assign_vif_chanctx(struct ieee80211_hw *hw,
static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *conf)
{
struct ath_softc *sc = hw->priv;

View File

@ -4235,6 +4235,7 @@ out:
}
static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
@ -4308,6 +4309,7 @@ out:
static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);

View File

@ -2722,6 +2722,7 @@ static void mac80211_hwsim_change_chanctx(struct ieee80211_hw *hw,
static int mac80211_hwsim_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
hwsim_check_magic(vif);
@ -2732,6 +2733,7 @@ static int mac80211_hwsim_assign_vif_chanctx(struct ieee80211_hw *hw,
static void mac80211_hwsim_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
hwsim_check_magic(vif);

View File

@ -680,6 +680,7 @@ void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *
}
int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *conf)
{
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
@ -692,6 +693,7 @@ int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
}
void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *conf)
{
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;

View File

@ -48,8 +48,10 @@ int wfx_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf
void wfx_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf);
void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf, u32 changed);
int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *conf);
void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *conf);
/* Hardware API Callbacks */

View File

@ -4701,6 +4701,7 @@ out:
static int wlcore_op_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct wl1271 *wl = hw->priv;
@ -4751,6 +4752,7 @@ out:
static void wlcore_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx)
{
struct wl1271 *wl = hw->priv;

View File

@ -261,11 +261,13 @@ enum ieee80211_chanctx_switch_mode {
* done.
*
* @vif: the vif that should be switched from old_ctx to new_ctx
* @link_id: the link ID that's switching
* @old_ctx: the old context to which the vif was assigned
* @new_ctx: the new context to which the vif must be assigned
*/
struct ieee80211_vif_chanctx_switch {
struct ieee80211_vif *vif;
unsigned int link_id;
struct ieee80211_chanctx_conf *old_ctx;
struct ieee80211_chanctx_conf *new_ctx;
};
@ -4262,9 +4264,11 @@ struct ieee80211_ops {
u32 changed);
int (*assign_vif_chanctx)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx);
void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
unsigned int link_id,
struct ieee80211_chanctx_conf *ctx);
int (*switch_vif_chanctx)(struct ieee80211_hw *hw,
struct ieee80211_vif_chanctx_switch *vifs,

View File

@ -840,9 +840,10 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
sdata = wiphy_dereference(local->hw.wiphy,
local->monitor_sdata);
if (sdata) {
ieee80211_vif_release_channel(sdata);
ret = ieee80211_vif_use_channel(sdata, chandef,
IEEE80211_CHANCTX_EXCLUSIVE);
ieee80211_link_release_channel(sdata->link[0]);
ret = ieee80211_link_use_channel(sdata->link[0],
chandef,
IEEE80211_CHANCTX_EXCLUSIVE);
}
} else if (local->open_count == local->monitors) {
local->_oper_chandef = *chandef;
@ -1183,10 +1184,12 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
}
mutex_lock(&local->mtx);
err = ieee80211_vif_use_channel(sdata, &params->chandef,
IEEE80211_CHANCTX_SHARED);
err = ieee80211_link_use_channel(sdata->link[params->beacon.link_id],
&params->chandef,
IEEE80211_CHANCTX_SHARED);
if (!err)
ieee80211_vif_copy_chanctx_to_vlans(sdata, false);
ieee80211_link_copy_chanctx_to_vlans(sdata->link[params->beacon.link_id],
false);
mutex_unlock(&local->mtx);
if (err) {
sdata->vif.bss_conf.beacon_int = prev_beacon_int;
@ -1296,7 +1299,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
error:
mutex_lock(&local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(sdata->link[params->beacon.link_id]);
mutex_unlock(&local->mtx);
return err;
@ -1433,8 +1436,8 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf);
mutex_lock(&local->mtx);
ieee80211_vif_copy_chanctx_to_vlans(sdata, true);
ieee80211_vif_release_channel(sdata);
ieee80211_link_copy_chanctx_to_vlans(sdata->link[link_id], true);
ieee80211_link_release_channel(sdata->link[link_id]);
mutex_unlock(&local->mtx);
return 0;
@ -2401,8 +2404,8 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
sdata->deflink.needed_rx_chains = sdata->local->rx_chains;
mutex_lock(&sdata->local->mtx);
err = ieee80211_vif_use_channel(sdata, &setup->chandef,
IEEE80211_CHANCTX_SHARED);
err = ieee80211_link_use_channel(sdata->link[0], &setup->chandef,
IEEE80211_CHANCTX_SHARED);
mutex_unlock(&sdata->local->mtx);
if (err)
return err;
@ -2416,7 +2419,7 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
ieee80211_stop_mesh(sdata);
mutex_lock(&sdata->local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(sdata->link[0]);
kfree(sdata->u.mesh.ie);
mutex_unlock(&sdata->local->mtx);
@ -3145,8 +3148,8 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
sdata->deflink.smps_mode = IEEE80211_SMPS_OFF;
sdata->deflink.needed_rx_chains = local->rx_chains;
err = ieee80211_vif_use_channel(sdata, chandef,
IEEE80211_CHANCTX_SHARED);
err = ieee80211_link_use_channel(sdata->link[0], chandef,
IEEE80211_CHANCTX_SHARED);
if (err)
goto out_unlock;
@ -3174,7 +3177,7 @@ static void ieee80211_end_cac(struct wiphy *wiphy,
cancel_delayed_work(&sdata->deflink.dfs_cac_timer_work);
if (sdata->wdev.cac_started) {
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(sdata->link[0]);
sdata->wdev.cac_started = false;
}
}
@ -3378,7 +3381,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
if (sdata->deflink.reserved_ready)
return 0;
return ieee80211_vif_use_reserved_context(sdata);
return ieee80211_link_use_reserved_context(sdata->link[0]);
}
if (!cfg80211_chandef_identical(&sdata->vif.bss_conf.chandef,
@ -3643,16 +3646,16 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
if (err)
goto out;
err = ieee80211_vif_reserve_chanctx(sdata, &params->chandef,
chanctx->mode,
params->radar_required);
err = ieee80211_link_reserve_chanctx(sdata->link[0], &params->chandef,
chanctx->mode,
params->radar_required);
if (err)
goto out;
/* if reservation is invalid then this will fail */
err = ieee80211_check_combinations(sdata, NULL, chanctx->mode, 0);
if (err) {
ieee80211_vif_unreserve_chanctx(sdata);
ieee80211_link_unreserve_chanctx(sdata->link[0]);
goto out;
}
@ -3662,7 +3665,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
err = ieee80211_set_csa_beacon(sdata, params, &changed);
if (err) {
ieee80211_vif_unreserve_chanctx(sdata);
ieee80211_link_unreserve_chanctx(sdata->link[0]);
goto out;
}
@ -3921,9 +3924,9 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy,
int ret = -ENODATA;
rcu_read_lock();
chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
chanctx_conf = rcu_dereference(sdata->vif.link_conf[link_id]->chanctx_conf);
if (chanctx_conf) {
*chandef = sdata->vif.bss_conf.chandef;
*chandef = sdata->vif.link_conf[link_id]->chandef;
ret = 0;
} else if (local->open_count > 0 &&
local->open_count == local->monitors &&
@ -3980,7 +3983,8 @@ static int ieee80211_set_ap_chanwidth(struct wiphy *wiphy,
int ret;
u32 changed = 0;
ret = ieee80211_vif_change_bandwidth(sdata, chandef, &changed);
ret = ieee80211_link_change_bandwidth(sdata->link[link_id], chandef,
&changed);
if (ret == 0)
ieee80211_link_info_change_notify(sdata, link_id, changed);

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Portions
* Copyright (C) 2022 Intel Corporation
*/
#ifndef __MAC80211_DEBUG_H
#define __MAC80211_DEBUG_H
#include <net/cfg80211.h>
@ -130,6 +134,16 @@ do { \
#define sdata_dbg(sdata, fmt, ...) \
_sdata_dbg(1, sdata, fmt, ##__VA_ARGS__)
#define link_info(link, fmt, ...) \
_sdata_info((link)->sdata, "[link %d] " fmt, (link)->link_id, \
##__VA_ARGS__)
#define link_err(link, fmt, ...) \
_sdata_err((link)->sdata, "[link %d] " fmt, (link)->link_id, \
##__VA_ARGS__)
#define link_dbg(link, fmt, ...) \
_sdata_dbg(1, (link)->sdata, "[link %d] " fmt, (link)->link_id, \
##__VA_ARGS__)
#define ht_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_HT_DEBUG, \
sdata, fmt, ##__VA_ARGS__)

View File

@ -938,6 +938,7 @@ static inline void drv_change_chanctx(struct ieee80211_local *local,
static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
unsigned int link_id,
struct ieee80211_chanctx *ctx)
{
int ret = 0;
@ -945,11 +946,12 @@ static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
if (!check_sdata_in_driver(sdata))
return -EIO;
trace_drv_assign_vif_chanctx(local, sdata, ctx);
trace_drv_assign_vif_chanctx(local, sdata, link_id, ctx);
if (local->ops->assign_vif_chanctx) {
WARN_ON_ONCE(!ctx->driver_present);
ret = local->ops->assign_vif_chanctx(&local->hw,
&sdata->vif,
link_id,
&ctx->conf);
}
trace_drv_return_int(local, ret);
@ -959,6 +961,7 @@ static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
unsigned int link_id,
struct ieee80211_chanctx *ctx)
{
might_sleep();
@ -966,11 +969,12 @@ static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
if (!check_sdata_in_driver(sdata))
return;
trace_drv_unassign_vif_chanctx(local, sdata, ctx);
trace_drv_unassign_vif_chanctx(local, sdata, link_id, ctx);
if (local->ops->unassign_vif_chanctx) {
WARN_ON_ONCE(!ctx->driver_present);
local->ops->unassign_vif_chanctx(&local->hw,
&sdata->vif,
link_id,
&ctx->conf);
}
trace_drv_return_void(local);

View File

@ -71,6 +71,6 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
eht_cap->has_eht = true;
sta->deflink.cur_max_bandwidth = ieee80211_sta_cap_rx_bw(sta);
sta->sta.deflink.bandwidth = ieee80211_sta_cur_vht_bw(sta);
sta->deflink.cur_max_bandwidth = ieee80211_sta_cap_rx_bw(sta, 0);
sta->sta.deflink.bandwidth = ieee80211_sta_cur_vht_bw(sta, 0);
}

View File

@ -3,7 +3,7 @@
* HE handling
*
* Copyright(c) 2017 Intel Deutschland GmbH
* Copyright(c) 2019 - 2020 Intel Corporation
* Copyright(c) 2019 - 2022 Intel Corporation
*/
#include "ieee80211_i.h"
@ -153,8 +153,8 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
he_cap->has_he = true;
sta->deflink.cur_max_bandwidth = ieee80211_sta_cap_rx_bw(sta);
sta->sta.deflink.bandwidth = ieee80211_sta_cur_vht_bw(sta);
sta->deflink.cur_max_bandwidth = ieee80211_sta_cap_rx_bw(sta, 0);
sta->sta.deflink.bandwidth = ieee80211_sta_cur_vht_bw(sta, 0);
if (sband->band == NL80211_BAND_6GHZ && he_6ghz_capa)
ieee80211_update_from_he_6ghz_capa(he_6ghz_capa, sta);

View File

@ -301,8 +301,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->link[0], &chandef,
ifibss->fixed_channel ?
IEEE80211_CHANCTX_SHARED :
IEEE80211_CHANCTX_EXCLUSIVE)) {
sdata_info(sdata, "Failed to join IBSS, no channel context\n");
@ -371,7 +371,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->link[0]);
mutex_unlock(&local->mtx);
sdata_info(sdata, "Failed to join IBSS, driver failure: %d\n",
err);
@ -725,7 +725,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->link[0]);
mutex_unlock(&local->mtx);
}

View File

@ -787,8 +787,8 @@ struct ieee80211_chanctx {
struct list_head list;
struct rcu_head rcu_head;
struct list_head assigned_vifs;
struct list_head reserved_vifs;
struct list_head assigned_links;
struct list_head reserved_links;
enum ieee80211_chanctx_replace_state replace_state;
struct ieee80211_chanctx *replace_ctx;
@ -909,6 +909,12 @@ struct ieee80211_link_data_ap {
};
struct ieee80211_link_data {
struct ieee80211_sub_if_data *sdata;
unsigned int link_id;
struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
/* multicast keys only */
struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS +
NUM_DEFAULT_MGMT_KEYS +
@ -989,9 +995,6 @@ struct ieee80211_sub_if_data {
struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
struct mac80211_qos_map __rcu *qos_map;
struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
/* used to reconfigure hardware SM PS */
struct work_struct recalc_smps;
@ -2119,8 +2122,10 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
struct ieee80211_supported_band *sband,
const struct ieee80211_vht_cap *vht_cap_ie,
struct sta_info *sta);
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta);
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta);
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta,
unsigned int link_id);
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta,
unsigned int link_id);
void ieee80211_sta_set_rx_nss(struct sta_info *sta);
enum ieee80211_sta_rx_bandwidth
ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width);
@ -2470,26 +2475,26 @@ bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper,
u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
int __must_check
ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
const struct cfg80211_chan_def *chandef,
enum ieee80211_chanctx_mode mode);
ieee80211_link_use_channel(struct ieee80211_link_data *link,
const struct cfg80211_chan_def *chandef,
enum ieee80211_chanctx_mode mode);
int __must_check
ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
const struct cfg80211_chan_def *chandef,
enum ieee80211_chanctx_mode mode,
bool radar_required);
ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link,
const struct cfg80211_chan_def *chandef,
enum ieee80211_chanctx_mode mode,
bool radar_required);
int __must_check
ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata);
int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata);
ieee80211_link_use_reserved_context(struct ieee80211_link_data *link);
int ieee80211_link_unreserve_chanctx(struct ieee80211_link_data *link);
int __must_check
ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
const struct cfg80211_chan_def *chandef,
u32 *changed);
void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
bool clear);
ieee80211_link_change_bandwidth(struct ieee80211_link_data *link,
const struct cfg80211_chan_def *chandef,
u32 *changed);
void ieee80211_link_release_channel(struct ieee80211_link_data *link);
void ieee80211_link_vlan_copy_chanctx(struct ieee80211_link_data *link);
void ieee80211_link_copy_chanctx_to_vlans(struct ieee80211_link_data *link,
bool clear);
int ieee80211_chanctx_refcount(struct ieee80211_local *local,
struct ieee80211_chanctx *ctx);

View File

@ -471,7 +471,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
chandef = sdata->vif.bss_conf.chandef;
WARN_ON(local->suspended);
mutex_lock(&local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(sdata->link[0]);
mutex_unlock(&local->mtx);
cfg80211_cac_event(sdata->dev, &chandef,
NL80211_RADAR_CAC_ABORTED,
@ -1027,6 +1027,7 @@ static void ieee80211_sdata_init(struct ieee80211_local *local,
*/
sdata->vif.link_conf[0] = &sdata->vif.bss_conf;
sdata->link[0] = &sdata->deflink;
sdata->deflink.sdata = sdata;
}
int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
@ -1077,8 +1078,8 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
mutex_unlock(&local->iflist_mtx);
mutex_lock(&local->mtx);
ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef,
IEEE80211_CHANCTX_EXCLUSIVE);
ret = ieee80211_link_use_channel(sdata->link[0], &local->monitor_chandef,
IEEE80211_CHANCTX_EXCLUSIVE);
mutex_unlock(&local->mtx);
if (ret) {
mutex_lock(&local->iflist_mtx);
@ -1122,7 +1123,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
synchronize_net();
mutex_lock(&local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(sdata->link[0]);
mutex_unlock(&local->mtx);
drv_remove_interface(local, sdata);
@ -1228,7 +1229,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
case NL80211_IFTYPE_AP_VLAN:
/* no need to tell driver, but set carrier and chanctx */
if (sdata->bss->active) {
ieee80211_vif_vlan_copy_chanctx(sdata);
ieee80211_link_vlan_copy_chanctx(sdata->link[0]);
netif_carrier_on(dev);
ieee80211_set_vif_encap_ops(sdata);
} else {
@ -1681,8 +1682,8 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
ieee80211_csa_finalize_work);
INIT_WORK(&sdata->deflink.color_change_finalize_work,
ieee80211_color_change_finalize_work);
INIT_LIST_HEAD(&sdata->assigned_chanctx_list);
INIT_LIST_HEAD(&sdata->reserved_chanctx_list);
INIT_LIST_HEAD(&sdata->deflink.assigned_chanctx_list);
INIT_LIST_HEAD(&sdata->deflink.reserved_chanctx_list);
switch (type) {
case NL80211_IFTYPE_P2P_GO:

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2008, 2009 open80211s Ltd.
* Copyright (C) 2019, 2021 Intel Corporation
* Copyright (C) 2019, 2021-2022 Intel Corporation
* Author: Luis Carlos Cobo <luisca@cozybit.com>
*/
#include <linux/gfp.h>
@ -464,7 +464,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
rate_control_rate_init(sta);
else
rate_control_rate_update(local, sband, sta, changed);
rate_control_rate_update(local, sband, sta, 0, changed);
out:
spin_unlock_bh(&sta->mesh->plink_lock);
}

View File

@ -479,7 +479,7 @@ static int ieee80211_config_bw(struct ieee80211_sub_if_data *sdata,
return -EINVAL;
}
ret = ieee80211_vif_change_bandwidth(sdata, &chandef, changed);
ret = ieee80211_link_change_bandwidth(&sdata->deflink, &chandef, changed);
if (ret) {
sdata_info(sdata,
@ -1248,7 +1248,7 @@ static void ieee80211_chswitch_work(struct work_struct *work)
if (sdata->deflink.reserved_ready)
goto out;
ret = ieee80211_vif_use_reserved_context(sdata);
ret = ieee80211_link_use_reserved_context(&sdata->deflink);
if (ret) {
sdata_info(sdata,
"failed to use reserved channel context, disconnecting (err=%d)\n",
@ -1354,7 +1354,7 @@ ieee80211_sta_abort_chanswitch(struct ieee80211_sub_if_data *sdata)
mutex_lock(&local->mtx);
mutex_lock(&local->chanctx_mtx);
ieee80211_vif_unreserve_chanctx(sdata);
ieee80211_link_unreserve_chanctx(&sdata->deflink);
mutex_unlock(&local->chanctx_mtx);
if (sdata->deflink.csa_block_tx)
@ -1496,8 +1496,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
goto drop_connection;
}
res = ieee80211_vif_reserve_chanctx(sdata, &csa_ie.chandef,
chanctx->mode, false);
res = ieee80211_link_reserve_chanctx(&sdata->deflink, &csa_ie.chandef,
chanctx->mode, false);
if (res) {
sdata_info(sdata,
"failed to reserve channel context for channel switch, disconnecting (err=%d)\n",
@ -1942,7 +1942,7 @@ void ieee80211_dfs_cac_timer_work(struct work_struct *work)
mutex_lock(&sdata->local->mtx);
if (sdata->wdev.cac_started) {
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(&sdata->deflink);
cfg80211_cac_event(sdata->dev, &chandef,
NL80211_RADAR_CAC_FINISHED,
GFP_KERNEL);
@ -2483,7 +2483,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
ifmgd->flags = 0;
mutex_lock(&local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(&sdata->deflink);
sdata->vif.bss_conf.csa_active = false;
sdata->deflink.u.mgd.csa_waiting_bcn = false;
@ -2923,7 +2923,7 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata,
ieee80211_link_info_change_notify(sdata, 0, BSS_CHANGED_BSSID);
sdata->u.mgd.flags = 0;
mutex_lock(&sdata->local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&sdata->local->mtx);
}
@ -2954,7 +2954,7 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
sdata->vif.bss_conf.mu_mimo_owner = false;
mutex_lock(&sdata->local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&sdata->local->mtx);
if (abandon)
@ -5497,8 +5497,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
* on incompatible channels, e.g. 80+80 and 160 sharing the
* same control channel) try to use a smaller bandwidth.
*/
ret = ieee80211_vif_use_channel(sdata, &chandef,
IEEE80211_CHANCTX_SHARED);
ret = ieee80211_link_use_channel(&sdata->deflink, &chandef,
IEEE80211_CHANCTX_SHARED);
/* don't downgrade for 5 and 10 MHz channels, though. */
if (chandef.width == NL80211_CHAN_WIDTH_5 ||
@ -5507,8 +5507,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
while (ret && chandef.width != NL80211_CHAN_WIDTH_20_NOHT) {
ifmgd->flags |= ieee80211_chandef_downgrade(&chandef);
ret = ieee80211_vif_use_channel(sdata, &chandef,
IEEE80211_CHANCTX_SHARED);
ret = ieee80211_link_use_channel(&sdata->deflink, &chandef,
IEEE80211_CHANCTX_SHARED);
}
out:
mutex_unlock(&local->mtx);
@ -5868,7 +5868,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
ieee80211_link_info_change_notify(sdata, 0, BSS_CHANGED_BSSID);
ifmgd->auth_data = NULL;
mutex_lock(&sdata->local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&sdata->local->mtx);
kfree(auth_data);
return err;

View File

@ -186,8 +186,8 @@ int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
sdata->deflink.needed_rx_chains = sdata->local->rx_chains;
mutex_lock(&sdata->local->mtx);
err = ieee80211_vif_use_channel(sdata, &setup->chandef,
IEEE80211_CHANCTX_SHARED);
err = ieee80211_link_use_channel(sdata->link[0], &setup->chandef,
IEEE80211_CHANCTX_SHARED);
mutex_unlock(&sdata->local->mtx);
if (err)
return err;
@ -229,7 +229,7 @@ int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata)
ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_OCB);
mutex_lock(&sdata->local->mtx);
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(sdata->link[0]);
mutex_unlock(&sdata->local->mtx);
skb_queue_purge(&sdata->skb_queue);

View File

@ -90,14 +90,17 @@ void rate_control_tx_status(struct ieee80211_local *local,
}
void rate_control_rate_update(struct ieee80211_local *local,
struct ieee80211_supported_band *sband,
struct sta_info *sta, u32 changed)
struct ieee80211_supported_band *sband,
struct sta_info *sta, unsigned int link_id,
u32 changed)
{
struct rate_control_ref *ref = local->rate_ctrl;
struct ieee80211_sta *ista = &sta->sta;
void *priv_sta = sta->rate_ctrl_priv;
struct ieee80211_chanctx_conf *chanctx_conf;
WARN_ON(link_id != 0);
if (ref && ref->ops->rate_update) {
rcu_read_lock();
@ -113,6 +116,7 @@ void rate_control_rate_update(struct ieee80211_local *local,
spin_unlock_bh(&sta->rate_ctrl_lock);
rcu_read_unlock();
}
drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
}

View File

@ -3,6 +3,7 @@
* Copyright 2002-2005, Instant802 Networks, Inc.
* Copyright 2005, Devicescape Software, Inc.
* Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
* Copyright (C) 2022 Intel Corporation
*/
#ifndef IEEE80211_RATE_H
@ -31,8 +32,10 @@ void rate_control_tx_status(struct ieee80211_local *local,
void rate_control_rate_init(struct sta_info *sta);
void rate_control_rate_update(struct ieee80211_local *local,
struct ieee80211_supported_band *sband,
struct sta_info *sta, u32 changed);
struct ieee80211_supported_band *sband,
struct sta_info *sta,
unsigned int link_id,
u32 changed);
static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
struct sta_info *sta, gfp_t gfp)

View File

@ -3369,7 +3369,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
sband = rx->local->hw.wiphy->bands[status->band];
rate_control_rate_update(local, sband, rx->sta,
rate_control_rate_update(local, sband, rx->sta, 0,
IEEE80211_RC_SMPS_CHANGED);
cfg80211_sta_opmode_change_notify(sdata->dev,
rx->sta->addr,
@ -3391,11 +3391,11 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
if (chanwidth == IEEE80211_HT_CHANWIDTH_20MHZ)
max_bw = IEEE80211_STA_RX_BW_20;
else
max_bw = ieee80211_sta_cap_rx_bw(rx->sta);
max_bw = ieee80211_sta_cap_rx_bw(rx->sta, 0);
/* set cur_max_bandwidth and recalc sta bw */
rx->sta->deflink.cur_max_bandwidth = max_bw;
new_bw = ieee80211_sta_cur_vht_bw(rx->sta);
new_bw = ieee80211_sta_cur_vht_bw(rx->sta, 0);
if (rx->sta->sta.deflink.bandwidth == new_bw)
goto handled;
@ -3406,7 +3406,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
ieee80211_sta_rx_bw_to_chan_width(rx->sta);
sta_opmode.changed = STA_OPMODE_MAX_BW_CHANGED;
rate_control_rate_update(local, sband, rx->sta,
rate_control_rate_update(local, sband, rx->sta, 0,
IEEE80211_RC_BW_CHANGED);
cfg80211_sta_opmode_change_notify(sdata->dev,
rx->sta->addr,

View File

@ -1268,10 +1268,10 @@ static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata,
enum ieee80211_sta_rx_bandwidth bw;
bw = ieee80211_chan_width_to_rx_bw(conf->def.width);
bw = min(bw, ieee80211_sta_cap_rx_bw(sta));
bw = min(bw, ieee80211_sta_cap_rx_bw(sta, 0));
if (bw != sta->sta.deflink.bandwidth) {
sta->sta.deflink.bandwidth = bw;
rate_control_rate_update(local, sband, sta,
rate_control_rate_update(local, sband, sta, 0,
IEEE80211_RC_BW_CHANGED);
/*
* if a TDLS peer BW was updated, we need to

View File

@ -1625,6 +1625,7 @@ struct trace_chandef_entry {
struct trace_switch_entry {
struct trace_vif_entry vif;
unsigned int link_id;
struct trace_chandef_entry old_chandef;
struct trace_chandef_entry new_chandef;
} __packed;
@ -1664,6 +1665,7 @@ TRACE_EVENT(drv_switch_vif_chanctx,
SWITCH_ENTRY_ASSIGN(vif.vif_type, vif->type);
SWITCH_ENTRY_ASSIGN(vif.p2p, vif->p2p);
SWITCH_ENTRY_ASSIGN(link_id, link_id);
strncpy(local_vifs[i].vif.vif_name,
sdata->name,
sizeof(local_vifs[i].vif.vif_name));
@ -1704,40 +1706,45 @@ TRACE_EVENT(drv_switch_vif_chanctx,
DECLARE_EVENT_CLASS(local_sdata_chanctx,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
unsigned int link_id,
struct ieee80211_chanctx *ctx),
TP_ARGS(local, sdata, ctx),
TP_ARGS(local, sdata, link_id, ctx),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
CHANCTX_ENTRY
__field(unsigned int, link_id)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
CHANCTX_ASSIGN;
__entry->link_id = link_id;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT CHANCTX_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG, CHANCTX_PR_ARG
LOCAL_PR_FMT VIF_PR_FMT " link_id:%d" CHANCTX_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG, __entry->link_id, CHANCTX_PR_ARG
)
);
DEFINE_EVENT(local_sdata_chanctx, drv_assign_vif_chanctx,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
unsigned int link_id,
struct ieee80211_chanctx *ctx),
TP_ARGS(local, sdata, ctx)
TP_ARGS(local, sdata, link_id, ctx)
);
DEFINE_EVENT(local_sdata_chanctx, drv_unassign_vif_chanctx,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
unsigned int link_id,
struct ieee80211_chanctx *ctx),
TP_ARGS(local, sdata, ctx)
TP_ARGS(local, sdata, link_id, ctx)
);
TRACE_EVENT(drv_start_ap,

View File

@ -2255,7 +2255,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local)
}
static void ieee80211_assign_chanctx(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata)
struct ieee80211_sub_if_data *sdata,
unsigned int link_id)
{
struct ieee80211_chanctx_conf *conf;
struct ieee80211_chanctx *ctx;
@ -2264,11 +2265,11 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local,
return;
mutex_lock(&local->chanctx_mtx);
conf = rcu_dereference_protected(sdata->vif.bss_conf.chanctx_conf,
conf = rcu_dereference_protected(sdata->vif.link_conf[link_id]->chanctx_conf,
lockdep_is_held(&local->chanctx_mtx));
if (conf) {
ctx = container_of(conf, struct ieee80211_chanctx, conf);
drv_assign_vif_chanctx(local, sdata, ctx);
drv_assign_vif_chanctx(local, sdata, link_id, ctx);
}
mutex_unlock(&local->chanctx_mtx);
}
@ -2474,7 +2475,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
sdata = wiphy_dereference(local->hw.wiphy,
local->monitor_sdata);
if (sdata && ieee80211_sdata_running(sdata))
ieee80211_assign_chanctx(local, sdata);
ieee80211_assign_chanctx(local, sdata, 0);
}
/* reconfigure hardware */
@ -2484,12 +2485,16 @@ int ieee80211_reconfig(struct ieee80211_local *local)
/* Finally also reconfigure all the BSS information */
list_for_each_entry(sdata, &local->interfaces, list) {
unsigned int link;
u32 changed;
if (!ieee80211_sdata_running(sdata))
continue;
ieee80211_assign_chanctx(local, sdata);
for (link = 0; link < ARRAY_SIZE(sdata->vif.link_conf); link++) {
if (sdata->vif.link_conf[link])
ieee80211_assign_chanctx(local, sdata, link);
}
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP_VLAN:
@ -3975,7 +3980,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef;
ieee80211_vif_release_channel(sdata);
ieee80211_link_release_channel(sdata->link[0]);
cfg80211_cac_event(sdata->dev,
&chandef,
NL80211_RADAR_CAC_ABORTED,
@ -4401,7 +4406,7 @@ void ieee80211_recalc_dtim(struct ieee80211_local *local,
static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local,
struct ieee80211_chanctx *ctx)
{
struct ieee80211_sub_if_data *sdata;
struct ieee80211_link_data *link;
u8 radar_detect = 0;
lockdep_assert_held(&local->chanctx_mtx);
@ -4409,20 +4414,26 @@ static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local,
if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED))
return 0;
list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list)
if (sdata->deflink.reserved_radar_required)
radar_detect |= BIT(sdata->deflink.reserved_chandef.width);
list_for_each_entry(link, &ctx->reserved_links, reserved_chanctx_list)
if (link->reserved_radar_required)
radar_detect |= BIT(link->reserved_chandef.width);
/*
* An in-place reservation context should not have any assigned vifs
* until it replaces the other context.
*/
WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER &&
!list_empty(&ctx->assigned_vifs));
!list_empty(&ctx->assigned_links));
list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list)
if (sdata->deflink.radar_required)
radar_detect |= BIT(sdata->vif.bss_conf.chandef.width);
list_for_each_entry(link, &ctx->assigned_links, assigned_chanctx_list) {
struct ieee80211_sub_if_data *sdata = link->sdata;
if (!link->radar_required)
continue;
radar_detect |=
BIT(sdata->vif.link_conf[link->link_id]->chandef.width);
}
return radar_detect;
}

View File

@ -313,7 +313,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
sta->deflink.cur_max_bandwidth = IEEE80211_STA_RX_BW_160;
}
sta->sta.deflink.bandwidth = ieee80211_sta_cur_vht_bw(sta);
sta->sta.deflink.bandwidth = ieee80211_sta_cur_vht_bw(sta, 0);
switch (vht_cap->cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK) {
case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454:
@ -330,19 +330,21 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
}
/* FIXME: move this to some better location - parses HE/EHT now */
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta)
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta,
unsigned int link_id)
{
struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.deflink.vht_cap;
struct ieee80211_sta_he_cap *he_cap = &sta->sta.deflink.he_cap;
struct ieee80211_sta_eht_cap *eht_cap = &sta->sta.deflink.eht_cap;
struct ieee80211_bss_conf *link_conf = sta->sdata->vif.link_conf[link_id];
struct ieee80211_link_sta *link_sta = sta->sta.link[link_id];
struct ieee80211_sta_vht_cap *vht_cap = &link_sta->vht_cap;
struct ieee80211_sta_he_cap *he_cap = &link_sta->he_cap;
struct ieee80211_sta_eht_cap *eht_cap = &link_sta->eht_cap;
u32 cap_width;
if (he_cap->has_he) {
u8 info;
if (eht_cap->has_eht &&
sta->sdata->vif.bss_conf.chandef.chan->band ==
NL80211_BAND_6GHZ) {
link_conf->chandef.chan->band == NL80211_BAND_6GHZ) {
info = eht_cap->eht_cap_elem.phy_cap_info[0];
if (info & IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ)
@ -351,8 +353,7 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta)
info = he_cap->he_cap_elem.phy_cap_info[0];
if (sta->sdata->vif.bss_conf.chandef.chan->band ==
NL80211_BAND_2GHZ) {
if (link_conf->chandef.chan->band == NL80211_BAND_2GHZ) {
if (info & IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G)
return IEEE80211_STA_RX_BW_40;
else
@ -369,7 +370,7 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta)
}
if (!vht_cap->vht_supported)
return sta->sta.deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
return link_sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
IEEE80211_STA_RX_BW_40 :
IEEE80211_STA_RX_BW_20;
@ -466,14 +467,15 @@ ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width)
}
/* FIXME: rename/move - this deals with everything not just VHT */
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta)
enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta,
unsigned int link_id)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
struct ieee80211_bss_conf *link_conf = sta->sdata->vif.link_conf[link_id];
enum nl80211_chan_width bss_width = link_conf->chandef.width;
enum ieee80211_sta_rx_bandwidth bw;
enum nl80211_chan_width bss_width = sdata->vif.bss_conf.chandef.width;
bw = ieee80211_sta_cap_rx_bw(sta);
bw = min(bw, sta->deflink.cur_max_bandwidth);
bw = ieee80211_sta_cap_rx_bw(sta, link_id);
bw = min(bw, sta->link[link_id]->cur_max_bandwidth);
/* Don't consider AP's bandwidth for TDLS peers, section 11.23.1 of
* IEEE80211-2016 specification makes higher bandwidth operation
@ -629,7 +631,7 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
break;
}
new_bw = ieee80211_sta_cur_vht_bw(sta);
new_bw = ieee80211_sta_cur_vht_bw(sta, 0);
if (new_bw != sta->sta.deflink.bandwidth) {
sta->sta.deflink.bandwidth = new_bw;
sta_opmode.bw = ieee80211_sta_rx_bw_to_chan_width(sta);
@ -692,7 +694,7 @@ void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
if (changed > 0) {
ieee80211_recalc_min_chandef(sdata);
rate_control_rate_update(local, sband, sta, changed);
rate_control_rate_update(local, sband, sta, 0, changed);
}
}