From 98787f1dc0e47afffce21fd597b098e57df6e757 Mon Sep 17 00:00:00 2001 From: jinbao liu Date: Tue, 25 Apr 2023 19:35:08 -0700 Subject: [PATCH] qcacmn: Fix a RX MCS index issue in HT mode Currently driver obtains RX MCS index from RX MSDU TLV END of a data frame. According to the specification, the MCS index should starts with 8 rather than 0 when NSS=2 in HT mode. However, the original RX MCS index from HW starts with 0, thus SW needs to get a final MCS index by adding an offset when NSS=2 in HT mode. Change-Id: Iba5f9976958233fc283513caf0184e59774ab50a CRs-Fixed: 3471953 --- dp/wifi3.0/dp_rx.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 2ee4ca4554..c25714845f 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -1392,6 +1392,22 @@ void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf, rate_mcs = hal_rx_tlv_rate_mcs_get(soc->hal_soc, rx_tlv_hdr); bw = hal_rx_tlv_bw_get(soc->hal_soc, rx_tlv_hdr); nss = hal_rx_msdu_start_nss_get(soc->hal_soc, rx_tlv_hdr); + + /* + * The MCS index does not start with 0 when NSS>1 in HT mode. + * MCS params for optional 20/40MHz, NSS=1~3, EQM(NSS>1): + * ------------------------------------------------------ + * NSS | 1 | 2 | 3 | 4 + * ------------------------------------------------------ + * MCS index: HT20 | 0 ~ 7 | 8 ~ 15 | 16 ~ 23 | 24 ~ 31 + * ------------------------------------------------------ + * MCS index: HT40 | 0 ~ 7 | 8 ~ 15 | 16 ~ 23 | 24 ~ 31 + * ------------------------------------------------------ + * Currently, the MAX_NSS=2. If NSS>2, MCS index = 8 * (NSS-1) + */ + if ((pkt_type == DOT11_N) && (nss == 2)) + rate_mcs += 8; + rx_info->rs_ratephy1 = rate_mcs | (nss << 0x8) | (pkt_type << 16) | (bw << 24); @@ -2507,6 +2523,21 @@ void dp_rx_msdu_extd_stats_update(struct dp_soc *soc, qdf_nbuf_t nbuf, pkt_type = (pkt_type >= HAL_DOT11_MAX ? DOT11_MAX : hal_2_dp_pkt_type_map[pkt_type]); + /* + * The MCS index does not start with 0 when NSS>1 in HT mode. + * MCS params for optional 20/40MHz, NSS=1~3, EQM(NSS>1): + * ------------------------------------------------------ + * NSS | 1 | 2 | 3 | 4 + * ------------------------------------------------------ + * MCS index: HT20 | 0 ~ 7 | 8 ~ 15 | 16 ~ 23 | 24 ~ 31 + * ------------------------------------------------------ + * MCS index: HT40 | 0 ~ 7 | 8 ~ 15 | 16 ~ 23 | 24 ~ 31 + * ------------------------------------------------------ + * Currently, the MAX_NSS=2. If NSS>2, MCS index = 8 * (NSS-1) + */ + if ((pkt_type == DOT11_N) && (nss == 2)) + mcs += 8; + DP_PEER_EXTD_STATS_INCC(txrx_peer, rx.rx_mpdu_cnt[mcs], 1, ((mcs < MAX_MCS) && QDF_NBUF_CB_RX_CHFRAG_START(nbuf)), link_id);