| From b5bdd1f773d65d640844f4b8a3e63c25057f1b46 Mon Sep 17 00:00:00 2001 |
| From: Aloka Dixit <quic_alokad@quicinc.com> |
| Date: Mon, 30 Jan 2023 16:12:27 -0800 |
| Subject: [PATCH 8/9] wifi: mac80211: configure puncturing bitmap |
| |
| - Configure the bitmap in link_conf and notify the driver. |
| - Modify 'change' in ieee80211_start_ap() from u32 to u64 to support |
| BSS_CHANGED_EHT_PUNCTURING. |
| - Propagate the bitmap in channel switch events to userspace. |
| |
| Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com> |
| Signed-off-by: Muna Sinada <quic_msinada@quicinc.com> |
| Link: https://lore.kernel.org/r/20230131001227.25014-5-quic_alokad@quicinc.com |
| Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| --- |
| include/net/mac80211.h | 3 +++ |
| net/mac80211/cfg.c | 22 +++++++++++++++++++--- |
| 2 files changed, 22 insertions(+), 3 deletions(-) |
| |
| diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| index 8fb38c9..c4ff6a3 100644 |
| --- a/include/net/mac80211.h |
| +++ b/include/net/mac80211.h |
| @@ -645,6 +645,7 @@ struct ieee80211_fils_discovery { |
| * @csa_active: marks whether a channel switch is going on. Internally it is |
| * write-protected by sdata_lock and local->mtx so holding either is fine |
| * for read access. |
| + * @csa_punct_bitmap: new puncturing bitmap for channel switch |
| * @mu_mimo_owner: indicates interface owns MU-MIMO capability |
| * @chanctx_conf: The channel context this interface is assigned to, or %NULL |
| * when it is not assigned. This pointer is RCU-protected due to the TX |
| @@ -744,6 +745,8 @@ struct ieee80211_bss_conf { |
| u16 eht_puncturing; |
| |
| bool csa_active; |
| + u16 csa_punct_bitmap; |
| + |
| bool mu_mimo_owner; |
| struct ieee80211_chanctx_conf __rcu *chanctx_conf; |
| |
| diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
| index 17d1e71..6defc1d 100644 |
| --- a/net/mac80211/cfg.c |
| +++ b/net/mac80211/cfg.c |
| @@ -1220,7 +1220,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, |
| struct ieee80211_local *local = sdata->local; |
| struct beacon_data *old; |
| struct ieee80211_sub_if_data *vlan; |
| - u32 changed = BSS_CHANGED_BEACON_INT | |
| + u64 changed = BSS_CHANGED_BEACON_INT | |
| BSS_CHANGED_BEACON_ENABLED | |
| BSS_CHANGED_BEACON | |
| BSS_CHANGED_P2P_PS | |
| @@ -1307,6 +1307,11 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, |
| IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO; |
| } |
| |
| + if (params->eht_cap) { |
| + link_conf->eht_puncturing = params->punct_bitmap; |
| + changed |= BSS_CHANGED_EHT_PUNCTURING; |
| + } |
| + |
| if (sdata->vif.type == NL80211_IFTYPE_AP && |
| params->mbssid_config.tx_wdev) { |
| err = ieee80211_set_ap_mbssid_options(sdata, |
| @@ -3556,6 +3561,12 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) |
| lockdep_assert_held(&local->mtx); |
| lockdep_assert_held(&local->chanctx_mtx); |
| |
| + if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) { |
| + sdata->vif.bss_conf.eht_puncturing = |
| + sdata->vif.bss_conf.csa_punct_bitmap; |
| + changed |= BSS_CHANGED_EHT_PUNCTURING; |
| + } |
| + |
| /* |
| * using reservation isn't immediate as it may be deferred until later |
| * with multi-vif. once reservation is complete it will re-schedule the |
| @@ -3598,7 +3609,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) |
| return err; |
| |
| cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0, |
| - 0); |
| + sdata->vif.bss_conf.eht_puncturing); |
| |
| return 0; |
| } |
| @@ -3860,9 +3871,13 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, |
| goto out; |
| } |
| |
| + if (params->punct_bitmap && !sdata->vif.bss_conf.eht_support) |
| + goto out; |
| + |
| sdata->deflink.csa_chandef = params->chandef; |
| sdata->deflink.csa_block_tx = params->block_tx; |
| sdata->vif.bss_conf.csa_active = true; |
| + sdata->vif.bss_conf.csa_punct_bitmap = params->punct_bitmap; |
| |
| if (sdata->deflink.csa_block_tx) |
| ieee80211_stop_vif_queues(local, sdata, |
| @@ -3870,7 +3885,8 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, |
| |
| cfg80211_ch_switch_started_notify(sdata->dev, |
| &sdata->deflink.csa_chandef, 0, |
| - params->count, params->block_tx, 0); |
| + params->count, params->block_tx, |
| + sdata->vif.bss_conf.csa_punct_bitmap); |
| |
| if (changed) { |
| ieee80211_link_info_change_notify(sdata, &sdata->deflink, |
| -- |
| 2.39.2 |
| |