003-02-v6.9-wifi-rtl8xxxu-enable-channel-switch-support.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. From ece90a8622320bf5a24d3326da1f8e109891573c Mon Sep 17 00:00:00 2001
  2. From: Martin Kaistra <[email protected]>
  3. Date: Thu, 11 Jan 2024 17:36:28 +0100
  4. Subject: [PATCH 2/2] wifi: rtl8xxxu: enable channel switch support
  5. The CSA countdown in the beacon frames, which are sent out by firmware,
  6. needs to get updated by the driver. To achieve this, convert
  7. update_beacon_work to delayed_work and schedule it with the beacon
  8. interval in case CSA is active and the countdown is not complete.
  9. Signed-off-by: Martin Kaistra <[email protected]>
  10. Reviewed-by: Ping-Ke Shih <[email protected]>
  11. Signed-off-by: Kalle Valo <[email protected]>
  12. Link: https://msgid.link/[email protected]
  13. ---
  14. .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +-
  15. .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++++++----
  16. 2 files changed, 16 insertions(+), 5 deletions(-)
  17. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
  18. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
  19. @@ -1900,7 +1900,7 @@ struct rtl8xxxu_priv {
  20. struct delayed_work ra_watchdog;
  21. struct work_struct c2hcmd_work;
  22. struct sk_buff_head c2hcmd_queue;
  23. - struct work_struct update_beacon_work;
  24. + struct delayed_work update_beacon_work;
  25. struct rtl8xxxu_btcoex bt_coex;
  26. struct rtl8xxxu_ra_report ra_report;
  27. struct rtl8xxxu_cfo_tracking cfo_tracking;
  28. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
  29. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
  30. @@ -4605,7 +4605,7 @@ static int rtl8xxxu_set_tim(struct ieee8
  31. {
  32. struct rtl8xxxu_priv *priv = hw->priv;
  33. - schedule_work(&priv->update_beacon_work);
  34. + schedule_delayed_work(&priv->update_beacon_work, 0);
  35. return 0;
  36. }
  37. @@ -5107,7 +5107,7 @@ rtl8xxxu_bss_info_changed(struct ieee802
  38. }
  39. if (changed & BSS_CHANGED_BEACON)
  40. - schedule_work(&priv->update_beacon_work);
  41. + schedule_delayed_work(&priv->update_beacon_work, 0);
  42. error:
  43. return;
  44. @@ -5726,7 +5726,7 @@ static void rtl8xxxu_send_beacon_frame(s
  45. static void rtl8xxxu_update_beacon_work_callback(struct work_struct *work)
  46. {
  47. struct rtl8xxxu_priv *priv =
  48. - container_of(work, struct rtl8xxxu_priv, update_beacon_work);
  49. + container_of(work, struct rtl8xxxu_priv, update_beacon_work.work);
  50. struct ieee80211_hw *hw = priv->hw;
  51. struct ieee80211_vif *vif = priv->vifs[0];
  52. @@ -5735,6 +5735,14 @@ static void rtl8xxxu_update_beacon_work_
  53. return;
  54. }
  55. + if (vif->bss_conf.csa_active) {
  56. + if (ieee80211_beacon_cntdwn_is_complete(vif)) {
  57. + ieee80211_csa_finish(vif);
  58. + return;
  59. + }
  60. + schedule_delayed_work(&priv->update_beacon_work,
  61. + msecs_to_jiffies(vif->bss_conf.beacon_int));
  62. + }
  63. rtl8xxxu_send_beacon_frame(hw, vif);
  64. }
  65. @@ -7482,6 +7490,7 @@ static void rtl8xxxu_stop(struct ieee802
  66. cancel_work_sync(&priv->c2hcmd_work);
  67. cancel_delayed_work_sync(&priv->ra_watchdog);
  68. + cancel_delayed_work_sync(&priv->update_beacon_work);
  69. rtl8xxxu_free_rx_resources(priv);
  70. rtl8xxxu_free_tx_resources(priv);
  71. @@ -7763,7 +7772,7 @@ static int rtl8xxxu_probe(struct usb_int
  72. spin_lock_init(&priv->rx_urb_lock);
  73. INIT_WORK(&priv->rx_urb_wq, rtl8xxxu_rx_urb_work);
  74. INIT_DELAYED_WORK(&priv->ra_watchdog, rtl8xxxu_watchdog_callback);
  75. - INIT_WORK(&priv->update_beacon_work, rtl8xxxu_update_beacon_work_callback);
  76. + INIT_DELAYED_WORK(&priv->update_beacon_work, rtl8xxxu_update_beacon_work_callback);
  77. skb_queue_head_init(&priv->c2hcmd_queue);
  78. usb_set_intfdata(interface, hw);
  79. @@ -7824,6 +7833,8 @@ static int rtl8xxxu_probe(struct usb_int
  80. hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP);
  81. hw->queues = 4;
  82. + hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
  83. +
  84. if (priv->fops->supports_concurrent) {
  85. hw->wiphy->iface_combinations = rtl8xxxu_combinations;
  86. hw->wiphy->n_iface_combinations = ARRAY_SIZE(rtl8xxxu_combinations);