1 From 2cc25e4b2a04cdd90dbb2916678745565cc4aeed Mon Sep 17 00:00:00 2001
2 From: Aloka Dixit <quic_alokad@quicinc.com>
3 Date: Mon, 30 Jan 2023 16:12:27 -0800
4 Subject: [PATCH] wifi: mac80211: configure puncturing bitmap
6 - Configure the bitmap in link_conf and notify the driver.
7 - Modify 'change' in ieee80211_start_ap() from u32 to u64 to support
8 BSS_CHANGED_EHT_PUNCTURING.
9 - Propagate the bitmap in channel switch events to userspace.
11 Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
12 Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
13 Link: https://lore.kernel.org/r/20230131001227.25014-5-quic_alokad@quicinc.com
14 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 include/net/mac80211.h | 3 +++
17 net/mac80211/cfg.c | 22 +++++++++++++++++++---
18 2 files changed, 22 insertions(+), 3 deletions(-)
20 --- a/include/net/mac80211.h
21 +++ b/include/net/mac80211.h
22 @@ -645,6 +645,7 @@ struct ieee80211_fils_discovery {
23 * @csa_active: marks whether a channel switch is going on. Internally it is
24 * write-protected by sdata_lock and local->mtx so holding either is fine
26 + * @csa_punct_bitmap: new puncturing bitmap for channel switch
27 * @mu_mimo_owner: indicates interface owns MU-MIMO capability
28 * @chanctx_conf: The channel context this interface is assigned to, or %NULL
29 * when it is not assigned. This pointer is RCU-protected due to the TX
30 @@ -744,6 +745,8 @@ struct ieee80211_bss_conf {
34 + u16 csa_punct_bitmap;
37 struct ieee80211_chanctx_conf __rcu *chanctx_conf;
39 --- a/net/mac80211/cfg.c
40 +++ b/net/mac80211/cfg.c
41 @@ -1220,7 +1220,7 @@ static int ieee80211_start_ap(struct wip
42 struct ieee80211_local *local = sdata->local;
43 struct beacon_data *old;
44 struct ieee80211_sub_if_data *vlan;
45 - u32 changed = BSS_CHANGED_BEACON_INT |
46 + u64 changed = BSS_CHANGED_BEACON_INT |
47 BSS_CHANGED_BEACON_ENABLED |
50 @@ -1307,6 +1307,11 @@ static int ieee80211_start_ap(struct wip
51 IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO;
54 + if (params->eht_cap) {
55 + link_conf->eht_puncturing = params->punct_bitmap;
56 + changed |= BSS_CHANGED_EHT_PUNCTURING;
59 if (sdata->vif.type == NL80211_IFTYPE_AP &&
60 params->mbssid_config.tx_wdev) {
61 err = ieee80211_set_ap_mbssid_options(sdata,
62 @@ -3559,6 +3564,12 @@ static int __ieee80211_csa_finalize(stru
63 lockdep_assert_held(&local->mtx);
64 lockdep_assert_held(&local->chanctx_mtx);
66 + if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) {
67 + sdata->vif.bss_conf.eht_puncturing =
68 + sdata->vif.bss_conf.csa_punct_bitmap;
69 + changed |= BSS_CHANGED_EHT_PUNCTURING;
73 * using reservation isn't immediate as it may be deferred until later
74 * with multi-vif. once reservation is complete it will re-schedule the
75 @@ -3601,7 +3612,7 @@ static int __ieee80211_csa_finalize(stru
78 cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0,
80 + sdata->vif.bss_conf.eht_puncturing);
84 @@ -3863,9 +3874,13 @@ __ieee80211_channel_switch(struct wiphy
88 + if (params->punct_bitmap && !sdata->vif.bss_conf.eht_support)
91 sdata->deflink.csa_chandef = params->chandef;
92 sdata->deflink.csa_block_tx = params->block_tx;
93 sdata->vif.bss_conf.csa_active = true;
94 + sdata->vif.bss_conf.csa_punct_bitmap = params->punct_bitmap;
96 if (sdata->deflink.csa_block_tx)
97 ieee80211_stop_vif_queues(local, sdata,
98 @@ -3873,7 +3888,8 @@ __ieee80211_channel_switch(struct wiphy
100 cfg80211_ch_switch_started_notify(sdata->dev,
101 &sdata->deflink.csa_chandef, 0,
102 - params->count, params->block_tx, 0);
103 + params->count, params->block_tx,
104 + sdata->vif.bss_conf.csa_punct_bitmap);
107 ieee80211_link_info_change_notify(sdata, &sdata->deflink,