aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mac80211_hwsim.c
diff options
context:
space:
mode:
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>2022-06-22 16:11:43 +0300
committerJohannes Berg <johannes.berg@intel.com>2022-07-15 11:43:24 +0200
commitaea9a6088ae46e77527716496ab259ddfa320148 (patch)
tree147b08d40a5bdc738c0e4763efa74983c57d875c /drivers/net/wireless/mac80211_hwsim.c
parentwifi: mac80211: do link->MLD address translation on RX (diff)
downloadlinux-dev-aea9a6088ae46e77527716496ab259ddfa320148.tar.xz
linux-dev-aea9a6088ae46e77527716496ab259ddfa320148.zip
wifi: mac80211_hwsim: do rc update per link
Make mac80211_hwsim_sta_rc_update() iterate over all the STA links. This is somewhat temporary, we really should add the link to the API, but then hwsim still calls it internally and would need this. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c63
1 files changed, 42 insertions, 21 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index d0d19648d6a9..4a3d42b3099f 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2263,35 +2263,56 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw,
{
struct mac80211_hwsim_data *data = hw->priv;
u32 bw = U32_MAX;
- enum nl80211_chan_width confbw = NL80211_CHAN_WIDTH_20_NOHT;
+ int link_id;
+
+ rcu_read_lock();
+ for (link_id = 0;
+ link_id < ARRAY_SIZE(vif->link_conf);
+ link_id++) {
+ enum nl80211_chan_width confbw = NL80211_CHAN_WIDTH_20_NOHT;
+ struct ieee80211_bss_conf *vif_conf;
+ struct ieee80211_link_sta *link_sta;
+
+ link_sta = rcu_dereference(sta->link[link_id]);
+
+ if (!link_sta)
+ continue;
- switch (sta->deflink.bandwidth) {
+ switch (link_sta->bandwidth) {
#define C(_bw) case IEEE80211_STA_RX_BW_##_bw: bw = _bw; break
- C(20);
- C(40);
- C(80);
- C(160);
- C(320);
+ C(20);
+ C(40);
+ C(80);
+ C(160);
+ C(320);
#undef C
- }
+ }
- if (!data->use_chanctx) {
- confbw = data->bw;
- } else {
- struct ieee80211_chanctx_conf *chanctx_conf;
+ if (!data->use_chanctx) {
+ confbw = data->bw;
+ } else {
+ struct ieee80211_chanctx_conf *chanctx_conf;
+
+ vif_conf = rcu_dereference(vif->link_conf[link_id]);
+ if (WARN_ON(!vif_conf))
+ continue;
+
+ chanctx_conf = rcu_dereference(vif_conf->chanctx_conf);
+
+ if (!WARN_ON(!chanctx_conf))
+ confbw = chanctx_conf->def.width;
+ }
+
+ WARN(bw > hwsim_get_chanwidth(confbw),
+ "intf %pM [link=%d]: bad STA %pM bandwidth %d MHz (%d) > channel config %d MHz (%d)\n",
+ vif->addr, link_id, sta->addr, bw, sta->deflink.bandwidth,
+ hwsim_get_chanwidth(data->bw), data->bw);
- rcu_read_lock();
- chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf);
- if (!WARN_ON(!chanctx_conf))
- confbw = chanctx_conf->def.width;
- rcu_read_unlock();
}
+ rcu_read_unlock();
+
- WARN(bw > hwsim_get_chanwidth(confbw),
- "intf %pM: bad STA %pM bandwidth %d MHz (%d) > channel config %d MHz (%d)\n",
- vif->addr, sta->addr, bw, sta->deflink.bandwidth,
- hwsim_get_chanwidth(data->bw), data->bw);
}
static int mac80211_hwsim_sta_add(struct ieee80211_hw *hw,