Commit 7f501452 authored by Aditya Kumar Singh's avatar Aditya Kumar Singh Committed by Johannes Berg

wifi: mac80211_hwsim: add support for switch_vif_chanctx callback

Currently switch_vif_chanctx mac80211 callback is not supported for
MLO. Add it.
Signed-off-by: default avatarAditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://msgid.link/20240216144621.514385-3-quic_adisi@quicinc.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 6030b3a4
......@@ -3215,6 +3215,47 @@ static void mac80211_hwsim_unassign_vif_chanctx(struct ieee80211_hw *hw,
}
}
static int mac80211_hwsim_switch_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif_chanctx_switch *vifs,
int n_vifs,
enum ieee80211_chanctx_switch_mode mode)
{
int i;
if (n_vifs <= 0)
return -EINVAL;
wiphy_dbg(hw->wiphy,
"switch vif channel context mode: %u\n", mode);
for (i = 0; i < n_vifs; i++) {
hwsim_check_chanctx_magic(vifs[i].old_ctx);
wiphy_dbg(hw->wiphy,
"switch vif channel context: %d MHz/width: %d/cfreqs:%d/%d MHz -> %d MHz/width: %d/cfreqs:%d/%d MHz\n",
vifs[i].old_ctx->def.chan->center_freq,
vifs[i].old_ctx->def.width,
vifs[i].old_ctx->def.center_freq1,
vifs[i].old_ctx->def.center_freq2,
vifs[i].new_ctx->def.chan->center_freq,
vifs[i].new_ctx->def.width,
vifs[i].new_ctx->def.center_freq1,
vifs[i].new_ctx->def.center_freq2);
switch (mode) {
case CHANCTX_SWMODE_REASSIGN_VIF:
hwsim_check_chanctx_magic(vifs[i].new_ctx);
break;
case CHANCTX_SWMODE_SWAP_CONTEXTS:
hwsim_set_chanctx_magic(vifs[i].new_ctx);
hwsim_clear_chanctx_magic(vifs[i].old_ctx);
break;
default:
WARN_ON("Invalid mode");
}
}
return 0;
}
static const char mac80211_hwsim_gstrings_stats[][ETH_GSTRING_LEN] = {
"tx_pkts_nic",
"tx_bytes_nic",
......@@ -3940,7 +3981,8 @@ static const struct ieee80211_ops mac80211_hwsim_ops = {
.remove_chanctx = mac80211_hwsim_remove_chanctx, \
.change_chanctx = mac80211_hwsim_change_chanctx, \
.assign_vif_chanctx = mac80211_hwsim_assign_vif_chanctx,\
.unassign_vif_chanctx = mac80211_hwsim_unassign_vif_chanctx,
.unassign_vif_chanctx = mac80211_hwsim_unassign_vif_chanctx, \
.switch_vif_chanctx = mac80211_hwsim_switch_vif_chanctx,
static const struct ieee80211_ops mac80211_hwsim_mchan_ops = {
HWSIM_COMMON_OPS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment