developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 1 | From a0306fbf2adb7074815390d6adbe58fb72533556 Mon Sep 17 00:00:00 2001 |
| 2 | From: Aloka Dixit <quic_alokad@quicinc.com> |
| 3 | Date: Mon, 30 Jan 2023 16:12:26 -0800 |
| 4 | Subject: [PATCH 7/9] wifi: cfg80211: include puncturing bitmap in channel |
| 5 | switch events |
| 6 | |
| 7 | Add puncturing bitmap in channel switch notifications |
| 8 | and corresponding trace functions. |
| 9 | |
| 10 | Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com> |
| 11 | Link: https://lore.kernel.org/r/20230131001227.25014-4-quic_alokad@quicinc.com |
| 12 | [fix qtnfmac] |
| 13 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| 14 | --- |
| 15 | drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- |
| 16 | drivers/net/wireless/marvell/mwifiex/11h.c | 2 +- |
| 17 | .../net/wireless/quantenna/qtnfmac/event.c | 2 +- |
| 18 | include/net/cfg80211.h | 6 +++-- |
| 19 | net/mac80211/cfg.c | 5 ++-- |
| 20 | net/mac80211/mlme.c | 4 ++-- |
| 21 | net/wireless/nl80211.c | 20 ++++++++++------ |
| 22 | net/wireless/trace.h | 24 ++++++++++++------- |
| 23 | 8 files changed, 41 insertions(+), 24 deletions(-) |
| 24 | |
| 25 | diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c |
| 26 | index 07de0bd..576c449 100644 |
| 27 | --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c |
| 28 | +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c |
| 29 | @@ -1119,7 +1119,7 @@ void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq, |
| 30 | NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT); |
| 31 | |
| 32 | mutex_lock(&vif->wdev.mtx); |
| 33 | - cfg80211_ch_switch_notify(vif->ndev, &chandef, 0); |
| 34 | + cfg80211_ch_switch_notify(vif->ndev, &chandef, 0, 0); |
| 35 | mutex_unlock(&vif->wdev.mtx); |
| 36 | } |
| 37 | |
| 38 | diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c |
| 39 | index 6a9d7bc..b0c40a7 100644 |
| 40 | --- a/drivers/net/wireless/marvell/mwifiex/11h.c |
| 41 | +++ b/drivers/net/wireless/marvell/mwifiex/11h.c |
| 42 | @@ -292,6 +292,6 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work) |
| 43 | mwifiex_dbg(priv->adapter, MSG, |
| 44 | "indicating channel switch completion to kernel\n"); |
| 45 | mutex_lock(&priv->wdev.mtx); |
| 46 | - cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0); |
| 47 | + cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0, 0); |
| 48 | mutex_unlock(&priv->wdev.mtx); |
| 49 | } |
| 50 | diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c |
| 51 | index 4fafe37..0e336ff 100644 |
| 52 | --- a/drivers/net/wireless/quantenna/qtnfmac/event.c |
| 53 | +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c |
| 54 | @@ -478,7 +478,7 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac, |
| 55 | continue; |
| 56 | |
| 57 | mutex_lock(&vif->wdev.mtx); |
| 58 | - cfg80211_ch_switch_notify(vif->netdev, &chandef, 0); |
| 59 | + cfg80211_ch_switch_notify(vif->netdev, &chandef, 0, 0); |
| 60 | mutex_unlock(&vif->wdev.mtx); |
| 61 | } |
| 62 | |
| 63 | diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
| 64 | index 9c65eda..8d72357 100644 |
| 65 | --- a/include/net/cfg80211.h |
| 66 | +++ b/include/net/cfg80211.h |
| 67 | @@ -8322,13 +8322,14 @@ bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, |
| 68 | * @dev: the device which switched channels |
| 69 | * @chandef: the new channel definition |
| 70 | * @link_id: the link ID for MLO, must be 0 for non-MLO |
| 71 | + * @punct_bitmap: the new puncturing bitmap |
| 72 | * |
| 73 | * Caller must acquire wdev_lock, therefore must only be called from sleepable |
| 74 | * driver context! |
| 75 | */ |
| 76 | void cfg80211_ch_switch_notify(struct net_device *dev, |
| 77 | struct cfg80211_chan_def *chandef, |
| 78 | - unsigned int link_id); |
| 79 | + unsigned int link_id, u16 punct_bitmap); |
| 80 | |
| 81 | /* |
| 82 | * cfg80211_ch_switch_started_notify - notify channel switch start |
| 83 | @@ -8337,6 +8338,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| 84 | * @link_id: the link ID for MLO, must be 0 for non-MLO |
| 85 | * @count: the number of TBTTs until the channel switch happens |
| 86 | * @quiet: whether or not immediate quiet was requested by the AP |
| 87 | + * @punct_bitmap: the future puncturing bitmap |
| 88 | * |
| 89 | * Inform the userspace about the channel switch that has just |
| 90 | * started, so that it can take appropriate actions (eg. starting |
| 91 | @@ -8345,7 +8347,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| 92 | void cfg80211_ch_switch_started_notify(struct net_device *dev, |
| 93 | struct cfg80211_chan_def *chandef, |
| 94 | unsigned int link_id, u8 count, |
| 95 | - bool quiet); |
| 96 | + bool quiet, u16 punct_bitmap); |
| 97 | |
| 98 | /** |
| 99 | * ieee80211_operating_class_to_band - convert operating class to band |
| 100 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
| 101 | index 5bb43de..17d1e71 100644 |
| 102 | --- a/net/mac80211/cfg.c |
| 103 | +++ b/net/mac80211/cfg.c |
| 104 | @@ -3597,7 +3597,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) |
| 105 | if (err) |
| 106 | return err; |
| 107 | |
| 108 | - cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0); |
| 109 | + cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0, |
| 110 | + 0); |
| 111 | |
| 112 | return 0; |
| 113 | } |
| 114 | @@ -3869,7 +3870,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, |
| 115 | |
| 116 | cfg80211_ch_switch_started_notify(sdata->dev, |
| 117 | &sdata->deflink.csa_chandef, 0, |
| 118 | - params->count, params->block_tx); |
| 119 | + params->count, params->block_tx, 0); |
| 120 | |
| 121 | if (changed) { |
| 122 | ieee80211_link_info_change_notify(sdata, &sdata->deflink, |
| 123 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
| 124 | index 2716ae0..d63434b 100644 |
| 125 | --- a/net/mac80211/mlme.c |
| 126 | +++ b/net/mac80211/mlme.c |
| 127 | @@ -1778,7 +1778,7 @@ static void ieee80211_chswitch_post_beacon(struct ieee80211_link_data *link) |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | - cfg80211_ch_switch_notify(sdata->dev, &link->reserved_chandef, 0); |
| 132 | + cfg80211_ch_switch_notify(sdata->dev, &link->reserved_chandef, 0, 0); |
| 133 | } |
| 134 | |
| 135 | void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success) |
| 136 | @@ -1988,7 +1988,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, |
| 137 | mutex_unlock(&local->mtx); |
| 138 | |
| 139 | cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, 0, |
| 140 | - csa_ie.count, csa_ie.mode); |
| 141 | + csa_ie.count, csa_ie.mode, 0); |
| 142 | |
| 143 | if (local->ops->channel_switch) { |
| 144 | /* use driver's channel switch callback */ |
| 145 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
| 146 | index 4cc095d..f3b2fc4 100644 |
| 147 | --- a/net/wireless/nl80211.c |
| 148 | +++ b/net/wireless/nl80211.c |
| 149 | @@ -18973,7 +18973,7 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
| 150 | struct cfg80211_chan_def *chandef, |
| 151 | gfp_t gfp, |
| 152 | enum nl80211_commands notif, |
| 153 | - u8 count, bool quiet) |
| 154 | + u8 count, bool quiet, u16 punct_bitmap) |
| 155 | { |
| 156 | struct wireless_dev *wdev = netdev->ieee80211_ptr; |
| 157 | struct sk_buff *msg; |
| 158 | @@ -19007,6 +19007,9 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
| 159 | goto nla_put_failure; |
| 160 | } |
| 161 | |
| 162 | + if (nla_put_u32(msg, NL80211_ATTR_PUNCT_BITMAP, punct_bitmap)) |
| 163 | + goto nla_put_failure; |
| 164 | + |
| 165 | genlmsg_end(msg, hdr); |
| 166 | |
| 167 | genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, |
| 168 | @@ -19019,7 +19022,7 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
| 169 | |
| 170 | void cfg80211_ch_switch_notify(struct net_device *dev, |
| 171 | struct cfg80211_chan_def *chandef, |
| 172 | - unsigned int link_id) |
| 173 | + unsigned int link_id, u16 punct_bitmap) |
| 174 | { |
| 175 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 176 | struct wiphy *wiphy = wdev->wiphy; |
| 177 | @@ -19028,7 +19031,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| 178 | ASSERT_WDEV_LOCK(wdev); |
| 179 | WARN_INVALID_LINK_ID(wdev, link_id); |
| 180 | |
| 181 | - trace_cfg80211_ch_switch_notify(dev, chandef, link_id); |
| 182 | + trace_cfg80211_ch_switch_notify(dev, chandef, link_id, punct_bitmap); |
| 183 | |
| 184 | switch (wdev->iftype) { |
| 185 | case NL80211_IFTYPE_STATION: |
| 186 | @@ -19056,14 +19059,15 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
| 187 | cfg80211_sched_dfs_chan_update(rdev); |
| 188 | |
| 189 | nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL, |
| 190 | - NL80211_CMD_CH_SWITCH_NOTIFY, 0, false); |
| 191 | + NL80211_CMD_CH_SWITCH_NOTIFY, 0, false, |
| 192 | + punct_bitmap); |
| 193 | } |
| 194 | EXPORT_SYMBOL(cfg80211_ch_switch_notify); |
| 195 | |
| 196 | void cfg80211_ch_switch_started_notify(struct net_device *dev, |
| 197 | struct cfg80211_chan_def *chandef, |
| 198 | unsigned int link_id, u8 count, |
| 199 | - bool quiet) |
| 200 | + bool quiet, u16 punct_bitmap) |
| 201 | { |
| 202 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 203 | struct wiphy *wiphy = wdev->wiphy; |
| 204 | @@ -19072,11 +19076,13 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev, |
| 205 | ASSERT_WDEV_LOCK(wdev); |
| 206 | WARN_INVALID_LINK_ID(wdev, link_id); |
| 207 | |
| 208 | - trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id); |
| 209 | + trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id, |
| 210 | + punct_bitmap); |
| 211 | + |
| 212 | |
| 213 | nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL, |
| 214 | NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, |
| 215 | - count, quiet); |
| 216 | + count, quiet, punct_bitmap); |
| 217 | } |
| 218 | EXPORT_SYMBOL(cfg80211_ch_switch_started_notify); |
| 219 | |
| 220 | diff --git a/net/wireless/trace.h b/net/wireless/trace.h |
| 221 | index 8e7c00f..4a7d0ae 100644 |
| 222 | --- a/net/wireless/trace.h |
| 223 | +++ b/net/wireless/trace.h |
| 224 | @@ -3245,39 +3245,47 @@ TRACE_EVENT(cfg80211_chandef_dfs_required, |
| 225 | TRACE_EVENT(cfg80211_ch_switch_notify, |
| 226 | TP_PROTO(struct net_device *netdev, |
| 227 | struct cfg80211_chan_def *chandef, |
| 228 | - unsigned int link_id), |
| 229 | - TP_ARGS(netdev, chandef, link_id), |
| 230 | + unsigned int link_id, |
| 231 | + u16 punct_bitmap), |
| 232 | + TP_ARGS(netdev, chandef, link_id, punct_bitmap), |
| 233 | TP_STRUCT__entry( |
| 234 | NETDEV_ENTRY |
| 235 | CHAN_DEF_ENTRY |
| 236 | __field(unsigned int, link_id) |
| 237 | + __field(u16, punct_bitmap) |
| 238 | ), |
| 239 | TP_fast_assign( |
| 240 | NETDEV_ASSIGN; |
| 241 | CHAN_DEF_ASSIGN(chandef); |
| 242 | __entry->link_id = link_id; |
| 243 | + __entry->punct_bitmap = punct_bitmap; |
| 244 | ), |
| 245 | - TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d", |
| 246 | - NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id) |
| 247 | + TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u", |
| 248 | + NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id, |
| 249 | + __entry->punct_bitmap) |
| 250 | ); |
| 251 | |
| 252 | TRACE_EVENT(cfg80211_ch_switch_started_notify, |
| 253 | TP_PROTO(struct net_device *netdev, |
| 254 | struct cfg80211_chan_def *chandef, |
| 255 | - unsigned int link_id), |
| 256 | - TP_ARGS(netdev, chandef, link_id), |
| 257 | + unsigned int link_id, |
| 258 | + u16 punct_bitmap), |
| 259 | + TP_ARGS(netdev, chandef, link_id, punct_bitmap), |
| 260 | TP_STRUCT__entry( |
| 261 | NETDEV_ENTRY |
| 262 | CHAN_DEF_ENTRY |
| 263 | __field(unsigned int, link_id) |
| 264 | + __field(u16, punct_bitmap) |
| 265 | ), |
| 266 | TP_fast_assign( |
| 267 | NETDEV_ASSIGN; |
| 268 | CHAN_DEF_ASSIGN(chandef); |
| 269 | __entry->link_id = link_id; |
| 270 | + __entry->punct_bitmap = punct_bitmap; |
| 271 | ), |
| 272 | - TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d", |
| 273 | - NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id) |
| 274 | + TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u", |
| 275 | + NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id, |
| 276 | + __entry->punct_bitmap) |
| 277 | ); |
| 278 | |
| 279 | TRACE_EVENT(cfg80211_radar_event, |
| 280 | -- |
| 281 | 2.39.2 |
| 282 | |