0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. From a27c6a5853eb9d4f293b99be73a6891fe88263c7 Mon Sep 17 00:00:00 2001
  2. From: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
  3. Date: Tue, 10 Jan 2023 15:30:57 +0200
  4. Subject: [PATCH] wifi: ath11k: Add support to configure FTM responder role
  5. Fine Timing Measurement(FTM) support is used to measure round trip
  6. time between two nodes.
  7. Enable FTM responder feature using hw_params on supported device.
  8. Since FTM functionality is offloaded to firmware, adding the
  9. interface allows user space to enable or disable FTM responder.
  10. Also add support for advertising the same in extended capabilities.
  11. QCA6390, WCN6855 and WCN6750 do not support this feature.
  12. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  13. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  14. Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
  15. Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
  16. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  17. Link: https://lore.kernel.org/r/20221220044435.10506-1-quic_rajkbhag@quicinc.com
  18. ---
  19. drivers/net/wireless/ath/ath11k/core.c | 8 ++++++++
  20. drivers/net/wireless/ath/ath11k/core.h | 1 +
  21. drivers/net/wireless/ath/ath11k/hw.h | 1 +
  22. drivers/net/wireless/ath/ath11k/mac.c | 20 +++++++++++++++++++-
  23. drivers/net/wireless/ath/ath11k/wmi.h | 1 +
  24. 5 files changed, 30 insertions(+), 1 deletion(-)
  25. --- a/drivers/net/wireless/ath/ath11k/core.c
  26. +++ b/drivers/net/wireless/ath/ath11k/core.c
  27. @@ -116,6 +116,7 @@ static const struct ath11k_hw_params ath
  28. .tcl_ring_retry = true,
  29. .tx_ring_size = DP_TCL_DATA_RING_SIZE,
  30. .smp2p_wow_exit = false,
  31. + .ftm_responder = true,
  32. },
  33. {
  34. .hw_rev = ATH11K_HW_IPQ6018_HW10,
  35. @@ -198,6 +199,7 @@ static const struct ath11k_hw_params ath
  36. .tx_ring_size = DP_TCL_DATA_RING_SIZE,
  37. .smp2p_wow_exit = false,
  38. .support_fw_mac_sequence = false,
  39. + .ftm_responder = true,
  40. },
  41. {
  42. .name = "qca6390 hw2.0",
  43. @@ -282,6 +284,7 @@ static const struct ath11k_hw_params ath
  44. .tx_ring_size = DP_TCL_DATA_RING_SIZE,
  45. .smp2p_wow_exit = false,
  46. .support_fw_mac_sequence = true,
  47. + .ftm_responder = false,
  48. },
  49. {
  50. .name = "qcn9074 hw1.0",
  51. @@ -363,6 +366,7 @@ static const struct ath11k_hw_params ath
  52. .tx_ring_size = DP_TCL_DATA_RING_SIZE,
  53. .smp2p_wow_exit = false,
  54. .support_fw_mac_sequence = false,
  55. + .ftm_responder = true,
  56. },
  57. {
  58. .name = "wcn6855 hw2.0",
  59. @@ -447,6 +451,7 @@ static const struct ath11k_hw_params ath
  60. .tx_ring_size = DP_TCL_DATA_RING_SIZE,
  61. .smp2p_wow_exit = false,
  62. .support_fw_mac_sequence = true,
  63. + .ftm_responder = false,
  64. },
  65. {
  66. .name = "wcn6855 hw2.1",
  67. @@ -529,6 +534,7 @@ static const struct ath11k_hw_params ath
  68. .tx_ring_size = DP_TCL_DATA_RING_SIZE,
  69. .smp2p_wow_exit = false,
  70. .support_fw_mac_sequence = true,
  71. + .ftm_responder = false,
  72. },
  73. {
  74. .name = "wcn6750 hw1.0",
  75. @@ -609,6 +615,7 @@ static const struct ath11k_hw_params ath
  76. .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750,
  77. .smp2p_wow_exit = true,
  78. .support_fw_mac_sequence = true,
  79. + .ftm_responder = false,
  80. },
  81. {
  82. .hw_rev = ATH11K_HW_IPQ5018_HW10,
  83. @@ -688,6 +695,7 @@ static const struct ath11k_hw_params ath
  84. .tx_ring_size = DP_TCL_DATA_RING_SIZE,
  85. .smp2p_wow_exit = false,
  86. .support_fw_mac_sequence = false,
  87. + .ftm_responder = true,
  88. },
  89. };
  90. --- a/drivers/net/wireless/ath/ath11k/core.h
  91. +++ b/drivers/net/wireless/ath/ath11k/core.h
  92. @@ -346,6 +346,7 @@ struct ath11k_vif {
  93. bool is_started;
  94. bool is_up;
  95. + bool ftm_responder;
  96. bool spectral_enabled;
  97. bool ps;
  98. u32 aid;
  99. --- a/drivers/net/wireless/ath/ath11k/hw.h
  100. +++ b/drivers/net/wireless/ath/ath11k/hw.h
  101. @@ -224,6 +224,7 @@ struct ath11k_hw_params {
  102. u32 tx_ring_size;
  103. bool smp2p_wow_exit;
  104. bool support_fw_mac_sequence;
  105. + bool ftm_responder;
  106. };
  107. struct ath11k_hw_ops {
  108. --- a/drivers/net/wireless/ath/ath11k/mac.c
  109. +++ b/drivers/net/wireless/ath/ath11k/mac.c
  110. @@ -3110,7 +3110,7 @@ static void ath11k_mac_op_bss_info_chang
  111. u16 bitrate;
  112. int ret = 0;
  113. u8 rateidx;
  114. - u32 rate;
  115. + u32 rate, param;
  116. u32 ipv4_cnt;
  117. mutex_lock(&ar->conf_mutex);
  118. @@ -3412,6 +3412,20 @@ static void ath11k_mac_op_bss_info_chang
  119. }
  120. }
  121. + if (changed & BSS_CHANGED_FTM_RESPONDER &&
  122. + arvif->ftm_responder != info->ftm_responder &&
  123. + ar->ab->hw_params.ftm_responder &&
  124. + (vif->type == NL80211_IFTYPE_AP ||
  125. + vif->type == NL80211_IFTYPE_MESH_POINT)) {
  126. + arvif->ftm_responder = info->ftm_responder;
  127. + param = WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE;
  128. + ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param,
  129. + arvif->ftm_responder);
  130. + if (ret)
  131. + ath11k_warn(ar->ab, "Failed to set ftm responder %i: %d\n",
  132. + arvif->vdev_id, ret);
  133. + }
  134. +
  135. if (changed & BSS_CHANGED_FILS_DISCOVERY ||
  136. changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP)
  137. ath11k_mac_fils_discovery(arvif, info);
  138. @@ -9113,6 +9127,10 @@ static int __ath11k_mac_register(struct
  139. wiphy_ext_feature_set(ar->hw->wiphy,
  140. NL80211_EXT_FEATURE_SET_SCAN_DWELL);
  141. + if (ab->hw_params.ftm_responder)
  142. + wiphy_ext_feature_set(ar->hw->wiphy,
  143. + NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
  144. +
  145. ath11k_reg_init(ar);
  146. if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) {
  147. --- a/drivers/net/wireless/ath/ath11k/wmi.h
  148. +++ b/drivers/net/wireless/ath/ath11k/wmi.h
  149. @@ -1073,6 +1073,7 @@ enum wmi_tlv_vdev_param {
  150. WMI_VDEV_PARAM_ENABLE_BCAST_PROBE_RESPONSE,
  151. WMI_VDEV_PARAM_FILS_MAX_CHANNEL_GUARD_TIME,
  152. WMI_VDEV_PARAM_HE_LTF = 0x74,
  153. + WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE = 0x7d,
  154. WMI_VDEV_PARAM_BA_MODE = 0x7e,
  155. WMI_VDEV_PARAM_AUTORATE_MISC_CFG = 0x80,
  156. WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE = 0x87,