Commit 344d18ce authored by Johannes Berg's avatar Johannes Berg
Browse files

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: default avatarMiriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240506215543.29f954b1f576.I9a683a9647c33d4dd3011aade6677982428c1082@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 7ef8f682
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -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();
}
@@ -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;
@@ -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;
@@ -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;

@@ -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 &&
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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:
+3 −3
Original line number Diff line number Diff line
@@ -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>
@@ -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);
+11 −7
Original line number Diff line number Diff line
@@ -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 */
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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,
Loading