Browse Source

qcacmn: tx monitor populate basic tlv

tx monitor populate basic tlv data.

Change-Id: I346b5da00b967fb9717009a153e8f8db239494ef
CRs-Fixed: 3204929
nobelj 3 years ago
parent
commit
69a8a9c767
2 changed files with 343 additions and 6 deletions
  1. 47 1
      hal/wifi3.0/be/hal_be_api_mon.h
  2. 296 5
      hal/wifi3.0/be/hal_be_generic_api.h

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

@@ -784,6 +784,16 @@ enum txmon_pkt_type {
 	TXMON_PKT_TYPE_11AZ
 };
 
+enum txmon_generated_response {
+	TXMON_GEN_RESP_SELFGEN_ACK = 0,
+	TXMON_GEN_RESP_SELFGEN_CTS,
+	TXMON_GEN_RESP_SELFGEN_BA,
+	TXMON_GEN_RESP_SELFGEN_MBA,
+	TXMON_GEN_RESP_SELFGEN_CBF,
+	TXMON_GEN_RESP_SELFGEN_TRIG,
+	TXMON_GEN_RESP_SELFGEN_NDP_LMR
+};
+
 #define TXMON_HAL(hal_tx_ppdu_info, field)		\
 			hal_tx_ppdu_info->field
 #define TXMON_HAL_STATUS(hal_tx_ppdu_info, field)	\
@@ -794,10 +804,35 @@ enum txmon_pkt_type {
 #define TXMON_STATUS_INFO(hal_tx_status_info, field)	\
 			hal_tx_status_info->field
 
+/**
+ * struct hal_tx_status_info - status info that wasn't populated in rx_status
+ * @reception_type: su or uplink mu reception type
+ * @transmission_type: su or mu transmission type
+ * @medium_prot_type: medium protection type
+ * @generated_response: Generated frame in response window
+ * @no_bitmap_avail: Bitmap available flag
+ * @explicit_ack: Explicit Acknowledge flag
+ * @explicit_ack_type: Explicit Acknowledge type
+ * @r2r_end_status_follow: Response to Response status flag
+ * @response_type: Response type in response window
+ * @ndp_frame: NDP frame
+ * @num_users: number of users
+ * @sw_frame_group_id: software frame group ID
+ * @r2r_to_follow: Response to Response follow flag
+ * @buffer: Packet buffer pointer address
+ * @offset: Packet buffer offset
+ * @length: Packet buffer length
+ * @protection_addr: Protection Address flag
+ * @addr1: MAC address 1
+ * @addr2: MAC address 2
+ * @addr3: MAC address 3
+ * @addr4: MAC address 4
+ */
 struct hal_tx_status_info {
 	uint8_t reception_type;
 	uint8_t transmission_type;
 	uint8_t medium_prot_type;
+	uint8_t generated_response;
 
 	uint32_t no_bitmap_avail	:1,
 		explicit_ack		:1,
@@ -810,7 +845,6 @@ struct hal_tx_status_info {
 
 	uint8_t sw_frame_group_id;
 	uint32_t r2r_to_follow;
-	uint32_t prot_tlv_status;
 
 	void *buffer;
 	uint32_t offset;
@@ -823,6 +857,18 @@ struct hal_tx_status_info {
 	uint8_t addr4[QDF_MAC_ADDR_SIZE];
 };
 
+/**
+ * struct hal_tx_ppdu_info - tx monitor ppdu information
+ * @ppdu_id:  Id of the PLCP protocol data unit
+ * @num_users: number of users
+ * @is_used: boolean flag to identify valid ppdu info
+ * @is_data: boolean flag to identify data frame
+ * @cur_usr_idx: Current user index of the PPDU
+ * @reserved: for furture purpose
+ * @prot_tlv_status: protection tlv status
+ * @rx_status: monitor mode rx status information
+ * @rx_user_status: monitor mode rx user status information
+ */
 struct hal_tx_ppdu_info {
 	uint32_t ppdu_id;
 	uint32_t num_users	:8,

+ 296 - 5
hal/wifi3.0/be/hal_be_generic_api.h

@@ -511,6 +511,37 @@ hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
 				    struct hal_tx_status_info *data_status_info,
 				    struct hal_tx_status_info *prot_status_info)
 {
+	prot_status_info->protection_addr =
+			HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+					   USE_ADDRESS_FIELDS_FOR_PROTECTION);
+	/* protection frame address 1 */
+	*(uint32_t *)&prot_status_info->addr1[0] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD1_31_0);
+	*(uint32_t *)&prot_status_info->addr1[4] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD1_47_32);
+	/* protection frame address 2 */
+	*(uint32_t *)&prot_status_info->addr2[0] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD2_15_0);
+	*(uint32_t *)&prot_status_info->addr2[2] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD2_47_16);
+	/* protection frame address 3 */
+	*(uint32_t *)&prot_status_info->addr3[0] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD3_31_0);
+	*(uint32_t *)&prot_status_info->addr3[4] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD3_47_32);
+	/* protection frame address 4 */
+	*(uint32_t *)&prot_status_info->addr4[0] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD4_15_0);
+	*(uint32_t *)&prot_status_info->addr4[2] =
+				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
+						   PROTECTION_FRAME_AD4_47_16);
 }
 
 /**
@@ -529,6 +560,16 @@ hal_txmon_parse_peer_entry(void *tx_tlv,
 			   struct hal_tx_ppdu_info *tx_ppdu_info,
 			   struct hal_tx_status_info *tx_status_info)
 {
+	*(uint32_t *)&tx_status_info->addr1[0] =
+		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_31_0);
+	*(uint32_t *)&tx_status_info->addr1[4] =
+		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_47_32);
+	*(uint32_t *)&tx_status_info->addr2[0] =
+		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_15_0);
+	*(uint32_t *)&tx_status_info->addr2[2] =
+		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_47_16);
+	TXMON_HAL_USER(tx_ppdu_info, user_id, sw_peer_id) =
+		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, SW_PEER_ID);
 }
 
 /**
@@ -543,6 +584,10 @@ static inline void
 hal_txmon_parse_queue_exten(void *tx_tlv,
 			    struct hal_tx_ppdu_info *tx_ppdu_info)
 {
+	TXMON_HAL_STATUS(tx_ppdu_info, frame_control) =
+				HAL_TX_DESC_GET_64(tx_tlv, TX_QUEUE_EXTENSION,
+						   FRAME_CTL);
+	TXMON_HAL_STATUS(tx_ppdu_info, frame_control_info_valid) = true;
 }
 
 /**
@@ -558,6 +603,10 @@ static inline void
 hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
 			   struct hal_tx_ppdu_info *tx_ppdu_info)
 {
+	TXMON_HAL_USER(tx_ppdu_info, user_id,
+		       start_seq) = HAL_TX_DESC_GET_64(tx_tlv, TX_MPDU_START,
+						       MPDU_SEQUENCE_NUMBER);
+	TXMON_HAL(tx_ppdu_info, cur_usr_idx) = user_id;
 }
 #endif
 
@@ -780,14 +829,104 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	case WIFITX_FES_STATUS_END_E:/* UPSTREAM */
 	{
 		/* initiator PPDU window end */
+		uint32_t ppdu_timestamp_start = 0;
+		uint32_t ppdu_timestamp_end = 0;
+		uint8_t response_type = 0;
+		uint8_t r2r_end_status_follow = 0;
+
 		status = HAL_MON_TX_FES_STATUS_END;
+
+		ppdu_timestamp_start =
+			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
+					   START_OF_FRAME_TIMESTAMP_15_0) |
+			(HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
+					    START_OF_FRAME_TIMESTAMP_31_16) <<
+			 HAL_TX_LSB(TX_FES_STATUS_END,
+				    START_OF_FRAME_TIMESTAMP_31_16));
+		ppdu_timestamp_end =
+			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
+					   END_OF_FRAME_TIMESTAMP_15_0) |
+			(HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
+					    END_OF_FRAME_TIMESTAMP_31_16) <<
+			 HAL_TX_LSB(TX_FES_STATUS_END,
+				    END_OF_FRAME_TIMESTAMP_31_16));
+
+		response_type = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
+						   RESPONSE_TYPE);
+		/*
+		 * r2r end status follow to inform whether to look for
+		 * rx_response_required_info
+		 */
+		r2r_end_status_follow =
+			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
+					   R2R_END_STATUS_TO_FOLLOW);
+
+		TXMON_STATUS_INFO(tx_status_info,
+				  response_type) = response_type;
+		TXMON_STATUS_INFO(tx_status_info,
+				  r2r_to_follow) = r2r_end_status_follow;
+
+		/*  update phy timestamp to ppdu timestamp */
+		TXMON_HAL_STATUS(ppdu_info,
+				 ppdu_timestamp) = ppdu_timestamp_start;
+
 		SHOW_DEFINED(WIFITX_FES_STATUS_END_E);
 		break;
 	}
 	/* response window open */
 	case WIFIRX_RESPONSE_REQUIRED_INFO_E:/* UPSTREAM */
 	{
+		/* response PPDU window start */
+		uint32_t ppdu_id = 0;
+		uint8_t reception_type = 0;
+		uint8_t response_sta_count = 0;
+
 		status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
+
+		ppdu_id = HAL_TX_DESC_GET_64(tx_tlv,
+					     RX_RESPONSE_REQUIRED_INFO,
+					     PHY_PPDU_ID);
+		reception_type =
+			HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
+					   SU_OR_UPLINK_MU_RECEPTION);
+		response_sta_count =
+			HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
+					   RESPONSE_STA_COUNT);
+
+		/* get mac address */
+		*(uint32_t *)&tx_status_info->addr1[0] =
+				HAL_TX_DESC_GET_64(tx_tlv,
+						   RX_RESPONSE_REQUIRED_INFO,
+						   ADDR1_31_0);
+		*(uint32_t *)&tx_status_info->addr1[4] =
+				HAL_TX_DESC_GET_64(tx_tlv,
+						   RX_RESPONSE_REQUIRED_INFO,
+						   ADDR1_47_32);
+		*(uint32_t *)&tx_status_info->addr2[0] =
+				HAL_TX_DESC_GET_64(tx_tlv,
+						   RX_RESPONSE_REQUIRED_INFO,
+						   ADDR2_15_0);
+		*(uint32_t *)&tx_status_info->addr2[2] =
+				HAL_TX_DESC_GET_64(tx_tlv,
+						   RX_RESPONSE_REQUIRED_INFO,
+						   ADDR2_47_16);
+
+		TXMON_HAL(ppdu_info, ppdu_id) = ppdu_id;
+		TXMON_HAL_STATUS(ppdu_info, ppdu_id) = ppdu_id;
+
+		if (response_sta_count == 0)
+			response_sta_count = 1;
+		TXMON_HAL(ppdu_info, num_users) = response_sta_count;
+
+		if (reception_type)
+			TXMON_STATUS_INFO(tx_status_info,
+					  transmission_type) =
+							TXMON_SU_TRANSMISSION;
+		else
+			TXMON_STATUS_INFO(tx_status_info,
+					  transmission_type) =
+							TXMON_MU_TRANSMISSION;
+
 		SHOW_DEFINED(WIFIRX_RESPONSE_REQUIRED_INFO_E);
 		break;
 	}
@@ -795,7 +934,38 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	case WIFIRESPONSE_END_STATUS_E:/* UPSTREAM */
 	{
 		/* response PPDU window end */
+		uint8_t generated_response = 0;
+		uint32_t bandwidth = 0;
+		uint32_t ppdu_timestamp_start = 0;
+		uint32_t ppdu_timestamp_end = 0;
+
 		status = HAL_MON_RESPONSE_END_STATUS_INFO;
+		generated_response = HAL_TX_DESC_GET_64(tx_tlv,
+							RESPONSE_END_STATUS,
+							GENERATED_RESPONSE);
+		bandwidth = HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
+					       COEX_BASED_TX_BW);
+		/* 32 bits TSF */
+		ppdu_timestamp_start =
+			(HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
+					    START_OF_FRAME_TIMESTAMP_15_0) |
+			 (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
+					     START_OF_FRAME_TIMESTAMP_31_16) <<
+			  16));
+		ppdu_timestamp_end =
+			(HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
+					    END_OF_FRAME_TIMESTAMP_15_0) |
+			 (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
+					     END_OF_FRAME_TIMESTAMP_31_16) <<
+			  16));
+
+		TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
+		/* update phy timestamp to ppdu timestamp */
+		TXMON_HAL_STATUS(ppdu_info,
+				 ppdu_timestamp) = ppdu_timestamp_start;
+
+		TXMON_STATUS_INFO(tx_status_info,
+				  generated_response) = generated_response;
 		SHOW_DEFINED(WIFIRESPONSE_END_STATUS_E);
 		break;
 	}
@@ -849,6 +1019,20 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	}
 	case WIFITX_DATA_E:/* DOWNSTREAM */
 	{
+		status = HAL_MON_TX_DATA;
+		/*
+		 * TODO: do we need a conversion api to convert
+		 * user_id from hw to get host user_index
+		 */
+		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
+		TXMON_STATUS_INFO(tx_status_info,
+				  buffer) = (void *)status_frag;
+		TXMON_STATUS_INFO(tx_status_info,
+				  offset) = ((void *)tx_tlv -
+					     (void *)status_frag);
+		TXMON_STATUS_INFO(tx_status_info,
+				  length) = tlv_len;
+
 		/*
 		 * reference of the status buffer will be held in
 		 * dp_tx_update_ppdu_info_status()
@@ -857,13 +1041,23 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 		SHOW_DEFINED(WIFITX_DATA_E);
 		break;
 	}
-	case WIFIMON_BUFFER_ADDR_E:
+	case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
 	{
-		frag_buf = hal_txmon_get_buffer_addr_generic_be(tx_tlv, NULL);
-		if (frag_buf)
-			qdf_frag_free(frag_buf);
-		frag_buf = NULL;
+		struct hal_mon_buf_addr_status buf_status = {0};
+
 		status = HAL_MON_TX_BUFFER_ADDR;
+		/*
+		 * TODO: do we need a conversion api to convert
+		 * user_id from hw to get host user_index
+		 */
+		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
+		frag_buf = hal_txmon_get_buffer_addr_generic_be(tx_tlv,
+								&buf_status);
+		TXMON_STATUS_INFO(tx_status_info,
+				  buffer) = (void *)frag_buf;
+		TXMON_STATUS_INFO(tx_status_info, offset) = 0;
+		TXMON_STATUS_INFO(tx_status_info,
+				  length) = buf_status.dma_length;
 
 		SHOW_DEFINED(WIFIMON_BUFFER_ADDR_E);
 		break;
@@ -998,24 +1192,75 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 		/*
 		 * TLV indicating that first transmission on the medium
 		 */
+		uint8_t medium_prot_type = 0;
+
 		status = HAL_MON_TX_FES_STATUS_START;
+
+		medium_prot_type = HAL_TX_DESC_GET_64(tx_tlv,
+						      TX_FES_STATUS_START,
+						      MEDIUM_PROT_TYPE);
+
+		ppdu_info = (struct hal_tx_ppdu_info *)prot_ppdu_info;
+		/* update what type of medium protection frame */
+		TXMON_STATUS_INFO(tx_status_info,
+				  medium_prot_type) = medium_prot_type;
 		SHOW_DEFINED(WIFITX_FES_STATUS_START_E);
 		break;
 	}
 	case WIFITX_FES_STATUS_PROT_E:
 	{
+		uint32_t start_timestamp = 0;
+		uint32_t end_timestamp = 0;
+
 		/*
 		 * generated by TXPCU to indicate the result of having
 		 * received of the expected protection frame
 		 */
 
 		status = HAL_MON_TX_FES_STATUS_PROT;
+		start_timestamp =
+			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
+					   START_OF_FRAME_TIMESTAMP_15_0);
+		start_timestamp |=
+			(HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
+					    START_OF_FRAME_TIMESTAMP_31_16) <<
+			 15);
+		end_timestamp = HAL_TX_DESC_GET_64(tx_tlv,
+						   TX_FES_STATUS_PROT,
+						   END_OF_FRAME_TIMESTAMP_15_0);
+		end_timestamp |=
+			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
+					   END_OF_FRAME_TIMESTAMP_31_16) << 15;
+
+		/* ppdu timestamp as phy timestamp */
+		TXMON_HAL_STATUS(ppdu_info,
+				 ppdu_timestamp) = start_timestamp;
+
 		SHOW_DEFINED(WIFITX_FES_STATUS_PROT_E);
 		break;
 	}
 	case WIFITX_FES_STATUS_START_PROT_E:
 	{
+		uint64_t tsft_64;
+		uint32_t response_type;
 		status = HAL_MON_TX_FES_STATUS_START_PROT;
+		TXMON_HAL(ppdu_info, prot_tlv_status) = tlv_tag;
+		/* timestamp */
+		tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
+					     TX_FES_STATUS_START_PROT,
+					     PROT_TIMESTAMP_LOWER_32);
+		tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
+					       TX_FES_STATUS_START_PROT,
+					       PROT_TIMESTAMP_UPPER_32) << 32);
+
+		response_type = HAL_TX_DESC_GET_64(tx_tlv,
+						   TX_FES_STATUS_START_PROT,
+						   RESPONSE_TYPE);
+
+		TXMON_STATUS_INFO(tx_status_info,
+				  response_type) = response_type;
+		TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
+
 		SHOW_DEFINED(WIFITX_FES_STATUS_START_PROT_E);
 		break;
 	}
@@ -1032,13 +1277,44 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	}
 	case WIFITX_FES_STATUS_START_PPDU_E:
 	{
+		uint64_t tsft_64;
+		uint8_t ndp_frame;
+
 		status = HAL_MON_TX_FES_STATUS_START_PPDU;
+		tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
+					     TX_FES_STATUS_START_PPDU,
+					     PPDU_TIMESTAMP_LOWER_32);
+		tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
+					       TX_FES_STATUS_START_PPDU,
+					       PPDU_TIMESTAMP_UPPER_32) << 32);
+
+		ndp_frame = HAL_TX_DESC_GET_64(tx_tlv,
+					       TX_FES_STATUS_START_PPDU,
+					       NDP_FRAME);
+
+		TXMON_STATUS_INFO(tx_status_info, ndp_frame) = ndp_frame;
+		TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
+
 		SHOW_DEFINED(WIFITX_FES_STATUS_START_PPDU_E);
 		break;
 	}
 	case WIFITX_FES_STATUS_USER_PPDU_E:
 	{
 		/* user tlv */
+		uint16_t duration;
+		uint8_t transmitted_tid;
+
+		duration = HAL_TX_DESC_GET_64(tx_tlv,
+					      TX_FES_STATUS_USER_PPDU,
+					      DURATION);
+		transmitted_tid = HAL_TX_DESC_GET_64(tx_tlv,
+						     TX_FES_STATUS_USER_PPDU,
+						     TRANSMITTED_TID);
+
+		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
+		TXMON_HAL_USER(ppdu_info, user_id, tid) = transmitted_tid;
+		TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
+
 		status = HAL_MON_TX_FES_STATUS_USER_PPDU;
 		SHOW_DEFINED(WIFITX_FES_STATUS_USER_PPDU_E);
 		break;
@@ -1268,7 +1544,22 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	case WIFICOEX_TX_STATUS_E:
 	{
 		/* duration are retrieved from coex tx status */
+		uint16_t duration;
+		uint8_t status_reason;
+
 		status = HAL_MON_COEX_TX_STATUS;
+		duration = HAL_TX_DESC_GET_64(tx_tlv,
+					      COEX_TX_STATUS,
+					      CURRENT_TX_DURATION);
+		status_reason = HAL_TX_DESC_GET_64(tx_tlv,
+						   COEX_TX_STATUS,
+						   TX_STATUS_REASON);
+
+		/* update duration */
+		if (status_reason == COEX_FES_TX_START ||
+		    status_reason == COEX_RESPONSE_TX_START)
+			TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
+
 		SHOW_DEFINED(WIFICOEX_TX_STATUS_E);
 		break;
 	}