0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. From 5a81610acf66c4ad6e1a1fbd09f3f555fca863b1 Mon Sep 17 00:00:00 2001
  2. From: Aloka Dixit <quic_alokad@quicinc.com>
  3. Date: Fri, 5 May 2023 16:11:27 +0300
  4. Subject: [PATCH 72/77] wifi: ath11k: MBSSID configuration during vdev
  5. create/start
  6. Configure multiple BSSID flags and index of the transmitting interface
  7. in vdev create/start commands depending on the service bit
  8. WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT.
  9. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  10. Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
  11. Co-developed-by: John Crispin <john@phrozen.org>
  12. Signed-off-by: John Crispin <john@phrozen.org>
  13. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  14. Link: https://lore.kernel.org/r/20230405221648.17950-3-quic_alokad@quicinc.com
  15. ---
  16. drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++++++++++++++++--
  17. drivers/net/wireless/ath/ath11k/wmi.c | 5 ++
  18. drivers/net/wireless/ath/ath11k/wmi.h | 19 ++++++++
  19. 3 files changed, 90 insertions(+), 4 deletions(-)
  20. --- a/drivers/net/wireless/ath/ath11k/mac.c
  21. +++ b/drivers/net/wireless/ath/ath11k/mac.c
  22. @@ -6181,17 +6181,62 @@ static void ath11k_mac_op_stop(struct ie
  23. atomic_set(&ar->num_pending_mgmt_tx, 0);
  24. }
  25. -static void
  26. -ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
  27. - struct vdev_create_params *params)
  28. +static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif,
  29. + u32 *flags, u32 *tx_vdev_id)
  30. +{
  31. + struct ath11k *ar = arvif->ar;
  32. + struct ath11k_vif *tx_arvif;
  33. + struct ieee80211_vif *tx_vif;
  34. +
  35. + *tx_vdev_id = 0;
  36. + tx_vif = arvif->vif->mbssid_tx_vif;
  37. + if (!tx_vif) {
  38. + *flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP;
  39. + return 0;
  40. + }
  41. +
  42. + tx_arvif = (void *)tx_vif->drv_priv;
  43. +
  44. + if (arvif->vif->bss_conf.nontransmitted) {
  45. + if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
  46. + return -EINVAL;
  47. +
  48. + *flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP;
  49. + *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id;
  50. + } else if (tx_arvif == arvif) {
  51. + *flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP;
  52. + } else {
  53. + return -EINVAL;
  54. + }
  55. +
  56. + if (arvif->vif->bss_conf.ema_ap)
  57. + *flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE;
  58. +
  59. + return 0;
  60. +}
  61. +
  62. +static int ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
  63. + struct vdev_create_params *params)
  64. {
  65. struct ath11k *ar = arvif->ar;
  66. struct ath11k_pdev *pdev = ar->pdev;
  67. + int ret;
  68. params->if_id = arvif->vdev_id;
  69. params->type = arvif->vdev_type;
  70. params->subtype = arvif->vdev_subtype;
  71. params->pdev_id = pdev->pdev_id;
  72. + params->mbssid_flags = 0;
  73. + params->mbssid_tx_vdev_id = 0;
  74. +
  75. + if (!test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
  76. + ar->ab->wmi_ab.svc_map)) {
  77. + ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
  78. + &params->mbssid_flags,
  79. + &params->mbssid_tx_vdev_id);
  80. + if (ret)
  81. + return ret;
  82. + }
  83. if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) {
  84. params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains;
  85. @@ -6206,6 +6251,7 @@ ath11k_mac_setup_vdev_create_params(stru
  86. params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains;
  87. params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains;
  88. }
  89. + return 0;
  90. }
  91. static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw,
  92. @@ -6500,7 +6546,12 @@ static int ath11k_mac_op_add_interface(s
  93. for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++)
  94. vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1);
  95. - ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
  96. + ret = ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
  97. + if (ret) {
  98. + ath11k_warn(ab, "failed to create vdev parameters %d: %d\n",
  99. + arvif->vdev_id, ret);
  100. + goto err;
  101. + }
  102. ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param);
  103. if (ret) {
  104. @@ -6905,6 +6956,17 @@ ath11k_mac_vdev_start_restart(struct ath
  105. arg.pref_tx_streams = ar->num_tx_chains;
  106. arg.pref_rx_streams = ar->num_rx_chains;
  107. + arg.mbssid_flags = 0;
  108. + arg.mbssid_tx_vdev_id = 0;
  109. + if (test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
  110. + ar->ab->wmi_ab.svc_map)) {
  111. + ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
  112. + &arg.mbssid_flags,
  113. + &arg.mbssid_tx_vdev_id);
  114. + if (ret)
  115. + return ret;
  116. + }
  117. +
  118. if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
  119. arg.ssid = arvif->u.ap.ssid;
  120. arg.ssid_len = arvif->u.ap.ssid_len;
  121. --- a/drivers/net/wireless/ath/ath11k/wmi.c
  122. +++ b/drivers/net/wireless/ath/ath11k/wmi.c
  123. @@ -724,6 +724,9 @@ int ath11k_wmi_vdev_create(struct ath11k
  124. cmd->vdev_subtype = param->subtype;
  125. cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX;
  126. cmd->pdev_id = param->pdev_id;
  127. + cmd->mbssid_flags = param->mbssid_flags;
  128. + cmd->mbssid_tx_vdev_id = param->mbssid_tx_vdev_id;
  129. +
  130. ether_addr_copy(cmd->vdev_macaddr.addr, macaddr);
  131. ptr = skb->data + sizeof(*cmd);
  132. @@ -941,6 +944,8 @@ int ath11k_wmi_vdev_start(struct ath11k
  133. cmd->cac_duration_ms = arg->cac_duration_ms;
  134. cmd->regdomain = arg->regdomain;
  135. cmd->he_ops = arg->he_ops;
  136. + cmd->mbssid_flags = arg->mbssid_flags;
  137. + cmd->mbssid_tx_vdev_id = arg->mbssid_tx_vdev_id;
  138. if (!restart) {
  139. if (arg->ssid) {
  140. --- a/drivers/net/wireless/ath/ath11k/wmi.h
  141. +++ b/drivers/net/wireless/ath/ath11k/wmi.h
  142. @@ -137,6 +137,14 @@ enum {
  143. WMI_AUTORATE_3200NS_GI = BIT(11),
  144. };
  145. +enum {
  146. + WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP = 0x00000001,
  147. + WMI_HOST_VDEV_FLAGS_TRANSMIT_AP = 0x00000002,
  148. + WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP = 0x00000004,
  149. + WMI_HOST_VDEV_FLAGS_EMA_MODE = 0x00000008,
  150. + WMI_HOST_VDEV_FLAGS_SCAN_MODE_VAP = 0x00000010,
  151. +};
  152. +
  153. /*
  154. * wmi command groups.
  155. */
  156. @@ -2096,6 +2104,7 @@ enum wmi_tlv_service {
  157. WMI_TLV_SERVICE_EXT2_MSG = 220,
  158. WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246,
  159. WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249,
  160. + WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253,
  161. WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263,
  162. /* The second 128 bits */
  163. @@ -2583,6 +2592,8 @@ struct vdev_create_params {
  164. u8 rx;
  165. } chains[NUM_NL80211_BANDS];
  166. u32 pdev_id;
  167. + u32 mbssid_flags;
  168. + u32 mbssid_tx_vdev_id;
  169. };
  170. struct wmi_vdev_create_cmd {
  171. @@ -2593,6 +2604,8 @@ struct wmi_vdev_create_cmd {
  172. struct wmi_mac_addr vdev_macaddr;
  173. u32 num_cfg_txrx_streams;
  174. u32 pdev_id;
  175. + u32 mbssid_flags;
  176. + u32 mbssid_tx_vdev_id;
  177. } __packed;
  178. struct wmi_vdev_txrx_streams {
  179. @@ -2656,6 +2669,9 @@ struct wmi_vdev_start_request_cmd {
  180. u32 he_ops;
  181. u32 cac_duration_ms;
  182. u32 regdomain;
  183. + u32 min_data_rate;
  184. + u32 mbssid_flags;
  185. + u32 mbssid_tx_vdev_id;
  186. } __packed;
  187. #define MGMT_TX_DL_FRM_LEN 64
  188. @@ -2825,6 +2841,9 @@ struct wmi_vdev_start_req_arg {
  189. u32 pref_rx_streams;
  190. u32 pref_tx_streams;
  191. u32 num_noa_descriptors;
  192. + u32 min_data_rate;
  193. + u32 mbssid_flags;
  194. + u32 mbssid_tx_vdev_id;
  195. };
  196. struct peer_create_params {