Bladeren bron

qcacmn: cdp: Converge cdp_ipa_ops

Currently cdp ops are given pdev/vdev/peer
handle as its arguments, which is directly
accessed in those APIs. This can cause a
race-condition in access of the respective
handles if it has been deleted in parallel.

Hence as a part of cdp convergence, pass only
the pdev_id or vdev_id or peer mac address,
which will be used to get the respective handles,
and hence avoiding the unwanted access of the
handles if it has been deleted.

- ipa_get_resource
- ipa_set_doorbell_paddr
- ipa_set_active
- ipa_register_op_cb
- ipa_get_stat
- ipa_tx_data_frame
- ipa_uc_get_share_stats
- ipa_uc_set_quota
- ipa_enable_autonomy
- ipa_disable_autonomy
- ipa_setup
- ipa_enable_pipes
- ipa_disable_pipes
- ipa_rx_intrabss_fwd

Change-Id: Ieb7e48d11a69a1e4a92a7114042b1db72d5f4b65
CRs-Fixed: 2540862
Vevek Venkatesan 5 jaren geleden
bovenliggende
commit
2cc8c5d14d
4 gewijzigde bestanden met toevoegingen van 395 en 270 verwijderingen
  1. 78 75
      dp/inc/cdp_txrx_ipa.h
  2. 45 30
      dp/inc/cdp_txrx_ops.h
  3. 120 145
      dp/wifi3.0/dp_ipa.c
  4. 152 20
      dp/wifi3.0/dp_ipa.h

+ 78 - 75
dp/inc/cdp_txrx_ipa.h

@@ -35,23 +35,23 @@
 /**
  * cdp_ipa_get_resource() - Get allocated WLAN resources for IPA data path
  * @soc - data path soc handle
- * @pdev - device instance pointer
+ * @pdev_id - device instance id
  *
  * Get allocated WLAN resources for IPA data path
  *
  * return QDF_STATUS_SUCCESS
  */
 static inline QDF_STATUS
-cdp_ipa_get_resource(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_ipa_get_resource(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_get_resource)
-		return soc->ops->ipa_ops->ipa_get_resource(pdev);
+		return soc->ops->ipa_ops->ipa_get_resource(soc, pdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -59,23 +59,23 @@ cdp_ipa_get_resource(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
 /**
  * cdp_ipa_set_doorbell_paddr() - give IPA db paddr to FW
  * @soc - data path soc handle
- * @pdev - device instance pointer
+ * @pdev_id - device instance id
  *
  * give IPA db paddr to FW
  *
  * return QDF_STATUS_SUCCESS
  */
 static inline QDF_STATUS
-cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_set_doorbell_paddr)
-		return soc->ops->ipa_ops->ipa_set_doorbell_paddr(pdev);
+		return soc->ops->ipa_ops->ipa_set_doorbell_paddr(soc, pdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -83,7 +83,7 @@ cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
 /**
  * cdp_ipa_set_active() - activate/de-ctivate IPA offload path
  * @soc - data path soc handle
- * @pdev - device instance pointer
+ * @pdev_id - device instance id
  * @uc_active - activate or de-activate
  * @is_tx - toggle tx or rx data path
  *
@@ -92,18 +92,18 @@ cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  * return QDF_STATUS_SUCCESS
  */
 static inline QDF_STATUS
-cdp_ipa_set_active(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
-		 bool uc_active, bool is_tx)
+cdp_ipa_set_active(ol_txrx_soc_handle soc, uint8_t pdev_id, bool uc_active,
+		   bool is_tx)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_set_active)
-		return soc->ops->ipa_ops->ipa_set_active(pdev, uc_active,
-				is_tx);
+		return soc->ops->ipa_ops->ipa_set_active(soc, pdev_id,
+				uc_active, is_tx);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -111,7 +111,7 @@ cdp_ipa_set_active(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
 /**
  * cdp_ipa_op_response() - event handler from FW
  * @soc - data path soc handle
- * @pdev - device instance pointer
+ * @pdev_id - device instance id
  * @op_msg - event contents from firmware
  *
  * event handler from FW
@@ -119,17 +119,16 @@ cdp_ipa_set_active(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  * return QDF_STATUS_SUCCESS
  */
 static inline QDF_STATUS
-cdp_ipa_op_response(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
-		uint8_t *op_msg)
+cdp_ipa_op_response(ol_txrx_soc_handle soc, uint8_t pdev_id, uint8_t *op_msg)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_op_response)
-		return soc->ops->ipa_ops->ipa_op_response(pdev, op_msg);
+		return soc->ops->ipa_ops->ipa_op_response(soc, pdev_id, op_msg);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -137,7 +136,7 @@ cdp_ipa_op_response(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
 /**
  * cdp_ipa_register_op_cb() - register event handler function pointer
  * @soc - data path soc handle
- * @pdev - device instance pointer
+ * @pdev_id - device instance id
  * @op_cb - event handler callback function pointer
  * @usr_ctxt - user context to registered
  *
@@ -146,18 +145,18 @@ cdp_ipa_op_response(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  * return QDF_STATUS_SUCCESS
  */
 static inline QDF_STATUS
-cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
-		 ipa_uc_op_cb_type op_cb, void *usr_ctxt)
+cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id,
+		       ipa_uc_op_cb_type op_cb, void *usr_ctxt)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_register_op_cb)
-		return soc->ops->ipa_ops->ipa_register_op_cb(pdev, op_cb,
-							     usr_ctxt);
+		return soc->ops->ipa_ops->ipa_register_op_cb(soc, pdev_id,
+							     op_cb, usr_ctxt);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -165,52 +164,55 @@ cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
 /**
  * cdp_ipa_get_stat() - get IPA data path stats from FW
  * @soc - data path soc handle
- * @pdev - device instance pointer
+ * @pdev_id - device instance id
  *
  * get IPA data path stats from FW async
  *
  * return QDF_STATUS_SUCCESS
  */
 static inline QDF_STATUS
-cdp_ipa_get_stat(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_ipa_get_stat(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_get_stat)
-		return soc->ops->ipa_ops->ipa_get_stat(pdev);
+		return soc->ops->ipa_ops->ipa_get_stat(soc, pdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
 
 /**
  * cdp_tx_send_ipa_data_frame() - send IPA data frame
- * @vdev: vdev
+ * @soc - data path soc handle
+ * @vdev_id: vdev id
  * @skb: skb
  *
  * Return: skb/ NULL is for success
  */
 static inline qdf_nbuf_t cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc,
-				struct cdp_vdev *vdev, qdf_nbuf_t skb)
+						    uint8_t vdev_id,
+						    qdf_nbuf_t skb)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !vdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return skb;
 	}
 
 	if (soc->ops->ipa_ops->ipa_tx_data_frame)
-		return soc->ops->ipa_ops->ipa_tx_data_frame(vdev, skb);
+		return soc->ops->ipa_ops->ipa_tx_data_frame(soc, vdev_id, skb);
 
 	return skb;
 }
 
 /**
  * cdp_ipa_set_uc_tx_partition_base() - set tx packet partition base
- * @pdev: physical device instance
+ * @soc - data path soc handle
+ * @cfg_pdev: physical device instance config
  * @value: partition base value
  *
  * Return: QDF_STATUS
@@ -235,23 +237,24 @@ cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc,
 #ifdef FEATURE_METERING
 /**
  * cdp_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW
- * @pdev: physical device instance
+ * @soc - data path soc handle
+ * @pdev_id: physical device instance number
  * @value: reset stats
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc,
-			struct cdp_pdev *pdev, uint8_t value)
+cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
+			   uint8_t value)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_uc_get_share_stats)
-		return soc->ops->ipa_ops->ipa_uc_get_share_stats(pdev,
+		return soc->ops->ipa_ops->ipa_uc_get_share_stats(soc, pdev_id,
 								 value);
 
 	return QDF_STATUS_SUCCESS;
@@ -259,24 +262,23 @@ cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc,
 
 /**
  * cdp_ipa_uc_set_quota() - set quota limit to FW
- * @pdev: physical device instance
+ * @soc - data path soc handle
+ * @pdev_id: physical device instance number
  * @value: quota limit bytes
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc,
-		struct cdp_pdev *pdev, uint64_t value)
+cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc, uint8_t pdev_id, uint64_t value)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_uc_set_quota)
-		return soc->ops->ipa_ops->ipa_uc_set_quota(pdev,
-							   value);
+		return soc->ops->ipa_ops->ipa_uc_set_quota(soc, pdev_id, value);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -285,7 +287,7 @@ cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc,
 /**
  * cdp_ipa_enable_autonomy() - Enable autonomy RX data path
  * @soc: data path soc handle
- * @pdev: handle to the device instance
+ * @pdev_id: physical device instance number
  *
  * IPA Data path is enabled and resumed.
  * All autonomy data path elements are ready to deliver packet
@@ -295,16 +297,16 @@ cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc,
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_enable_autonomy)
-		return soc->ops->ipa_ops->ipa_enable_autonomy(pdev);
+		return soc->ops->ipa_ops->ipa_enable_autonomy(soc, pdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -312,7 +314,7 @@ cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
 /**
  * cdp_ipa_disable_autonomy() - Disable autonomy RX data path
  * @soc: data path soc handle
- * @pdev: handle to the device instance
+ * @pdev_id: physical device instance number
  *
  * IPA Data path is enabled and resumed.
  * All autonomy datapath elements are ready to deliver packet
@@ -322,15 +324,15 @@ cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
-	if (soc->ops->ipa_ops->ipa_enable_autonomy)
-		return soc->ops->ipa_ops->ipa_disable_autonomy(pdev);
+	if (soc->ops->ipa_ops->ipa_disable_autonomy)
+		return soc->ops->ipa_ops->ipa_disable_autonomy(soc, pdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -339,7 +341,7 @@ cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
 /**
  * cdp_ipa_setup() - Setup and connect IPA pipes
  * @soc: data path soc handle
- * @pdev: handle to the device instance
+ * @pdev_id: handle to the device instance number
  * @ipa_i2w_cb: IPA to WLAN callback
  * @ipa_w2i_cb: WLAN to IPA callback
  * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
@@ -355,21 +357,21 @@ cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_setup(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, void *ipa_i2w_cb,
+cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
 	      void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_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)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_setup)
-		return soc->ops->ipa_ops->ipa_setup(pdev, ipa_i2w_cb,
+		return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
 						    ipa_w2i_cb,
 						    ipa_wdi_meter_notifier_cb,
 						    ipa_desc_size, ipa_priv,
@@ -385,7 +387,7 @@ cdp_ipa_setup(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, void *ipa_i2w_cb,
 /**
  * cdp_ipa_setup() - Setup and connect IPA pipes
  * @soc: data path soc handle
- * @pdev: handle to the device instance
+ * @pdev_id: handle to the device instance number
  * @ipa_i2w_cb: IPA to WLAN callback
  * @ipa_w2i_cb: WLAN to IPA callback
  * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
@@ -398,19 +400,19 @@ cdp_ipa_setup(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, void *ipa_i2w_cb,
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_setup(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, void *ipa_i2w_cb,
+cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
 	      void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
 	      uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
 	      uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_setup)
-		return soc->ops->ipa_ops->ipa_setup(pdev, ipa_i2w_cb,
+		return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
 						    ipa_w2i_cb,
 						    ipa_wdi_meter_notifier_cb,
 						    ipa_desc_size, ipa_priv,
@@ -508,22 +510,22 @@ 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: handle to the device instance
+ * @soc - data path soc handle
+ * @pdev_id - device instance id
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_enable_pipes)
-		return soc->ops->ipa_ops->ipa_enable_pipes(pdev);
+		return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -531,21 +533,21 @@ cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
 /**
  * cdp_ipa_uc_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
  * @soc: data path soc handle
- * @pdev: handle to the device instance
+ * @pdev_id - device instance id
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			"%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_disable_pipes)
-		return soc->ops->ipa_ops->ipa_disable_pipes(pdev);
+		return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -579,7 +581,7 @@ cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
  * cdp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path
  *
  * @soc: data path soc handle
- * @vdev: vdev handle
+ * @vdev_id: vdev id
  * @nbuf: pointer to skb of ethernet packet received from IPA RX path
  * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX
  *
@@ -589,17 +591,18 @@ cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
  *	   network stack. false if packet needs to be passed to network stack.
  */
 static inline bool
-cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
+cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, uint8_t vdev_id,
 			qdf_nbuf_t nbuf, bool *fwd_success)
 {
-	if (!soc || !soc->ops || !soc->ops->ipa_ops || !vdev || !fwd_success) {
+	if (!soc || !soc->ops || !soc->ops->ipa_ops || !fwd_success) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
 			  "%s invalid instance", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (soc->ops->ipa_ops->ipa_rx_intrabss_fwd)
-		return soc->ops->ipa_ops->ipa_rx_intrabss_fwd(vdev, nbuf,
+		return soc->ops->ipa_ops->ipa_rx_intrabss_fwd(soc, vdev_id,
+							      nbuf,
 							      fwd_success);
 
 	/* Fall back to pass up to stack */

+ 45 - 30
dp/inc/cdp_txrx_ops.h

@@ -1378,38 +1378,51 @@ struct cdp_throttle_ops {
  * @ipa_tx_data_frame:
  */
 struct cdp_ipa_ops {
-	QDF_STATUS (*ipa_get_resource)(struct cdp_pdev *pdev);
-	QDF_STATUS (*ipa_set_doorbell_paddr)(struct cdp_pdev *pdev);
-	QDF_STATUS (*ipa_set_active)(struct cdp_pdev *pdev, bool uc_active,
-		bool is_tx);
-	QDF_STATUS (*ipa_op_response)(struct cdp_pdev *pdev, uint8_t *op_msg);
-	QDF_STATUS (*ipa_register_op_cb)(struct cdp_pdev *pdev,
-		void (*ipa_uc_op_cb_type)(uint8_t *op_msg, void *osif_ctxt),
-		void *usr_ctxt);
-	QDF_STATUS (*ipa_get_stat)(struct cdp_pdev *pdev);
-	qdf_nbuf_t (*ipa_tx_data_frame)(struct cdp_vdev *vdev, qdf_nbuf_t skb);
+	QDF_STATUS (*ipa_get_resource)(struct cdp_soc_t *soc_hdl,
+				       uint8_t pdev_id);
+	QDF_STATUS (*ipa_set_doorbell_paddr)(struct cdp_soc_t *soc_hdl,
+					     uint8_t pdev_id);
+	QDF_STATUS (*ipa_set_active)(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				     bool uc_active, bool is_tx);
+	QDF_STATUS (*ipa_op_response)(struct cdp_soc_t *soc_hdl,
+				      uint8_t pdev_id, uint8_t *op_msg);
+	QDF_STATUS (*ipa_register_op_cb)(struct cdp_soc_t *soc_hdl,
+					 uint8_t pdev_id,
+					 void (*ipa_uc_op_cb_type)
+					 (uint8_t *op_msg, void *osif_ctxt),
+					 void *usr_ctxt);
+	QDF_STATUS (*ipa_get_stat)(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+	qdf_nbuf_t (*ipa_tx_data_frame)(struct cdp_soc_t *soc_hdl,
+					uint8_t vdev_id, qdf_nbuf_t skb);
 	void (*ipa_set_uc_tx_partition_base)(struct cdp_cfg *pdev,
 		uint32_t value);
 #ifdef FEATURE_METERING
-	QDF_STATUS (*ipa_uc_get_share_stats)(struct cdp_pdev *pdev,
-		uint8_t reset_stats);
-	QDF_STATUS (*ipa_uc_set_quota)(struct cdp_pdev *pdev,
-		uint64_t quota_bytes);
+	QDF_STATUS (*ipa_uc_get_share_stats)(struct cdp_soc_t *soc_hdl,
+					     uint8_t pdev_id,
+					     uint8_t reset_stats);
+	QDF_STATUS (*ipa_uc_set_quota)(struct cdp_soc_t *soc_hdl,
+				       uint8_t pdev_id, uint64_t quota_bytes);
 #endif
-	QDF_STATUS (*ipa_enable_autonomy)(struct cdp_pdev *pdev);
-	QDF_STATUS (*ipa_disable_autonomy)(struct cdp_pdev *pdev);
+	QDF_STATUS (*ipa_enable_autonomy)(struct cdp_soc_t *soc_hdl,
+					  uint8_t pdev_id);
+	QDF_STATUS (*ipa_disable_autonomy)(struct cdp_soc_t *soc_hdl,
+					   uint8_t pdev_id);
 #ifdef CONFIG_IPA_WDI_UNIFIED_API
-	QDF_STATUS (*ipa_setup)(struct cdp_pdev *pdev, void *ipa_i2w_cb,
-		void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_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);
+	QDF_STATUS (*ipa_setup)(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				void *ipa_i2w_cb, void *ipa_w2i_cb,
+				void *ipa_wdi_meter_notifier_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);
 #else /* CONFIG_IPA_WDI_UNIFIED_API */
-	QDF_STATUS (*ipa_setup)(struct cdp_pdev *pdev, void *ipa_i2w_cb,
-		void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
-		uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
-		uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle);
+	QDF_STATUS (*ipa_setup)(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				void *ipa_i2w_cb, void *ipa_w2i_cb,
+				void *ipa_wdi_meter_notifier_cb,
+				uint32_t ipa_desc_size, void *ipa_priv,
+				bool is_rm_enabled, uint32_t *tx_pipe_handle,
+				uint32_t *rx_pipe_handle);
 #endif /* CONFIG_IPA_WDI_UNIFIED_API */
 	QDF_STATUS (*ipa_cleanup)(uint32_t tx_pipe_handle,
 		uint32_t rx_pipe_handle);
@@ -1418,12 +1431,14 @@ struct cdp_ipa_ops {
 		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_STATUS (*ipa_enable_pipes)(struct cdp_pdev *pdev);
-	QDF_STATUS (*ipa_disable_pipes)(struct cdp_pdev *pdev);
+	QDF_STATUS (*ipa_enable_pipes)(struct cdp_soc_t *soc_hdl,
+				       uint8_t pdev_id);
+	QDF_STATUS (*ipa_disable_pipes)(struct cdp_soc_t *soc_hdl,
+					uint8_t pdev_id);
 	QDF_STATUS (*ipa_set_perf_level)(int client,
 		uint32_t max_supported_bw_mbps);
-	bool (*ipa_rx_intrabss_fwd)(struct cdp_vdev *vdev, qdf_nbuf_t nbuf,
-				    bool *fwd_success);
+	bool (*ipa_rx_intrabss_fwd)(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+				    qdf_nbuf_t nbuf, bool *fwd_success);
 };
 #endif
 

+ 120 - 145
dp/wifi3.0/dp_ipa.c

@@ -565,22 +565,19 @@ static QDF_STATUS dp_ipa_get_shared_mem_info(qdf_device_t osdev,
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_uc_get_resource() - Client request resource information
- * @ppdev - handle to the device instance
- *
- *  IPA client will request IPA UC related resource information
- *  Resource information will be distributed to IPA module
- *  All of the required resources should be pre-allocated
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS dp_ipa_get_resource(struct cdp_pdev *ppdev)
+QDF_STATUS dp_ipa_get_resource(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
-	struct dp_ipa_resources *ipa_res = &pdev->ipa_resource;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+	struct dp_ipa_resources *ipa_res;
+
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
 
+	ipa_res = &pdev->ipa_resource;
 	if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
@@ -616,20 +613,12 @@ QDF_STATUS dp_ipa_get_resource(struct cdp_pdev *ppdev)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_set_doorbell_paddr () - Set doorbell register physical address to SRNG
- * @ppdev - handle to the device instance
- *
- * Set TX_COMP_DOORBELL register physical address to WBM Head_Ptr_MemAddr_LSB
- * Set RX_READ_DOORBELL register physical address to REO Head_Ptr_MemAddr_LSB
- *
- * Return: none
- */
-QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_pdev *ppdev)
+QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
-	struct dp_ipa_resources *ipa_res = &pdev->ipa_resource;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+	struct dp_ipa_resources *ipa_res;
 	struct hal_srng *wbm_srng = (struct hal_srng *)
 			soc->tx_comp_ring[IPA_TX_COMP_RING_IDX].hal_srng;
 	struct hal_srng *reo_srng = (struct hal_srng *)
@@ -637,6 +626,12 @@ QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_pdev *ppdev)
 	uint32_t tx_comp_doorbell_dmaaddr;
 	uint32_t rx_ready_doorbell_dmaaddr;
 
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	ipa_res = &pdev->ipa_resource;
 	if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
@@ -672,16 +667,17 @@ QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_pdev *ppdev)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_op_response() - Handle OP command response from firmware
- * @ppdev - handle to the device instance
- * @op_msg: op response message from firmware
- *
- * Return: none
- */
-QDF_STATUS dp_ipa_op_response(struct cdp_pdev *ppdev, uint8_t *op_msg)
+QDF_STATUS dp_ipa_op_response(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			      uint8_t *op_msg)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	if (!wlan_cfg_is_ipa_enabled(pdev->soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
@@ -698,18 +694,18 @@ QDF_STATUS dp_ipa_op_response(struct cdp_pdev *ppdev, uint8_t *op_msg)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_register_op_cb() - Register OP handler function
- * @ppdev - handle to the device instance
- * @op_cb: handler function pointer
- *
- * Return: none
- */
-QDF_STATUS dp_ipa_register_op_cb(struct cdp_pdev *ppdev,
+QDF_STATUS dp_ipa_register_op_cb(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 				 ipa_uc_op_cb_type op_cb,
 				 void *usr_ctxt)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	if (!wlan_cfg_is_ipa_enabled(pdev->soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
@@ -720,32 +716,28 @@ QDF_STATUS dp_ipa_register_op_cb(struct cdp_pdev *ppdev,
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_get_stat() - Get firmware wdi status
- * @ppdev - handle to the device instance
- *
- * Return: none
- */
-QDF_STATUS dp_ipa_get_stat(struct cdp_pdev *ppdev)
+QDF_STATUS dp_ipa_get_stat(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
 	/* TBD */
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_tx_send_ipa_data_frame() - send IPA data frame
- * @vdev: vdev
- * @skb: skb
- *
- * Return: skb/ NULL is for success
- */
-qdf_nbuf_t dp_tx_send_ipa_data_frame(struct cdp_vdev *vdev, qdf_nbuf_t skb)
+qdf_nbuf_t dp_tx_send_ipa_data_frame(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+				     qdf_nbuf_t skb)
 {
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_vdev *vdev =
+		dp_get_vdev_from_soc_vdev_id_wifi3(soc, vdev_id);
 	qdf_nbuf_t ret;
 
+	if (!vdev) {
+		dp_err("%s invalid instance", __func__);
+		return skb;
+	}
+
 	/* Terminate the (single-element) list of tx frames */
 	qdf_nbuf_set_next(skb, NULL);
-	ret = dp_tx_send(vdev, skb);
+	ret = dp_tx_send(dp_vdev_to_cdp_vdev(vdev), skb);
 	if (ret) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			  "%s: Failed to tx", __func__);
@@ -755,21 +747,19 @@ qdf_nbuf_t dp_tx_send_ipa_data_frame(struct cdp_vdev *vdev, qdf_nbuf_t skb)
 	return NULL;
 }
 
-/**
- * dp_ipa_enable_autonomy() – Enable autonomy RX path
- * @pdev - handle to the device instance
- *
- * Set all RX packet route to IPA REO ring
- * Program Destination_Ring_Ctrl_IX_0 REO register to point IPA REO ring
- * Return: none
- */
-QDF_STATUS dp_ipa_enable_autonomy(struct cdp_pdev *ppdev)
+QDF_STATUS dp_ipa_enable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
 	uint32_t ix0;
 	uint32_t ix2;
 
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
@@ -803,22 +793,20 @@ QDF_STATUS dp_ipa_enable_autonomy(struct cdp_pdev *ppdev)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_disable_autonomy() – Disable autonomy RX path
- * @ppdev - handle to the device instance
- *
- * Disable RX packet routing to IPA REO
- * Program Destination_Ring_Ctrl_IX_0 REO register to disable
- * Return: none
- */
-QDF_STATUS dp_ipa_disable_autonomy(struct cdp_pdev *ppdev)
+QDF_STATUS dp_ipa_disable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
 	uint32_t ix0;
 	uint32_t ix2;
 	uint32_t ix3;
 
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
@@ -1065,32 +1053,18 @@ dp_ipa_wdi_rx_smmu_params(struct dp_soc *soc,
 		RX_PKT_TLVS_LEN + L3_HEADER_PADDING;
 }
 
-/**
- * dp_ipa_setup() - Setup and connect IPA pipes
- * @ppdev - handle to the device instance
- * @ipa_i2w_cb: IPA to WLAN callback
- * @ipa_w2i_cb: WLAN to IPA callback
- * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
- * @ipa_desc_size: IPA descriptor size
- * @ipa_priv: handle to the HTT instance
- * @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
- * @is_smmu_enabled: Is SMMU enabled or not
- * @sys_in: parameters to setup sys pipe in mcc mode
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb,
-			void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
+QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			void *ipa_i2w_cb, void *ipa_w2i_cb,
+			void *ipa_wdi_meter_notifier_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)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
-	struct dp_ipa_resources *ipa_res = &pdev->ipa_resource;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+	struct dp_ipa_resources *ipa_res;
 	qdf_ipa_ep_cfg_t *tx_cfg;
 	qdf_ipa_ep_cfg_t *rx_cfg;
 	qdf_ipa_wdi_pipe_setup_info_t *tx = NULL;
@@ -1101,6 +1075,12 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb,
 	qdf_ipa_wdi_conn_out_params_t pipe_out;
 	int ret;
 
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	ipa_res = &pdev->ipa_resource;
 	if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
@@ -1267,30 +1247,17 @@ QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
 }
 
 #else /* CONFIG_IPA_WDI_UNIFIED_API */
-
-/**
- * dp_ipa_setup() - Setup and connect IPA pipes
- * @ppdev - handle to the device instance
- * @ipa_i2w_cb: IPA to WLAN callback
- * @ipa_w2i_cb: WLAN to IPA callback
- * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
- * @ipa_desc_size: IPA descriptor size
- * @ipa_priv: handle to the HTT instance
- * @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
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb,
-			void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
+QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			void *ipa_i2w_cb, void *ipa_w2i_cb,
+			void *ipa_wdi_meter_notifier_cb,
 			uint32_t ipa_desc_size, void *ipa_priv,
 			bool is_rm_enabled, uint32_t *tx_pipe_handle,
 			uint32_t *rx_pipe_handle)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
-	struct dp_ipa_resources *ipa_res = &pdev->ipa_resource;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+	struct dp_ipa_resources *ipa_res;
 	qdf_ipa_wdi_pipe_setup_info_t *tx;
 	qdf_ipa_wdi_pipe_setup_info_t *rx;
 	qdf_ipa_wdi_conn_in_params_t pipe_in;
@@ -1300,6 +1267,12 @@ QDF_STATUS dp_ipa_setup(struct cdp_pdev *ppdev, void *ipa_i2w_cb,
 	uint32_t desc_size;
 	int ret;
 
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	ipa_res = &pdev->ipa_resource;
 	if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
@@ -1568,18 +1541,18 @@ QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
- * @ppdev - handle to the device instance
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS dp_ipa_enable_pipes(struct cdp_pdev *ppdev)
+QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
 	QDF_STATUS result;
 
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	qdf_atomic_set(&soc->ipa_pipes_enabled, 1);
 	dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, true);
 
@@ -1596,18 +1569,18 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_pdev *ppdev)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * dp_ipa_uc_disable_pipes() – Suspend traffic and disable Tx/Rx pipes
- * @ppdev - handle to the device instance
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS dp_ipa_disable_pipes(struct cdp_pdev *ppdev)
+QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)ppdev;
-	struct dp_soc *soc = pdev->soc;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
 	QDF_STATUS result;
 
+	if (!pdev) {
+		dp_err("%s invalid instance", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	result = qdf_ipa_wdi_disable_pipes();
 	if (result)
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
@@ -1677,10 +1650,12 @@ static qdf_nbuf_t dp_ipa_intrabss_send(struct dp_pdev *pdev,
 	return NULL;
 }
 
-bool dp_ipa_rx_intrabss_fwd(struct cdp_vdev *pvdev, qdf_nbuf_t nbuf,
-			    bool *fwd_success)
+bool dp_ipa_rx_intrabss_fwd(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+			    qdf_nbuf_t nbuf, bool *fwd_success)
 {
-	struct dp_vdev *vdev = (struct dp_vdev *)pvdev;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_vdev *vdev =
+		dp_get_vdev_from_soc_vdev_id_wifi3(soc, vdev_id);
 	struct dp_pdev *pdev;
 	struct dp_peer *da_peer;
 	struct dp_peer *sa_peer;

+ 152 - 20
dp/wifi3.0/dp_ipa.h

@@ -45,28 +45,143 @@ 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
 
-QDF_STATUS dp_ipa_get_resource(struct cdp_pdev *pdev);
-QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_pdev *pdev);
-QDF_STATUS dp_ipa_uc_set_active(struct cdp_pdev *pdev, bool uc_active,
-		bool is_tx);
-QDF_STATUS dp_ipa_op_response(struct cdp_pdev *pdev, uint8_t *op_msg);
-QDF_STATUS dp_ipa_register_op_cb(struct cdp_pdev *pdev, ipa_uc_op_cb_type op_cb,
-		void *usr_ctxt);
-QDF_STATUS dp_ipa_get_stat(struct cdp_pdev *pdev);
-qdf_nbuf_t dp_tx_send_ipa_data_frame(struct cdp_vdev *vdev, qdf_nbuf_t skb);
-QDF_STATUS dp_ipa_enable_autonomy(struct cdp_pdev *pdev);
-QDF_STATUS dp_ipa_disable_autonomy(struct cdp_pdev *pdev);
+/**
+ * dp_ipa_get_resource() - Client request resource information
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ *
+ *  IPA client will request IPA UC related resource information
+ *  Resource information will be distributed to IPA module
+ *  All of the required resources should be pre-allocated
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dp_ipa_get_resource(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+
+/**
+ * dp_ipa_set_doorbell_paddr () - Set doorbell register physical address to SRNG
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ *
+ * Set TX_COMP_DOORBELL register physical address to WBM Head_Ptr_MemAddr_LSB
+ * Set RX_READ_DOORBELL register physical address to REO Head_Ptr_MemAddr_LSB
+ *
+ * Return: none
+ */
+QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_soc_t *soc_hdl,
+				     uint8_t pdev_id);
+QDF_STATUS dp_ipa_uc_set_active(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				bool uc_active, bool is_tx);
+
+/**
+ * dp_ipa_op_response() - Handle OP command response from firmware
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ * @op_msg: op response message from firmware
+ *
+ * Return: none
+ */
+QDF_STATUS dp_ipa_op_response(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			      uint8_t *op_msg);
+
+/**
+ * dp_ipa_register_op_cb() - Register OP handler function
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ * @op_cb: handler function pointer
+ *
+ * Return: none
+ */
+QDF_STATUS dp_ipa_register_op_cb(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				 ipa_uc_op_cb_type op_cb, void *usr_ctxt);
+
+/**
+ * dp_ipa_get_stat() - Get firmware wdi status
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ *
+ * Return: none
+ */
+QDF_STATUS dp_ipa_get_stat(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+
+/**
+ * dp_tx_send_ipa_data_frame() - send IPA data frame
+ * @soc_hdl: datapath soc handle
+ * @vdev_id: virtual device/interface id
+ * @skb: skb
+ *
+ * Return: skb/ NULL is for success
+ */
+qdf_nbuf_t dp_tx_send_ipa_data_frame(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+				     qdf_nbuf_t skb);
+
+/**
+ * dp_ipa_enable_autonomy() – Enable autonomy RX path
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ *
+ * Set all RX packet route to IPA REO ring
+ * Program Destination_Ring_Ctrl_IX_0 REO register to point IPA REO ring
+ * Return: none
+ */
+QDF_STATUS dp_ipa_enable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+
+/**
+ * dp_ipa_disable_autonomy() – Disable autonomy RX path
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ *
+ * Disable RX packet routing to IPA REO
+ * Program Destination_Ring_Ctrl_IX_0 REO register to disable
+ * Return: none
+ */
+QDF_STATUS dp_ipa_disable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+
 #ifdef CONFIG_IPA_WDI_UNIFIED_API
-QDF_STATUS dp_ipa_setup(struct cdp_pdev *pdev, void *ipa_i2w_cb,
-			void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
+/**
+ * dp_ipa_setup() - Setup and connect IPA pipes
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ * @ipa_i2w_cb: IPA to WLAN callback
+ * @ipa_w2i_cb: WLAN to IPA callback
+ * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
+ * @ipa_desc_size: IPA descriptor size
+ * @ipa_priv: handle to the HTT instance
+ * @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
+ * @is_smmu_enabled: Is SMMU enabled or not
+ * @sys_in: parameters to setup sys pipe in mcc mode
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			void *ipa_i2w_cb, void *ipa_w2i_cb,
+			void *ipa_wdi_meter_notifier_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);
 #else /* CONFIG_IPA_WDI_UNIFIED_API */
-QDF_STATUS dp_ipa_setup(struct cdp_pdev *pdev, void *ipa_i2w_cb,
-			void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
+/**
+ * dp_ipa_setup() - Setup and connect IPA pipes
+ * @soc_hdl - data path soc handle
+ * @pdev_id - device instance id
+ * @ipa_i2w_cb: IPA to WLAN callback
+ * @ipa_w2i_cb: WLAN to IPA callback
+ * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
+ * @ipa_desc_size: IPA descriptor size
+ * @ipa_priv: handle to the HTT instance
+ * @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
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			void *ipa_i2w_cb, void *ipa_w2i_cb,
+			void *ipa_wdi_meter_notifier_cb,
 			uint32_t ipa_desc_size, void *ipa_priv,
 			bool is_rm_enabled, uint32_t *tx_pipe_handle,
 			uint32_t *rx_pipe_handle);
@@ -82,15 +197,32 @@ QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
 		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);
-QDF_STATUS dp_ipa_enable_pipes(struct cdp_pdev *pdev);
-QDF_STATUS dp_ipa_disable_pipes(struct cdp_pdev *pdev);
+
+/**
+ * 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
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+
+/**
+ * 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
+ *
+ * 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);
 
 /**
  * dp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path
  *
- * @pvdev: pointer to dp_vdev structure
+ * @soc_hdl: data path soc handle
+ * @vdev_id: virtual device/interface id
  * @nbuf: pointer to skb of ethernet packet received from IPA RX path
  * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX
  *
@@ -99,8 +231,8 @@ QDF_STATUS dp_ipa_set_perf_level(int client,
  * Return: true if packet is intra-bss fwd-ed and no need to pass to
  *	   network stack. false if packet needs to be passed to network stack.
  */
-bool dp_ipa_rx_intrabss_fwd(struct cdp_vdev *pvdev, qdf_nbuf_t nbuf,
-			    bool *fwd_success);
+bool dp_ipa_rx_intrabss_fwd(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+			    qdf_nbuf_t nbuf, bool *fwd_success);
 int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev);
 int dp_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev);
 int dp_ipa_ring_resource_setup(struct dp_soc *soc,