소스 검색

qcacmn: use rssi_comb_ppdu for sniffer rssi

Use rssi_comb_ppdu of TLV WIFIPHYRX_RSSI_LEGACY_E
as RSSI reported in monitor mode on KIWI and HSP.

Change-Id: If9d0e5645c12874af32e43dae596602e446a44b0
CRs-Fixed: 3609169
Jinwei Chen 1 년 전
부모
커밋
643e1be5db

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

@@ -3393,8 +3393,8 @@ hal_rx_status_get_tlv_info_generic_be(void *rx_tlv_hdr, void *ppduinfo,
 				      RECEIVE_RSSI_INFO_PREAMBLE_RSSI_INFO_DETAILS);
 
 		ppdu_info->rx_status.rssi_comb =
-			HAL_RX_GET_64(rx_tlv,
-				      PHYRX_RSSI_LEGACY, RSSI_COMB);
+				hal_rx_phy_legacy_get_rssi(hal_soc_hdl, rx_tlv);
+
 		ppdu_info->rx_status.bw = hal->ops->hal_rx_get_tlv(rx_tlv);
 		ppdu_info->rx_status.he_re = 0;
 

+ 2 - 0
hal/wifi3.0/be/hal_be_generic_api.c

@@ -993,4 +993,6 @@ void hal_hw_txrx_default_ops_attach_be(struct hal_soc *hal_soc)
 				hal_rx_en_mcast_fp_data_filter_generic_be;
 	hal_soc->ops->hal_rx_get_phy_ppdu_id_size =
 					hal_rx_get_phy_ppdu_id_size_be;
+	hal_soc->ops->hal_rx_phy_legacy_get_rssi =
+					hal_rx_phy_legacy_get_rssi_be;
 }

+ 12 - 0
hal/wifi3.0/be/hal_be_rx_tlv.h

@@ -1889,6 +1889,18 @@ static inline uint8_t hal_rx_get_mpdu_frame_control_valid_be(uint8_t *buf)
 	return HAL_RX_TLV_MPDU_GET_FRAME_CONTROL_VALID(rx_pkt_tlvs);
 }
 
+/**
+ * hal_rx_phy_legacy_get_rssi_be() - API to get RSSI from TLV
+ *                                   WIFIPHYRX_RSSI_LEGACY_E
+ * @buf: pointer to the start of WIFIPHYRX_RSSI_LEGACY_E TLV
+ *
+ * Return: value of RSSI
+ */
+static inline int8_t hal_rx_phy_legacy_get_rssi_be(uint8_t *buf)
+{
+	return HAL_RX_GET_64(buf, PHYRX_RSSI_LEGACY, RSSI_COMB);
+}
+
 /**
  * hal_rx_mpdu_get_addr2_be() - API to check get address2 of the mpdu
  *                              in the packet

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

@@ -1137,6 +1137,8 @@ struct hal_hw_txrx_ops {
 	void (*hal_rx_mon_hw_desc_get_mpdu_status)(void *hw_desc_addr,
 						   struct mon_rx_status *rs);
 	uint8_t (*hal_rx_get_tlv)(void *rx_tlv);
+	int8_t (*hal_rx_phy_legacy_get_rssi)(uint8_t *rx_tlv);
+
 	void (*hal_rx_proc_phyrx_other_receive_info_tlv)(void *rx_tlv_hdr,
 							void *ppdu_info_handle);
 	void (*hal_rx_dump_msdu_end_tlv)(void *pkt_tlvs, uint8_t dbg_level);

+ 15 - 0
hal/wifi3.0/hal_rx.h

@@ -3197,6 +3197,21 @@ hal_rx_tlv_l3_type_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
 			HAL_RX_TLV_L3_TYPE_INVALID;
 }
 
+/**
+ * hal_rx_phy_legacy_get_rssi() - API to get RSSI from TLV
+ * @hal_soc_hdl: HAL soc handle
+ * @buf: pointer to the start of WIFIPHYRX_RSSI_LEGACY_E TLV
+ *
+ * Return: value of RSSI
+ */
+static inline int8_t
+hal_rx_phy_legacy_get_rssi(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	return hal_soc->ops->hal_rx_phy_legacy_get_rssi(buf);
+}
+
 /**
  * hal_get_tsf_time() - Get tsf time
  * @hal_soc_hdl: HAL soc handle

+ 14 - 0
hal/wifi3.0/kiwi/hal_kiwi.c

@@ -1287,6 +1287,18 @@ static uint8_t hal_rx_get_tlv_kiwi(void *rx_tlv)
 	return HAL_RX_GET(rx_tlv, PHYRX_RSSI_LEGACY, RECEIVE_BANDWIDTH);
 }
 
+/**
+ * hal_rx_phy_legacy_get_rssi_kiwi() - API to get RSSI from TLV
+ *                                     WIFIPHYRX_RSSI_LEGACY_E
+ * @buf: pointer to the start of WIFIPHYRX_RSSI_LEGACY_E TLV
+ *
+ * Return: value of RSSI
+ */
+static int8_t hal_rx_phy_legacy_get_rssi_kiwi(uint8_t *buf)
+{
+	return HAL_RX_GET_64(buf, PHYRX_RSSI_LEGACY, RSSI_COMB_PPDU);
+}
+
 /**
  * hal_rx_proc_phyrx_other_receive_info_tlv_kiwi()
  *				    - process other receive info TLV
@@ -2212,6 +2224,8 @@ static void hal_hw_txrx_ops_attach_kiwi(struct hal_soc *hal_soc)
 					hal_rx_msdu_desc_info_ptr_get_kiwi;
 	hal_soc->ops->hal_ent_mpdu_desc_info = hal_ent_mpdu_desc_info_kiwi;
 	hal_soc->ops->hal_dst_mpdu_desc_info = hal_dst_mpdu_desc_info_kiwi;
+	hal_soc->ops->hal_rx_phy_legacy_get_rssi =
+					hal_rx_phy_legacy_get_rssi_kiwi;
 	hal_soc->ops->hal_rx_get_fc_valid = hal_rx_get_fc_valid_be;
 	hal_soc->ops->hal_rx_get_to_ds_flag = hal_rx_get_to_ds_flag_be;
 	hal_soc->ops->hal_rx_get_mac_addr2_valid =

+ 14 - 0
hal/wifi3.0/li/hal_li_generic_api.c

@@ -831,6 +831,18 @@ hal_rx_tlv_first_mpdu_get_li(uint8_t *buf)
 	return first_mpdu;
 }
 
+/**
+ * hal_rx_phy_legacy_get_rssi_li() - API to get RSSI from TLV
+ *                                   WIFIPHYRX_RSSI_LEGACY_E
+ * @buf: pointer to the start of WIFIPHYRX_RSSI_LEGACY_E TLV
+ *
+ * Return: value of RSSI
+ */
+static inline int8_t hal_rx_phy_legacy_get_rssi_li(uint8_t *buf)
+{
+	return HAL_RX_GET(buf, PHYRX_RSSI_LEGACY_35, RSSI_COMB);
+}
+
 /*
  * hal_rx_msdu_get_keyid_li(): API to get the key id if the decrypted packet
  * from rx_msdu_end
@@ -1146,4 +1158,6 @@ void hal_hw_txrx_default_ops_attach_li(struct hal_soc *hal_soc)
 	hal_soc->ops->hal_get_idle_link_bm_id = hal_get_idle_link_bm_id_li;
 	hal_soc->ops->hal_rx_get_phy_ppdu_id_size =
 						hal_rx_get_phy_ppdu_id_size_li;
+	hal_soc->ops->hal_rx_phy_legacy_get_rssi =
+						hal_rx_phy_legacy_get_rssi_li;
 }

+ 2 - 2
hal/wifi3.0/li/hal_li_generic_api.h

@@ -1565,8 +1565,8 @@ hal_rx_status_get_tlv_info_generic_li(void *rx_tlv_hdr, void *ppduinfo,
 			HAL_RX_OFFSET(UNIFIED_PHYRX_RSSI_LEGACY_19,
 				RECEIVE_RSSI_INFO_PREAMBLE_RSSI_INFO_DETAILS);
 
-		ppdu_info->rx_status.rssi_comb = HAL_RX_GET(rx_tlv,
-			PHYRX_RSSI_LEGACY_35, RSSI_COMB);
+		ppdu_info->rx_status.rssi_comb =
+				hal_rx_phy_legacy_get_rssi(hal_soc_hdl, rx_tlv);
 		ppdu_info->rx_status.bw = hal->ops->hal_rx_get_tlv(rx_tlv);
 		ppdu_info->rx_status.he_re = 0;
 

+ 14 - 0
hal/wifi3.0/qca6490/hal_6490.c

@@ -216,6 +216,18 @@ static uint8_t hal_rx_get_tlv_6490(void *rx_tlv)
 	return HAL_RX_GET(rx_tlv, PHYRX_RSSI_LEGACY_0, RECEIVE_BANDWIDTH);
 }
 
+/**
+ * hal_rx_phy_legacy_get_rssi_6490() - API to get RSSI from TLV
+ *                                     WIFIPHYRX_RSSI_LEGACY_E
+ * @buf: pointer to the start of WIFIPHYRX_RSSI_LEGACY_E TLV
+ *
+ * Return: value of RSSI
+ */
+static int8_t hal_rx_phy_legacy_get_rssi_6490(uint8_t *buf)
+{
+	return HAL_RX_GET(buf, PHYRX_RSSI_LEGACY_36, RSSI_COMB_PPDU);
+}
+
 /**
  * hal_rx_proc_phyrx_other_receive_info_tlv_6490()
  *				    - process other receive info TLV
@@ -1873,6 +1885,8 @@ static void hal_hw_txrx_ops_attach_qca6490(struct hal_soc *hal_soc)
 					hal_rx_msdu_desc_info_ptr_get_6490;
 	hal_soc->ops->hal_ent_mpdu_desc_info = hal_ent_mpdu_desc_info_6490;
 	hal_soc->ops->hal_dst_mpdu_desc_info = hal_dst_mpdu_desc_info_6490;
+	hal_soc->ops->hal_rx_phy_legacy_get_rssi =
+					hal_rx_phy_legacy_get_rssi_6490;
 	hal_soc->ops->hal_rx_get_fc_valid = hal_rx_get_fc_valid_6490;
 	hal_soc->ops->hal_rx_get_to_ds_flag = hal_rx_get_to_ds_flag_6490;
 	hal_soc->ops->hal_rx_get_mac_addr2_valid =