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

wifi: mac80211: handle set csa/after_csa beacon on per link basis

In order to support CSA with MLO, there is a need to handle the functions
ieee80211_set_csa_beacon() and ieee80211_set_after_csa_beacon() on a per
link basis.

Implement this by making the function argument accept the the link data
instead of the sdata.

Currently, deflink would only be passed. Proper link data will be passed in
a subsequent patch.
Signed-off-by: default avatarAditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://msgid.link/20240130140918.1172387-4-quic_adisi@quicinc.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 480e7048
......@@ -3590,20 +3590,21 @@ void ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool block_t
}
EXPORT_SYMBOL(ieee80211_channel_switch_disconnect);
static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata,
static int ieee80211_set_after_csa_beacon(struct ieee80211_link_data *link_data,
u64 *changed)
{
struct ieee80211_sub_if_data *sdata = link_data->sdata;
int err;
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP:
if (!sdata->deflink.u.ap.next_beacon)
if (!link_data->u.ap.next_beacon)
return -EINVAL;
err = ieee80211_assign_beacon(sdata, &sdata->deflink,
sdata->deflink.u.ap.next_beacon,
err = ieee80211_assign_beacon(sdata, link_data,
link_data->u.ap.next_beacon,
NULL, NULL, changed);
ieee80211_free_next_beacon(&sdata->deflink);
ieee80211_free_next_beacon(link_data);
if (err < 0)
return err;
......@@ -3662,7 +3663,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
sdata->vif.bss_conf.csa_active = false;
err = ieee80211_set_after_csa_beacon(sdata, &changed);
err = ieee80211_set_after_csa_beacon(&sdata->deflink, &changed);
if (err)
return err;
......@@ -3714,18 +3715,19 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
ieee80211_csa_finalize(link);
}
static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,
static int ieee80211_set_csa_beacon(struct ieee80211_link_data *link_data,
struct cfg80211_csa_settings *params,
u64 *changed)
{
struct ieee80211_sub_if_data *sdata = link_data->sdata;
struct ieee80211_csa_settings csa = {};
int err;
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP:
sdata->deflink.u.ap.next_beacon =
link_data->u.ap.next_beacon =
cfg80211_beacon_dup(&params->beacon_after);
if (!sdata->deflink.u.ap.next_beacon)
if (!link_data->u.ap.next_beacon)
return -ENOMEM;
/*
......@@ -3751,7 +3753,7 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,
IEEE80211_MAX_CNTDWN_COUNTERS_NUM) ||
(params->n_counter_offsets_presp >
IEEE80211_MAX_CNTDWN_COUNTERS_NUM)) {
ieee80211_free_next_beacon(&sdata->deflink);
ieee80211_free_next_beacon(link_data);
return -EINVAL;
}
......@@ -3761,11 +3763,11 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,
csa.n_counter_offsets_presp = params->n_counter_offsets_presp;
csa.count = params->count;
err = ieee80211_assign_beacon(sdata, &sdata->deflink,
err = ieee80211_assign_beacon(sdata, link_data,
&params->beacon_csa, &csa,
NULL, changed);
if (err < 0) {
ieee80211_free_next_beacon(&sdata->deflink);
ieee80211_free_next_beacon(link_data);
return err;
}
......@@ -3925,7 +3927,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
if (sdata->vif.bss_conf.color_change_active)
ieee80211_color_change_abort(sdata);
err = ieee80211_set_csa_beacon(sdata, params, &changed);
err = ieee80211_set_csa_beacon(&sdata->deflink, params, &changed);
if (err) {
ieee80211_link_unreserve_chanctx(&sdata->deflink);
goto out;
......
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