0077-wifi-ath11k-EMA-beacon-support.patch 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. From 87bd401138161008fdb82fbca6e213af117bfeb9 Mon Sep 17 00:00:00 2001
  2. From: Aloka Dixit <quic_alokad@quicinc.com>
  3. Date: Fri, 5 May 2023 16:11:28 +0300
  4. Subject: [PATCH 77/77] wifi: ath11k: EMA beacon support
  5. Add new function ath11k_mac_setup_bcn_tmpl_ema() which invokes the new
  6. API provided by MAC80211 to retrieve EMA beacons.
  7. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  8. Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
  9. Co-developed-by: John Crispin <john@phrozen.org>
  10. Signed-off-by: John Crispin <john@phrozen.org>
  11. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  12. Link: https://lore.kernel.org/r/20230405221648.17950-8-quic_alokad@quicinc.com
  13. ---
  14. drivers/net/wireless/ath/ath11k/mac.c | 59 ++++++++++++++++++++++++++-
  15. drivers/net/wireless/ath/ath11k/wmi.c | 3 +-
  16. drivers/net/wireless/ath/ath11k/wmi.h | 11 ++++-
  17. 3 files changed, 70 insertions(+), 3 deletions(-)
  18. --- a/drivers/net/wireless/ath/ath11k/mac.c
  19. +++ b/drivers/net/wireless/ath/ath11k/mac.c
  20. @@ -1452,6 +1452,60 @@ static void ath11k_mac_set_vif_params(st
  21. arvif->wpaie_present = false;
  22. }
  23. +static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
  24. +{
  25. + struct ath11k_vif *tx_arvif;
  26. + struct ieee80211_ema_beacons *beacons;
  27. + int ret = 0;
  28. + bool nontx_vif_params_set = false;
  29. + u32 params = 0;
  30. + u8 i = 0;
  31. +
  32. + tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv;
  33. +
  34. + beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
  35. + tx_arvif->vif, 0);
  36. + if (!beacons || !beacons->cnt) {
  37. + ath11k_warn(arvif->ar->ab,
  38. + "failed to get ema beacon templates from mac80211\n");
  39. + return -EPERM;
  40. + }
  41. +
  42. + if (tx_arvif == arvif)
  43. + ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb);
  44. + else
  45. + arvif->wpaie_present = tx_arvif->wpaie_present;
  46. +
  47. + for (i = 0; i < beacons->cnt; i++) {
  48. + if (tx_arvif != arvif && !nontx_vif_params_set)
  49. + nontx_vif_params_set =
  50. + ath11k_mac_set_nontx_vif_params(tx_arvif, arvif,
  51. + beacons->bcn[i].skb);
  52. +
  53. + params = beacons->cnt;
  54. + params |= (i << WMI_EMA_TMPL_IDX_SHIFT);
  55. + params |= ((!i ? 1 : 0) << WMI_EMA_FIRST_TMPL_SHIFT);
  56. + params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT);
  57. +
  58. + ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id,
  59. + &beacons->bcn[i].offs,
  60. + beacons->bcn[i].skb, params);
  61. + if (ret) {
  62. + ath11k_warn(tx_arvif->ar->ab,
  63. + "failed to set ema beacon template id %i error %d\n",
  64. + i, ret);
  65. + break;
  66. + }
  67. + }
  68. +
  69. + ieee80211_beacon_free_ema_list(beacons);
  70. +
  71. + if (tx_arvif != arvif && !nontx_vif_params_set)
  72. + return -EINVAL; /* Profile not found in the beacons */
  73. +
  74. + return ret;
  75. +}
  76. +
  77. static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
  78. {
  79. struct ath11k *ar = arvif->ar;
  80. @@ -1484,7 +1538,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbs
  81. else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn))
  82. return -EINVAL;
  83. - ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
  84. + ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0);
  85. kfree_skb(bcn);
  86. if (ret)
  87. @@ -1508,6 +1562,9 @@ static int ath11k_mac_setup_bcn_tmpl(str
  88. arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up)
  89. return 0;
  90. + if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif)
  91. + return ath11k_mac_setup_bcn_tmpl_ema(arvif);
  92. +
  93. return ath11k_mac_setup_bcn_tmpl_mbssid(arvif);
  94. }
  95. --- a/drivers/net/wireless/ath/ath11k/wmi.c
  96. +++ b/drivers/net/wireless/ath/ath11k/wmi.c
  97. @@ -1699,7 +1699,7 @@ int ath11k_wmi_send_bcn_offload_control_
  98. int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
  99. struct ieee80211_mutable_offsets *offs,
  100. - struct sk_buff *bcn)
  101. + struct sk_buff *bcn, u32 ema_params)
  102. {
  103. struct ath11k_pdev_wmi *wmi = ar->wmi;
  104. struct wmi_bcn_tmpl_cmd *cmd;
  105. @@ -1738,6 +1738,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a
  106. cmd->buf_len = bcn->len;
  107. cmd->mbssid_ie_offset = offs->mbssid_off;
  108. + cmd->ema_params = ema_params;
  109. ptr = skb->data + sizeof(*cmd);
  110. --- a/drivers/net/wireless/ath/ath11k/wmi.h
  111. +++ b/drivers/net/wireless/ath/ath11k/wmi.h
  112. @@ -3566,6 +3566,10 @@ struct wmi_get_pdev_temperature_cmd {
  113. #define WMI_BEACON_TX_BUFFER_SIZE 512
  114. +#define WMI_EMA_TMPL_IDX_SHIFT 8
  115. +#define WMI_EMA_FIRST_TMPL_SHIFT 16
  116. +#define WMI_EMA_LAST_TMPL_SHIFT 24
  117. +
  118. struct wmi_bcn_tmpl_cmd {
  119. u32 tlv_header;
  120. u32 vdev_id;
  121. @@ -3576,6 +3580,11 @@ struct wmi_bcn_tmpl_cmd {
  122. u32 csa_event_bitmap;
  123. u32 mbssid_ie_offset;
  124. u32 esp_ie_offset;
  125. + u32 csc_switch_count_offset;
  126. + u32 csc_event_bitmap;
  127. + u32 mu_edca_ie_offset;
  128. + u32 feature_enable_bitmap;
  129. + u32 ema_params;
  130. } __packed;
  131. struct wmi_key_seq_counter {
  132. @@ -6298,7 +6307,7 @@ int ath11k_wmi_mgmt_send(struct ath11k *
  133. struct sk_buff *frame);
  134. int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
  135. struct ieee80211_mutable_offsets *offs,
  136. - struct sk_buff *bcn);
  137. + struct sk_buff *bcn, u32 ema_param);
  138. int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id);
  139. int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid,
  140. const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx,