Quellcode durchsuchen

qcacmn: Add support in IPA datapath for 2X_PDEV

2x_pdev changes are include for support new IPA API's
and change the existing API's argument to support new
parameter which is ipa handle, create a new API to get
the IPA hdl from IPA component in DP

Change-Id: I3d2b378620dbd1e64d295623534126e0eebc2d28
Devender kumar vor 3 Jahren
Ursprung
Commit
95ced9577d
4 geänderte Dateien mit 140 neuen und 61 gelöschten Zeilen
  1. 28 15
      dp/inc/cdp_txrx_ipa.h
  2. 13 9
      dp/inc/cdp_txrx_ops.h
  3. 67 28
      dp/wifi3.0/dp_ipa.c
  4. 32 9
      dp/wifi3.0/dp_ipa.h

+ 28 - 15
dp/inc/cdp_txrx_ipa.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -404,6 +404,7 @@ cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
  * @is_smmu_enabled: Is SMMU enabled or not
  * @sys_in: parameters to setup sys pipe in mcc mode
  * @over_gsi: Is IPA using GSI
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
@@ -413,7 +414,7 @@ cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
 	      uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
 	      uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle,
 	      bool is_smmu_enabled, qdf_ipa_sys_connect_params_t *sys_in,
-	      bool over_gsi)
+	      bool over_gsi, qdf_ipa_wdi_hdl_t hdl)
 {
 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -430,7 +431,7 @@ cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
 						    tx_pipe_handle,
 						    rx_pipe_handle,
 						    is_smmu_enabled,
-						    sys_in, over_gsi);
+						    sys_in, over_gsi, hdl);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -481,12 +482,14 @@ cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
  * @pdev_id: handle to the device instance number
  * @tx_pipe_handle: Tx pipe handle
  * @rx_pipe_handle: Rx pipe handle
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
 cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id,
-		uint32_t tx_pipe_handle, uint32_t rx_pipe_handle)
+		uint32_t tx_pipe_handle, uint32_t rx_pipe_handle,
+		qdf_ipa_wdi_hdl_t hdl)
 {
 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -497,7 +500,7 @@ cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id,
 	if (soc->ops->ipa_ops->ipa_cleanup)
 		return soc->ops->ipa_ops->ipa_cleanup(soc, pdev_id,
 						      tx_pipe_handle,
-						      rx_pipe_handle);
+						      rx_pipe_handle, hdl);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -511,6 +514,7 @@ cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id,
  * @cons_client: IPA cons client type
  * @session_id: Session ID
  * @is_ipv6_enabled: Is IPV6 enabled or not
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
@@ -518,7 +522,8 @@ static inline QDF_STATUS
 cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
 		    qdf_ipa_client_type_t prod_client,
 		    qdf_ipa_client_type_t cons_client,
-		    uint8_t session_id, bool is_ipv6_enabled)
+		    uint8_t session_id, bool is_ipv6_enabled,
+		    qdf_ipa_wdi_hdl_t hdl)
 {
 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -531,7 +536,8 @@ cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
 							  prod_client,
 							  cons_client,
 							  session_id,
-							  is_ipv6_enabled);
+							  is_ipv6_enabled,
+							  hdl);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -541,12 +547,13 @@ cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
  * @soc: data path soc handle
  * @ifname: Interface name
  * @is_ipv6_enabled: Is IPV6 enabled or not
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
 cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
-		      bool is_ipv6_enabled)
+		      bool is_ipv6_enabled, qdf_ipa_wdi_hdl_t hdl)
 {
 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -556,7 +563,8 @@ cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
 
 	if (soc->ops->ipa_ops->ipa_cleanup_iface)
 		return soc->ops->ipa_ops->ipa_cleanup_iface(ifname,
-							    is_ipv6_enabled);
+							    is_ipv6_enabled,
+							    hdl);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -565,11 +573,13 @@ cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
  * cdp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
  * @soc - data path soc handle
  * @pdev_id - device instance id
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
+cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id,
+		     qdf_ipa_wdi_hdl_t hdl)
 {
 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -578,7 +588,7 @@ cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
 	}
 
 	if (soc->ops->ipa_ops->ipa_enable_pipes)
-		return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id);
+		return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id, hdl);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -587,11 +597,13 @@ cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
  * cdp_ipa_uc_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
  * @soc: data path soc handle
  * @pdev_id - device instance id
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
+cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id,
+		      qdf_ipa_wdi_hdl_t hdl)
 {
 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -600,7 +612,7 @@ cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
 	}
 
 	if (soc->ops->ipa_ops->ipa_disable_pipes)
-		return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id);
+		return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id, hdl);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -610,12 +622,13 @@ cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
  * @soc: data path soc handle
  * @client: WLAN Client ID
  * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
+ * @hdl: IPA handle
  *
  * Return: 0 on success, negative errno on error
  */
 static inline QDF_STATUS
 cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
-		       uint32_t max_supported_bw_mbps)
+		       uint32_t max_supported_bw_mbps, qdf_ipa_wdi_hdl_t hdl)
 {
 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -625,7 +638,7 @@ cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
 
 	if (soc->ops->ipa_ops->ipa_set_perf_level)
 		return soc->ops->ipa_ops->ipa_set_perf_level(client,
-				max_supported_bw_mbps);
+				max_supported_bw_mbps, hdl);
 
 	return QDF_STATUS_SUCCESS;
 }

+ 13 - 9
dp/inc/cdp_txrx_ops.h

@@ -1743,7 +1743,7 @@ struct cdp_ipa_ops {
 				bool is_rm_enabled, uint32_t *tx_pipe_handle,
 				uint32_t *rx_pipe_handle, bool is_smmu_enabled,
 				qdf_ipa_sys_connect_params_t *sys_in,
-				bool over_gsi);
+				bool over_gsi, qdf_ipa_wdi_hdl_t hdl);
 #else /* CONFIG_IPA_WDI_UNIFIED_API */
 	QDF_STATUS (*ipa_setup)(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 				void *ipa_i2w_cb, void *ipa_w2i_cb,
@@ -1754,18 +1754,22 @@ struct cdp_ipa_ops {
 #endif /* CONFIG_IPA_WDI_UNIFIED_API */
 	QDF_STATUS (*ipa_cleanup)(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 				  uint32_t tx_pipe_handle,
-				  uint32_t rx_pipe_handle);
+				  uint32_t rx_pipe_handle,
+				  qdf_ipa_wdi_hdl_t hdl);
 	QDF_STATUS (*ipa_setup_iface)(char *ifname, uint8_t *mac_addr,
-		qdf_ipa_client_type_t prod_client,
-		qdf_ipa_client_type_t cons_client,
-		uint8_t session_id, bool is_ipv6_enabled);
-	QDF_STATUS (*ipa_cleanup_iface)(char *ifname, bool is_ipv6_enabled);
+				      qdf_ipa_client_type_t prod_client,
+				      qdf_ipa_client_type_t cons_client,
+				      uint8_t session_id, bool is_ipv6_enabled,
+				      qdf_ipa_wdi_hdl_t hdl);
+	QDF_STATUS (*ipa_cleanup_iface)(char *ifname, bool is_ipv6_enabled,
+					qdf_ipa_wdi_hdl_t hdl);
 	QDF_STATUS (*ipa_enable_pipes)(struct cdp_soc_t *soc_hdl,
-				       uint8_t pdev_id);
+				       uint8_t pdev_id, qdf_ipa_wdi_hdl_t hdl);
 	QDF_STATUS (*ipa_disable_pipes)(struct cdp_soc_t *soc_hdl,
-					uint8_t pdev_id);
+					uint8_t pdev_id, qdf_ipa_wdi_hdl_t hdl);
 	QDF_STATUS (*ipa_set_perf_level)(int client,
-		uint32_t max_supported_bw_mbps);
+					 uint32_t max_supported_bw_mbps,
+					 qdf_ipa_wdi_hdl_t hdl);
 	bool (*ipa_rx_intrabss_fwd)(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
 				    qdf_nbuf_t nbuf, bool *fwd_success);
 	QDF_STATUS (*ipa_tx_buf_smmu_mapping)(struct cdp_soc_t *soc_hdl,

+ 67 - 28
dp/wifi3.0/dp_ipa.c

@@ -107,7 +107,17 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
 {
 	qdf_mem_info_t mem_map_table = {0};
 	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+	qdf_ipa_wdi_hdl_t hdl;
 
+	/* Need to handle the case when one soc will
+	 * have multiple pdev(radio's), Currently passing
+	 * pdev_id as 0 assuming 1 soc has only 1 radio.
+	 */
+	hdl = wlan_ipa_get_hdl(soc->ctrl_psoc, 0);
+	if (hdl == DP_IPA_HDL_INVALID) {
+		dp_err("IPA handle is invalid");
+		return QDF_STATUS_E_INVAL;
+	}
 	qdf_update_mem_map_table(soc->osdev, &mem_map_table,
 				 qdf_nbuf_get_frag_paddr(nbuf, 0),
 				 size);
@@ -116,9 +126,11 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
 		/* Assert if PA is zero */
 		qdf_assert_always(mem_map_table.pa);
 
-		ret = qdf_ipa_wdi_create_smmu_mapping(1, &mem_map_table);
+		ret = qdf_ipa_wdi_create_smmu_mapping(hdl, 1,
+						      &mem_map_table);
 	} else {
-		ret = qdf_ipa_wdi_release_smmu_mapping(1, &mem_map_table);
+		ret = qdf_ipa_wdi_release_smmu_mapping(hdl, 1,
+						       &mem_map_table);
 	}
 	qdf_assert_always(!ret);
 
@@ -1991,18 +2003,24 @@ static void
 dp_ipa_wdi_tx_smmu_params(struct dp_soc *soc,
 			  struct dp_ipa_resources *ipa_res,
 			  qdf_ipa_wdi_pipe_setup_info_smmu_t *tx_smmu,
-			  bool over_gsi)
+			  bool over_gsi,
+			  qdf_ipa_wdi_hdl_t hdl)
 {
 	struct tcl_data_cmd *tcl_desc_ptr;
 	uint8_t *desc_addr;
 	uint32_t desc_size;
 
-	if (over_gsi)
-		QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(tx_smmu) =
-			IPA_CLIENT_WLAN2_CONS;
-	else
+	if (over_gsi) {
+		if (hdl == DP_IPA_HDL_FIRST)
+			QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(tx_smmu) =
+				IPA_CLIENT_WLAN2_CONS;
+		else if (hdl == DP_IPA_HDL_SECOND)
+			QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(tx_smmu) =
+				IPA_CLIENT_WLAN4_CONS;
+	} else {
 		QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(tx_smmu) =
 			IPA_CLIENT_WLAN1_CONS;
+	}
 
 	qdf_mem_copy(&QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_BASE(tx_smmu),
 		     &ipa_res->tx_comp_ring.sgtable,
@@ -2054,14 +2072,20 @@ static void
 dp_ipa_wdi_rx_smmu_params(struct dp_soc *soc,
 			  struct dp_ipa_resources *ipa_res,
 			  qdf_ipa_wdi_pipe_setup_info_smmu_t *rx_smmu,
-			  bool over_gsi)
-{
-	if (over_gsi)
-		QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(rx_smmu) =
-					IPA_CLIENT_WLAN2_PROD;
-	else
+			  bool over_gsi,
+			  qdf_ipa_wdi_hdl_t hdl)
+{
+	if (over_gsi) {
+		if (hdl == DP_IPA_HDL_FIRST)
+			QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(rx_smmu) =
+				IPA_CLIENT_WLAN2_PROD;
+		else if (hdl == DP_IPA_HDL_SECOND)
+			QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(rx_smmu) =
+				IPA_CLIENT_WLAN3_PROD;
+	} else {
 		QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(rx_smmu) =
 					IPA_CLIENT_WLAN1_PROD;
+	}
 
 	qdf_mem_copy(&QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_BASE(rx_smmu),
 		     &ipa_res->rx_rdy_ring.sgtable,
@@ -2096,7 +2120,8 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 			uint32_t ipa_desc_size, void *ipa_priv,
 			bool is_rm_enabled, uint32_t *tx_pipe_handle,
 			uint32_t *rx_pipe_handle, bool is_smmu_enabled,
-			qdf_ipa_sys_connect_params_t *sys_in, bool over_gsi)
+			qdf_ipa_sys_connect_params_t *sys_in, bool over_gsi,
+			qdf_ipa_wdi_hdl_t hdl)
 {
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	struct dp_pdev *pdev =
@@ -2158,7 +2183,7 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 	 * Event Ring Doorbell PA: TCL Head Pointer Address
 	 */
 	if (is_smmu_enabled)
-		dp_ipa_wdi_tx_smmu_params(soc, ipa_res, tx_smmu, over_gsi);
+		dp_ipa_wdi_tx_smmu_params(soc, ipa_res, tx_smmu, over_gsi, hdl);
 	else
 		dp_ipa_wdi_tx_params(soc, ipa_res, tx, over_gsi);
 
@@ -2190,12 +2215,13 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 	 * Event Ring Doorbell PA: FW Head Pointer Address
 	 */
 	if (is_smmu_enabled)
-		dp_ipa_wdi_rx_smmu_params(soc, ipa_res, rx_smmu, over_gsi);
+		dp_ipa_wdi_rx_smmu_params(soc, ipa_res, rx_smmu, over_gsi, hdl);
 	else
 		dp_ipa_wdi_rx_params(soc, ipa_res, rx, over_gsi);
 
 	QDF_IPA_WDI_CONN_IN_PARAMS_NOTIFY(pipe_in) = ipa_w2i_cb;
 	QDF_IPA_WDI_CONN_IN_PARAMS_PRIV(pipe_in) = ipa_priv;
+	QDF_IPA_WDI_CONN_IN_PARAMS_HANDLE(pipe_in) = hdl;
 
 	/* Connect WDI IPA PIPEs */
 	ret = qdf_ipa_wdi_conn_pipes(pipe_in, &pipe_out);
@@ -2235,13 +2261,15 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  * @cons_client: IPA cons client type
  * @session_id: Session ID
  * @is_ipv6_enabled: Is IPV6 enabled or not
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
 			      qdf_ipa_client_type_t prod_client,
 			      qdf_ipa_client_type_t cons_client,
-			      uint8_t session_id, bool is_ipv6_enabled)
+			      uint8_t session_id, bool is_ipv6_enabled,
+			      qdf_ipa_wdi_hdl_t hdl)
 {
 	qdf_ipa_wdi_reg_intf_in_params_t in;
 	qdf_ipa_wdi_hdr_info_t hdr_info;
@@ -2271,6 +2299,7 @@ QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
 	QDF_IPA_WDI_REG_INTF_IN_PARAMS_ALT_DST_PIPE(&in) = cons_client;
 	QDF_IPA_WDI_REG_INTF_IN_PARAMS_IS_META_DATA_VALID(&in) = 1;
 	QDF_IPA_WDI_REG_INTF_IN_PARAMS_META_DATA_MASK(&in) = htonl(0x00FF0000);
+	QDF_IPA_WDI_REG_INTF_IN_PARAMS_HANDLE(&in) = hdl;
 	dp_ipa_setup_iface_session_id(&in, session_id);
 
 	/* IPV6 header */
@@ -2494,13 +2523,15 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  * @cons_client: IPA cons client type
  * @session_id: Session ID
  * @is_ipv6_enabled: Is IPV6 enabled or not
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
 			      qdf_ipa_client_type_t prod_client,
 			      qdf_ipa_client_type_t cons_client,
-			      uint8_t session_id, bool is_ipv6_enabled)
+			      uint8_t session_id, bool is_ipv6_enabled,
+			      qdf_ipa_wdi_hdl_t hdl)
 {
 	qdf_ipa_wdi_reg_intf_in_params_t in;
 	qdf_ipa_wdi_hdr_info_t hdr_info;
@@ -2560,18 +2591,20 @@ QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
  * @pdev_id: dp pdev id
  * @tx_pipe_handle: Tx pipe handle
  * @rx_pipe_handle: Rx pipe handle
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS dp_ipa_cleanup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
-			  uint32_t tx_pipe_handle, uint32_t rx_pipe_handle)
+			  uint32_t tx_pipe_handle, uint32_t rx_pipe_handle,
+			  qdf_ipa_wdi_hdl_t hdl)
 {
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	struct dp_pdev *pdev;
 	int ret;
 
-	ret = qdf_ipa_wdi_disconn_pipes();
+	ret = qdf_ipa_wdi_disconn_pipes(hdl);
 	if (ret) {
 		dp_err("ipa_wdi_disconn_pipes: IPA pipe cleanup failed: ret=%d",
 		       ret);
@@ -2599,14 +2632,16 @@ exit:
  * dp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface
  * @ifname: Interface name
  * @is_ipv6_enabled: Is IPV6 enabled or not
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled)
+QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled,
+				qdf_ipa_wdi_hdl_t hdl)
 {
 	int ret;
 
-	ret = qdf_ipa_wdi_dereg_intf(ifname);
+	ret = qdf_ipa_wdi_dereg_intf(ifname, hdl);
 	if (ret) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			  "%s: ipa_wdi_dereg_intf: IPA pipe deregistration failed: ret=%d",
@@ -2627,7 +2662,8 @@ QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled)
 #define DP_IPA_RESET_TX_DB_PA(soc, ipa_res)
 #endif
 
-QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
+QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			       qdf_ipa_wdi_hdl_t hdl)
 {
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	struct dp_pdev *pdev =
@@ -2646,7 +2682,7 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	DP_IPA_EP_SET_TX_DB_PA(soc, ipa_res);
 	dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, true);
 
-	result = qdf_ipa_wdi_enable_pipes();
+	result = qdf_ipa_wdi_enable_pipes(hdl);
 	if (result) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			  "%s: Enable WDI PIPE fail, code %d",
@@ -2665,7 +2701,8 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	return QDF_STATUS_SUCCESS;
 }
 
-QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
+QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				qdf_ipa_wdi_hdl_t hdl)
 {
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	struct dp_pdev *pdev =
@@ -2688,7 +2725,7 @@ QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	 */
 	DP_IPA_RESET_TX_DB_PA(soc, ipa_res);
 
-	result = qdf_ipa_wdi_disable_pipes();
+	result = qdf_ipa_wdi_disable_pipes(hdl);
 	if (result) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			  "%s: Disable WDI PIPE fail, code %d",
@@ -2707,10 +2744,12 @@ QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
  * dp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates
  * @client: Client type
  * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS dp_ipa_set_perf_level(int client, uint32_t max_supported_bw_mbps)
+QDF_STATUS dp_ipa_set_perf_level(int client, uint32_t max_supported_bw_mbps,
+				 qdf_ipa_wdi_hdl_t hdl)
 {
 	qdf_ipa_wdi_perf_profile_t profile;
 	QDF_STATUS result;
@@ -2718,7 +2757,7 @@ QDF_STATUS dp_ipa_set_perf_level(int client, uint32_t max_supported_bw_mbps)
 	profile.client = client;
 	profile.max_supported_bw_mbps = max_supported_bw_mbps;
 
-	result = qdf_ipa_wdi_set_perf_profile(&profile);
+	result = qdf_ipa_wdi_set_perf_profile(hdl, &profile);
 	if (result) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			  "%s: ipa_wdi_set_perf_profile fail, code %d",

+ 32 - 9
dp/wifi3.0/dp_ipa.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -61,6 +61,20 @@ struct dp_ipa_uc_rx_hdr {
 #define DP_IPA_UC_WLAN_RX_HDR_LEN      sizeof(struct dp_ipa_uc_rx_hdr)
 #define DP_IPA_UC_WLAN_HDR_DES_MAC_OFFSET	0
 
+#define DP_IPA_HDL_INVALID	0xFF
+#define DP_IPA_HDL_FIRST	0
+#define DP_IPA_HDL_SECOND	1
+/**
+ * wlan_ipa_get_hdl() - Get ipa handle from IPA component
+ * @psoc - control psoc object
+ * @pdev_id - pdev id
+ *
+ * IPA componenet will return the IPA handle based on pdev_id
+ *
+ * Return: IPA handle
+ */
+qdf_ipa_wdi_hdl_t wlan_ipa_get_hdl(void *psoc, uint8_t pdev_id);
+
 /**
  * dp_ipa_get_resource() - Client request resource information
  * @soc_hdl - data path soc handle
@@ -189,6 +203,7 @@ QDF_STATUS dp_ipa_disable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
  * @rx_pipe_handle: pointer to Rx pipe handle
  * @is_smmu_enabled: Is SMMU enabled or not
  * @sys_in: parameters to setup sys pipe in mcc mode
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
@@ -199,7 +214,8 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 			bool is_rm_enabled, uint32_t *tx_pipe_handle,
 			uint32_t *rx_pipe_handle,
 			bool is_smmu_enabled,
-			qdf_ipa_sys_connect_params_t *sys_in, bool over_gsi);
+			qdf_ipa_sys_connect_params_t *sys_in, bool over_gsi,
+			qdf_ipa_wdi_hdl_t hdl);
 #else /* CONFIG_IPA_WDI_UNIFIED_API */
 /**
  * dp_ipa_setup() - Setup and connect IPA pipes
@@ -213,6 +229,7 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  * @is_rm_enabled: Is IPA RM enabled or not
  * @tx_pipe_handle: pointer to Tx pipe handle
  * @rx_pipe_handle: pointer to Rx pipe handle
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
@@ -225,7 +242,7 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 #endif /* CONFIG_IPA_WDI_UNIFIED_API */
 QDF_STATUS dp_ipa_cleanup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 			  uint32_t tx_pipe_handle,
-			  uint32_t rx_pipe_handle);
+			  uint32_t rx_pipe_handle, qdf_ipa_wdi_hdl_t hdl);
 QDF_STATUS dp_ipa_remove_header(char *name);
 int dp_ipa_add_header_info(char *ifname, uint8_t *mac_addr,
 		uint8_t session_id, bool is_ipv6_enabled);
@@ -233,28 +250,34 @@ int dp_ipa_register_interface(char *ifname, bool is_ipv6_enabled);
 QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
 		qdf_ipa_client_type_t prod_client,
 		qdf_ipa_client_type_t cons_client,
-		uint8_t session_id, bool is_ipv6_enabled);
-QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled);
+		uint8_t session_id, bool is_ipv6_enabled,
+		qdf_ipa_wdi_hdl_t hdl);
+QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled,
+				qdf_ipa_wdi_hdl_t hdl);
 
 /**
  * dp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
  * @soc_hdl - handle to the soc
  * @pdev_id - pdev id number, to get the handle
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			       qdf_ipa_wdi_hdl_t hdl);
 
 /**
  * dp_ipa_disable_pipes() – Suspend traffic and disable Tx/Rx pipes
  * @soc_hdl - handle to the soc
  * @pdev_id - pdev id number, to get the handle
+ * @hdl: IPA handle
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
-QDF_STATUS dp_ipa_set_perf_level(int client,
-		uint32_t max_supported_bw_mbps);
+QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				qdf_ipa_wdi_hdl_t hdl);
+QDF_STATUS dp_ipa_set_perf_level(int client, uint32_t max_supported_bw_mbps,
+				 qdf_ipa_wdi_hdl_t hdl);
 
 /**
  * dp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path