Browse Source

qcacmn: Move CCE and flow hal implementation to per chip

Move CCE and flow hal implementation to per chip hal layer.

Change-Id: I95a37d8bab00cdecfd6e8ae9a724b8c5541b336e
Kai Chen 3 năm trước cách đây
mục cha
commit
d93357ef5d

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

@@ -14259,6 +14259,7 @@ static void dp_soc_cfg_init(struct dp_soc *soc)
 		soc->num_hw_dscp_tid_map = HAL_MAX_HW_DSCP_TID_V2_MAPS;
 		soc->lmac_polled_mode = 0;
 		soc->wbm_release_desc_rx_sg_support = 1;
+		soc->is_rx_fse_full_cache_invalidate_war_enabled = true;
 		break;
 	case TARGET_TYPE_QCA5018:
 	case TARGET_TYPE_QCN6122:

+ 102 - 0
hal/wifi3.0/be/hal_be_generic_api.h

@@ -1619,4 +1619,106 @@ static void hal_rx_get_tlv_size_generic_be(uint16_t *rx_pkt_tlv_size,
 	/* For now mon pkt tlv is same as rx pkt tlv */
 	*rx_mon_pkt_tlv_size = RX_PKT_TLVS_LEN;
 }
+
+/**
+ * hal_rx_flow_get_tuple_info_be() - Setup a flow search entry in HW FST
+ * @fst: Pointer to the Rx Flow Search Table
+ * @hal_hash: HAL 5 tuple hash
+ * @tuple_info: 5-tuple info of the flow returned to the caller
+ *
+ * Return: Success/Failure
+ */
+static void *
+hal_rx_flow_get_tuple_info_be(uint8_t *rx_fst, uint32_t hal_hash,
+			      uint8_t *flow_tuple_info)
+{
+	struct hal_rx_fst *fst = (struct hal_rx_fst *)rx_fst;
+	void *hal_fse = NULL;
+	struct hal_flow_tuple_info *tuple_info
+		= (struct hal_flow_tuple_info *)flow_tuple_info;
+
+	hal_fse = (uint8_t *)fst->base_vaddr +
+		(hal_hash * HAL_RX_FST_ENTRY_SIZE);
+
+	if (!hal_fse || !tuple_info)
+		return NULL;
+
+	if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY, VALID))
+		return NULL;
+
+	tuple_info->src_ip_127_96 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      SRC_IP_127_96));
+	tuple_info->src_ip_95_64 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      SRC_IP_95_64));
+	tuple_info->src_ip_63_32 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      SRC_IP_63_32));
+	tuple_info->src_ip_31_0 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      SRC_IP_31_0));
+	tuple_info->dest_ip_127_96 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      DEST_IP_127_96));
+	tuple_info->dest_ip_95_64 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      DEST_IP_95_64));
+	tuple_info->dest_ip_63_32 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      DEST_IP_63_32));
+	tuple_info->dest_ip_31_0 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY,
+						      DEST_IP_31_0));
+	tuple_info->dest_port = HAL_GET_FLD(hal_fse,
+					    RX_FLOW_SEARCH_ENTRY,
+					    DEST_PORT);
+	tuple_info->src_port = HAL_GET_FLD(hal_fse,
+					   RX_FLOW_SEARCH_ENTRY,
+					   SRC_PORT);
+	tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
+					      RX_FLOW_SEARCH_ENTRY,
+					      L4_PROTOCOL);
+
+	return hal_fse;
+}
+
+/**
+ * hal_rx_flow_delete_entry_be() - Setup a flow search entry in HW FST
+ * @fst: Pointer to the Rx Flow Search Table
+ * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
+ *
+ * Return: Success/Failure
+ */
+static QDF_STATUS
+hal_rx_flow_delete_entry_be(uint8_t *rx_fst, void *hal_rx_fse)
+{
+	uint8_t *fse = (uint8_t *)hal_rx_fse;
+
+	if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID))
+		return QDF_STATUS_E_NOENT;
+
+	HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * hal_rx_fst_get_fse_size_be() - Retrieve the size of each entry in Rx FST
+ *
+ * Return: size of each entry/flow in Rx FST
+ */
+static inline uint32_t
+hal_rx_fst_get_fse_size_be(void)
+{
+	return HAL_RX_FST_ENTRY_SIZE;
+}
 #endif /* _HAL_BE_GENERIC_API_H_ */

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

@@ -860,6 +860,7 @@ struct hal_hw_txrx_ops {
 	bool (*hal_rx_msdu_flow_idx_invalid)(uint8_t *buf);
 	bool (*hal_rx_msdu_flow_idx_timeout)(uint8_t *buf);
 	uint32_t (*hal_rx_msdu_fse_metadata_get)(uint8_t *buf);
+	bool (*hal_rx_msdu_cce_match_get)(uint8_t *buf);
 	uint16_t (*hal_rx_msdu_cce_metadata_get)(uint8_t *buf);
 	void
 	    (*hal_rx_msdu_get_flow_params)(
@@ -892,6 +893,12 @@ struct hal_hw_txrx_ops {
 	void * (*hal_rx_flow_setup_fse)(uint8_t *rx_fst,
 					uint32_t table_offset,
 					uint8_t *rx_flow);
+	void * (*hal_rx_flow_get_tuple_info)(uint8_t *rx_fst,
+					     uint32_t hal_hash,
+					     uint8_t *tuple_info);
+	QDF_STATUS (*hal_rx_flow_delete_entry)(uint8_t *fst,
+					       void *fse);
+	uint32_t (*hal_rx_fst_get_fse_size)(void);
 	void (*hal_compute_reo_remap_ix2_ix3)(uint32_t *ring,
 					      uint32_t num_rings,
 					      uint32_t *remap1,

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

@@ -1152,6 +1152,21 @@ hal_rx_msdu_end_last_msdu_get(hal_soc_handle_t hal_soc_hdl,
 	return hal_soc->ops->hal_rx_msdu_end_last_msdu_get(buf);
 }
 
+/**
+ * hal_rx_msdu_cce_match_get: API to get CCE match
+ * from rx_msdu_end TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ * Return: cce_meta_data
+ */
+static inline bool
+hal_rx_msdu_cce_match_get(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_msdu_cce_match_get(buf);
+}
+
 /**
  * hal_rx_msdu_cce_metadata_get: API to get CCE metadata
  * from rx_msdu_end TLV

+ 66 - 80
hal/wifi3.0/hal_rx_flow.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 above
@@ -204,23 +205,26 @@ qdf_export_symbol(hal_rx_flow_get_cmem_fse_timestamp);
 
 /**
  * hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table
+ * @hal_soc_hdl: HAL SOC handle
  * @fst: Pointer to the Rx Flow Search Table
  * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
  *
  * Return: Success/Failure
  */
 QDF_STATUS
-hal_rx_flow_delete_entry(struct hal_rx_fst *fst, void *hal_rx_fse)
+hal_rx_flow_delete_entry(hal_soc_handle_t hal_soc_hdl,
+			 struct hal_rx_fst *fst, void *hal_rx_fse)
 {
-	uint8_t *fse = (uint8_t *)hal_rx_fse;
-
-	if (!HAL_GET_FLD(fse, HAL_RX_FLOW_SEARCH_ENTRY, VALID))
-		return QDF_STATUS_E_NOENT;
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
 
-	HAL_CLR_FLD(fse, HAL_RX_FLOW_SEARCH_ENTRY, VALID);
+	if (hal_soc->ops->hal_rx_flow_delete_entry) {
+		return hal_soc->ops->hal_rx_flow_delete_entry((uint8_t *)fst,
+							   hal_rx_fse);
+	}
 
-	return QDF_STATUS_SUCCESS;
+	return QDF_STATUS_E_NOSUPPORT;
 }
+
 qdf_export_symbol(hal_rx_flow_delete_entry);
 
 #ifndef WLAN_SUPPORT_RX_FISA
@@ -270,70 +274,41 @@ static inline void *hal_rx_fst_get_base(struct hal_rx_fst *fst)
  *
  * Return: size of each entry/flow in Rx FST
  */
-static inline uint32_t hal_rx_fst_get_fse_size(void)
+static inline uint32_t
+hal_rx_fst_get_fse_size(hal_soc_handle_t hal_soc_hdl)
 {
-	return HAL_RX_FST_ENTRY_SIZE;
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	if (hal_soc->ops->hal_rx_fst_get_fse_size)
+		return hal_soc->ops->hal_rx_fst_get_fse_size();
+
+	return 0;
 }
 
 /**
- * hal_rx_flow_get_tuple_info() - Retrieve the 5-tuple flow info for an entry
- * @hal_fse: Pointer to the Flow in Rx FST
+ * hal_rx_flow_get_tuple_info() - Get a flow search entry in HW FST
+ * @hal_soc_hdl: HAL SOC handle
+ * @fst: Pointer to the Rx Flow Search Table
+ * @hal_hash: HAL 5 tuple hash
  * @tuple_info: 5-tuple info of the flow returned to the caller
  *
  * Return: Success/Failure
  */
-QDF_STATUS hal_rx_flow_get_tuple_info(void *hal_fse,
-				      struct hal_flow_tuple_info *tuple_info)
+void *
+hal_rx_flow_get_tuple_info(hal_soc_handle_t hal_soc_hdl,
+			   struct hal_rx_fst *fst,
+			   uint32_t hal_hash,
+			   struct hal_flow_tuple_info *tuple_info)
 {
-	if (!hal_fse || !tuple_info)
-		return QDF_STATUS_E_INVAL;
-
-	if (!HAL_GET_FLD(hal_fse, HAL_RX_FLOW_SEARCH_ENTRY, VALID))
-		return QDF_STATUS_E_NOENT;
-
-	tuple_info->src_ip_127_96 =
-				qdf_ntohl(HAL_GET_FLD(hal_fse,
-						      HAL_RX_FLOW_SEARCH_ENTRY,
-						      SRC_IP_127_96));
-	tuple_info->src_ip_95_64 =
-				qdf_ntohl(HAL_GET_FLD(hal_fse,
-						      HAL_RX_FLOW_SEARCH_ENTRY,
-						      SRC_IP_95_64));
-	tuple_info->src_ip_63_32 =
-				qdf_ntohl(HAL_GET_FLD(hal_fse,
-						      HAL_RX_FLOW_SEARCH_ENTRY,
-						      SRC_IP_63_32));
-	tuple_info->src_ip_31_0 =
-				qdf_ntohl(HAL_GET_FLD(hal_fse,
-						      HAL_RX_FLOW_SEARCH_ENTRY,
-						      SRC_IP_31_0));
-	tuple_info->dest_ip_127_96 =
-				qdf_ntohl(HAL_GET_FLD(hal_fse,
-						      HAL_RX_FLOW_SEARCH_ENTRY,
-						      DEST_IP_127_96));
-	tuple_info->dest_ip_95_64 =
-				qdf_ntohl(HAL_GET_FLD(hal_fse,
-						      HAL_RX_FLOW_SEARCH_ENTRY,
-						      DEST_IP_95_64));
-	tuple_info->dest_ip_63_32 =
-				qdf_ntohl(HAL_GET_FLD(hal_fse,
-						      HAL_RX_FLOW_SEARCH_ENTRY,
-						      DEST_IP_63_32));
-	tuple_info->dest_ip_31_0 =
-			qdf_ntohl(HAL_GET_FLD(hal_fse,
-					      HAL_RX_FLOW_SEARCH_ENTRY,
-					      DEST_IP_31_0));
-	tuple_info->dest_port = HAL_GET_FLD(hal_fse,
-					    HAL_RX_FLOW_SEARCH_ENTRY,
-					    DEST_PORT);
-	tuple_info->src_port = HAL_GET_FLD(hal_fse,
-					   HAL_RX_FLOW_SEARCH_ENTRY,
-					   SRC_PORT);
-	tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
-					      HAL_RX_FLOW_SEARCH_ENTRY,
-					      L4_PROTOCOL);
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
 
-	return QDF_STATUS_SUCCESS;
+	if (hal_soc->ops->hal_rx_flow_get_tuple_info)
+		return hal_soc->ops->hal_rx_flow_get_tuple_info(
+						(uint8_t *)fst,
+						hal_hash,
+						(uint8_t *)tuple_info);
+
+	return NULL;
 }
 
 #ifndef WLAN_SUPPORT_RX_FISA
@@ -417,11 +392,13 @@ static void hal_flow_toeplitz_create_cache(struct hal_rx_fst *fst)
  * Return:
  */
 struct hal_rx_fst *
-hal_rx_fst_attach(qdf_device_t qdf_dev,
+hal_rx_fst_attach(hal_soc_handle_t hal_soc_hdl,
+		  qdf_device_t qdf_dev,
 		  uint64_t *hal_fst_base_paddr, uint16_t max_entries,
 		  uint16_t max_search, uint8_t *hash_key)
 {
 	struct hal_rx_fst *fst = qdf_mem_malloc(sizeof(struct hal_rx_fst));
+	uint32_t fst_entry_size;
 
 	if (!fst) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
@@ -436,13 +413,16 @@ hal_rx_fst_attach(qdf_device_t qdf_dev,
 	fst->max_entries = max_entries;
 	fst->hash_mask = max_entries - 1;
 
+	fst_entry_size = hal_rx_fst_get_fse_size(hal_soc_hdl);
+
 	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
 		  "HAL FST allocation %pK %d * %d\n", fst,
-		  fst->max_entries, HAL_RX_FST_ENTRY_SIZE);
+		  fst->max_entries, fst_entry_size);
+
 
 	fst->base_vaddr = (uint8_t *)qdf_mem_alloc_consistent(qdf_dev,
 				qdf_dev->dev,
-				(fst->max_entries * HAL_RX_FST_ENTRY_SIZE),
+				(fst->max_entries * fst_entry_size),
 				&fst->base_paddr);
 
 	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
@@ -457,7 +437,7 @@ hal_rx_fst_attach(qdf_device_t qdf_dev,
 			   (void *)fst->key, HAL_FST_HASH_KEY_SIZE_BYTES);
 
 	qdf_mem_set((uint8_t *)fst->base_vaddr,
-		    (fst->max_entries * HAL_RX_FST_ENTRY_SIZE), 0);
+		    (fst->max_entries * fst_entry_size), 0);
 
 	hal_rx_fst_key_configure(fst);
 	hal_flow_toeplitz_create_cache(fst);
@@ -469,19 +449,25 @@ qdf_export_symbol(hal_rx_fst_attach);
 /**
  * hal_rx_fst_detach() - De-init the Rx flow search table from HW
  *
+ * @hal_soc_hdl: HAL SOC handler
  * @rx_fst: Pointer to the Rx FST
  * @qdf_dev: QDF device handle
  *
  * Return:
  */
-void hal_rx_fst_detach(struct hal_rx_fst *rx_fst,
+void hal_rx_fst_detach(hal_soc_handle_t hal_soc_hdl,
+		       struct hal_rx_fst *rx_fst,
 		       qdf_device_t qdf_dev)
 {
+	uint32_t fst_entry_size;
+
 	if (!rx_fst || !qdf_dev)
 		return;
 
+	fst_entry_size = hal_rx_fst_get_fse_size(hal_soc_hdl);
+
 	qdf_mem_free_consistent(qdf_dev, qdf_dev->dev,
-				rx_fst->max_entries * HAL_RX_FST_ENTRY_SIZE,
+				rx_fst->max_entries * fst_entry_size,
 				rx_fst->base_vaddr, rx_fst->base_paddr, 0);
 
 	qdf_mem_free(rx_fst);
@@ -566,7 +552,7 @@ qdf_export_symbol(hal_rx_get_hal_hash);
 
 /**
  * hal_rx_insert_flow_entry() - Add a flow into the FST table
- *
+ * @hal_soc: HAL SOC handle
  * @hal_fst: HAL Rx FST Handle
  * @flow_hash: Flow hash computed from flow tuple
  * @flow_tuple_info: Flow tuple used to compute the hash
@@ -575,21 +561,21 @@ qdf_export_symbol(hal_rx_get_hal_hash);
  * Return: Success if flow is inserted into the table, error otherwise
  */
 QDF_STATUS
-hal_rx_insert_flow_entry(struct hal_rx_fst *fst, uint32_t flow_hash,
+hal_rx_insert_flow_entry(hal_soc_handle_t hal_soc,
+			 struct hal_rx_fst *fst, uint32_t flow_hash,
 			 void *flow_tuple_info, uint32_t *flow_idx)
 {
 	int i;
 	void *hal_fse = NULL;
 	uint32_t hal_hash = 0;
 	struct hal_flow_tuple_info hal_tuple_info = { 0 };
-	QDF_STATUS status;
 
 	for (i = 0; i < fst->max_skid_length; i++) {
 		hal_hash = hal_rx_get_hal_hash(fst, (flow_hash + i));
-		hal_fse = (uint8_t *)fst->base_vaddr +
-			(hal_hash * HAL_RX_FST_ENTRY_SIZE);
-		status = hal_rx_flow_get_tuple_info(hal_fse, &hal_tuple_info);
-		if (status == QDF_STATUS_E_NOENT)
+
+		hal_fse = hal_rx_flow_get_tuple_info(hal_soc, fst, hal_hash,
+						     &hal_tuple_info);
+		if (!hal_fse)
 			break;
 
 		/* Find the matching flow entry in HW FST */
@@ -624,21 +610,21 @@ qdf_export_symbol(hal_rx_insert_flow_entry);
  * Return: Success if matching flow is found in the table, error otherwise
  */
 QDF_STATUS
-hal_rx_find_flow_from_tuple(struct hal_rx_fst *fst, uint32_t flow_hash,
+hal_rx_find_flow_from_tuple(hal_soc_handle_t hal_soc_hdl,
+			    struct hal_rx_fst *fst, uint32_t flow_hash,
 			    void *flow_tuple_info, uint32_t *flow_idx)
 {
 	int i;
 	void *hal_fse = NULL;
 	uint32_t hal_hash = 0;
 	struct hal_flow_tuple_info hal_tuple_info = { 0 };
-	QDF_STATUS status;
 
 	for (i = 0; i < fst->max_skid_length; i++) {
 		hal_hash = hal_rx_get_hal_hash(fst, (flow_hash + i));
-		hal_fse = (uint8_t *)fst->base_vaddr +
-			(hal_hash * HAL_RX_FST_ENTRY_SIZE);
-		status = hal_rx_flow_get_tuple_info(hal_fse, &hal_tuple_info);
-		if (status != QDF_STATUS_SUCCESS)
+
+		hal_fse = hal_rx_flow_get_tuple_info(hal_soc_hdl, fst, hal_hash,
+						     &hal_tuple_info);
+		if (!hal_fse)
 			continue;
 
 		/* Find the matching flow entry in HW FST */

+ 23 - 10
hal/wifi3.0/hal_rx_flow.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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
@@ -103,28 +104,35 @@ uint32_t hal_rx_flow_get_cmem_fse_timestamp(hal_soc_handle_t hal_soc_hdl,
 
 /**
  * hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table
+ * @hal_soc_hdl: HAL SOC handle
  * @fst: Pointer to the Rx Flow Search Table
  * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
  *
  * Return: Success/Failure
  */
 QDF_STATUS
-hal_rx_flow_delete_entry(struct hal_rx_fst *fst, void *hal_rx_fse);
+hal_rx_flow_delete_entry(hal_soc_handle_t hal_soc_hdl,
+			 struct hal_rx_fst *fst, void *hal_rx_fse);
 
 /**
  * hal_rx_flow_get_tuple_info() - Retrieve the 5-tuple flow info for an entry
- * @hal_fse: Pointer to the Flow in Rx FST
+ * @hal_soc_hdl: HAL SOC handle
+ * @fst: Pointer to the Rx Flow Search Table
+ * @hal_hash: HAL 5 tuple hash
  * @tuple_info: 5-tuple info of the flow returned to the caller
  *
  * Return: Success/Failure
  */
-QDF_STATUS hal_rx_flow_get_tuple_info(void *hal_fse,
-				      struct hal_flow_tuple_info *tuple_info);
-
+void *
+hal_rx_flow_get_tuple_info(hal_soc_handle_t hal_soc_hdl,
+			   struct hal_rx_fst *fst,
+			   uint32_t hal_hash,
+			   struct hal_flow_tuple_info *tuple_info);
 
 /**
  * hal_rx_fst_attach() - Initialize Rx flow search table in HW FST
  *
+ * @hal_soc_hdl: HAL SOC handle
  * @qdf_dev: QDF device handle
  * @hal_fst_base_paddr: Pointer to the physical base address of the Rx FST
  * @max_entries: Max number of flows allowed in the FST
@@ -134,23 +142,26 @@ QDF_STATUS hal_rx_flow_get_tuple_info(void *hal_fse,
  * Return:
  */
 struct hal_rx_fst *
-hal_rx_fst_attach(qdf_device_t qdf_dev,
+hal_rx_fst_attach(hal_soc_handle_t hal_soc_hdl,
+		  qdf_device_t qdf_dev,
 		  uint64_t *hal_fst_base_paddr, uint16_t max_entries,
 		  uint16_t max_search, uint8_t *hash_key);
 
 /**
  * hal_rx_fst_detach() - De-init the Rx flow search table from HW
  *
+ * @hal_soc_hdl: HAL SOC handler
  * @rx_fst: Pointer to the Rx FST
  * @qdf_dev: QDF device handle
  *
  * Return:
  */
-void hal_rx_fst_detach(struct hal_rx_fst *rx_fst, qdf_device_t qdf_dev);
+void hal_rx_fst_detach(hal_soc_handle_t hal_soc_hdl,
+		       struct hal_rx_fst *rx_fst, qdf_device_t qdf_dev);
 
 /**
  * hal_rx_insert_flow_entry() - Add a flow into the FST table
- *
+ * @hal_soc_hdl: HAL SOC handle
  * @hal_fst: HAL Rx FST Handle
  * @flow_hash: Flow hash computed from flow tuple
  * @flow_tuple_info: Flow tuple used to compute the hash
@@ -159,7 +170,8 @@ void hal_rx_fst_detach(struct hal_rx_fst *rx_fst, qdf_device_t qdf_dev);
  * Return: Success if flow is inserted into the table, error otherwise
  */
 QDF_STATUS
-hal_rx_insert_flow_entry(struct hal_rx_fst *fst, uint32_t flow_hash,
+hal_rx_insert_flow_entry(hal_soc_handle_t hal_soc_hdl,
+			 struct hal_rx_fst *fst, uint32_t flow_hash,
 			 void *flow_tuple_info, uint32_t *flow_idx);
 
 /**
@@ -173,7 +185,8 @@ hal_rx_insert_flow_entry(struct hal_rx_fst *fst, uint32_t flow_hash,
  * Return: Success if matching flow is found in the table, error otherwise
  */
 QDF_STATUS
-hal_rx_find_flow_from_tuple(struct hal_rx_fst *fst, uint32_t flow_hash,
+hal_rx_find_flow_from_tuple(hal_soc_handle_t hal_soc_hdl,
+			    struct hal_rx_fst *fst, uint32_t flow_hash,
 			    void *flow_tuple_info, uint32_t *flow_idx);
 
 /**

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

@@ -2385,4 +2385,106 @@ void hal_tx_desc_set_cache_set_num_generic_li(void *desc, uint8_t cache_num)
 {
 }
 #endif
+
+/**
+ * hal_rx_flow_get_tuple_info_li() - Setup a flow search entry in HW FST
+ * @fst: Pointer to the Rx Flow Search Table
+ * @hal_hash: HAL 5 tuple hash
+ * @tuple_info: 5-tuple info of the flow returned to the caller
+ *
+ * Return: Success/Failure
+ */
+static void *
+hal_rx_flow_get_tuple_info_li(uint8_t *rx_fst, uint32_t hal_hash,
+			      uint8_t *flow_tuple_info)
+{
+	struct hal_rx_fst *fst = (struct hal_rx_fst *)rx_fst;
+	void *hal_fse = NULL;
+	struct hal_flow_tuple_info *tuple_info
+		= (struct hal_flow_tuple_info *)flow_tuple_info;
+
+	hal_fse = (uint8_t *)fst->base_vaddr +
+		(hal_hash * HAL_RX_FST_ENTRY_SIZE);
+
+	if (!hal_fse || !tuple_info)
+		return NULL;
+
+	if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY_9, VALID))
+		return NULL;
+
+	tuple_info->src_ip_127_96 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY_0,
+						      SRC_IP_127_96));
+	tuple_info->src_ip_95_64 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY_1,
+						      SRC_IP_95_64));
+	tuple_info->src_ip_63_32 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY_2,
+						      SRC_IP_63_32));
+	tuple_info->src_ip_31_0 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY_3,
+						      SRC_IP_31_0));
+	tuple_info->dest_ip_127_96 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY_4,
+						      DEST_IP_127_96));
+	tuple_info->dest_ip_95_64 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY_5,
+						      DEST_IP_95_64));
+	tuple_info->dest_ip_63_32 =
+				qdf_ntohl(HAL_GET_FLD(hal_fse,
+						      RX_FLOW_SEARCH_ENTRY_6,
+						      DEST_IP_63_32));
+	tuple_info->dest_ip_31_0 =
+			qdf_ntohl(HAL_GET_FLD(hal_fse,
+					      RX_FLOW_SEARCH_ENTRY_7,
+					      DEST_IP_31_0));
+	tuple_info->dest_port = HAL_GET_FLD(hal_fse,
+					    RX_FLOW_SEARCH_ENTRY_8,
+					    DEST_PORT);
+	tuple_info->src_port = HAL_GET_FLD(hal_fse,
+					   RX_FLOW_SEARCH_ENTRY_8,
+					   SRC_PORT);
+	tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
+					      RX_FLOW_SEARCH_ENTRY_9,
+					      L4_PROTOCOL);
+
+	return hal_fse;
+}
+
+/**
+ * hal_rx_flow_delete_entry_li() - Setup a flow search entry in HW FST
+ * @fst: Pointer to the Rx Flow Search Table
+ * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
+ *
+ * Return: Success/Failure
+ */
+static QDF_STATUS
+hal_rx_flow_delete_entry_li(uint8_t *rx_fst, void *hal_rx_fse)
+{
+	uint8_t *fse = (uint8_t *)hal_rx_fse;
+
+	if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY_9, VALID))
+		return QDF_STATUS_E_NOENT;
+
+	HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY_9, VALID);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * hal_rx_fst_get_fse_size_li() - Retrieve the size of each entry
+ *
+ * Return: size of each entry/flow in Rx FST
+ */
+static inline uint32_t
+hal_rx_fst_get_fse_size_li(void)
+{
+	return HAL_RX_FST_ENTRY_SIZE;
+}
 #endif /* _HAL_LI_GENERIC_API_H_ */

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

@@ -453,13 +453,13 @@ hal_rx_attn_ip_cksum_fail_get(uint8_t *buf)
 		RX_ATTENTION_1_CCE_MATCH_LSB))
 
 /*
- * hal_rx_msdu_cce_match_get(): get CCE match bit
+ * hal_rx_msdu_cce_match_get_li(): get CCE match bit
  * from rx attention
  * @buf: pointer to rx_pkt_tlvs
  * Return: CCE match value
  */
 static inline bool
-hal_rx_msdu_cce_match_get(uint8_t *buf)
+hal_rx_msdu_cce_match_get_li(uint8_t *buf)
 {
 	struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf;
 	struct rx_attention *rx_attn = &pkt_tlvs->attn_tlv.rx_attn;

+ 7 - 0
hal/wifi3.0/qca5018/hal_5018.c

@@ -1796,6 +1796,8 @@ static void hal_hw_txrx_ops_attach_qca5018(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_5018;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_5018;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_5018;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1825,6 +1827,11 @@ static void hal_hw_txrx_ops_attach_qca5018(struct hal_soc *hal_soc)
 	hal_soc->ops->hal_rx_pkt_tlv_offset_get = hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_5018;
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_li;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_li;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_li;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 = hal_compute_reo_remap_ix2_ix3_5018;
 	hal_soc->ops->hal_setup_link_idle_list =
 				hal_setup_link_idle_list_generic_li;

+ 2 - 0
hal/wifi3.0/qca6290/hal_6290.c

@@ -1184,6 +1184,8 @@ static void hal_hw_txrx_ops_attach_6290(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_6290;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_6290;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_6290;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =

+ 2 - 0
hal/wifi3.0/qca6390/hal_6390.c

@@ -1238,6 +1238,8 @@ static void hal_hw_txrx_ops_attach_qca6390(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_6390;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_6390;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_6390;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =

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

@@ -1810,6 +1810,8 @@ static void hal_hw_txrx_ops_attach_qca6490(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_6490;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_6490;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_6490;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1853,6 +1855,11 @@ static void hal_hw_txrx_ops_attach_qca6490(struct hal_soc *hal_soc)
 					hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_6490;
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_li;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_li;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_li;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_6490;
 	hal_soc->ops->hal_rx_msdu_get_reo_destination_indication =

+ 7 - 0
hal/wifi3.0/qca6750/hal_6750.c

@@ -1967,6 +1967,8 @@ static void hal_hw_txrx_ops_attach_qca6750(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_6750;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_6750;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_6750;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -2010,6 +2012,11 @@ static void hal_hw_txrx_ops_attach_qca6750(struct hal_soc *hal_soc)
 					hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_6750;
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_li;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_li;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_li;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_6750;
 

+ 7 - 0
hal/wifi3.0/qca8074v1/hal_8074v1.c

@@ -1361,6 +1361,8 @@ static void hal_hw_txrx_ops_attach_qca8074(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_8074v1;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_8074v1;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_8074v1;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1389,6 +1391,11 @@ static void hal_hw_txrx_ops_attach_qca8074(struct hal_soc *hal_soc)
 					hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_8074v1;
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_li;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_li;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_li;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_8074v1;
 	hal_soc->ops->hal_setup_link_idle_list =

+ 7 - 0
hal/wifi3.0/qca8074v2/hal_8074v2.c

@@ -1357,6 +1357,8 @@ static void hal_hw_txrx_ops_attach_qca8074v2(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_8074v2;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_8074v2;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_8074v2;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1390,6 +1392,11 @@ static void hal_hw_txrx_ops_attach_qca8074v2(struct hal_soc *hal_soc)
 					hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_8074v2;
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_li;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_li;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_li;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_8074v2;
 	hal_soc->ops->hal_setup_link_idle_list =

+ 7 - 0
hal/wifi3.0/qcn6122/hal_qcn6122.c

@@ -1853,6 +1853,8 @@ static void hal_hw_txrx_ops_attach_qcn6122(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_6122;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_6122;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_6122;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1889,6 +1891,11 @@ static void hal_hw_txrx_ops_attach_qcn6122(struct hal_soc *hal_soc)
 					hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_6122;
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_li;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_li;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_li;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_6122;
 	hal_soc->ops->hal_setup_link_idle_list =

+ 8 - 0
hal/wifi3.0/qcn9000/hal_9000.c

@@ -1888,6 +1888,8 @@ static void hal_hw_txrx_ops_attach_qcn9000(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_9000;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_9000;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_li;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_9000;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1924,6 +1926,12 @@ static void hal_hw_txrx_ops_attach_qcn9000(struct hal_soc *hal_soc)
 					hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_9000;
+
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_li;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_li;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_li;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_9000;
 	hal_soc->ops->hal_setup_link_idle_list =

+ 8 - 0
hal/wifi3.0/qcn9224/hal_9224.c

@@ -1739,6 +1739,8 @@ static void hal_hw_txrx_ops_attach_qcn9224(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_be;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_be;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_be;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_be;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1771,6 +1773,12 @@ static void hal_hw_txrx_ops_attach_qcn9224(struct hal_soc *hal_soc)
 					hal_rx_pkt_tlv_offset_get_generic;
 #endif
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_9224;
+
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_be;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_be;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_be;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_9224;
 

+ 7 - 0
hal/wifi3.0/wcn7850/hal_7850.c

@@ -1411,6 +1411,8 @@ static void hal_hw_txrx_ops_attach_wcn7850(struct hal_soc *hal_soc)
 					hal_rx_msdu_flow_idx_timeout_be;
 	hal_soc->ops->hal_rx_msdu_fse_metadata_get =
 					hal_rx_msdu_fse_metadata_get_be;
+	hal_soc->ops->hal_rx_msdu_cce_match_get =
+					hal_rx_msdu_cce_match_get_be;
 	hal_soc->ops->hal_rx_msdu_cce_metadata_get =
 					hal_rx_msdu_cce_metadata_get_be;
 	hal_soc->ops->hal_rx_msdu_get_flow_params =
@@ -1451,6 +1453,11 @@ static void hal_hw_txrx_ops_attach_wcn7850(struct hal_soc *hal_soc)
 	hal_soc->ops->hal_rx_pkt_tlv_offset_get =
 					hal_rx_pkt_tlv_offset_get_generic;
 	hal_soc->ops->hal_rx_flow_setup_fse = hal_rx_flow_setup_fse_7850;
+	hal_soc->ops->hal_rx_flow_get_tuple_info =
+					hal_rx_flow_get_tuple_info_be;
+	 hal_soc->ops->hal_rx_flow_delete_entry =
+					hal_rx_flow_delete_entry_be;
+	hal_soc->ops->hal_rx_fst_get_fse_size = hal_rx_fst_get_fse_size_be;
 	hal_soc->ops->hal_compute_reo_remap_ix2_ix3 =
 					hal_compute_reo_remap_ix2_ix3_7850;
 	hal_soc->ops->hal_rx_flow_setup_cmem_fse = NULL;