1
0

344-v6.3-0003-wifi-cfg80211-include-puncturing-bitmap-in-channel-s.patch 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. From b345f0637c0042f9e6b78378a32256d90f485774 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] wifi: cfg80211: include puncturing bitmap in channel switch
  5. events
  6. Add puncturing bitmap in channel switch notifications
  7. and corresponding trace functions.
  8. Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
  9. Link: https://lore.kernel.org/r/20230131001227.25014-4-quic_alokad@quicinc.com
  10. [fix qtnfmac]
  11. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  12. ---
  13. drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +-
  14. drivers/net/wireless/marvell/mwifiex/11h.c | 2 +-
  15. .../net/wireless/quantenna/qtnfmac/event.c | 2 +-
  16. include/net/cfg80211.h | 6 +++--
  17. net/mac80211/cfg.c | 5 ++--
  18. net/mac80211/mlme.c | 4 ++--
  19. net/wireless/nl80211.c | 20 ++++++++++------
  20. net/wireless/trace.h | 24 ++++++++++++-------
  21. 8 files changed, 41 insertions(+), 24 deletions(-)
  22. --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
  23. +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
  24. @@ -1119,7 +1119,7 @@ void ath6kl_cfg80211_ch_switch_notify(st
  25. NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT);
  26. mutex_lock(&vif->wdev.mtx);
  27. - cfg80211_ch_switch_notify(vif->ndev, &chandef, 0);
  28. + cfg80211_ch_switch_notify(vif->ndev, &chandef, 0, 0);
  29. mutex_unlock(&vif->wdev.mtx);
  30. }
  31. --- a/drivers/net/wireless/marvell/mwifiex/11h.c
  32. +++ b/drivers/net/wireless/marvell/mwifiex/11h.c
  33. @@ -292,6 +292,6 @@ void mwifiex_dfs_chan_sw_work_queue(stru
  34. mwifiex_dbg(priv->adapter, MSG,
  35. "indicating channel switch completion to kernel\n");
  36. mutex_lock(&priv->wdev.mtx);
  37. - cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0);
  38. + cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0, 0);
  39. mutex_unlock(&priv->wdev.mtx);
  40. }
  41. --- a/drivers/net/wireless/quantenna/qtnfmac/event.c
  42. +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c
  43. @@ -478,7 +478,7 @@ qtnf_event_handle_freq_change(struct qtn
  44. continue;
  45. mutex_lock(&vif->wdev.mtx);
  46. - cfg80211_ch_switch_notify(vif->netdev, &chandef, 0);
  47. + cfg80211_ch_switch_notify(vif->netdev, &chandef, 0, 0);
  48. mutex_unlock(&vif->wdev.mtx);
  49. }
  50. --- a/include/net/cfg80211.h
  51. +++ b/include/net/cfg80211.h
  52. @@ -8325,13 +8325,14 @@ bool cfg80211_reg_can_beacon_relax(struc
  53. * @dev: the device which switched channels
  54. * @chandef: the new channel definition
  55. * @link_id: the link ID for MLO, must be 0 for non-MLO
  56. + * @punct_bitmap: the new puncturing bitmap
  57. *
  58. * Caller must acquire wdev_lock, therefore must only be called from sleepable
  59. * driver context!
  60. */
  61. void cfg80211_ch_switch_notify(struct net_device *dev,
  62. struct cfg80211_chan_def *chandef,
  63. - unsigned int link_id);
  64. + unsigned int link_id, u16 punct_bitmap);
  65. /*
  66. * cfg80211_ch_switch_started_notify - notify channel switch start
  67. @@ -8340,6 +8341,7 @@ void cfg80211_ch_switch_notify(struct ne
  68. * @link_id: the link ID for MLO, must be 0 for non-MLO
  69. * @count: the number of TBTTs until the channel switch happens
  70. * @quiet: whether or not immediate quiet was requested by the AP
  71. + * @punct_bitmap: the future puncturing bitmap
  72. *
  73. * Inform the userspace about the channel switch that has just
  74. * started, so that it can take appropriate actions (eg. starting
  75. @@ -8348,7 +8350,7 @@ void cfg80211_ch_switch_notify(struct ne
  76. void cfg80211_ch_switch_started_notify(struct net_device *dev,
  77. struct cfg80211_chan_def *chandef,
  78. unsigned int link_id, u8 count,
  79. - bool quiet);
  80. + bool quiet, u16 punct_bitmap);
  81. /**
  82. * ieee80211_operating_class_to_band - convert operating class to band
  83. --- a/net/mac80211/cfg.c
  84. +++ b/net/mac80211/cfg.c
  85. @@ -3600,7 +3600,8 @@ static int __ieee80211_csa_finalize(stru
  86. if (err)
  87. return err;
  88. - cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0);
  89. + cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0,
  90. + 0);
  91. return 0;
  92. }
  93. @@ -3872,7 +3873,7 @@ __ieee80211_channel_switch(struct wiphy
  94. cfg80211_ch_switch_started_notify(sdata->dev,
  95. &sdata->deflink.csa_chandef, 0,
  96. - params->count, params->block_tx);
  97. + params->count, params->block_tx, 0);
  98. if (changed) {
  99. ieee80211_link_info_change_notify(sdata, &sdata->deflink,
  100. --- a/net/mac80211/mlme.c
  101. +++ b/net/mac80211/mlme.c
  102. @@ -1778,7 +1778,7 @@ static void ieee80211_chswitch_post_beac
  103. return;
  104. }
  105. - cfg80211_ch_switch_notify(sdata->dev, &link->reserved_chandef, 0);
  106. + cfg80211_ch_switch_notify(sdata->dev, &link->reserved_chandef, 0, 0);
  107. }
  108. void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success)
  109. @@ -1988,7 +1988,7 @@ ieee80211_sta_process_chanswitch(struct
  110. mutex_unlock(&local->mtx);
  111. cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, 0,
  112. - csa_ie.count, csa_ie.mode);
  113. + csa_ie.count, csa_ie.mode, 0);
  114. if (local->ops->channel_switch) {
  115. /* use driver's channel switch callback */
  116. --- a/net/wireless/nl80211.c
  117. +++ b/net/wireless/nl80211.c
  118. @@ -18973,7 +18973,7 @@ static void nl80211_ch_switch_notify(str
  119. struct cfg80211_chan_def *chandef,
  120. gfp_t gfp,
  121. enum nl80211_commands notif,
  122. - u8 count, bool quiet)
  123. + u8 count, bool quiet, u16 punct_bitmap)
  124. {
  125. struct wireless_dev *wdev = netdev->ieee80211_ptr;
  126. struct sk_buff *msg;
  127. @@ -19007,6 +19007,9 @@ static void nl80211_ch_switch_notify(str
  128. goto nla_put_failure;
  129. }
  130. + if (nla_put_u32(msg, NL80211_ATTR_PUNCT_BITMAP, punct_bitmap))
  131. + goto nla_put_failure;
  132. +
  133. genlmsg_end(msg, hdr);
  134. genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
  135. @@ -19019,7 +19022,7 @@ static void nl80211_ch_switch_notify(str
  136. void cfg80211_ch_switch_notify(struct net_device *dev,
  137. struct cfg80211_chan_def *chandef,
  138. - unsigned int link_id)
  139. + unsigned int link_id, u16 punct_bitmap)
  140. {
  141. struct wireless_dev *wdev = dev->ieee80211_ptr;
  142. struct wiphy *wiphy = wdev->wiphy;
  143. @@ -19028,7 +19031,7 @@ void cfg80211_ch_switch_notify(struct ne
  144. ASSERT_WDEV_LOCK(wdev);
  145. WARN_INVALID_LINK_ID(wdev, link_id);
  146. - trace_cfg80211_ch_switch_notify(dev, chandef, link_id);
  147. + trace_cfg80211_ch_switch_notify(dev, chandef, link_id, punct_bitmap);
  148. switch (wdev->iftype) {
  149. case NL80211_IFTYPE_STATION:
  150. @@ -19056,14 +19059,15 @@ void cfg80211_ch_switch_notify(struct ne
  151. cfg80211_sched_dfs_chan_update(rdev);
  152. nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
  153. - NL80211_CMD_CH_SWITCH_NOTIFY, 0, false);
  154. + NL80211_CMD_CH_SWITCH_NOTIFY, 0, false,
  155. + punct_bitmap);
  156. }
  157. EXPORT_SYMBOL(cfg80211_ch_switch_notify);
  158. void cfg80211_ch_switch_started_notify(struct net_device *dev,
  159. struct cfg80211_chan_def *chandef,
  160. unsigned int link_id, u8 count,
  161. - bool quiet)
  162. + bool quiet, u16 punct_bitmap)
  163. {
  164. struct wireless_dev *wdev = dev->ieee80211_ptr;
  165. struct wiphy *wiphy = wdev->wiphy;
  166. @@ -19072,11 +19076,13 @@ void cfg80211_ch_switch_started_notify(s
  167. ASSERT_WDEV_LOCK(wdev);
  168. WARN_INVALID_LINK_ID(wdev, link_id);
  169. - trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id);
  170. + trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id,
  171. + punct_bitmap);
  172. +
  173. nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
  174. NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
  175. - count, quiet);
  176. + count, quiet, punct_bitmap);
  177. }
  178. EXPORT_SYMBOL(cfg80211_ch_switch_started_notify);
  179. --- a/net/wireless/trace.h
  180. +++ b/net/wireless/trace.h
  181. @@ -3245,39 +3245,47 @@ TRACE_EVENT(cfg80211_chandef_dfs_require
  182. TRACE_EVENT(cfg80211_ch_switch_notify,
  183. TP_PROTO(struct net_device *netdev,
  184. struct cfg80211_chan_def *chandef,
  185. - unsigned int link_id),
  186. - TP_ARGS(netdev, chandef, link_id),
  187. + unsigned int link_id,
  188. + u16 punct_bitmap),
  189. + TP_ARGS(netdev, chandef, link_id, punct_bitmap),
  190. TP_STRUCT__entry(
  191. NETDEV_ENTRY
  192. CHAN_DEF_ENTRY
  193. __field(unsigned int, link_id)
  194. + __field(u16, punct_bitmap)
  195. ),
  196. TP_fast_assign(
  197. NETDEV_ASSIGN;
  198. CHAN_DEF_ASSIGN(chandef);
  199. __entry->link_id = link_id;
  200. + __entry->punct_bitmap = punct_bitmap;
  201. ),
  202. - TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d",
  203. - NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id)
  204. + TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u",
  205. + NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id,
  206. + __entry->punct_bitmap)
  207. );
  208. TRACE_EVENT(cfg80211_ch_switch_started_notify,
  209. TP_PROTO(struct net_device *netdev,
  210. struct cfg80211_chan_def *chandef,
  211. - unsigned int link_id),
  212. - TP_ARGS(netdev, chandef, link_id),
  213. + unsigned int link_id,
  214. + u16 punct_bitmap),
  215. + TP_ARGS(netdev, chandef, link_id, punct_bitmap),
  216. TP_STRUCT__entry(
  217. NETDEV_ENTRY
  218. CHAN_DEF_ENTRY
  219. __field(unsigned int, link_id)
  220. + __field(u16, punct_bitmap)
  221. ),
  222. TP_fast_assign(
  223. NETDEV_ASSIGN;
  224. CHAN_DEF_ASSIGN(chandef);
  225. __entry->link_id = link_id;
  226. + __entry->punct_bitmap = punct_bitmap;
  227. ),
  228. - TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d",
  229. - NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id)
  230. + TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u",
  231. + NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id,
  232. + __entry->punct_bitmap)
  233. );
  234. TRACE_EVENT(cfg80211_radar_event,