Skip to content

Commit 344d18c

Browse files
committed
wifi: mac80211: collect some CSA data into sub-structs
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 <[email protected]> Link: https://msgid.link/20240506215543.29f954b1f576.I9a683a9647c33d4dd3011aade6677982428c1082@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 7ef8f68 commit 344d18c

File tree

7 files changed

+65
-61
lines changed

7 files changed

+65
-61
lines changed

net/mac80211/cfg.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,10 +3633,10 @@ void ieee80211_csa_finish(struct ieee80211_vif *vif, unsigned int link_id)
36333633
continue;
36343634

36353635
wiphy_work_queue(iter->local->hw.wiphy,
3636-
&iter->deflink.csa_finalize_work);
3636+
&iter->deflink.csa.finalize_work);
36373637
}
36383638
}
3639-
wiphy_work_queue(local->hw.wiphy, &link_data->csa_finalize_work);
3639+
wiphy_work_queue(local->hw.wiphy, &link_data->csa.finalize_work);
36403640

36413641
rcu_read_unlock();
36423642
}
@@ -3723,7 +3723,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
37233723
}
37243724

37253725
if (!cfg80211_chandef_identical(&link_conf->chanreq.oper,
3726-
&link_data->csa_chanreq.oper))
3726+
&link_data->csa.chanreq.oper))
37273727
return -EINVAL;
37283728

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

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

37503750
return 0;
@@ -3765,7 +3765,7 @@ static void ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
37653765
void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
37663766
{
37673767
struct ieee80211_link_data *link =
3768-
container_of(work, struct ieee80211_link_data, csa_finalize_work);
3768+
container_of(work, struct ieee80211_link_data, csa.finalize_work);
37693769
struct ieee80211_sub_if_data *sdata = link->sdata;
37703770
struct ieee80211_local *local = sdata->local;
37713771

@@ -4012,7 +4012,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
40124012
goto out;
40134013
}
40144014

4015-
link_data->csa_chanreq = chanreq;
4015+
link_data->csa.chanreq = chanreq;
40164016
link_conf->csa_active = true;
40174017

40184018
if (params->block_tx &&
@@ -4023,12 +4023,12 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
40234023
}
40244024

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

40294029
if (changed) {
40304030
ieee80211_link_info_change_notify(sdata, link_data, changed);
4031-
drv_channel_switch_beacon(sdata, &link_data->csa_chanreq.oper);
4031+
drv_channel_switch_beacon(sdata, &link_data->csa.chanreq.oper);
40324032
} else {
40334033
/* if the beacon didn't change, we can finalize immediately */
40344034
ieee80211_csa_finalize(link_data);

net/mac80211/chan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,11 +1162,11 @@ ieee80211_link_chanctx_reservation_complete(struct ieee80211_link_data *link)
11621162
case NL80211_IFTYPE_MESH_POINT:
11631163
case NL80211_IFTYPE_OCB:
11641164
wiphy_work_queue(sdata->local->hw.wiphy,
1165-
&link->csa_finalize_work);
1165+
&link->csa.finalize_work);
11661166
break;
11671167
case NL80211_IFTYPE_STATION:
11681168
wiphy_delayed_work_queue(sdata->local->hw.wiphy,
1169-
&link->u.mgd.chswitch_work, 0);
1169+
&link->u.mgd.csa.switch_work, 0);
11701170
break;
11711171
case NL80211_IFTYPE_UNSPECIFIED:
11721172
case NL80211_IFTYPE_AP_VLAN:

net/mac80211/ibss.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Copyright 2009, Johannes Berg <[email protected]>
1010
* Copyright 2013-2014 Intel Mobile Communications GmbH
1111
* Copyright(c) 2016 Intel Deutschland GmbH
12-
* Copyright(c) 2018-2023 Intel Corporation
12+
* Copyright(c) 2018-2024 Intel Corporation
1313
*/
1414

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

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

543543
/* generate the beacon */
544544
return ieee80211_ibss_csa_beacon(sdata, NULL, changed);

net/mac80211/ieee80211_i.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -975,11 +975,13 @@ struct ieee80211_link_data_managed {
975975
bool disable_wmm_tracking;
976976
bool operating_11g_mode;
977977

978-
bool csa_waiting_bcn;
979-
bool csa_ignored_same_chan;
980-
bool csa_blocked_tx;
981-
unsigned long csa_time;
982-
struct wiphy_delayed_work chswitch_work;
978+
struct {
979+
struct wiphy_delayed_work switch_work;
980+
unsigned long time;
981+
bool waiting_bcn;
982+
bool ignored_same_chan;
983+
bool blocked_tx;
984+
} csa;
983985

984986
struct wiphy_work request_smps_work;
985987
/* used to reconfigure hardware SM PS */
@@ -1038,11 +1040,13 @@ struct ieee80211_link_data {
10381040
struct ieee80211_key __rcu *default_mgmt_key;
10391041
struct ieee80211_key __rcu *default_beacon_key;
10401042

1041-
struct wiphy_work csa_finalize_work;
10421043

10431044
bool operating_11g_mode;
10441045

1045-
struct ieee80211_chan_req csa_chanreq;
1046+
struct {
1047+
struct wiphy_work finalize_work;
1048+
struct ieee80211_chan_req chanreq;
1049+
} csa;
10461050

10471051
struct wiphy_work color_change_finalize_work;
10481052
struct delayed_work color_collision_detect_work;

net/mac80211/iface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,14 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
543543

544544
sdata->vif.bss_conf.csa_active = false;
545545
if (sdata->vif.type == NL80211_IFTYPE_STATION)
546-
sdata->deflink.u.mgd.csa_waiting_bcn = false;
546+
sdata->deflink.u.mgd.csa.waiting_bcn = false;
547547
if (sdata->csa_blocked_queues) {
548548
ieee80211_wake_vif_queues(local, sdata,
549549
IEEE80211_QUEUE_STOP_REASON_CSA);
550550
sdata->csa_blocked_queues = false;
551551
}
552552

553-
wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.csa_finalize_work);
553+
wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.csa.finalize_work);
554554
wiphy_work_cancel(local->hw.wiphy,
555555
&sdata->deflink.color_change_finalize_work);
556556
wiphy_delayed_work_cancel(local->hw.wiphy,

net/mac80211/link.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
3737
link_conf->link_id = link_id;
3838
link_conf->vif = &sdata->vif;
3939

40-
wiphy_work_init(&link->csa_finalize_work,
40+
wiphy_work_init(&link->csa.finalize_work,
4141
ieee80211_csa_finalize_work);
4242
wiphy_work_init(&link->color_change_finalize_work,
4343
ieee80211_color_change_finalize_work);
@@ -72,7 +72,7 @@ void ieee80211_link_stop(struct ieee80211_link_data *link)
7272

7373
cancel_delayed_work_sync(&link->color_collision_detect_work);
7474
wiphy_work_cancel(link->sdata->local->hw.wiphy,
75-
&link->csa_finalize_work);
75+
&link->csa.finalize_work);
7676
ieee80211_link_release_channel(link);
7777
}
7878

@@ -366,8 +366,8 @@ static int _ieee80211_set_active_links(struct ieee80211_sub_if_data *sdata,
366366
*/
367367
if (link->conf->csa_active)
368368
wiphy_delayed_work_queue(local->hw.wiphy,
369-
&link->u.mgd.chswitch_work,
370-
link->u.mgd.csa_time -
369+
&link->u.mgd.csa.switch_work,
370+
link->u.mgd.csa.time -
371371
jiffies);
372372
}
373373

0 commit comments

Comments
 (0)