From 2321888a0f07a22af896313ea93d2470546c12f5 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 20 Nov 2020 16:03:47 +0530 Subject: [PATCH] ath11k: fix rssi station dump not updated in qcn9000 In qcn9000, station dump signal values displays default -95 dbm, Since there is firmware header change for HAL_RX_MPDU_START between qcn9000 and qca8074 which cause wrong peer_id fetch from msdu. Fixed this by update hal_rx_mpdu_info with corresponding qcn9000 tlv format. Signed-off-by: P Praneesh --- drivers/net/wireless/ath/ath11k/hal_rx.c | 20 +++++++++++++---- drivers/net/wireless/ath/ath11k/hal_rx.h | 17 +++++++++++++- drivers/net/wireless/ath/ath11k/hw.c | 38 ++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/hw.h | 3 +++ 4 files changed, 73 insertions(+), 5 deletions(-) --- a/drivers/net/wireless/ath/ath11k/hal_rx.c +++ b/drivers/net/wireless/ath/ath11k/hal_rx.c @@ -899,6 +899,20 @@ ath11k_hal_rx_populate_mu_user_info(void ath11k_hal_rx_populate_byte_count(rx_tlv, ppdu_info, rx_user_status); } +static +u16 ath11k_hal_rxdesc_get_hal_mpdu_peerid(struct ath11k_base *ab, + struct hal_rx_mpdu_info *mpdu_info) +{ + return ab->hw_params.hw_ops->rx_desc_get_hal_mpdu_peerid(mpdu_info); +} + +static +u32 ath11k_hal_rxdesc_get_hal_mpdu_len(struct ath11k_base *ab, + struct hal_rx_mpdu_info *mpdu_info) +{ + return ab->hw_params.hw_ops->rx_desc_get_hal_mpdu_len(mpdu_info); +} + static enum hal_rx_mon_status ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab, struct hal_rx_mon_ppdu_info *ppdu_info, @@ -1544,13 +1558,11 @@ ath11k_hal_rx_parse_mon_status_tlv(struc (struct hal_rx_mpdu_info *)tlv_data; u16 peer_id; - peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, - __le32_to_cpu(mpdu_info->info0)); + peer_id = ath11k_hal_rxdesc_get_hal_mpdu_peerid(ab,mpdu_info); if (peer_id) ppdu_info->peer_id = peer_id; - ppdu_info->mpdu_len += FIELD_GET(HAL_RX_MPDU_INFO_INFO1_MPDU_LEN, - __le32_to_cpu(mpdu_info->info1)); + ppdu_info->mpdu_len += ath11k_hal_rxdesc_get_hal_mpdu_len(ab,mpdu_info); break; } case HAL_RXPCU_PPDU_END_INFO: { --- a/drivers/net/wireless/ath/ath11k/hal_rx.h +++ b/drivers/net/wireless/ath/ath11k/hal_rx.h @@ -445,7 +445,7 @@ struct hal_rx_phyrx_rssi_legacy_info { #define HAL_RX_MPDU_INFO_INFO0_PEERID GENMASK(31, 16) #define HAL_RX_MPDU_INFO_INFO1_MPDU_LEN GENMASK(13, 0) -struct hal_rx_mpdu_info { +struct hal_rx_mpdu_info_ipq8074 { __le32 rsvd0; __le32 info0; __le32 rsvd1[11]; @@ -453,6 +453,21 @@ struct hal_rx_mpdu_info { __le32 rsvd2[9]; } __packed; +struct hal_rx_mpdu_info_ipq9074 { + __le32 rsvd0[10]; + __le32 info0; + __le32 rsvd1[2]; + __le32 info1; + __le32 rsvd2[9]; +} __packed; + +struct hal_rx_mpdu_info { + union { + struct hal_rx_mpdu_info_ipq8074 ipq8074; + struct hal_rx_mpdu_info_ipq9074 qcn9074; + } u; +} __packed; + #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0) struct hal_rx_ppdu_end_duration { __le32 rsvd0[9]; --- a/drivers/net/wireless/ath/ath11k/hw.c +++ b/drivers/net/wireless/ath/ath11k/hw.c @@ -353,6 +353,20 @@ static u8 *ath11k_hw_ipq8074_rx_desc_get return &desc->u.ipq8074.msdu_payload[0]; } +static +u16 ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid(struct hal_rx_mpdu_info *mpdu_info) +{ + return FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, + __le32_to_cpu(mpdu_info->u.ipq8074.info0)); +} + +static +u32 ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len(struct hal_rx_mpdu_info *mpdu_info) +{ + return FIELD_GET(HAL_RX_MPDU_INFO_INFO1_MPDU_LEN, + __le32_to_cpu(mpdu_info->u.ipq8074.info1)); +} + static bool ath11k_hw_qcn9074_rx_desc_get_first_msdu(struct hal_rx_desc *desc) { return !!FIELD_GET(RX_MSDU_END_INFO4_FIRST_MSDU, @@ -554,6 +568,20 @@ static void ath11k_hw_ipq5018_set_rx_fra ath11k_hif_write32(ab, reo_base + HAL_REO1_R0_MISC_CTL, val); } +static +u16 ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_peerid(struct hal_rx_mpdu_info *mpdu_info) +{ + return FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, + __le32_to_cpu(mpdu_info->u.qcn9074.info0)); +} + +static +u32 ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_len(struct hal_rx_mpdu_info *mpdu_info) +{ + return FIELD_GET(HAL_RX_MPDU_INFO_INFO1_MPDU_LEN, + __le32_to_cpu(mpdu_info->u.qcn9074.info1)); +} + static u32 ath11k_get_reo_dest_remap_config_default(void) { u32 ring_hash_map; @@ -632,6 +660,8 @@ const struct ath11k_hw_ops ipq8074_ops = .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq8074_rx_desc_mpdu_start_addr2, .set_rx_fragmentation_dst_ring = ath11k_hw_ipq8074_set_rx_fragmentation_dst_ring, .get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default, + .rx_desc_get_hal_mpdu_peerid = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid, + .rx_desc_get_hal_mpdu_len = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len, }; const struct ath11k_hw_ops ipq6018_ops = { @@ -671,6 +701,8 @@ const struct ath11k_hw_ops ipq6018_ops = .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq8074_rx_desc_mpdu_start_addr2, .set_rx_fragmentation_dst_ring = ath11k_hw_ipq8074_set_rx_fragmentation_dst_ring, .get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default, + .rx_desc_get_hal_mpdu_peerid = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid, + .rx_desc_get_hal_mpdu_len = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len, }; const struct ath11k_hw_ops qca6390_ops = { @@ -707,6 +739,8 @@ const struct ath11k_hw_ops qca6390_ops = .rx_desc_get_msdu_payload = ath11k_hw_ipq8074_rx_desc_get_msdu_payload, .set_rx_fragmentation_dst_ring = ath11k_hw_ipq8074_set_rx_fragmentation_dst_ring, .get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default, + .rx_desc_get_hal_mpdu_peerid = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid, + .rx_desc_get_hal_mpdu_len = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len, //TODO /* .rx_desc_get_da_mcbc, .rx_desc_mac_addr2_valid, @@ -748,6 +782,8 @@ const struct ath11k_hw_ops qcn9074_ops = .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, .set_rx_fragmentation_dst_ring = ath11k_hw_ipq8074_set_rx_fragmentation_dst_ring, .get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default, + .rx_desc_get_hal_mpdu_peerid = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_peerid, + .rx_desc_get_hal_mpdu_len = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_len, }; /* IPQ5018 hw ops is similar to QCN9074 except for the dest ring remap */ @@ -787,6 +823,8 @@ const struct ath11k_hw_ops ipq5018_ops = .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, .set_rx_fragmentation_dst_ring = ath11k_hw_ipq5018_set_rx_fragmentation_dst_ring, + .rx_desc_get_hal_mpdu_peerid = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_peerid, + .rx_desc_get_hal_mpdu_len = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_len, .get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_5018, }; --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -125,6 +125,7 @@ enum ath11k_bus { #define ATH11K_EXT_IRQ_GRP_NUM_MAX 11 +struct hal_rx_mpdu_info; struct hal_rx_desc; struct hal_tcl_data_cmd; struct napi_struct; @@ -234,6 +235,8 @@ struct ath11k_hw_ops { u8* (*rx_desc_mpdu_start_addr2)(struct hal_rx_desc *desc); void (*set_rx_fragmentation_dst_ring)(struct ath11k_base *ab); u32 (*get_reo_dest_remap_config)(void); + u16 (*rx_desc_get_hal_mpdu_peerid) (struct hal_rx_mpdu_info *mpdu_info); + u32 (*rx_desc_get_hal_mpdu_len) (struct hal_rx_mpdu_info *mpdu_info); }; extern const struct ath11k_hw_ops ipq8074_ops;