| From a0306fbf2adb7074815390d6adbe58fb72533556 Mon Sep 17 00:00:00 2001 |
| From: Aloka Dixit <quic_alokad@quicinc.com> |
| Date: Mon, 30 Jan 2023 16:12:26 -0800 |
| Subject: [PATCH 7/9] wifi: cfg80211: include puncturing bitmap in channel |
| switch events |
| |
| Add puncturing bitmap in channel switch notifications |
| and corresponding trace functions. |
| |
| Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com> |
| Link: https://lore.kernel.org/r/20230131001227.25014-4-quic_alokad@quicinc.com |
| [fix qtnfmac] |
| Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| --- |
| drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- |
| drivers/net/wireless/marvell/mwifiex/11h.c | 2 +- |
| .../net/wireless/quantenna/qtnfmac/event.c | 2 +- |
| include/net/cfg80211.h | 6 +++-- |
| net/mac80211/cfg.c | 5 ++-- |
| net/mac80211/mlme.c | 4 ++-- |
| net/wireless/nl80211.c | 20 ++++++++++------ |
| net/wireless/trace.h | 24 ++++++++++++------- |
| 8 files changed, 41 insertions(+), 24 deletions(-) |
| |
| diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c |
| index 07de0bd..576c449 100644 |
| --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c |
| +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c |
| @@ -1119,7 +1119,7 @@ void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq, |
| NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT); |
| |
| mutex_lock(&vif->wdev.mtx); |
| - cfg80211_ch_switch_notify(vif->ndev, &chandef, 0); |
| + cfg80211_ch_switch_notify(vif->ndev, &chandef, 0, 0); |
| mutex_unlock(&vif->wdev.mtx); |
| } |
| |
| diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c |
| index 6a9d7bc..b0c40a7 100644 |
| --- a/drivers/net/wireless/marvell/mwifiex/11h.c |
| +++ b/drivers/net/wireless/marvell/mwifiex/11h.c |
| @@ -292,6 +292,6 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work) |
| mwifiex_dbg(priv->adapter, MSG, |
| "indicating channel switch completion to kernel\n"); |
| mutex_lock(&priv->wdev.mtx); |
| - cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0); |
| + cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0, 0); |
| mutex_unlock(&priv->wdev.mtx); |
| } |
| diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c |
| index 4fafe37..0e336ff 100644 |
| --- a/drivers/net/wireless/quantenna/qtnfmac/event.c |
| +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c |
| @@ -478,7 +478,7 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac, |
| continue; |
| |
| mutex_lock(&vif->wdev.mtx); |
| - cfg80211_ch_switch_notify(vif->netdev, &chandef, 0); |
| + cfg80211_ch_switch_notify(vif->netdev, &chandef, 0, 0); |
| mutex_unlock(&vif->wdev.mtx); |
| } |
| |
| diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
| index 9c65eda..8d72357 100644 |
| --- a/include/net/cfg80211.h |
| +++ b/include/net/cfg80211.h |
| @@ -8322,13 +8322,14 @@ bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, |
| * @dev: the device which switched channels |
| * @chandef: the new channel definition |
| * @link_id: the link ID for MLO, must be 0 for non-MLO |
| + * @punct_bitmap: the new puncturing bitmap |
| * |
| * Caller must acquire wdev_lock, therefore must only be called from sleepable |
| * driver context! |
| */ |
| void cfg80211_ch_switch_notify(struct net_device *dev, |
| struct cfg80211_chan_def *chandef, |
| - unsigned int link_id); |
| + unsigned int link_id, u16 punct_bitmap); |
| |
| /* |
| * cfg80211_ch_switch_started_notify - notify channel switch start |
| @@ -8337,6 +8338,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| * @link_id: the link ID for MLO, must be 0 for non-MLO |
| * @count: the number of TBTTs until the channel switch happens |
| * @quiet: whether or not immediate quiet was requested by the AP |
| + * @punct_bitmap: the future puncturing bitmap |
| * |
| * Inform the userspace about the channel switch that has just |
| * started, so that it can take appropriate actions (eg. starting |
| @@ -8345,7 +8347,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| void cfg80211_ch_switch_started_notify(struct net_device *dev, |
| struct cfg80211_chan_def *chandef, |
| unsigned int link_id, u8 count, |
| - bool quiet); |
| + bool quiet, u16 punct_bitmap); |
| |
| /** |
| * ieee80211_operating_class_to_band - convert operating class to band |
| diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
| index 5bb43de..17d1e71 100644 |
| --- a/net/mac80211/cfg.c |
| +++ b/net/mac80211/cfg.c |
| @@ -3597,7 +3597,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) |
| if (err) |
| return err; |
| |
| - cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0); |
| + cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0, |
| + 0); |
| |
| return 0; |
| } |
| @@ -3869,7 +3870,7 @@ __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); |
| + params->count, params->block_tx, 0); |
| |
| if (changed) { |
| ieee80211_link_info_change_notify(sdata, &sdata->deflink, |
| diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
| index 2716ae0..d63434b 100644 |
| --- a/net/mac80211/mlme.c |
| +++ b/net/mac80211/mlme.c |
| @@ -1778,7 +1778,7 @@ static void ieee80211_chswitch_post_beacon(struct ieee80211_link_data *link) |
| return; |
| } |
| |
| - cfg80211_ch_switch_notify(sdata->dev, &link->reserved_chandef, 0); |
| + cfg80211_ch_switch_notify(sdata->dev, &link->reserved_chandef, 0, 0); |
| } |
| |
| void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success) |
| @@ -1988,7 +1988,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, |
| mutex_unlock(&local->mtx); |
| |
| cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, 0, |
| - csa_ie.count, csa_ie.mode); |
| + csa_ie.count, csa_ie.mode, 0); |
| |
| if (local->ops->channel_switch) { |
| /* use driver's channel switch callback */ |
| diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
| index 4cc095d..f3b2fc4 100644 |
| --- a/net/wireless/nl80211.c |
| +++ b/net/wireless/nl80211.c |
| @@ -18973,7 +18973,7 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
| struct cfg80211_chan_def *chandef, |
| gfp_t gfp, |
| enum nl80211_commands notif, |
| - u8 count, bool quiet) |
| + u8 count, bool quiet, u16 punct_bitmap) |
| { |
| struct wireless_dev *wdev = netdev->ieee80211_ptr; |
| struct sk_buff *msg; |
| @@ -19007,6 +19007,9 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
| goto nla_put_failure; |
| } |
| |
| + if (nla_put_u32(msg, NL80211_ATTR_PUNCT_BITMAP, punct_bitmap)) |
| + goto nla_put_failure; |
| + |
| genlmsg_end(msg, hdr); |
| |
| genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, |
| @@ -19019,7 +19022,7 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
| |
| void cfg80211_ch_switch_notify(struct net_device *dev, |
| struct cfg80211_chan_def *chandef, |
| - unsigned int link_id) |
| + unsigned int link_id, u16 punct_bitmap) |
| { |
| struct wireless_dev *wdev = dev->ieee80211_ptr; |
| struct wiphy *wiphy = wdev->wiphy; |
| @@ -19028,7 +19031,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| ASSERT_WDEV_LOCK(wdev); |
| WARN_INVALID_LINK_ID(wdev, link_id); |
| |
| - trace_cfg80211_ch_switch_notify(dev, chandef, link_id); |
| + trace_cfg80211_ch_switch_notify(dev, chandef, link_id, punct_bitmap); |
| |
| switch (wdev->iftype) { |
| case NL80211_IFTYPE_STATION: |
| @@ -19056,14 +19059,15 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| cfg80211_sched_dfs_chan_update(rdev); |
| |
| nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL, |
| - NL80211_CMD_CH_SWITCH_NOTIFY, 0, false); |
| + NL80211_CMD_CH_SWITCH_NOTIFY, 0, false, |
| + punct_bitmap); |
| } |
| EXPORT_SYMBOL(cfg80211_ch_switch_notify); |
| |
| void cfg80211_ch_switch_started_notify(struct net_device *dev, |
| struct cfg80211_chan_def *chandef, |
| unsigned int link_id, u8 count, |
| - bool quiet) |
| + bool quiet, u16 punct_bitmap) |
| { |
| struct wireless_dev *wdev = dev->ieee80211_ptr; |
| struct wiphy *wiphy = wdev->wiphy; |
| @@ -19072,11 +19076,13 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev, |
| ASSERT_WDEV_LOCK(wdev); |
| WARN_INVALID_LINK_ID(wdev, link_id); |
| |
| - trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id); |
| + trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id, |
| + punct_bitmap); |
| + |
| |
| nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL, |
| NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, |
| - count, quiet); |
| + count, quiet, punct_bitmap); |
| } |
| EXPORT_SYMBOL(cfg80211_ch_switch_started_notify); |
| |
| diff --git a/net/wireless/trace.h b/net/wireless/trace.h |
| index 8e7c00f..4a7d0ae 100644 |
| --- a/net/wireless/trace.h |
| +++ b/net/wireless/trace.h |
| @@ -3245,39 +3245,47 @@ TRACE_EVENT(cfg80211_chandef_dfs_required, |
| TRACE_EVENT(cfg80211_ch_switch_notify, |
| TP_PROTO(struct net_device *netdev, |
| struct cfg80211_chan_def *chandef, |
| - unsigned int link_id), |
| - TP_ARGS(netdev, chandef, link_id), |
| + unsigned int link_id, |
| + u16 punct_bitmap), |
| + TP_ARGS(netdev, chandef, link_id, punct_bitmap), |
| TP_STRUCT__entry( |
| NETDEV_ENTRY |
| CHAN_DEF_ENTRY |
| __field(unsigned int, link_id) |
| + __field(u16, punct_bitmap) |
| ), |
| TP_fast_assign( |
| NETDEV_ASSIGN; |
| CHAN_DEF_ASSIGN(chandef); |
| __entry->link_id = link_id; |
| + __entry->punct_bitmap = punct_bitmap; |
| ), |
| - TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d", |
| - NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id) |
| + TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u", |
| + NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id, |
| + __entry->punct_bitmap) |
| ); |
| |
| TRACE_EVENT(cfg80211_ch_switch_started_notify, |
| TP_PROTO(struct net_device *netdev, |
| struct cfg80211_chan_def *chandef, |
| - unsigned int link_id), |
| - TP_ARGS(netdev, chandef, link_id), |
| + unsigned int link_id, |
| + u16 punct_bitmap), |
| + TP_ARGS(netdev, chandef, link_id, punct_bitmap), |
| TP_STRUCT__entry( |
| NETDEV_ENTRY |
| CHAN_DEF_ENTRY |
| __field(unsigned int, link_id) |
| + __field(u16, punct_bitmap) |
| ), |
| TP_fast_assign( |
| NETDEV_ASSIGN; |
| CHAN_DEF_ASSIGN(chandef); |
| __entry->link_id = link_id; |
| + __entry->punct_bitmap = punct_bitmap; |
| ), |
| - TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d", |
| - NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id) |
| + TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u", |
| + NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id, |
| + __entry->punct_bitmap) |
| ); |
| |
| TRACE_EVENT(cfg80211_radar_event, |
| -- |
| 2.39.2 |
| |