Commit 9a886df0 authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: use link_id in ieee80211_change_bss()

We should set the parameters here per link, except
unfortunately ap_isolate, but we can't really change
that anymore so it'll remain a quirk in the API in
that you need to change it on one of the valid links
and it'll apply to all.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 1e0f8cc9
...@@ -2554,47 +2554,50 @@ static int ieee80211_change_bss(struct wiphy *wiphy, ...@@ -2554,47 +2554,50 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
struct bss_parameters *params) struct bss_parameters *params)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_link_data *link;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
u32 changed = 0; u32 changed = 0;
if (!sdata_dereference(sdata->deflink.u.ap.beacon, sdata)) link = ieee80211_link_or_deflink(sdata, params->link_id, true);
if (IS_ERR(link))
return PTR_ERR(link);
if (!sdata_dereference(link->u.ap.beacon, sdata))
return -ENOENT; return -ENOENT;
sband = ieee80211_get_sband(sdata); sband = ieee80211_get_link_sband(link);
if (!sband) if (!sband)
return -EINVAL; return -EINVAL;
if (params->use_cts_prot >= 0) { if (params->use_cts_prot >= 0) {
sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot; link->conf->use_cts_prot = params->use_cts_prot;
changed |= BSS_CHANGED_ERP_CTS_PROT; changed |= BSS_CHANGED_ERP_CTS_PROT;
} }
if (params->use_short_preamble >= 0) { if (params->use_short_preamble >= 0) {
sdata->vif.bss_conf.use_short_preamble = link->conf->use_short_preamble = params->use_short_preamble;
params->use_short_preamble;
changed |= BSS_CHANGED_ERP_PREAMBLE; changed |= BSS_CHANGED_ERP_PREAMBLE;
} }
if (!sdata->vif.bss_conf.use_short_slot && if (!link->conf->use_short_slot &&
(sband->band == NL80211_BAND_5GHZ || (sband->band == NL80211_BAND_5GHZ ||
sband->band == NL80211_BAND_6GHZ)) { sband->band == NL80211_BAND_6GHZ)) {
sdata->vif.bss_conf.use_short_slot = true; link->conf->use_short_slot = true;
changed |= BSS_CHANGED_ERP_SLOT; changed |= BSS_CHANGED_ERP_SLOT;
} }
if (params->use_short_slot_time >= 0) { if (params->use_short_slot_time >= 0) {
sdata->vif.bss_conf.use_short_slot = link->conf->use_short_slot = params->use_short_slot_time;
params->use_short_slot_time;
changed |= BSS_CHANGED_ERP_SLOT; changed |= BSS_CHANGED_ERP_SLOT;
} }
if (params->basic_rates) { if (params->basic_rates) {
ieee80211_parse_bitrates(sdata->vif.bss_conf.chandef.width, ieee80211_parse_bitrates(link->conf->chandef.width,
wiphy->bands[sband->band], wiphy->bands[sband->band],
params->basic_rates, params->basic_rates,
params->basic_rates_len, params->basic_rates_len,
&sdata->vif.bss_conf.basic_rates); &link->conf->basic_rates);
changed |= BSS_CHANGED_BASIC_RATES; changed |= BSS_CHANGED_BASIC_RATES;
ieee80211_check_rate_mask(&sdata->deflink); ieee80211_check_rate_mask(link);
} }
if (params->ap_isolate >= 0) { if (params->ap_isolate >= 0) {
...@@ -2606,30 +2609,29 @@ static int ieee80211_change_bss(struct wiphy *wiphy, ...@@ -2606,30 +2609,29 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
} }
if (params->ht_opmode >= 0) { if (params->ht_opmode >= 0) {
sdata->vif.bss_conf.ht_operation_mode = link->conf->ht_operation_mode = (u16)params->ht_opmode;
(u16) params->ht_opmode;
changed |= BSS_CHANGED_HT; changed |= BSS_CHANGED_HT;
} }
if (params->p2p_ctwindow >= 0) { if (params->p2p_ctwindow >= 0) {
sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow &= link->conf->p2p_noa_attr.oppps_ctwindow &=
~IEEE80211_P2P_OPPPS_CTWINDOW_MASK; ~IEEE80211_P2P_OPPPS_CTWINDOW_MASK;
sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |= link->conf->p2p_noa_attr.oppps_ctwindow |=
params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK; params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK;
changed |= BSS_CHANGED_P2P_PS; changed |= BSS_CHANGED_P2P_PS;
} }
if (params->p2p_opp_ps > 0) { if (params->p2p_opp_ps > 0) {
sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |= link->conf->p2p_noa_attr.oppps_ctwindow |=
IEEE80211_P2P_OPPPS_ENABLE_BIT; IEEE80211_P2P_OPPPS_ENABLE_BIT;
changed |= BSS_CHANGED_P2P_PS; changed |= BSS_CHANGED_P2P_PS;
} else if (params->p2p_opp_ps == 0) { } else if (params->p2p_opp_ps == 0) {
sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow &= link->conf->p2p_noa_attr.oppps_ctwindow &=
~IEEE80211_P2P_OPPPS_ENABLE_BIT; ~IEEE80211_P2P_OPPPS_ENABLE_BIT;
changed |= BSS_CHANGED_P2P_PS; changed |= BSS_CHANGED_P2P_PS;
} }
ieee80211_link_info_change_notify(sdata, &sdata->deflink, changed); ieee80211_link_info_change_notify(sdata, link, changed);
return 0; return 0;
} }
......
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