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