Эх сурвалжийг харах

qcacmn: Add support for rx evm and rx antenna

Add Host support for rx evm and rx antenna

CRs-Fixed: 2493515
Change-Id: I6c6e3edd8d6650eabb69cea08ec275da7067f37d
Amir Patel 5 жил өмнө
parent
commit
5a8bbbe05d

+ 2 - 0
dp/inc/cdp_txrx_cmn_struct.h

@@ -1560,6 +1560,8 @@ struct cdp_rx_indication_ppdu {
 	uint16_t frame_ctrl;
 	int8_t rssi_chain[SS_COUNT][MAX_BW];
 	struct cdp_stats_cookie *cookie;
+	struct cdp_rx_su_evm_info evm_info;
+	uint32_t rx_antenna;
 };
 
 /**

+ 28 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -111,7 +111,22 @@
 
 #define INVALID_RSSI 255
 
+/*Max SU EVM count */
+#define DP_RX_MAX_SU_EVM_COUNT 32
+
 #define WDI_EVENT_BASE 0x100
+
+#define CDP_TXRX_RATECODE_MCS_MASK 0xF
+#define CDP_TXRX_RATECODE_NSS_MASK 0x3
+#define CDP_TXRX_RATECODE_NSS_LSB 4
+#define CDP_TXRX_RATECODE_PREM_MASK 0x3
+#define CDP_TXRX_RATECODE_PREM_LSB 6
+
+#define CDP_TXRX_RATECODE(mcsb, nssb, premb) \
+	(((mcsb) & CDP_TXRX_RATECODE_MCS_MASK) | \
+	(((nssb) & CDP_TXRX_RATECODE_NSS_MASK) << CDP_TXRX_RATECODE_NSS_LSB) | \
+	(((premb) & CDP_TXRX_RATECODE_PREM_MASK) << CDP_TXRX_RATECODE_PREM_LSB))
+
 /* Different Packet Types */
 enum cdp_packet_type {
 	DOT11_A = 0,
@@ -202,6 +217,19 @@ struct cdp_tidq_stats {
 	uint32_t stats[TIDQ_STATS_MAX];
 };
 
+/*
+ * struct cdp_rx_su_evm_info: Rx evm info
+ * @number_of_symbols: number of symbols
+ * @nss_count: number of spatial streams
+ * @pilot_count: number of pilot count
+ */
+struct cdp_rx_su_evm_info {
+	uint16_t number_of_symbols;
+	uint8_t  nss_count;
+	uint8_t  pilot_count;
+	uint32_t pilot_evm[DP_RX_MAX_SU_EVM_COUNT];
+};
+
 /*
  * cdp_delay_stats_mode: Different types of delay statistics
  *

+ 35 - 0
dp/wifi3.0/dp_rx_mon_status.c

@@ -70,6 +70,36 @@ dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
 	}
 }
 
+/*
+ * dp_rx_populate_su_evm_details() - Populate su evm info
+ * @ppdu_info: ppdu info structure from ppdu ring
+ * @cdp_rx_ppdu: rx ppdu indication structure
+ */
+static inline void
+dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
+			      struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
+{
+	uint8_t pilot_evm;
+	uint8_t nss_count;
+	uint8_t pilot_count;
+
+	nss_count = ppdu_info->evm_info.nss_count;
+	pilot_count = ppdu_info->evm_info.pilot_count;
+
+	if ((nss_count * pilot_count) > DP_RX_MAX_SU_EVM_COUNT) {
+		qdf_err("pilot evm count is more than expected");
+		return;
+	}
+	cdp_rx_ppdu->evm_info.pilot_count = pilot_count;
+	cdp_rx_ppdu->evm_info.nss_count = nss_count;
+
+	/* Populate evm for pilot_evm  = nss_count*pilot_count */
+	for (pilot_evm = 0; pilot_evm < nss_count * pilot_count; pilot_evm++) {
+		cdp_rx_ppdu->evm_info.pilot_evm[pilot_evm] =
+			ppdu_info->evm_info.pilot_evm[pilot_evm];
+	}
+}
+
 /**
 * dp_rx_populate_cdp_indication_ppdu() - Populate cdp rx indication structure
 * @pdev: pdev ctx
@@ -158,6 +188,8 @@ dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
 	cdp_rx_ppdu->u.ltf_size = ppdu_info->rx_status.ltf_size;
 
 	dp_rx_populate_rx_rssi_chain(ppdu_info, cdp_rx_ppdu);
+	dp_rx_populate_su_evm_details(ppdu_info, cdp_rx_ppdu);
+	cdp_rx_ppdu->rx_antenna = ppdu_info->rx_status.rx_antenna;
 }
 #else
 static inline void
@@ -208,6 +240,9 @@ static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
 	ppdu_rx_rate = dp_ath_rate_out(peer->stats.rx.avg_rx_rate);
 	DP_STATS_UPD(peer, rx.rnd_avg_rx_rate, ppdu_rx_rate);
 	ppdu->rx_ratekbps = ratekbps;
+	ppdu->rx_ratecode = CDP_TXRX_RATECODE(ppdu->u.mcs,
+					      nss,
+					      ppdu->u.preamble);
 
 	if (peer->vdev)
 		peer->vdev->stats.rx.last_rx_rate = ratekbps;

+ 19 - 0
hal/wifi3.0/hal_api_mon.h

@@ -155,6 +155,23 @@
 /* Max MPDUs per status buffer */
 #define HAL_RX_MAX_MPDU 64
 
+/* Max pilot count */
+#define HAL_RX_MAX_SU_EVM_COUNT 32
+
+/*
+ * Struct hal_rx_su_evm_info - SU evm info
+ * @number_of_symbols: number of symbols
+ * @nss_count:         nss count
+ * @pilot_count:       pilot count
+ * @pilot_evm:         Array of pilot evm values
+ */
+struct hal_rx_su_evm_info {
+	uint32_t number_of_symbols;
+	uint8_t  nss_count;
+	uint8_t  pilot_count;
+	uint32_t pilot_evm[HAL_RX_MAX_SU_EVM_COUNT];
+};
+
 enum {
 	DP_PPDU_STATUS_START,
 	DP_PPDU_STATUS_DONE,
@@ -463,6 +480,8 @@ struct hal_rx_ppdu_info {
 	struct hal_rx_ppdu_msdu_info rx_msdu_info[HAL_MAX_UL_MU_USERS];
 	/* first msdu payload for all mpdus in ppdu */
 	struct hal_rx_msdu_payload_info ppdu_msdu_info[HAL_RX_MAX_MPDU];
+	/* evm info */
+	struct hal_rx_su_evm_info evm_info;
 };
 
 static inline uint32_t

+ 2 - 0
hal/wifi3.0/hal_generic_api.h

@@ -389,6 +389,8 @@ hal_rx_status_get_tlv_info_generic(void *rx_tlv_hdr, void *ppduinfo,
 		break;
 
 	case WIFIRXPCU_PPDU_END_INFO_E:
+		ppdu_info->rx_status.rx_antenna =
+			HAL_RX_GET(rx_tlv, RXPCU_PPDU_END_INFO_2, RX_ANTENNA);
 		ppdu_info->rx_status.tsft =
 			HAL_RX_GET(rx_tlv, RXPCU_PPDU_END_INFO_1,
 				WB_TIMESTAMP_UPPER_32);

+ 88 - 4
hal/wifi3.0/qca8074v2/hal_8074v2_rx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -23,6 +23,9 @@
 #include "hal_tx.h"
 #include "dp_types.h"
 #include "hal_api_mon.h"
+#ifndef QCA_WIFI_QCA6018
+#include "phyrx_other_receive_info_su_evm_details.h"
+#endif
 
 #define HAL_RX_MSDU_START_MIMO_SS_BITMAP(_rx_msdu_start)\
 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_msdu_start),\
@@ -101,6 +104,52 @@ static uint8_t hal_rx_get_tlv_8074v2(void *rx_tlv)
 	return HAL_RX_GET(rx_tlv, PHYRX_RSSI_LEGACY_0, RECEIVE_BANDWIDTH);
 }
 
+#ifndef QCA_WIFI_QCA6018
+#define HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, evm, pilot) \
+	(ppdu_info)->evm_info.pilot_evm[pilot] = HAL_RX_GET(rx_tlv, \
+				PHYRX_OTHER_RECEIVE_INFO, \
+				SU_EVM_DETAILS_##evm##_PILOT_##pilot##_EVM)
+
+static inline void
+hal_rx_update_su_evm_info(void *rx_tlv,
+			  void *ppdu_info_hdl)
+{
+	struct hal_rx_ppdu_info *ppdu_info =
+			(struct hal_rx_ppdu_info *)ppdu_info_hdl;
+
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 1, 0);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 2, 1);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 3, 2);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 4, 3);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 5, 4);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 6, 5);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 7, 6);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 8, 7);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 9, 8);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 10, 9);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 11, 10);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 12, 11);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 13, 12);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 14, 13);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 15, 14);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 16, 15);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 17, 16);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 18, 17);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 19, 18);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 20, 19);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 21, 20);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 22, 21);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 23, 22);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 24, 23);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 25, 24);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 26, 25);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 27, 26);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 28, 27);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 29, 28);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 30, 29);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 31, 30);
+	HAL_RX_UPDATE_SU_EVM_INFO(rx_tlv, ppdu_info, 32, 31);
+}
 /**
  * hal_rx_proc_phyrx_other_receive_info_tlv_8074v2()
  *				      -process other receive info TLV
@@ -111,10 +160,46 @@ static uint8_t hal_rx_get_tlv_8074v2(void *rx_tlv)
  */
 static
 void hal_rx_proc_phyrx_other_receive_info_tlv_8074v2(void *rx_tlv_hdr,
-						   void *ppdu_info)
+						     void *ppdu_info_hdl)
 {
-}
+	uint16_t tlv_tag;
+	void *rx_tlv;
+	struct hal_rx_ppdu_info *ppdu_info  = ppdu_info_hdl;
+
+	/* Skip TLV_HDR for OTHER_RECEIVE_INFO and follows the
+	 * embedded TLVs inside
+	 */
+	rx_tlv = (uint8_t *)rx_tlv_hdr + HAL_RX_TLV32_HDR_SIZE;
+	tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv);
+
+	switch (tlv_tag) {
+	case WIFIPHYRX_OTHER_RECEIVE_INFO_SU_EVM_DETAILS_E:
 
+		/* Skip TLV length to get TLV content */
+		rx_tlv = (uint8_t *)rx_tlv + HAL_RX_TLV32_HDR_SIZE;
+
+		ppdu_info->evm_info.number_of_symbols = HAL_RX_GET(rx_tlv,
+				PHYRX_OTHER_RECEIVE_INFO,
+				SU_EVM_DETAILS_0_NUMBER_OF_SYMBOLS);
+		ppdu_info->evm_info.pilot_count = HAL_RX_GET(rx_tlv,
+				PHYRX_OTHER_RECEIVE_INFO,
+				SU_EVM_DETAILS_0_PILOT_COUNT);
+		ppdu_info->evm_info.nss_count = HAL_RX_GET(rx_tlv,
+				PHYRX_OTHER_RECEIVE_INFO,
+				SU_EVM_DETAILS_0_NSS_COUNT);
+		hal_rx_update_su_evm_info(rx_tlv, ppdu_info_hdl);
+	break;
+	default:
+		qdf_err("TLV tag not found");
+	}
+}
+#else
+static inline
+void hal_rx_proc_phyrx_other_receive_info_tlv_8074v2(void *rx_tlv_hdr,
+						     void *ppdu_info_hdl)
+{
+}
+#endif
 
 /**
  * hal_rx_dump_msdu_start_tlv_8074v2() : dump RX msdu_start TLV in structured
@@ -368,4 +453,3 @@ static uint16_t hal_rx_msdu_end_da_idx_get_8074v2(uint8_t *buf)
 
 	return da_idx;
 }
-

+ 1 - 0
qdf/inc/qdf_nbuf.h

@@ -317,6 +317,7 @@ struct mon_rx_status {
 	uint8_t ltf_size;
 	uint8_t rxpcu_filter_pass;
 	int8_t rssi_chain[8][8];
+	uint32_t rx_antenna;
 };
 
 /**