ソースを参照

qcacmn: Add support for firmware to software tlv

Added support for parsing firmware to software tlv. which is mainly used
for populating frequency of the current packet.

Change-Id: I67c552e6d6b5caf9c12c34e553bad70b89b30c40
CRs-Fixed: 3270364
nobelj 2 年 前
コミット
f1dd81866f

+ 45 - 4
dp/wifi3.0/monitor/2.0/dp_tx_mon_2.0.c

@@ -1038,6 +1038,37 @@ dp_populate_tsft_from_phy_timestamp(struct dp_pdev *pdev,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * dp_tx_mon_update_channel_freq() - API to update channel frequency and number
+ * @pdev: pdev Handle
+ * @soc: soc Handle
+ * @freq: Frequency
+ *
+ * Return: void
+ */
+static inline void
+dp_tx_mon_update_channel_freq(struct dp_pdev *pdev, struct dp_soc *soc,
+			      uint16_t freq)
+{
+	if (soc && soc->cdp_soc.ol_ops->freq_to_channel) {
+		uint8_t c_num;
+
+		c_num = soc->cdp_soc.ol_ops->freq_to_channel(soc->ctrl_psoc,
+							     pdev->pdev_id,
+							     freq);
+		pdev->operating_channel.num = c_num;
+	}
+
+	if (soc && soc->cdp_soc.ol_ops->freq_to_band) {
+		uint8_t band;
+
+		band = soc->cdp_soc.ol_ops->freq_to_band(soc->ctrl_psoc,
+							 pdev->pdev_id,
+							 freq);
+		pdev->operating_channel.band = band;
+	}
+}
+
 /**
  * dp_tx_mon_update_radiotap() - API to update radiotap information
  * @pdev: pdev Handle
@@ -1054,13 +1085,23 @@ dp_tx_mon_update_radiotap(struct dp_pdev *pdev,
 
 	num_users = TXMON_PPDU_HAL(ppdu_info, num_users);
 
-	if (qdf_unlikely(TXMON_PPDU_COM(ppdu_info, chan_num) == 0))
+	if (qdf_unlikely(TXMON_PPDU_COM(ppdu_info, chan_freq) == 0 &&
+			 TXMON_PPDU_COM(ppdu_info, chan_num) == 0)) {
+		TXMON_PPDU_COM(ppdu_info, chan_freq) =
+				pdev->operating_channel.freq;
 		TXMON_PPDU_COM(ppdu_info, chan_num) =
 				pdev->operating_channel.num;
+	} else if (TXMON_PPDU_COM(ppdu_info, chan_freq) != 0 &&
+		   TXMON_PPDU_COM(ppdu_info, chan_num) == 0) {
+		uint16_t freq = TXMON_PPDU_COM(ppdu_info, chan_freq);
 
-	if (qdf_unlikely(TXMON_PPDU_COM(ppdu_info, chan_freq) == 0))
-		TXMON_PPDU_COM(ppdu_info, chan_freq) =
-				pdev->operating_channel.freq;
+		if (qdf_unlikely(pdev->operating_channel.freq != freq)) {
+			dp_tx_mon_update_channel_freq(pdev, pdev->soc, freq);
+			pdev->operating_channel.freq = freq;
+		}
+		TXMON_PPDU_COM(ppdu_info,
+			       chan_num) = pdev->operating_channel.num;
+	}
 
 	if (QDF_STATUS_SUCCESS !=
 	    dp_populate_tsft_from_phy_timestamp(pdev, ppdu_info))

+ 13 - 0
dp/wifi3.0/monitor/2.0/dp_tx_mon_status_2.0.c

@@ -1389,6 +1389,19 @@ dp_tx_mon_update_ppdu_info_status(struct dp_pdev *pdev,
 		/* No action for Queue Extension TLV */
 		break;
 	}
+	case HAL_MON_TX_FW2SW:
+	{
+		/* update the frequency */
+		tx_status_info = &tx_mon_be->data_status_info;
+
+		TXMON_PPDU_COM(tx_data_ppdu_info,
+			       chan_freq) = TXMON_STATUS_INFO(tx_status_info,
+							      freq);
+		TXMON_PPDU_COM(tx_prot_ppdu_info,
+			       chan_freq) = TXMON_STATUS_INFO(tx_status_info,
+							      freq);
+		break;
+	}
 	default:
 	{
 		/* return or break in default case */

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

@@ -750,6 +750,7 @@ enum hal_tx_tlv_status {
 	HAL_MON_MACTX_USER_DESC_COMMON,
 	HAL_MON_MACTX_PHY_DESC,
 
+	HAL_MON_TX_FW2SW,
 	HAL_MON_TX_STATUS_PPDU_NOT_DONE,
 };
 
@@ -840,6 +841,12 @@ struct hal_tx_status_info {
 	uint8_t medium_prot_type;
 	uint8_t generated_response;
 
+	uint16_t band_center_freq1;
+	uint16_t band_center_freq2;
+	uint16_t freq;
+	uint16_t phy_mode;
+	uint32_t schedule_id;
+
 	uint32_t no_bitmap_avail	:1,
 		explicit_ack		:1,
 		explicit_ack_type	:4,

+ 61 - 4
hal/wifi3.0/be/hal_be_generic_api.h

@@ -25,6 +25,8 @@
 #include "hal_be_reo.h"
 #include <hal_api_mon.h>
 #include <hal_generic_api.h>
+#include <hal_be_api_mon.h>
+#include "txmon_tlvs.h"
 
 /**
  * Debug macro to print the TLV header tag
@@ -679,6 +681,59 @@ uint8_t get_ru_offset_from_start_index(uint8_t ru_size, uint8_t start_idx)
 	return ru_alloc_offset[start_idx][ru_size];
 }
 
+/**
+ * hal_txmon_parse_fw2sw() - parse firmware to software tlv
+ *
+ * @tx_tlv: pointer to firmware to software tlvmpdu start tlv header
+ * @type: place where this tlv is generated
+ * @tx_status_info: pointer to hal_tx_status_info
+ *
+ * Return: void
+ */
+static inline void
+hal_txmon_parse_fw2sw(void *tx_tlv, uint8_t type,
+		      struct hal_tx_status_info *status_info)
+{
+	uint32_t *msg = (uint32_t *)tx_tlv;
+
+	switch (type) {
+	case TXMON_FW2SW_TYPE_FES_SETUP:
+	{
+		uint32_t schedule_id;
+		uint16_t c_freq1;
+		uint16_t c_freq2;
+		uint16_t freq_mhz;
+		uint8_t phy_mode;
+
+		c_freq1 = TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_GET(*msg);
+		c_freq2 = TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_GET(*msg);
+
+		msg++;
+		phy_mode = TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_GET(*msg);
+		freq_mhz = TXMON_FW2SW_MON_FES_SETUP_MHZ_GET(*msg);
+
+		msg++;
+		schedule_id = TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_GET(*msg);
+
+		TXMON_STATUS_INFO(status_info, band_center_freq1) = c_freq1;
+		TXMON_STATUS_INFO(status_info, band_center_freq2) = c_freq2;
+		TXMON_STATUS_INFO(status_info, freq) = freq_mhz;
+		TXMON_STATUS_INFO(status_info, phy_mode) = phy_mode;
+		TXMON_STATUS_INFO(status_info, schedule_id) = schedule_id;
+
+		break;
+	}
+	case TXMON_FW2SW_TYPE_FES_SETUP_USER:
+	{
+		break;
+	}
+	case TXMON_FW2SW_TYPE_FES_SETUP_EXT:
+	{
+		break;
+	}
+	};
+}
+
 /**
  * hal_txmon_status_get_num_users_generic_be() - api to get num users
  * from start of fes window
@@ -807,13 +862,12 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	struct hal_tx_ppdu_info *ppdu_info;
 	struct hal_tx_status_info *tx_status_info;
 	struct hal_mon_packet_info *packet_info = NULL;
-	uint32_t tlv_tag, user_id, tlv_len;
+	uint32_t tlv_tag, user_id, tlv_len, tlv_user_id;
 	uint32_t status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
 	void *tx_tlv;
 
 	tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
-	/* user_id start with 1, decrement by 1 to start from 0 */
-	user_id = HAL_RX_GET_USER_TLV64_USERID(tx_tlv_hdr);
+	tlv_user_id = HAL_RX_GET_USER_TLV64_USERID(tx_tlv_hdr);
 	tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv_hdr);
 
 	tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
@@ -824,7 +878,7 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	tx_status_info = (ppdu_info->is_data ? data_status_info :
 			  prot_status_info);
 
-	user_id = user_id > ppdu_info->num_users ? 0 : user_id;
+	user_id = (tlv_user_id > ppdu_info->num_users ? 0 : tlv_user_id);
 
 	switch (tlv_tag) {
 	/* start of initiator FES window */
@@ -2823,6 +2877,9 @@ hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
 	}
 	case WIFIFW2SW_MON_E:
 	{
+		/* parse fw2sw tlv */
+		hal_txmon_parse_fw2sw(tx_tlv, tlv_user_id, data_status_info);
+		status = HAL_MON_TX_FW2SW;
 		SHOW_DEFINED(WIFIFW2SW_MON_E);
 		break;
 	}