0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. From 031ffa6c2cd305a57ccc6d610f2decd956b2e7f6 Mon Sep 17 00:00:00 2001
  2. From: P Praneesh <quic_ppranees@quicinc.com>
  3. Date: Fri, 24 Mar 2023 16:57:00 +0200
  4. Subject: [PATCH] wifi: ath11k: fix rssi station dump not updated in QCN9074
  5. In QCN9074, station dump signal values display default value which
  6. is -95 dbm, since there is firmware header change for HAL_RX_MPDU_START
  7. between QCN9074 and IPQ8074 which cause wrong peer_id fetch from msdu.
  8. Fix this by updating hal_rx_mpdu_info with corresponding QCN9074 tlv
  9. format.
  10. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  11. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1
  12. Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
  13. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  14. Link: https://lore.kernel.org/r/20230320110312.20639-1-quic_ppranees@quicinc.com
  15. ---
  16. drivers/net/wireless/ath/ath11k/hal_rx.c | 10 ++++++++-
  17. drivers/net/wireless/ath/ath11k/hal_rx.h | 18 +++++++++++++++-
  18. drivers/net/wireless/ath/ath11k/hw.c | 27 ++++++++++++++++--------
  19. drivers/net/wireless/ath/ath11k/hw.h | 2 +-
  20. 4 files changed, 45 insertions(+), 12 deletions(-)
  21. --- a/drivers/net/wireless/ath/ath11k/hal_rx.c
  22. +++ b/drivers/net/wireless/ath/ath11k/hal_rx.c
  23. @@ -865,6 +865,12 @@ ath11k_hal_rx_populate_mu_user_info(void
  24. ath11k_hal_rx_populate_byte_count(rx_tlv, ppdu_info, rx_user_status);
  25. }
  26. +static u16 ath11k_hal_rx_mpduinfo_get_peerid(struct ath11k_base *ab,
  27. + struct hal_rx_mpdu_info *mpdu_info)
  28. +{
  29. + return ab->hw_params.hw_ops->mpdu_info_get_peerid(mpdu_info);
  30. +}
  31. +
  32. static enum hal_rx_mon_status
  33. ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
  34. struct hal_rx_mon_ppdu_info *ppdu_info,
  35. @@ -1459,9 +1465,11 @@ ath11k_hal_rx_parse_mon_status_tlv(struc
  36. break;
  37. }
  38. case HAL_RX_MPDU_START: {
  39. + struct hal_rx_mpdu_info *mpdu_info =
  40. + (struct hal_rx_mpdu_info *)tlv_data;
  41. u16 peer_id;
  42. - peer_id = ab->hw_params.hw_ops->mpdu_info_get_peerid(tlv_data);
  43. + peer_id = ath11k_hal_rx_mpduinfo_get_peerid(ab, mpdu_info);
  44. if (peer_id)
  45. ppdu_info->peer_id = peer_id;
  46. break;
  47. --- a/drivers/net/wireless/ath/ath11k/hal_rx.h
  48. +++ b/drivers/net/wireless/ath/ath11k/hal_rx.h
  49. @@ -405,7 +405,7 @@ struct hal_rx_phyrx_rssi_legacy_info {
  50. #define HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855 GENMASK(15, 0)
  51. #define HAL_RX_MPDU_INFO_INFO1_MPDU_LEN GENMASK(13, 0)
  52. -struct hal_rx_mpdu_info {
  53. +struct hal_rx_mpdu_info_ipq8074 {
  54. __le32 rsvd0;
  55. __le32 info0;
  56. __le32 rsvd1[11];
  57. @@ -413,12 +413,28 @@ struct hal_rx_mpdu_info {
  58. __le32 rsvd2[9];
  59. } __packed;
  60. +struct hal_rx_mpdu_info_qcn9074 {
  61. + __le32 rsvd0[10];
  62. + __le32 info0;
  63. + __le32 rsvd1[2];
  64. + __le32 info1;
  65. + __le32 rsvd2[9];
  66. +} __packed;
  67. +
  68. struct hal_rx_mpdu_info_wcn6855 {
  69. __le32 rsvd0[8];
  70. __le32 info0;
  71. __le32 rsvd1[14];
  72. } __packed;
  73. +struct hal_rx_mpdu_info {
  74. + union {
  75. + struct hal_rx_mpdu_info_ipq8074 ipq8074;
  76. + struct hal_rx_mpdu_info_qcn9074 qcn9074;
  77. + struct hal_rx_mpdu_info_wcn6855 wcn6855;
  78. + } u;
  79. +} __packed;
  80. +
  81. #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0)
  82. struct hal_rx_ppdu_end_duration {
  83. __le32 rsvd0[9];
  84. --- a/drivers/net/wireless/ath/ath11k/hw.c
  85. +++ b/drivers/net/wireless/ath/ath11k/hw.c
  86. @@ -835,26 +835,35 @@ static void ath11k_hw_ipq5018_reo_setup(
  87. ring_hash_map);
  88. }
  89. -static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data)
  90. +static u16
  91. +ath11k_hw_ipq8074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info)
  92. {
  93. u16 peer_id = 0;
  94. - struct hal_rx_mpdu_info *mpdu_info =
  95. - (struct hal_rx_mpdu_info *)tlv_data;
  96. peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID,
  97. - __le32_to_cpu(mpdu_info->info0));
  98. + __le32_to_cpu(mpdu_info->u.ipq8074.info0));
  99. return peer_id;
  100. }
  101. -static u16 ath11k_hw_wcn6855_mpdu_info_get_peerid(u8 *tlv_data)
  102. +static u16
  103. +ath11k_hw_qcn9074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info)
  104. +{
  105. + u16 peer_id = 0;
  106. +
  107. + peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID,
  108. + __le32_to_cpu(mpdu_info->u.qcn9074.info0));
  109. +
  110. + return peer_id;
  111. +}
  112. +
  113. +static u16
  114. +ath11k_hw_wcn6855_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info)
  115. {
  116. u16 peer_id = 0;
  117. - struct hal_rx_mpdu_info_wcn6855 *mpdu_info =
  118. - (struct hal_rx_mpdu_info_wcn6855 *)tlv_data;
  119. peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855,
  120. - __le32_to_cpu(mpdu_info->info0));
  121. + __le32_to_cpu(mpdu_info->u.wcn6855.info0));
  122. return peer_id;
  123. }
  124. @@ -1042,7 +1051,7 @@ const struct ath11k_hw_ops qcn9074_ops =
  125. .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention,
  126. .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload,
  127. .reo_setup = ath11k_hw_ipq8074_reo_setup,
  128. - .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid,
  129. + .mpdu_info_get_peerid = ath11k_hw_qcn9074_mpdu_info_get_peerid,
  130. .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid,
  131. .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2,
  132. .get_ring_selector = ath11k_hw_ipq8074_get_tcl_ring_selector,
  133. --- a/drivers/net/wireless/ath/ath11k/hw.h
  134. +++ b/drivers/net/wireless/ath/ath11k/hw.h
  135. @@ -263,7 +263,7 @@ struct ath11k_hw_ops {
  136. struct rx_attention *(*rx_desc_get_attention)(struct hal_rx_desc *desc);
  137. u8 *(*rx_desc_get_msdu_payload)(struct hal_rx_desc *desc);
  138. void (*reo_setup)(struct ath11k_base *ab);
  139. - u16 (*mpdu_info_get_peerid)(u8 *tlv_data);
  140. + u16 (*mpdu_info_get_peerid)(struct hal_rx_mpdu_info *mpdu_info);
  141. bool (*rx_desc_mac_addr2_valid)(struct hal_rx_desc *desc);
  142. u8* (*rx_desc_mpdu_start_addr2)(struct hal_rx_desc *desc);
  143. u32 (*get_ring_selector)(struct sk_buff *skb);