Skip to content

Commit

Permalink
wifi: mac80211: collect some CSA data into sub-structs
Browse files Browse the repository at this point in the history
Collect the CSA data in ieee80211_link_data_managed and
ieee80211_link_data into a csa sub-struct to clean up a
bit and make adding new things more obvious.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240506215543.29f954b1f576.I9a683a9647c33d4dd3011aade6677982428c1082@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed May 23, 2024
1 parent 7ef8f68 commit 344d18c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 61 deletions.
16 changes: 8 additions & 8 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3633,10 +3633,10 @@ void ieee80211_csa_finish(struct ieee80211_vif *vif, unsigned int link_id)
continue;

wiphy_work_queue(iter->local->hw.wiphy,
&iter->deflink.csa_finalize_work);
&iter->deflink.csa.finalize_work);
}
}
wiphy_work_queue(local->hw.wiphy, &link_data->csa_finalize_work);
wiphy_work_queue(local->hw.wiphy, &link_data->csa.finalize_work);

rcu_read_unlock();
}
Expand Down Expand Up @@ -3723,7 +3723,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
}

if (!cfg80211_chandef_identical(&link_conf->chanreq.oper,
&link_data->csa_chanreq.oper))
&link_data->csa.chanreq.oper))
return -EINVAL;

link_conf->csa_active = false;
Expand All @@ -3744,7 +3744,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
if (err)
return err;

cfg80211_ch_switch_notify(sdata->dev, &link_data->csa_chanreq.oper,
cfg80211_ch_switch_notify(sdata->dev, &link_data->csa.chanreq.oper,
link_data->link_id);

return 0;
Expand All @@ -3765,7 +3765,7 @@ static void ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
{
struct ieee80211_link_data *link =
container_of(work, struct ieee80211_link_data, csa_finalize_work);
container_of(work, struct ieee80211_link_data, csa.finalize_work);
struct ieee80211_sub_if_data *sdata = link->sdata;
struct ieee80211_local *local = sdata->local;

Expand Down Expand Up @@ -4012,7 +4012,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
goto out;
}

link_data->csa_chanreq = chanreq;
link_data->csa.chanreq = chanreq;
link_conf->csa_active = true;

if (params->block_tx &&
Expand All @@ -4023,12 +4023,12 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
}

cfg80211_ch_switch_started_notify(sdata->dev,
&link_data->csa_chanreq.oper, 0,
&link_data->csa.chanreq.oper, 0,
params->count, params->block_tx);

if (changed) {
ieee80211_link_info_change_notify(sdata, link_data, changed);
drv_channel_switch_beacon(sdata, &link_data->csa_chanreq.oper);
drv_channel_switch_beacon(sdata, &link_data->csa.chanreq.oper);
} else {
/* if the beacon didn't change, we can finalize immediately */
ieee80211_csa_finalize(link_data);
Expand Down
4 changes: 2 additions & 2 deletions net/mac80211/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,11 +1162,11 @@ ieee80211_link_chanctx_reservation_complete(struct ieee80211_link_data *link)
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_OCB:
wiphy_work_queue(sdata->local->hw.wiphy,
&link->csa_finalize_work);
&link->csa.finalize_work);
break;
case NL80211_IFTYPE_STATION:
wiphy_delayed_work_queue(sdata->local->hw.wiphy,
&link->u.mgd.chswitch_work, 0);
&link->u.mgd.csa.switch_work, 0);
break;
case NL80211_IFTYPE_UNSPECIFIED:
case NL80211_IFTYPE_AP_VLAN:
Expand Down
6 changes: 3 additions & 3 deletions net/mac80211/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright(c) 2016 Intel Deutschland GmbH
* Copyright(c) 2018-2023 Intel Corporation
* Copyright(c) 2018-2024 Intel Corporation
*/

#include <linux/delay.h>
Expand Down Expand Up @@ -533,12 +533,12 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata, u64 *changed)
IEEE80211_PRIVACY(ifibss->privacy));
/* XXX: should not really modify cfg80211 data */
if (cbss) {
cbss->channel = sdata->deflink.csa_chanreq.oper.chan;
cbss->channel = sdata->deflink.csa.chanreq.oper.chan;
cfg80211_put_bss(sdata->local->hw.wiphy, cbss);
}
}

ifibss->chandef = sdata->deflink.csa_chanreq.oper;
ifibss->chandef = sdata->deflink.csa.chanreq.oper;

/* generate the beacon */
return ieee80211_ibss_csa_beacon(sdata, NULL, changed);
Expand Down
18 changes: 11 additions & 7 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -975,11 +975,13 @@ struct ieee80211_link_data_managed {
bool disable_wmm_tracking;
bool operating_11g_mode;

bool csa_waiting_bcn;
bool csa_ignored_same_chan;
bool csa_blocked_tx;
unsigned long csa_time;
struct wiphy_delayed_work chswitch_work;
struct {
struct wiphy_delayed_work switch_work;
unsigned long time;
bool waiting_bcn;
bool ignored_same_chan;
bool blocked_tx;
} csa;

struct wiphy_work request_smps_work;
/* used to reconfigure hardware SM PS */
Expand Down Expand Up @@ -1038,11 +1040,13 @@ struct ieee80211_link_data {
struct ieee80211_key __rcu *default_mgmt_key;
struct ieee80211_key __rcu *default_beacon_key;

struct wiphy_work csa_finalize_work;

bool operating_11g_mode;

struct ieee80211_chan_req csa_chanreq;
struct {
struct wiphy_work finalize_work;
struct ieee80211_chan_req chanreq;
} csa;

struct wiphy_work color_change_finalize_work;
struct delayed_work color_collision_detect_work;
Expand Down
4 changes: 2 additions & 2 deletions net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,14 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do

sdata->vif.bss_conf.csa_active = false;
if (sdata->vif.type == NL80211_IFTYPE_STATION)
sdata->deflink.u.mgd.csa_waiting_bcn = false;
sdata->deflink.u.mgd.csa.waiting_bcn = false;
if (sdata->csa_blocked_queues) {
ieee80211_wake_vif_queues(local, sdata,
IEEE80211_QUEUE_STOP_REASON_CSA);
sdata->csa_blocked_queues = false;
}

wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.csa_finalize_work);
wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.csa.finalize_work);
wiphy_work_cancel(local->hw.wiphy,
&sdata->deflink.color_change_finalize_work);
wiphy_delayed_work_cancel(local->hw.wiphy,
Expand Down
8 changes: 4 additions & 4 deletions net/mac80211/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
link_conf->link_id = link_id;
link_conf->vif = &sdata->vif;

wiphy_work_init(&link->csa_finalize_work,
wiphy_work_init(&link->csa.finalize_work,
ieee80211_csa_finalize_work);
wiphy_work_init(&link->color_change_finalize_work,
ieee80211_color_change_finalize_work);
Expand Down Expand Up @@ -72,7 +72,7 @@ void ieee80211_link_stop(struct ieee80211_link_data *link)

cancel_delayed_work_sync(&link->color_collision_detect_work);
wiphy_work_cancel(link->sdata->local->hw.wiphy,
&link->csa_finalize_work);
&link->csa.finalize_work);
ieee80211_link_release_channel(link);
}

Expand Down Expand Up @@ -366,8 +366,8 @@ static int _ieee80211_set_active_links(struct ieee80211_sub_if_data *sdata,
*/
if (link->conf->csa_active)
wiphy_delayed_work_queue(local->hw.wiphy,
&link->u.mgd.chswitch_work,
link->u.mgd.csa_time -
&link->u.mgd.csa.switch_work,
link->u.mgd.csa.time -
jiffies);
}

Expand Down
Loading

0 comments on commit 344d18c

Please sign in to comment.