Ver Fonte

qcacmn: enable FSE with MLO support

from Beryllium onwards a single Flow Search Table
will be used across multiple radios. to ensure this
a single FST attach is called for the first SOC's
pdev and FST detach is called only during last pdev
of last SOC. the same FST instance is saved in all
pdevs of all the SOCs

CRs-Fixed: 3366409
Change-Id: I42fbdc6f09fb902021877e100a2831a1a24bc975
Tallapragada Kalyan há 2 anos atrás
pai
commit
328ea67a32

+ 64 - 7
dp/wifi3.0/be/dp_be.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -541,13 +541,10 @@ static QDF_STATUS dp_peer_ppeds_default_route_be(struct dp_soc *soc,
 	priority_valid = be_peer->priority_valid;
 
 	/*
-	 * if FST is enabled and MLO is disabled then
-	 * let flow rule take the decision of routing
-	 * the pkt to DS or host
+	 * if FST is enabled then let flow rule take the decision of
+	 * routing the pkt to DS or host
 	 */
-	if (wlan_cfg_is_rx_flow_tag_enabled(cfg) &&
-	    qdf_is_macaddr_zero((struct qdf_mac_addr *)
-				 be_vdev->vdev.mld_mac_addr.raw))
+	if (wlan_cfg_is_rx_flow_tag_enabled(cfg))
 		use_ppe_ds = 0;
 
 	if (soc->cdp_soc.ol_ops->peer_set_ppeds_default_routing) {
@@ -720,6 +717,26 @@ dp_mlo_mcast_deinit(struct dp_soc *soc, struct dp_vdev *vdev)
 	be_vdev->mcast_primary = false;
 	vdev->mlo_vdev = false;
 }
+
+static void dp_set_rx_fst_be(struct dp_soc *soc, struct dp_rx_fst *fst)
+{
+	dp_mlo_set_rx_fst(soc, fst);
+}
+
+static struct dp_rx_fst *dp_get_rx_fst_be(struct dp_soc *soc)
+{
+	return dp_mlo_get_rx_fst(soc);
+}
+
+static uint8_t dp_rx_fst_deref_be(struct dp_soc *soc)
+{
+	return dp_mlo_rx_fst_deref(soc);
+}
+
+static void dp_rx_fst_ref_be(struct dp_soc *soc)
+{
+	dp_mlo_rx_fst_ref(soc);
+}
 #else
 static inline void
 dp_mlo_mcast_init(struct dp_soc *soc, struct dp_vdev *vdev)
@@ -730,6 +747,24 @@ static inline void
 dp_mlo_mcast_deinit(struct dp_soc *soc, struct dp_vdev *vdev)
 {
 }
+
+static void dp_set_rx_fst_be(struct dp_soc *soc, struct dp_rx_fst *fst)
+{
+}
+
+static struct dp_rx_fst *dp_get_rx_fst_be(struct dp_soc *soc)
+{
+	return NULL;
+}
+
+static uint8_t dp_rx_fst_deref_be(struct dp_soc *soc)
+{
+	return 1;
+}
+
+static void dp_rx_fst_ref_be(struct dp_soc *soc)
+{
+}
 #endif
 static void dp_mlo_init_ptnr_list(struct dp_vdev *vdev)
 {
@@ -765,6 +800,24 @@ static void dp_get_rx_hash_key_be(struct dp_soc *soc,
 {
 	dp_get_rx_hash_key_bytes(lro_hash);
 }
+
+static void dp_set_rx_fst_be(struct dp_soc *soc, struct dp_rx_fst *fst)
+{
+}
+
+static struct dp_rx_fst *dp_get_rx_fst_be(struct dp_soc *soc)
+{
+	return NULL;
+}
+
+static uint8_t dp_rx_fst_deref_be(struct dp_soc *soc)
+{
+	return 1;
+}
+
+static void dp_rx_fst_ref_be(struct dp_soc *soc)
+{
+}
 #endif
 
 static QDF_STATUS dp_soc_attach_be(struct dp_soc *soc,
@@ -2499,6 +2552,10 @@ void dp_initialize_arch_ops_be(struct dp_arch_ops *arch_ops)
 	dp_init_near_full_arch_ops_be(arch_ops);
 	arch_ops->get_reo_qdesc_addr = dp_rx_get_reo_qdesc_addr_be;
 	arch_ops->get_rx_hash_key = dp_get_rx_hash_key_be;
+	arch_ops->dp_set_rx_fst = dp_set_rx_fst_be;
+	arch_ops->dp_get_rx_fst = dp_get_rx_fst_be;
+	arch_ops->dp_rx_fst_deref = dp_rx_fst_deref_be;
+	arch_ops->dp_rx_fst_ref = dp_rx_fst_ref_be;
 	arch_ops->print_mlo_ast_stats = dp_print_mlo_ast_stats_be;
 	arch_ops->peer_get_reo_hash = dp_peer_get_reo_hash_be;
 	arch_ops->reo_remap_config = dp_reo_remap_config_be;

+ 45 - 1
dp/wifi3.0/be/mlo/dp_mlo.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -744,6 +744,50 @@ void dp_mlo_get_rx_hash_key(struct dp_soc *soc,
 		      LRO_IPV6_SEED_ARR_SZ));
 }
 
+void dp_mlo_set_rx_fst(struct dp_soc *soc, struct dp_rx_fst *fst)
+{
+	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
+	struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
+
+	if (be_soc->mlo_enabled && ml_ctxt)
+		ml_ctxt->rx_fst = fst;
+}
+
+struct dp_rx_fst *dp_mlo_get_rx_fst(struct dp_soc *soc)
+{
+	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
+	struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
+
+	if (be_soc->mlo_enabled && ml_ctxt)
+		return ml_ctxt->rx_fst;
+
+	return NULL;
+}
+
+void dp_mlo_rx_fst_ref(struct dp_soc *soc)
+{
+	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
+	struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
+
+	if (be_soc->mlo_enabled && ml_ctxt)
+		ml_ctxt->rx_fst_ref_cnt++;
+}
+
+uint8_t dp_mlo_rx_fst_deref(struct dp_soc *soc)
+{
+	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
+	struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
+	uint8_t rx_fst_ref_cnt;
+
+	if (be_soc->mlo_enabled && ml_ctxt) {
+		rx_fst_ref_cnt = ml_ctxt->rx_fst_ref_cnt;
+		ml_ctxt->rx_fst_ref_cnt--;
+		return rx_fst_ref_cnt;
+	}
+
+	return 1;
+}
+
 struct dp_soc *
 dp_rx_replensih_soc_get(struct dp_soc *soc, uint8_t chip_id)
 {

+ 36 - 1
dp/wifi3.0/be/mlo/dp_mlo.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -39,6 +39,8 @@
  *           Associated peer with this MAC address)
  * @mld_peer_hash_lock: lock to protect mld_peer_hash
  * @link_to_pdev_map: link to pdev mapping
+ * @rx_fst: pointer to rx_fst handle
+ * @rx_fst_ref_cnt: ref count of rx_fst
  */
 struct dp_mlo_ctxt {
 	struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
@@ -56,6 +58,8 @@ struct dp_mlo_ctxt {
 	uint32_t toeplitz_hash_ipv6[LRO_IPV6_SEED_ARR_SZ];
 	struct dp_pdev_be *link_to_pdev_map[WLAN_MAX_MLO_CHIPS *
 		WLAN_MAX_MLO_LINKS_PER_SOC];
+	struct dp_rx_fst *rx_fst;
+	uint8_t rx_fst_ref_cnt;
 };
 
 /**
@@ -114,6 +118,37 @@ dp_mlo_get_soc_ref_by_chip_id(struct dp_mlo_ctxt *ml_ctxt, uint8_t chip_id);
 void dp_mlo_get_rx_hash_key(struct dp_soc *soc,
 			    struct cdp_lro_hash_config *lro_hash);
 
+/**
+ * dp_mlo_rx_fst_deref() - decrement rx_fst
+ * @soc: dp soc
+ *
+ * return: soc cnt
+ */
+uint8_t dp_mlo_rx_fst_deref(struct dp_soc *soc);
+
+/**
+ * dp_mlo_rx_fst_ref() - increment ref of rx_fst
+ * @soc: dp soc
+ *
+ */
+void dp_mlo_rx_fst_ref(struct dp_soc *soc);
+
+/**
+ * dp_mlo_get_rx_fst() - Get Rx FST from MLO context
+ * @soc: DP SOC
+ *
+ * Return: struct dp_rx_fst pointer
+ */
+struct dp_rx_fst *dp_mlo_get_rx_fst(struct dp_soc *soc);
+
+/**
+ * dp_mlo_set_rx_fst() - Set Rx FST in MLO context
+ * @soc: DP SOC
+ * @fst: pointer dp_rx_fst
+ *
+ */
+void dp_mlo_set_rx_fst(struct dp_soc *soc, struct dp_rx_fst *fst);
+
 /**
  * dp_mlo_update_link_to_pdev_map : map link-id to pdev mapping
  * @soc: DP SOC

+ 21 - 1
dp/wifi3.0/dp_internal.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -3363,6 +3363,26 @@ void dp_rx_fst_detach(struct dp_soc *soc, struct dp_pdev *pdev)
 }
 #endif
 
+/**
+ * dp_rx_fst_attach_wrapper() - wrapper API for dp_rx_fst_attach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: Handle to flow search table entry
+ */
+extern QDF_STATUS
+dp_rx_fst_attach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev);
+
+/**
+ * dp_rx_fst_detach_wrapper() - wrapper API for dp_rx_fst_detach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: None
+ */
+extern void
+dp_rx_fst_detach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev);
+
 /**
  * dp_vdev_get_ref() - API to take a reference for VDEV object
  *

+ 143 - 17
dp/wifi3.0/dp_main.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -5788,6 +5788,132 @@ static inline void dp_soc_tx_history_detach(struct dp_soc *soc)
 }
 #endif /* WLAN_FEATURE_DP_TX_DESC_HISTORY */
 
+#ifdef WLAN_SUPPORT_RX_FLOW_TAG
+/**
+ * dp_rx_fst_attach_wrapper() - wrapper API for dp_rx_fst_attach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: Handle to flow search table entry
+ */
+QDF_STATUS
+dp_rx_fst_attach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
+{
+	struct dp_rx_fst *rx_fst = NULL;
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	/* for Lithium the below API is not registered
+	 * hence fst attach happens for each pdev
+	 */
+	if (!soc->arch_ops.dp_get_rx_fst)
+		return dp_rx_fst_attach(soc, pdev);
+
+	rx_fst = soc->arch_ops.dp_get_rx_fst(soc);
+
+	/* for BE the FST attach is called only once per
+	 * ML context. if rx_fst is already registered
+	 * increase the ref count and return.
+	 */
+	if (rx_fst) {
+		soc->rx_fst = rx_fst;
+		pdev->rx_fst = rx_fst;
+		soc->arch_ops.dp_rx_fst_ref(soc);
+	} else {
+		ret = dp_rx_fst_attach(soc, pdev);
+		if ((ret != QDF_STATUS_SUCCESS) &&
+		    (ret != QDF_STATUS_E_NOSUPPORT))
+			return ret;
+
+		soc->arch_ops.dp_set_rx_fst(soc, soc->rx_fst);
+		soc->arch_ops.dp_rx_fst_ref(soc);
+	}
+	return ret;
+}
+
+/**
+ * dp_rx_fst_detach_wrapper() - wrapper API for dp_rx_fst_detach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: None
+ */
+void
+dp_rx_fst_detach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
+{
+	struct dp_rx_fst *rx_fst = NULL;
+
+	/* for Lithium the below API is not registered
+	 * hence fst detach happens for each pdev
+	 */
+	if (!soc->arch_ops.dp_get_rx_fst) {
+		dp_rx_fst_detach(soc, pdev);
+		return;
+	}
+
+	rx_fst = soc->arch_ops.dp_get_rx_fst(soc);
+
+	/* for BE the FST detach is called only when last
+	 * ref count reaches 1.
+	 */
+	if (rx_fst) {
+		if (soc->arch_ops.dp_rx_fst_deref(soc) == 1)
+			dp_rx_fst_detach(soc, pdev);
+	}
+	pdev->rx_fst = NULL;
+}
+#elif defined(WLAN_SUPPORT_RX_FISA)
+/**
+ * dp_rx_fst_attach_wrapper() - wrapper API for dp_rx_fst_attach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: Handle to flow search table entry
+ */
+QDF_STATUS
+dp_rx_fst_attach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
+{
+	return dp_rx_fst_attach(soc, pdev);
+}
+
+/**
+ * dp_rx_fst_detach_wrapper() - wrapper API for dp_rx_fst_detach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: None
+ */
+void
+dp_rx_fst_detach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
+{
+	dp_rx_fst_detach(soc, pdev);
+}
+#else
+/**
+ * dp_rx_fst_attach_wrapper() - wrapper API for dp_rx_fst_attach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: Handle to flow search table entry
+ */
+QDF_STATUS
+dp_rx_fst_attach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * dp_rx_fst_detach_wrapper() - wrapper API for dp_rx_fst_detach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: None
+ */
+void
+dp_rx_fst_detach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
+{
+}
+#endif
+
 /*
 * dp_pdev_attach_wifi3() - attach txrx pdev
 * @txrx_soc: Datapath SOC handle
@@ -5805,11 +5931,13 @@ QDF_STATUS dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc,
 	uint8_t pdev_id = params->pdev_id;
 	struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
 	int nss_cfg;
+	QDF_STATUS ret;
 
 	pdev_context_size =
 		soc->arch_ops.txrx_get_context_size(DP_CONTEXT_TYPE_PDEV);
 	if (pdev_context_size)
-		pdev = dp_context_alloc_mem(soc, DP_PDEV_TYPE, pdev_context_size);
+		pdev = dp_context_alloc_mem(soc, DP_PDEV_TYPE,
+					    pdev_context_size);
 
 	if (!pdev) {
 		dp_init_err("%pK: DP PDEV memory allocation failed",
@@ -5880,8 +6008,17 @@ QDF_STATUS dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc,
 		goto fail6;
 	}
 
+	ret = dp_rx_fst_attach_wrapper(soc, pdev);
+	if ((ret != QDF_STATUS_SUCCESS) && (ret != QDF_STATUS_E_NOSUPPORT)) {
+		dp_init_err("%pK: RX FST attach failed: pdev %d err %d",
+			    soc, pdev_id, ret);
+		goto fail7;
+	}
+
 	return QDF_STATUS_SUCCESS;
 
+fail7:
+	dp_free_ipa_rx_alt_refill_buf_ring(soc, pdev);
 fail6:
 	dp_monitor_pdev_detach(pdev);
 fail5:
@@ -6016,7 +6153,6 @@ static void dp_pdev_deinit(struct cdp_pdev *txrx_pdev, int force)
 		return;
 
 	dp_tx_me_exit(pdev);
-	dp_rx_fst_detach(pdev->soc, pdev);
 	dp_rx_pdev_buffers_free(pdev);
 	dp_rx_pdev_desc_pool_deinit(pdev);
 	dp_pdev_bkp_stats_detach(pdev);
@@ -6133,6 +6269,7 @@ static void dp_pdev_detach(struct cdp_pdev *txrx_pdev, int force)
 	struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev;
 	struct dp_soc *soc = pdev->soc;
 
+	dp_rx_fst_detach_wrapper(soc, pdev);
 	dp_pdev_htt_stats_dbgfs_deinit(pdev);
 	dp_rx_pdev_desc_pool_free(pdev);
 	dp_monitor_pdev_detach(pdev);
@@ -17109,7 +17246,6 @@ static QDF_STATUS dp_pdev_init(struct cdp_soc_t *txrx_soc,
 	struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
 	int nss_cfg;
 	void *sojourn_buf;
-	QDF_STATUS ret;
 
 	struct dp_soc *soc = (struct dp_soc *)txrx_soc;
 	struct dp_pdev *pdev = soc->pdev_list[pdev_id];
@@ -17231,23 +17367,15 @@ static QDF_STATUS dp_pdev_init(struct cdp_soc_t *txrx_soc,
 		goto fail4;
 	}
 
-	ret = dp_rx_fst_attach(soc, pdev);
-	if ((ret != QDF_STATUS_SUCCESS) &&
-	    (ret != QDF_STATUS_E_NOSUPPORT)) {
-		dp_init_err("%pK: RX Flow Search Table attach failed: pdev %d err %d",
-			    soc, pdev_id, ret);
-		goto fail5;
-	}
-
 	if (dp_pdev_bkp_stats_attach(pdev) != QDF_STATUS_SUCCESS) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
 			  FL("dp_pdev_bkp_stats_attach failed"));
-		goto fail6;
+		goto fail5;
 	}
 
 	if (dp_monitor_pdev_init(pdev)) {
 		dp_init_err("%pK: dp_monitor_pdev_init failed\n", soc);
-		goto fail7;
+		goto fail6;
 	}
 
 	/* initialize sw rx descriptors */
@@ -17264,10 +17392,8 @@ static QDF_STATUS dp_pdev_init(struct cdp_soc_t *txrx_soc,
 		qdf_skb_total_mem_stats_read());
 
 	return QDF_STATUS_SUCCESS;
-fail7:
-	dp_pdev_bkp_stats_detach(pdev);
 fail6:
-	dp_rx_fst_detach(soc, pdev);
+	dp_pdev_bkp_stats_detach(pdev);
 fail5:
 	dp_ipa_uc_detach(soc, pdev);
 fail4:

+ 5 - 1
dp/wifi3.0/dp_types.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -2000,6 +2000,10 @@ struct dp_arch_ops {
 				       unsigned int tid);
 	void (*get_rx_hash_key)(struct dp_soc *soc,
 				struct cdp_lro_hash_config *lro_hash);
+	void (*dp_set_rx_fst)(struct dp_soc *soc, struct dp_rx_fst *fst);
+	struct dp_rx_fst *(*dp_get_rx_fst)(struct dp_soc *soc);
+	uint8_t (*dp_rx_fst_deref)(struct dp_soc *soc);
+	void (*dp_rx_fst_ref)(struct dp_soc *soc);
 	void (*txrx_print_peer_stats)(struct cdp_peer_stats *peer_stats,
 				      enum peer_stats_type stats_type);
 	/* Dp peer reorder queue setup */

+ 5 - 1
dp/wifi3.0/li/dp_li.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -631,6 +631,10 @@ void dp_initialize_arch_ops_li(struct dp_arch_ops *arch_ops)
 	arch_ops->txrx_peer_map_attach = dp_peer_map_attach_li;
 	arch_ops->txrx_peer_map_detach = dp_peer_map_detach_li;
 	arch_ops->get_rx_hash_key = dp_get_rx_hash_key_li;
+	arch_ops->dp_set_rx_fst = NULL;
+	arch_ops->dp_get_rx_fst = NULL;
+	arch_ops->dp_rx_fst_ref = NULL;
+	arch_ops->dp_rx_fst_deref = NULL;
 	arch_ops->txrx_peer_setup = dp_peer_setup_li;
 	arch_ops->dp_rx_desc_cookie_2_va =
 			dp_rx_desc_cookie_2_va_li;

+ 4 - 4
hal/wifi3.0/hal_rx_flow.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -419,6 +419,7 @@ hal_rx_fst_attach(hal_soc_handle_t hal_soc_hdl,
 	fst->hash_mask = max_entries - 1;
 
 	fst_entry_size = hal_rx_fst_get_fse_size(hal_soc_hdl);
+	fst->fst_entry_size = fst_entry_size;
 
 	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
 		  "HAL FST allocation %pK %d * %d\n", fst,
@@ -473,15 +474,14 @@ qdf_export_symbol(hal_rx_fst_attach);
 void hal_rx_fst_detach(hal_soc_handle_t hal_soc_hdl, struct hal_rx_fst *rx_fst,
 		       qdf_device_t qdf_dev, uint64_t fst_cmem_base)
 {
-	uint32_t fst_entry_size;
 
 	if (!rx_fst || !qdf_dev)
 		return;
 
 	if (fst_cmem_base == 0 && rx_fst->base_vaddr) {
-		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 * fst_entry_size,
+					rx_fst->max_entries *
+					rx_fst->fst_entry_size,
 					rx_fst->base_vaddr, rx_fst->base_paddr,
 					0);
 	}

+ 3 - 1
hal/wifi3.0/hal_rx_flow_info.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -59,6 +59,7 @@ struct hal_rx_flow {
  * @key_cache: Toepliz Key Cache configured key
  * @add_flow_count: Add flow count
  * @del_flow_count: Delete flow count
+ * @fst_entry_size: size of each flow entry
  */
 struct hal_rx_fst {
 	uint8_t *base_vaddr;
@@ -73,6 +74,7 @@ struct hal_rx_fst {
 	uint16_t hash_mask;
 	uint32_t add_flow_count;
 	uint32_t del_flow_count;
+	uint32_t fst_entry_size;
 };
 
 #endif /* HAL_RX_FLOW_DEFINES_H */