Browse Source

qcacmn: Get puncture type from puncture pattern

Populate punctured pattern from WIFIPHYRX_COMMON_USER_INFO_E
And get puncture type from puncture pattern.

Change-Id: I3a5ba4c7c478d15cf3c3cfdcfd0573775ae342ca
CRs-Fixed: 3166010
aloksing 3 years ago
parent
commit
2c977089aa

+ 0 - 11
dp/cmn_dp_api/dp_ratetable.h

@@ -235,17 +235,6 @@ enum BW_TYPES_FP {
 };
 #endif
 
-enum PUNCTURED_MODES {
-	NO_PUNCTURE,
-#ifdef WLAN_FEATURE_11BE
-	PUNCTURED_20MHZ,
-	PUNCTURED_40MHZ,
-	PUNCTURED_80MHZ,
-	PUNCTURED_120MHZ,
-	PUNCTURED_MODE_CNT,
-#endif
-};
-
 enum DP_CMN_MODULATION_TYPE dp_getmodulation(uint16_t pream_type,
 					     uint8_t width,
 					     uint8_t punc_mode);

+ 1 - 1
dp/inc/cdp_txrx_cmn_struct.h

@@ -2377,7 +2377,7 @@ struct cdp_rx_stats_ppdu_user {
  * @user: per user stats in MU-user case
  * @nf: noise floor
  * @per_chain_rssi: rssi per antenna
- * @punc_bw: puncered bw
+ * @punc_bw: punctured bw
  * @phyrx_abort: rx aborted undecoded frame indication
  * @phyrx_abort_reason: abort reason defined in phyrx_abort_request_info
  * @l_sig_length: L SIG A length

+ 11 - 0
dp/inc/cdp_txrx_mon_struct.h

@@ -140,6 +140,17 @@ enum CMN_BW_TYPES {
 	CMN_BW_IDLE = 0xFF, /*default BW state */
 };
 
+enum cdp_punctured_modes {
+	NO_PUNCTURE,
+#ifdef WLAN_FEATURE_11BE
+	PUNCTURED_20MHZ,
+	PUNCTURED_40MHZ,
+	PUNCTURED_80MHZ,
+	PUNCTURED_120MHZ,
+#endif
+	PUNCTURED_MODE_CNT,
+};
+
 struct cdp_mon_status {
 	/* bss color value 1-63 used for update on ppdu_desc bsscolor */
 	uint8_t bsscolor;

+ 1 - 1
dp/wifi3.0/dp_main.c

@@ -10358,7 +10358,7 @@ static int dp_txrx_get_ratekbps(int preamb, int mcs,
 {
 	uint32_t rix;
 	uint16_t ratecode;
-	enum PUNCTURED_MODES punc_mode = NO_PUNCTURE;
+	enum cdp_punctured_modes punc_mode = NO_PUNCTURE;
 
 	return dp_getrateindex((uint32_t)gintval, (uint16_t)mcs, 1,
 			       (uint8_t)preamb, 1, punc_mode,

+ 65 - 0
dp/wifi3.0/monitor/2.0/dp_mon_2.0.c

@@ -518,6 +518,65 @@ dp_mon_tx_stats_update_2_0(struct dp_mon_peer *mon_peer,
 		      (preamble == DOT11_BE) &&
 		      (ppdu->ppdu_type == HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO)));
 }
+
+enum cdp_punctured_modes
+dp_mon_get_puncture_type(uint16_t puncture_pattern, uint8_t bw)
+{
+	uint16_t mask;
+	uint8_t punctured_bits;
+
+	switch (bw) {
+	case CMN_BW_80MHZ:
+		mask = PUNCTURE_80MHZ_MASK;
+		break;
+	case CMN_BW_160MHZ:
+		mask = PUNCTURE_160MHZ_MASK;
+		break;
+	case CMN_BW_320MHZ:
+		mask = PUNCTURE_320MHZ_MASK;
+		break;
+	default:
+		return NO_PUNCTURE;
+	}
+
+	/* 0s in puncture pattern received in TLV indicates punctured 20Mhz,
+	 * after complement, 1s will indicate punctured 20Mhz
+	 */
+	puncture_pattern = ~puncture_pattern;
+	puncture_pattern &= mask;
+
+	if (puncture_pattern) {
+		punctured_bits = 0;
+		while (puncture_pattern != 0) {
+			punctured_bits++;
+			puncture_pattern &= (puncture_pattern - 1);
+		}
+
+		if (bw == CMN_BW_80MHZ) {
+			if (punctured_bits == IEEE80211_PUNC_MINUS20MHZ)
+				return PUNCTURED_20MHZ;
+			else
+				return NO_PUNCTURE;
+		} else if (bw == CMN_BW_160MHZ) {
+			if (punctured_bits == IEEE80211_PUNC_MINUS20MHZ)
+				return PUNCTURED_20MHZ;
+			else if (punctured_bits == IEEE80211_PUNC_MINUS40MHZ)
+				return PUNCTURED_40MHZ;
+			else
+				return NO_PUNCTURE;
+		} else if (bw == CMN_BW_320MHZ) {
+			if (punctured_bits == IEEE80211_PUNC_MINUS40MHZ)
+				return PUNCTURED_40MHZ;
+			else if (punctured_bits == IEEE80211_PUNC_MINUS80MHZ)
+				return PUNCTURED_80MHZ;
+			else if (punctured_bits == IEEE80211_PUNC_MINUS120MHZ)
+				return PUNCTURED_120MHZ;
+			else
+				return NO_PUNCTURE;
+		}
+	}
+	return NO_PUNCTURE;
+}
 #endif
 
 #if defined(QCA_ENHANCED_STATS_SUPPORT) && !defined(WLAN_FEATURE_11BE)
@@ -526,6 +585,12 @@ dp_mon_tx_stats_update_2_0(struct dp_mon_peer *mon_peer,
 			   struct cdp_tx_completion_ppdu_user *ppdu)
 {
 }
+
+enum cdp_punctured_modes
+dp_mon_get_puncture_type(uint16_t puncture_pattern, uint8_t bw)
+{
+	return NO_PUNCTURE;
+}
 #endif /* QCA_ENHANCED_STATS_SUPPORT && WLAN_FEATURE_11BE */
 
 #ifdef QCA_SUPPORT_BPR

+ 10 - 0
dp/wifi3.0/monitor/2.0/dp_mon_2.0.h

@@ -257,6 +257,16 @@ void dp_mon_filter_show_filter_be(enum dp_mon_filter_mode mode,
 void dp_mon_filter_show_tx_filter_be(enum dp_mon_filter_mode mode,
 				     struct dp_mon_filter_be *filter);
 
+#ifdef QCA_ENHANCED_STATS_SUPPORT
+/**
+ * dp_mon_get_puncture_type() - Get puncture type
+ * @puncture_pattern: puncture bitmap
+ * @bw: Bandwidth
+ */
+enum cdp_punctured_modes
+dp_mon_get_puncture_type(uint16_t puncture_pattern, uint8_t bw);
+#endif
+
 /*
  * dp_mon_desc_get() - get monitor sw descriptor
  *

+ 8 - 2
dp/wifi3.0/monitor/2.0/dp_rx_mon_2.0.c

@@ -672,6 +672,9 @@ void
 dp_rx_mon_populate_ppdu_info_2_0(struct hal_rx_ppdu_info *hal_ppdu_info,
 				 struct cdp_rx_indication_ppdu *ppdu)
 {
+	uint16_t puncture_pattern;
+	enum cdp_punctured_modes punc_mode;
+
 	/* Align bw value as per host data structures */
 	if (hal_ppdu_info->rx_status.bw == HAL_FULL_RX_BW_320)
 		ppdu->u.bw = CMN_BW_320MHZ;
@@ -683,7 +686,10 @@ dp_rx_mon_populate_ppdu_info_2_0(struct hal_rx_ppdu_info *hal_ppdu_info,
 	else
 		ppdu->u.preamble = hal_ppdu_info->rx_status.preamble_type;
 
-	ppdu->punc_bw = hal_ppdu_info->rx_status.punctured_bw;
+	puncture_pattern = hal_ppdu_info->rx_status.punctured_pattern;
+	punc_mode = dp_mon_get_puncture_type(puncture_pattern,
+					     ppdu->u.bw);
+	ppdu->punc_bw = punc_mode;
 }
 #else
 void dp_rx_mon_stats_update_2_0(struct dp_mon_peer *mon_peer,
@@ -697,7 +703,7 @@ void
 dp_rx_mon_populate_ppdu_info_2_0(struct hal_rx_ppdu_info *hal_ppdu_info,
 				 struct cdp_rx_indication_ppdu *ppdu)
 {
-	ppdu->punc_bw = 0;
+	ppdu->punc_bw = NO_PUNCTURE;
 }
 #endif
 #endif

+ 1 - 1
dp/wifi3.0/monitor/dp_mon.c

@@ -2410,8 +2410,8 @@ dp_tx_rate_stats_update(struct dp_peer *peer,
 	uint64_t ppdu_tx_rate = 0;
 	uint32_t rix;
 	uint16_t ratecode = 0;
-	enum PUNCTURED_MODES punc_mode = NO_PUNCTURE;
 	struct dp_mon_peer *mon_peer = NULL;
+	enum cdp_punctured_modes punc_mode = NO_PUNCTURE;
 
 	if (!peer || !ppdu)
 		return;

+ 1 - 2
dp/wifi3.0/monitor/dp_rx_mon.c

@@ -646,7 +646,6 @@ static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
 	uint32_t rix;
 	uint16_t ratecode = 0;
 	struct cdp_rx_stats_ppdu_user *ppdu_user = NULL;
-	enum PUNCTURED_MODES punc_mode = NO_PUNCTURE;
 	struct dp_mon_peer *mon_peer = NULL;
 
 	if (!peer || !ppdu)
@@ -683,7 +682,7 @@ static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
 				   nss,
 				   ppdu->u.preamble,
 				   ppdu->u.bw,
-				   punc_mode,
+				   ppdu->punc_bw,
 				   &rix,
 				   &ratecode);
 

+ 1 - 0
hal/wifi3.0/be/hal_be_api_mon.h

@@ -1432,6 +1432,7 @@ hal_rx_parse_cmn_usr_info(struct hal_soc *hal_soc, uint8_t *tlv,
 	ppdu_info->rx_status.eht_data[0] |= (cmn_usr_info->ltf_size <<
 					     QDF_MON_STATUS_EHT_LTF_SHIFT);
 	ppdu_info->rx_status.ltf_size = cmn_usr_info->ltf_size;
+	ppdu_info->rx_status.punctured_pattern = cmn_usr_info->puncture_bitmap;
 
 	return HAL_TLV_STATUS_PPDU_NOT_DONE;
 }

+ 2 - 2
qdf/inc/qdf_nbuf.h

@@ -325,7 +325,7 @@ typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
  * @ba_bitmap: 256 bit block ack bitmap
  * @add_rtap_ext2: add radiotap extension2
  * @mpdu_retry_cnt: Rx mpdu retry count
- * @punctured_bw: puntured bw
+ * @punctured_pattern: punctured pattern (0 means the band is punctured)
  * @rx_user_status: pointer to mon_rx_user_status, when set update
  * radiotap header will use userinfo from this structure.
  * @usig_common: U-SIG property of received frame
@@ -441,7 +441,7 @@ struct mon_rx_status {
 	bool add_rtap_ext2;
 	uint32_t mpdu_retry_cnt;
 #ifdef WLAN_FEATURE_11BE
-	uint8_t punctured_bw;
+	uint16_t punctured_pattern;
 #endif
 	struct mon_rx_user_status *rx_user_status;
 	uint32_t usig_common;