developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 1 | From b5bdd1f773d65d640844f4b8a3e63c25057f1b46 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 8/9] wifi: mac80211: configure puncturing bitmap |
| 5 | |
| 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. |
| 10 | |
| 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> |
| 15 | --- |
| 16 | include/net/mac80211.h | 3 +++ |
| 17 | net/mac80211/cfg.c | 22 +++++++++++++++++++--- |
| 18 | 2 files changed, 22 insertions(+), 3 deletions(-) |
| 19 | |
| 20 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| 21 | index 8fb38c9..c4ff6a3 100644 |
| 22 | --- a/include/net/mac80211.h |
| 23 | +++ b/include/net/mac80211.h |
| 24 | @@ -645,6 +645,7 @@ struct ieee80211_fils_discovery { |
| 25 | * @csa_active: marks whether a channel switch is going on. Internally it is |
| 26 | * write-protected by sdata_lock and local->mtx so holding either is fine |
| 27 | * for read access. |
| 28 | + * @csa_punct_bitmap: new puncturing bitmap for channel switch |
| 29 | * @mu_mimo_owner: indicates interface owns MU-MIMO capability |
| 30 | * @chanctx_conf: The channel context this interface is assigned to, or %NULL |
| 31 | * when it is not assigned. This pointer is RCU-protected due to the TX |
| 32 | @@ -744,6 +745,8 @@ struct ieee80211_bss_conf { |
| 33 | u16 eht_puncturing; |
| 34 | |
| 35 | bool csa_active; |
| 36 | + u16 csa_punct_bitmap; |
| 37 | + |
| 38 | bool mu_mimo_owner; |
| 39 | struct ieee80211_chanctx_conf __rcu *chanctx_conf; |
| 40 | |
| 41 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
| 42 | index 17d1e71..6defc1d 100644 |
| 43 | --- a/net/mac80211/cfg.c |
| 44 | +++ b/net/mac80211/cfg.c |
| 45 | @@ -1220,7 +1220,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, |
| 46 | struct ieee80211_local *local = sdata->local; |
| 47 | struct beacon_data *old; |
| 48 | struct ieee80211_sub_if_data *vlan; |
| 49 | - u32 changed = BSS_CHANGED_BEACON_INT | |
| 50 | + u64 changed = BSS_CHANGED_BEACON_INT | |
| 51 | BSS_CHANGED_BEACON_ENABLED | |
| 52 | BSS_CHANGED_BEACON | |
| 53 | BSS_CHANGED_P2P_PS | |
| 54 | @@ -1307,6 +1307,11 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, |
| 55 | IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO; |
| 56 | } |
| 57 | |
| 58 | + if (params->eht_cap) { |
| 59 | + link_conf->eht_puncturing = params->punct_bitmap; |
| 60 | + changed |= BSS_CHANGED_EHT_PUNCTURING; |
| 61 | + } |
| 62 | + |
| 63 | if (sdata->vif.type == NL80211_IFTYPE_AP && |
| 64 | params->mbssid_config.tx_wdev) { |
| 65 | err = ieee80211_set_ap_mbssid_options(sdata, |
| 66 | @@ -3556,6 +3561,12 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) |
| 67 | lockdep_assert_held(&local->mtx); |
| 68 | lockdep_assert_held(&local->chanctx_mtx); |
| 69 | |
| 70 | + if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) { |
| 71 | + sdata->vif.bss_conf.eht_puncturing = |
| 72 | + sdata->vif.bss_conf.csa_punct_bitmap; |
| 73 | + changed |= BSS_CHANGED_EHT_PUNCTURING; |
| 74 | + } |
| 75 | + |
| 76 | /* |
| 77 | * using reservation isn't immediate as it may be deferred until later |
| 78 | * with multi-vif. once reservation is complete it will re-schedule the |
| 79 | @@ -3598,7 +3609,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) |
| 80 | return err; |
| 81 | |
| 82 | cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0, |
| 83 | - 0); |
| 84 | + sdata->vif.bss_conf.eht_puncturing); |
| 85 | |
| 86 | return 0; |
| 87 | } |
| 88 | @@ -3860,9 +3871,13 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, |
| 89 | goto out; |
| 90 | } |
| 91 | |
| 92 | + if (params->punct_bitmap && !sdata->vif.bss_conf.eht_support) |
| 93 | + goto out; |
| 94 | + |
| 95 | sdata->deflink.csa_chandef = params->chandef; |
| 96 | sdata->deflink.csa_block_tx = params->block_tx; |
| 97 | sdata->vif.bss_conf.csa_active = true; |
| 98 | + sdata->vif.bss_conf.csa_punct_bitmap = params->punct_bitmap; |
| 99 | |
| 100 | if (sdata->deflink.csa_block_tx) |
| 101 | ieee80211_stop_vif_queues(local, sdata, |
| 102 | @@ -3870,7 +3885,8 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, |
| 103 | |
| 104 | cfg80211_ch_switch_started_notify(sdata->dev, |
| 105 | &sdata->deflink.csa_chandef, 0, |
| 106 | - params->count, params->block_tx, 0); |
| 107 | + params->count, params->block_tx, |
| 108 | + sdata->vif.bss_conf.csa_punct_bitmap); |
| 109 | |
| 110 | if (changed) { |
| 111 | ieee80211_link_info_change_notify(sdata, &sdata->deflink, |
| 112 | -- |
| 113 | 2.39.2 |
| 114 | |