Kaynağa Gözat

qcacld-3.0: cdp: Convergence of cdp misc ops

Currently the cdp apis 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/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.

Converged misc_ops
- tx_non_std
- get_opmode
- get_tx_ack_stats
- set_ibss_vdev_heart_beat_timer
- hl_tdls_flag_reset
- set_wisa_mode
- txrx_post_data_stall_event
- update_mac_id
- pkt_log_init
- pkt_log_con_service
- get_num_rx_contexts
- set_wmm_param
- flush_rx_frames
- bad_peer_txctl_set_setting
- bad_peer_txctl_update_threshold
- txrx_data_stall_cb_register
- txrx_data_stall_cb_deregister
- vdev_set_driver_del_ack_enable
- get_intra_bss_fwd_pkts_count
- mark_first_wakeup_packet
- register_pktdump_cb
- unregister_pktdump_cb
- pdev_reset_driver_del_ack
- runtime_suspend
- runtime_resume

CRs-Fixed: 2539735
Change-Id: I2baad09fde29d439ae2099e01e4e68ed6b94196d
Rakesh Pillai 5 yıl önce
ebeveyn
işleme
6a36b0a26a

+ 6 - 6
components/pmo/core/inc/wlan_pmo_main.h

@@ -315,22 +315,22 @@ void pmo_core_psoc_set_hif_handle(struct wlan_objmgr_psoc *psoc,
 void *pmo_core_psoc_get_hif_handle(struct wlan_objmgr_psoc *psoc);
 
 /**
- * pmo_core_psoc_set_txrx_handle() - update psoc pdev txrx layer handle
+ * pmo_core_psoc_set_txrx_pdev_id() - update psoc pdev txrx layer handle
  * @psoc: objmgr psoc handle
- * @txrx_hdl: pdev txrx context handle
+ * @txrx_pdev_id: txrx pdev identifier
  *
  * Return: None
  */
-void pmo_core_psoc_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
-				   void *txrx_hdl);
+void pmo_core_psoc_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
+				    uint8_t txrx_pdev_id);
 
 /**
  * pmo_core_psoc_get_txrx_handle() - Get psoc pdev txrx handle
  * @psoc: objmgr psoc handle
  *
- * Return: pdev txrx handle
+ * Return: txrx pdev identifier
  */
-void *pmo_core_psoc_get_txrx_handle(struct wlan_objmgr_psoc *psoc);
+uint8_t pmo_core_psoc_get_txrx_handle(struct wlan_objmgr_psoc *psoc);
 
 /**
  * pmo_intersect_arp_ns_offload() - intersect config and firmware capability for

+ 2 - 2
components/pmo/core/inc/wlan_pmo_priv.h

@@ -43,7 +43,7 @@
  * @dp_hdl: psoc data path handle
  * @htc_hdl: htc layer handle
  * @hif_hdl: hif layer handle
- * @txrx_hdl: txrx pdev handle
+ * @txrx_pdev_id: txrx pdev identifier
  * @pause_bitmap_notifier: registered callback to update pause bitmap value
  * @pmo_get_pause_bitmap: registered callback to get pause bitmap value
  * @get_dtim_period: register callback to get dtim period from mlme
@@ -58,7 +58,7 @@ struct pmo_psoc_priv_obj {
 	void *dp_hdl;
 	void *htc_hdl;
 	void *hif_hdl;
-	void *txrx_hdl;
+	uint8_t txrx_pdev_id;
 	pmo_notify_pause_bitmap pause_bitmap_notifier;
 	pmo_get_pause_bitmap get_pause_bitmap;
 	pmo_get_vdev_dp_handle get_vdev_dp_handle;

+ 7 - 7
components/pmo/core/src/wlan_pmo_main.c

@@ -385,24 +385,24 @@ void *pmo_core_psoc_get_hif_handle(struct wlan_objmgr_psoc *psoc)
 	return hif_hdl;
 }
 
-void pmo_core_psoc_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
-				   void *txrx_hdl)
+void pmo_core_psoc_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
+				    uint8_t txrx_pdev_id)
 {
 	struct pmo_psoc_priv_obj *psoc_ctx;
 
 	pmo_psoc_with_ctx(psoc, psoc_ctx) {
-		psoc_ctx->txrx_hdl = txrx_hdl;
+		psoc_ctx->txrx_pdev_id = txrx_pdev_id;
 	}
 }
 
-void *pmo_core_psoc_get_txrx_handle(struct wlan_objmgr_psoc *psoc)
+uint8_t pmo_core_psoc_get_txrx_handle(struct wlan_objmgr_psoc *psoc)
 {
-	void *txrx_hdl = NULL;
+	uint8_t txrx_pdev_id = OL_TXRX_INVALID_PDEV_ID;
 	struct pmo_psoc_priv_obj *psoc_ctx;
 
 	pmo_psoc_with_ctx(psoc, psoc_ctx) {
-		txrx_hdl = psoc_ctx->txrx_hdl;
+		txrx_pdev_id = psoc_ctx->txrx_pdev_id;
 	}
 
-	return txrx_hdl;
+	return txrx_pdev_id;
 }

+ 15 - 13
components/pmo/core/src/wlan_pmo_suspend_resume.c

@@ -950,7 +950,7 @@ QDF_STATUS pmo_core_psoc_bus_runtime_suspend(struct wlan_objmgr_psoc *psoc,
 {
 	void *hif_ctx;
 	void *dp_soc;
-	void *txrx_pdev;
+	uint8_t pdev_id;
 	void *htc_ctx;
 	QDF_STATUS status;
 	int ret;
@@ -973,11 +973,12 @@ QDF_STATUS pmo_core_psoc_bus_runtime_suspend(struct wlan_objmgr_psoc *psoc,
 
 	hif_ctx = pmo_core_psoc_get_hif_handle(psoc);
 	dp_soc = pmo_core_psoc_get_dp_handle(psoc);
-	txrx_pdev = pmo_core_psoc_get_txrx_handle(psoc);
+	pdev_id = pmo_core_psoc_get_txrx_handle(psoc);
 	htc_ctx = pmo_core_psoc_get_htc_handle(psoc);
-	if (!hif_ctx || !dp_soc || !txrx_pdev || !htc_ctx) {
-		pmo_err("Invalid hif: %pK, dp: %pK, txrx: %pK, htc: %pK",
-			hif_ctx, dp_soc, txrx_pdev, htc_ctx);
+	if (!hif_ctx || !dp_soc || !htc_ctx ||
+	    pdev_id == OL_TXRX_INVALID_PDEV_ID) {
+		pmo_err("Invalid hif: %pK, dp: %pK, pdev_id: %d, htc: %pK",
+			hif_ctx, dp_soc, pdev_id, htc_ctx);
 		status = QDF_STATUS_E_INVAL;
 		goto dec_psoc_ref;
 	}
@@ -991,7 +992,7 @@ QDF_STATUS pmo_core_psoc_bus_runtime_suspend(struct wlan_objmgr_psoc *psoc,
 		goto runtime_failure;
 	}
 
-	status = cdp_runtime_suspend(dp_soc, txrx_pdev);
+	status = cdp_runtime_suspend(dp_soc, pdev_id);
 	if (status != QDF_STATUS_SUCCESS)
 		goto runtime_failure;
 
@@ -1056,7 +1057,7 @@ resume_htc:
 
 cdp_runtime_resume:
 	QDF_BUG(QDF_STATUS_SUCCESS ==
-		cdp_runtime_resume(dp_soc, txrx_pdev));
+		cdp_runtime_resume(dp_soc, pdev_id));
 
 runtime_failure:
 	hif_process_runtime_suspend_failure(hif_ctx);
@@ -1076,7 +1077,7 @@ QDF_STATUS pmo_core_psoc_bus_runtime_resume(struct wlan_objmgr_psoc *psoc,
 	int ret;
 	void *hif_ctx;
 	void *dp_soc;
-	void *txrx_pdev;
+	uint8_t pdev_id;
 	void *htc_ctx;
 	QDF_STATUS status;
 	qdf_time_t begin, end;
@@ -1097,11 +1098,12 @@ QDF_STATUS pmo_core_psoc_bus_runtime_resume(struct wlan_objmgr_psoc *psoc,
 
 	hif_ctx = pmo_core_psoc_get_hif_handle(psoc);
 	dp_soc = pmo_core_psoc_get_dp_handle(psoc);
-	txrx_pdev = pmo_core_psoc_get_txrx_handle(psoc);
+	pdev_id = pmo_core_psoc_get_txrx_handle(psoc);
 	htc_ctx = pmo_core_psoc_get_htc_handle(psoc);
-	if (!hif_ctx || !dp_soc || !txrx_pdev || !htc_ctx) {
-		pmo_err("Invalid hif: %pK, dp: %pK, txrx: %pK, htc: %pK",
-			hif_ctx, dp_soc, txrx_pdev, htc_ctx);
+	if (!hif_ctx || !dp_soc || !htc_ctx ||
+	    pdev_id == OL_TXRX_INVALID_PDEV_ID) {
+		pmo_err("Invalid hif: %pK, dp: %pK, pdev_id: %d, htc: %pK",
+			hif_ctx, dp_soc, pdev_id, htc_ctx);
 		status = QDF_STATUS_E_INVAL;
 		goto dec_psoc_ref;
 	}
@@ -1141,7 +1143,7 @@ QDF_STATUS pmo_core_psoc_bus_runtime_resume(struct wlan_objmgr_psoc *psoc,
 		goto fail;
 	}
 
-	status = cdp_runtime_resume(dp_soc, txrx_pdev);
+	status = cdp_runtime_resume(dp_soc, pdev_id);
 	if (status != QDF_STATUS_SUCCESS)
 		goto fail;
 

+ 6 - 6
components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h

@@ -767,14 +767,14 @@ void ucfg_pmo_psoc_set_hif_handle(struct wlan_objmgr_psoc *psoc,
 				  void *hif_handle);
 
 /**
- * ucfg_pmo_psoc_set_txrx_handle() - Set psoc pdev txrx layer handle
+ * ucfg_pmo_psoc_set_txrx_pdev_id() - Set psoc pdev txrx layer handle
  * @psoc: objmgr psoc handle
- * @txrx_handle: pdev txrx context handle
+ * @txrx_pdev_id: txrx pdev identifier
  *
  * Return: None
  */
-void ucfg_pmo_psoc_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
-				   void *txrx_handle);
+void ucfg_pmo_psoc_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
+				    uint8_t txrx_pdev_id);
 
 /**
  * ucfg_pmo_psoc_user_space_suspend_req() -  Handles user space suspend req
@@ -1392,9 +1392,9 @@ ucfg_pmo_psoc_set_hif_handle(
 }
 
 static inline void
-ucfg_pmo_psoc_set_txrx_handle(
+ucfg_pmo_psoc_set_txrx_pdev_id(
 		struct wlan_objmgr_psoc *psoc,
-		void *txrx_handle)
+		uint8_t txrx_pdev_id)
 {
 }
 

+ 3 - 3
components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c

@@ -356,10 +356,10 @@ void ucfg_pmo_psoc_set_hif_handle(struct wlan_objmgr_psoc *psoc,
 	pmo_core_psoc_set_hif_handle(psoc, hif_handle);
 }
 
-void ucfg_pmo_psoc_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
-				   void *txrx_handle)
+void ucfg_pmo_psoc_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
+				    uint8_t txrx_pdev_id)
 {
-	pmo_core_psoc_set_txrx_handle(psoc, txrx_handle);
+	pmo_core_psoc_set_txrx_pdev_id(psoc, txrx_pdev_id);
 }
 
 void ucfg_pmo_psoc_handle_initial_wake_up(void *cb_ctx)

+ 6 - 5
core/cds/src/cds_api.c

@@ -54,6 +54,7 @@
 #include <cdp_txrx_cmn_reg.h>
 #include <cdp_txrx_cfg.h>
 #include <cdp_txrx_misc.h>
+#include <ol_defines.h>
 #include <dispatcher_init_deinit.h>
 #include <cdp_txrx_handle.h>
 #include "target_type.h"
@@ -810,14 +811,14 @@ QDF_STATUS cds_dp_open(struct wlan_objmgr_psoc *psoc)
 		false : gp_cds_context->cds_cfg->enable_dp_rx_threads;
 
 	qdf_status = dp_txrx_init(cds_get_context(QDF_MODULE_ID_SOC),
-				  WMI_PDEV_ID_SOC,
+				  OL_TXRX_PDEV_ID,
 				  &dp_config);
 
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status))
 		goto intr_close;
 
-	ucfg_pmo_psoc_set_txrx_handle(psoc, gp_cds_context->pdev_txrx_ctx);
-	ucfg_ocb_set_txrx_pdev_id(psoc, WMI_PDEV_ID_SOC);
+	ucfg_pmo_psoc_set_txrx_pdev_id(psoc, OL_TXRX_PDEV_ID);
+	ucfg_ocb_set_txrx_pdev_id(psoc, OL_TXRX_PDEV_ID);
 
 	cds_debug("CDS successfully Opened");
 
@@ -874,7 +875,7 @@ QDF_STATUS cds_pre_enable(void)
 	/* call Packetlog connect service */
 	if (QDF_GLOBAL_FTM_MODE != cds_get_conparam() &&
 	    QDF_GLOBAL_EPPING_MODE != cds_get_conparam())
-		cdp_pkt_log_con_service(soc, gp_cds_context->pdev_txrx_ctx,
+		cdp_pkt_log_con_service(soc, OL_TXRX_PDEV_ID,
 					scn);
 
 	/*call WMA pre start */
@@ -1266,7 +1267,7 @@ QDF_STATUS cds_dp_close(struct wlan_objmgr_psoc *psoc)
 		       (struct cdp_pdev *)ctx, 1);
 
 	cds_set_context(QDF_MODULE_ID_TXRX, NULL);
-	ucfg_pmo_psoc_set_txrx_handle(psoc, NULL);
+	ucfg_pmo_psoc_set_txrx_pdev_id(psoc, OL_TXRX_INVALID_PDEV_ID);
 
 	return QDF_STATUS_SUCCESS;
 }

+ 18 - 8
core/dp/ol/inc/ol_txrx_ctrl_api.h

@@ -432,27 +432,37 @@ int16_t ol_txrx_peer_rssi(ol_txrx_peer_handle peer);
 #if defined(CONFIG_HL_SUPPORT) && defined(QCA_BAD_PEER_TX_FLOW_CL)
 
 /**
- * @brief Configure the bad peer tx limit setting.
- * @details
+ * ol_txrx_bad_peer_txctl_set_setting() - Configure the bad peer tx
+ *					  limit setting.
+ * @soc_hdl: soc handle
+ * @pdev_id: datapath pdev identifier
+ * @enable: enable/disable setting
+ * @period: balance period in ms
+ * @txq_limit: balance txq limit
  *
  * @param pdev - the physics device
  */
 void
 ol_txrx_bad_peer_txctl_set_setting(
-	struct cdp_pdev *pdev,
+	struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 	int enable,
 	int period,
 	int txq_limit);
 
 /**
- * @brief Configure the bad peer tx threshold limit
- * @details
+ * ol_txrx_bad_peer_txctl_update_threshold() - Configure the bad peer tx
+ *					       threshold limit
+ * @soc_hdl: soc handle
+ * @pdev_id: datapath pdev identifier
+ * @level: txctl level
+ * @tput_thresh throughput threshold
+ * @tx_limit: balance tx limit
  *
  * @param pdev - the physics device
  */
 void
 ol_txrx_bad_peer_txctl_update_threshold(
-	struct cdp_pdev *pdev,
+	struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 	int level,
 	int tput_thresh,
 	int tx_limit);
@@ -461,7 +471,7 @@ ol_txrx_bad_peer_txctl_update_threshold(
 
 static inline void
 ol_txrx_bad_peer_txctl_set_setting(
-	struct cdp_pdev *pdev,
+	struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 	int enable,
 	int period,
 	int txq_limit)
@@ -470,7 +480,7 @@ ol_txrx_bad_peer_txctl_set_setting(
 
 static inline void
 ol_txrx_bad_peer_txctl_update_threshold(
-	struct cdp_pdev *pdev,
+	struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 	int level,
 	int tput_thresh,
 	int tx_limit)

+ 1 - 2
core/dp/txrx/ol_rx.c

@@ -1706,8 +1706,7 @@ void ol_rx_pkt_dump_call(
 	packetdump_cb = pdev->ol_rx_packetdump_cb;
 	if (packetdump_cb &&
 	    wlan_op_mode_sta == peer->vdev->opmode)
-		packetdump_cb(soc_hdl,
-			      (struct cdp_vdev *)peer->vdev,
+		packetdump_cb(soc_hdl, OL_TXRX_PDEV_ID, peer->vdev->vdev_id,
 			      msdu, status, RX_DATA_PKT);
 }
 #endif

+ 5 - 2
core/dp/txrx/ol_rx_fwd.c

@@ -254,14 +254,17 @@ ol_rx_fwd_check(struct ol_txrx_vdev_t *vdev,
 /*
  * ol_get_intra_bss_fwd_pkts_count() - to get the total tx and rx packets
  *   that has been forwarded from txrx layer without going to upper layers.
+ * @soc_hdl: Datapath soc handle
  * @vdev_id: vdev id
  * @fwd_tx_packets: pointer to forwarded tx packets count parameter
  * @fwd_rx_packets: pointer to forwarded rx packets count parameter
  *
  * Return: status -> A_OK - success, A_ERROR - failure
  */
-A_STATUS ol_get_intra_bss_fwd_pkts_count(uint8_t vdev_id,
-		uint64_t *fwd_tx_packets, uint64_t *fwd_rx_packets)
+A_STATUS ol_get_intra_bss_fwd_pkts_count(struct cdp_soc_t *soc_hdl,
+					 uint8_t vdev_id,
+					 uint64_t *fwd_tx_packets,
+					 uint64_t *fwd_rx_packets)
 {
 	struct ol_txrx_vdev_t *vdev = NULL;
 

+ 5 - 5
core/dp/txrx/ol_rx_fwd.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011, 2014-2017, 2019 The Linux Foundation. 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
@@ -64,9 +64,9 @@ ol_rx_fwd_check(struct ol_txrx_vdev_t *vdev,
 		unsigned int tid, qdf_nbuf_t msdu_list);
 
 A_STATUS
-ol_get_intra_bss_fwd_pkts_count(
-	uint8_t vdev_id,
-	uint64_t *fwd_tx_packets,
-	uint64_t *fwd_rx_packets);
+ol_get_intra_bss_fwd_pkts_count(struct cdp_soc_t *soc_hdl,
+				uint8_t vdev_id,
+				uint64_t *fwd_tx_packets,
+				uint64_t *fwd_rx_packets);
 
 #endif /* _OL_RX_FWD_H_ */

+ 12 - 6
core/dp/txrx/ol_tx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2019 The Linux Foundation. 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
@@ -29,6 +29,7 @@
 #include <cdp_txrx_misc.h>      /* ol_tx_spec */
 #include <cdp_txrx_handle.h>
 #include <ol_txrx_types.h>      /* ol_tx_desc_t, ol_txrx_msdu_info_t */
+#include <ol_txrx.h>
 #include <hif.h>
 
 #ifdef IPA_OFFLOAD
@@ -124,7 +125,8 @@ ol_tx_hl(ol_txrx_vdev_handle vdev, qdf_nbuf_t msdu_list);
 
 /**
  * ol_tx_non_std() - Allow the control-path SW to send data frames
- * @data_vdev: which vdev should transmit the tx data frames
+ * @soc_hdl: Datapath soc handle
+ * @vdev_id: id of vdev
  * @tx_spec: what non-standard handling to apply to the tx data frames
  * @msdu_list: NULL-terminated list of tx MSDUs
  *
@@ -149,10 +151,12 @@ qdf_nbuf_t ol_tx_non_std_hl(struct ol_txrx_vdev_t *vdev,
 			    qdf_nbuf_t msdu_list);
 
 static inline qdf_nbuf_t
-ol_tx_non_std(struct cdp_vdev *pvdev,
+ol_tx_non_std(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
 	      enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list)
 {
-	struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
+	struct ol_txrx_vdev_t *vdev;
+
+	vdev = (struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
 
 	return ol_tx_non_std_hl(vdev, tx_spec, msdu_list);
 }
@@ -161,10 +165,12 @@ qdf_nbuf_t ol_tx_non_std_ll(struct ol_txrx_vdev_t *vdev,
 			    enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
 
 static inline qdf_nbuf_t
-ol_tx_non_std(struct cdp_vdev *pvdev,
+ol_tx_non_std(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
 	      enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list)
 {
-	struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
+	struct ol_txrx_vdev_t *vdev;
+
+	vdev = (struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
 
 	return ol_tx_non_std_ll(vdev, tx_spec, msdu_list);
 }

+ 22 - 15
core/dp/txrx/ol_tx_hl.c

@@ -693,14 +693,16 @@ MSDU_LOOP_BOTTOM:
 
 /**
  * ol_tx_pdev_reset_driver_del_ack() - reset driver delayed ack enabled flag
- * @ppdev: the data physical device
+ * @soc_hdl: soc handle
+ * @pdev_id: datapath pdev identifier
  *
  * Return: none
  */
 void
-ol_tx_pdev_reset_driver_del_ack(struct cdp_pdev *ppdev)
+ol_tx_pdev_reset_driver_del_ack(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
-	struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 	struct ol_txrx_vdev_t *vdev;
 
 	if (!pdev)
@@ -716,6 +718,7 @@ ol_tx_pdev_reset_driver_del_ack(struct cdp_pdev *ppdev)
 
 /**
  * ol_tx_vdev_set_driver_del_ack_enable() - set driver delayed ack enabled flag
+ * @soc_hdl: datapath soc handle
  * @vdev_id: vdev id
  * @rx_packets: number of rx packets
  * @time_in_ms: time in ms
@@ -725,7 +728,8 @@ ol_tx_pdev_reset_driver_del_ack(struct cdp_pdev *ppdev)
  * Return: none
  */
 void
-ol_tx_vdev_set_driver_del_ack_enable(uint8_t vdev_id,
+ol_tx_vdev_set_driver_del_ack_enable(struct cdp_soc_t *soc_hdl,
+				     uint8_t vdev_id,
 				     unsigned long rx_packets,
 				     uint32_t time_in_ms,
 				     uint32_t high_th,
@@ -1646,15 +1650,18 @@ void ol_txrx_pdev_grp_stat_destroy(struct ol_txrx_pdev_t *pdev)
 
 /**
  * ol_txrx_hl_tdls_flag_reset() - reset tdls flag for vdev
- * @vdev: the virtual device object
+ * @soc_hdl: Datapath soc handle
+ * @vdev_id: id of vdev
  * @flag: flag
  *
  * Return: None
  */
 void
-ol_txrx_hl_tdls_flag_reset(struct cdp_vdev *pvdev, bool flag)
+ol_txrx_hl_tdls_flag_reset(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+			   bool flag)
 {
-	struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
+	struct ol_txrx_vdev_t *vdev =
+		(struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
 
 	vdev->hlTdlsFlag = flag;
 }
@@ -1923,13 +1930,19 @@ int ol_txrx_distribute_group_credits(struct ol_txrx_pdev_t *pdev,
 
 #ifdef QCA_HL_NETDEV_FLOW_CONTROL
 int ol_txrx_register_hl_flow_control(struct cdp_soc_t *soc_hdl,
+				     uint8_t pdev_id,
 				     tx_pause_callback flowcontrol)
 {
 	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
-	uint8_t pdev_id = OL_TXRX_PDEV_ID;
 	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
-	u32 desc_pool_size = ol_tx_desc_pool_size_hl(pdev->ctrl_pdev);
+	u32 desc_pool_size;
+
+	if (!pdev || !flowcontrol) {
+		ol_txrx_err("pdev or pause_cb is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
 
+	desc_pool_size = ol_tx_desc_pool_size_hl(pdev->ctrl_pdev);
 	/*
 	 * Assert if the tx descriptor pool size meets the requirements
 	 * Maximum 2 sessions are allowed on a band.
@@ -1938,12 +1951,6 @@ int ol_txrx_register_hl_flow_control(struct cdp_soc_t *soc_hdl,
 		    ol_txrx_tx_desc_alloc_table[TXRX_FC_2GH_40M_2x2])
 		    <= desc_pool_size);
 
-	if (!pdev || !flowcontrol) {
-		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
-			  "pdev or pause_cb is NULL");
-		return QDF_STATUS_E_INVAL;
-	}
-
 	pdev->pause_cb = flowcontrol;
 	return 0;
 }

+ 8 - 6
core/dp/txrx/ol_tx_queue.c

@@ -869,10 +869,11 @@ ol_tx_bad_peer_update_tx_limit(struct ol_txrx_pdev_t *pdev,
 }
 
 void
-ol_txrx_bad_peer_txctl_set_setting(struct cdp_pdev *ppdev,
+ol_txrx_bad_peer_txctl_set_setting(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 				   int enable, int period, int txq_limit)
 {
-	struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	if (enable)
 		pdev->tx_peer_bal.enabled = ol_tx_peer_bal_enable;
@@ -885,11 +886,12 @@ ol_txrx_bad_peer_txctl_set_setting(struct cdp_pdev *ppdev,
 }
 
 void
-ol_txrx_bad_peer_txctl_update_threshold(struct cdp_pdev *ppdev,
-					int level, int tput_thresh,
-					int tx_limit)
+ol_txrx_bad_peer_txctl_update_threshold(struct cdp_soc_t *soc_hdl,
+					uint8_t pdev_id, int level,
+					int tput_thresh, int tx_limit)
 {
-	struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	/* Set the current settingl */
 	pdev->tx_peer_bal.ctl_thresh[level].tput_thresh =

+ 5 - 3
core/dp/txrx/ol_tx_sched.c

@@ -427,7 +427,7 @@ ol_tx_sched_init_rr(
 }
 
 void
-ol_txrx_set_wmm_param(struct cdp_pdev *data_pdev,
+ol_txrx_set_wmm_param(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 		      struct ol_tx_wmm_param_t wmm_param)
 {
 	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_LOW,
@@ -1108,10 +1108,12 @@ ol_tx_sched_init_wrr_adv(
  * settings of the scheduler, ie. VO, VI, BE, or BK.
  */
 void
-ol_txrx_set_wmm_param(struct cdp_pdev *pdev,
+ol_txrx_set_wmm_param(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 		      struct ol_tx_wmm_param_t wmm_param)
 {
-	struct ol_txrx_pdev_t *data_pdev = (struct ol_txrx_pdev_t *)pdev;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle data_pdev =
+				ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 	struct ol_tx_sched_wrr_adv_t def_cfg;
 	struct ol_tx_sched_wrr_adv_t *scheduler =
 					data_pdev->tx_sched.scheduler;

+ 1 - 1
core/dp/txrx/ol_tx_sched.h

@@ -74,7 +74,7 @@ void ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t *pdev);
 void ol_tx_sched_stats_clear(struct ol_txrx_pdev_t *pdev);
 
 void
-ol_txrx_set_wmm_param(struct cdp_pdev *data_pdev,
+ol_txrx_set_wmm_param(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 		      struct ol_tx_wmm_param_t wmm_param);
 
 #else

+ 3 - 3
core/dp/txrx/ol_tx_send.c

@@ -916,8 +916,8 @@ ol_tx_completion_handler(ol_txrx_pdev_handle pdev,
 		if (tx_desc->pkt_type != OL_TX_FRM_TSO) {
 			packetdump_cb = pdev->ol_tx_packetdump_cb;
 			if (packetdump_cb)
-				packetdump_cb(soc,
-					      (struct cdp_vdev *)tx_desc->vdev,
+				packetdump_cb(soc, pdev->id,
+					      tx_desc->vdev_id,
 					      netbuf, status, TX_DATA_PKT);
 		}
 #endif
@@ -1175,7 +1175,7 @@ ol_tx_single_completion_handler(ol_txrx_pdev_handle pdev,
 #if !defined(REMOVE_PKT_LOG)
 	packetdump_cb = pdev->ol_tx_packetdump_cb;
 	if (packetdump_cb)
-		packetdump_cb(soc, (struct cdp_vdev *)tx_desc->vdev,
+		packetdump_cb(soc, pdev->id, tx_desc->vdev_id,
 			      netbuf, status, TX_MGMT_PKT);
 #endif
 

+ 152 - 58
core/dp/txrx/ol_txrx.c

@@ -111,25 +111,26 @@ static void ol_vdev_rx_set_intrabss_fwd(struct cdp_vdev *vdev,
 		bool val);
 int ol_txrx_get_tx_pending(struct cdp_pdev *pdev_handle);
 extern void
-ol_txrx_set_wmm_param(struct cdp_pdev *data_pdev,
+ol_txrx_set_wmm_param(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 		      struct ol_tx_wmm_param_t wmm_param);
 
-extern void ol_txrx_get_pn_info(void *ppeer, uint8_t **last_pn_valid,
-		    uint64_t **last_pn, uint32_t **rmf_pn_replays);
-
 /* thresh for peer's cached buf queue beyond which the elements are dropped */
 #define OL_TXRX_CACHED_BUFQ_THRESH 128
 
 /**
  * ol_tx_mark_first_wakeup_packet() - set flag to indicate that
  *    fw is compatible for marking first packet after wow wakeup
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  * @value: 1 for enabled/ 0 for disabled
  *
  * Return: None
  */
-static void ol_tx_mark_first_wakeup_packet(uint8_t value)
+static void ol_tx_mark_first_wakeup_packet(struct cdp_soc_t *soc_hdl,
+					   uint8_t pdev_id, uint8_t value)
 {
-	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	if (!pdev) {
 		ol_txrx_err("pdev is NULL");
@@ -857,14 +858,17 @@ fail0:
 #if !defined(REMOVE_PKT_LOG) && !defined(QVIT)
 /**
  * htt_pkt_log_init() - API to initialize packet log
- * @handle: pdev handle
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  * @scn: HIF context
  *
  * Return: void
  */
-void htt_pkt_log_init(struct cdp_pdev *ppdev, void *scn)
+void htt_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn)
 {
-	struct ol_txrx_pdev_t *handle = (struct ol_txrx_pdev_t *)ppdev;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle handle =
+				ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	if (handle->pkt_log_init)
 		return;
@@ -898,7 +902,7 @@ static void htt_pktlogmod_exit(struct ol_txrx_pdev_t *handle)
 }
 
 #else
-void htt_pkt_log_init(struct cdp_pdev *pdev_handle, void *ol_sc) { }
+void htt_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev, void *scn) { }
 static void htt_pktlogmod_exit(ol_txrx_pdev_handle handle)  { }
 #endif
 
@@ -1713,6 +1717,7 @@ ol_txrx_vdev_attach(struct cdp_pdev *ppdev,
 		    uint8_t vdev_id, enum wlan_op_mode op_mode,
 		    enum wlan_op_subtype subtype)
 {
+	struct ol_txrx_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct ol_txrx_pdev_t  *pdev = (struct ol_txrx_pdev_t *)ppdev;
 	struct ol_txrx_vdev_t *vdev;
 	QDF_STATUS qdf_status;
@@ -1721,6 +1726,11 @@ ol_txrx_vdev_attach(struct cdp_pdev *ppdev,
 	TXRX_ASSERT2(pdev);
 	TXRX_ASSERT2(vdev_mac_addr);
 
+	if (qdf_unlikely(!soc)) {
+		ol_txrx_err("soc is NULL");
+		return NULL;
+	}
+
 	vdev = qdf_mem_malloc(sizeof(*vdev));
 	if (!vdev)
 		return NULL;    /* failure */
@@ -1746,7 +1756,8 @@ ol_txrx_vdev_attach(struct cdp_pdev *ppdev,
 	TAILQ_INIT(&vdev->peer_list);
 	vdev->last_real_peer = NULL;
 
-	ol_txrx_hl_tdls_flag_reset((struct cdp_vdev *)vdev, false);
+	ol_txrx_hl_tdls_flag_reset(ol_txrx_soc_t_to_cdp_soc_t(soc),
+				   vdev_id, false);
 
 #ifdef QCA_IBSS_SUPPORT
 	vdev->ibss_peer_num = 0;
@@ -2411,39 +2422,60 @@ ol_txrx_peer_get_peer_mac_addr(void *ppeer)
 #ifdef WLAN_FEATURE_11W
 /**
  * ol_txrx_get_pn_info() - Returns pn info from peer
- * @peer: handle to peer
+ * @soc_hdl: soc handle
+ * @peer_mac: mac address of the peer
+ * @vdev_id: vdev identifier
  * @last_pn_valid: return last_rmf_pn_valid value from peer.
  * @last_pn: return last_rmf_pn value from peer.
  * @rmf_pn_replays: return rmf_pn_replays value from peer.
  *
  * Return: NONE
  */
-void
-ol_txrx_get_pn_info(void *ppeer, uint8_t **last_pn_valid,
+static void
+ol_txrx_get_pn_info(struct cdp_soc_t *soc_hdl, uint8_t *peer_mac,
+		    uint8_t vdev_id, uint8_t **last_pn_valid,
 		    uint64_t **last_pn, uint32_t **rmf_pn_replays)
 {
-	ol_txrx_peer_handle peer = ppeer;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev;
+	ol_txrx_peer_handle peer;
+
+	pdev = ol_txrx_get_pdev_from_pdev_id(soc, OL_TXRX_PDEV_ID);
+	if (!pdev) {
+		ol_txrx_err("pdev is NULL");
+		return;
+	}
+
+	peer =  ol_txrx_peer_find_hash_find_get_ref(pdev, peer_mac, 0, 1,
+						    PEER_DEBUG_ID_OL_INTERNAL);
+	if (!peer)
+		return;
+
 	*last_pn_valid = &peer->last_rmf_pn_valid;
 	*last_pn = &peer->last_rmf_pn;
 	*rmf_pn_replays = &peer->rmf_pn_replays;
 }
 #else
-void
-ol_txrx_get_pn_info(void *ppeer, uint8_t **last_pn_valid,
-		uint64_t **last_pn, uint32_t **rmf_pn_replays)
+static void
+ol_txrx_get_pn_info(struct cdp_soc_t *soc_hdl, uint8_t *peer_mac,
+		    uint8_t vdev_id, uint8_t **last_pn_valid,
+		    uint64_t **last_pn, uint32_t **rmf_pn_replays)
 {
 }
 #endif
 
 /**
  * ol_txrx_get_opmode() - Return operation mode of vdev
- * @vdev: vdev handle
+ * @soc_hdl: Datapath soc handle
+ * @vdev_id: id of vdev
  *
  * Return: operation mode.
  */
-static int ol_txrx_get_opmode(struct cdp_vdev *pvdev)
+static int ol_txrx_get_opmode(struct cdp_soc_t *soc_hdl, uint8_t vdev_id)
 {
-	struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
+	struct ol_txrx_vdev_t *vdev;
+
+	vdev = (struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
 
 	return vdev->opmode;
 }
@@ -2575,15 +2607,19 @@ ol_txrx_update_ibss_add_peer_num_of_vdev(struct cdp_vdev *pvdev,
 /**
  * ol_txrx_set_ibss_vdev_heart_beat_timer() - Update ibss vdev heart
  * beat timer
- * @vdev: vdev handle
+ * @soc_hdl: Datapath soc handle
+ * @vdev_id: id of vdev
  * @timer_value_sec: new heart beat timer value
  *
  * Return: Old timer value set in vdev.
  */
-static uint16_t ol_txrx_set_ibss_vdev_heart_beat_timer(struct cdp_vdev *pvdev,
-						uint16_t timer_value_sec)
+static uint16_t
+ol_txrx_set_ibss_vdev_heart_beat_timer(struct cdp_soc_t *soc_hdl,
+				       uint8_t vdev_id,
+				       uint16_t timer_value_sec)
 {
-	struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
+	struct ol_txrx_vdev_t *vdev =
+		(struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
 	uint16_t old_timer_value = vdev->ibss_peer_heart_beat_timer;
 
 	vdev->ibss_peer_heart_beat_timer = timer_value_sec;
@@ -2598,9 +2634,9 @@ ol_txrx_update_ibss_add_peer_num_of_vdev(struct cdp_vdev *pvdev,
 	return 0;
 }
 
-static inline uint16_t
-ol_txrx_set_ibss_vdev_heart_beat_timer(struct cdp_vdev *pvdev,
-				       uint16_t timer_value_sec)
+static uint16_t ol_txrx_set_ibss_vdev_heart_beat_timer(
+				struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+				uint16_t timer_value_sec)
 {
 	return 0;
 }
@@ -3481,18 +3517,22 @@ static QDF_STATUS ol_txrx_wait_for_pending_tx(int timeout)
 #ifdef FEATURE_RUNTIME_PM
 /**
  * ol_txrx_runtime_suspend() - ensure TXRX is ready to runtime suspend
- * @txrx_pdev: TXRX pdev context
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  *
  * TXRX is ready to runtime suspend if there are no pending packets
  * in the tx queue.
  *
  * Return: QDF_STATUS
  */
-static QDF_STATUS ol_txrx_runtime_suspend(struct cdp_pdev *ppdev)
+static QDF_STATUS ol_txrx_runtime_suspend(struct cdp_soc_t *soc_hdl,
+					  uint8_t pdev_id)
 {
-	struct ol_txrx_pdev_t *txrx_pdev = (struct ol_txrx_pdev_t *)ppdev;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	struct cdp_pdev *txrx_pdev = (struct cdp_pdev *)
+				ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
-	if (ol_txrx_get_tx_pending((struct cdp_pdev *)txrx_pdev))
+	if (ol_txrx_get_tx_pending(txrx_pdev))
 		return QDF_STATUS_E_BUSY;
 	else
 		return QDF_STATUS_SUCCESS;
@@ -3500,13 +3540,15 @@ static QDF_STATUS ol_txrx_runtime_suspend(struct cdp_pdev *ppdev)
 
 /**
  * ol_txrx_runtime_resume() - ensure TXRX is ready to runtime resume
- * @txrx_pdev: TXRX pdev context
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  *
  * This is a dummy function for symmetry.
  *
  * Return: QDF_STATUS_SUCCESS
  */
-static QDF_STATUS ol_txrx_runtime_resume(struct cdp_pdev *ppdev)
+static QDF_STATUS ol_txrx_runtime_resume(struct cdp_soc_t *soc_hdl,
+					 uint8_t pdev_id)
 {
 	return QDF_STATUS_SUCCESS;
 }
@@ -4425,12 +4467,14 @@ static void ol_vdev_rx_set_intrabss_fwd(struct cdp_vdev *pvdev, bool val)
 
 /**
  * ol_txrx_update_mac_id() - update mac_id for vdev
+ * @soc_hdl: Datapath soc handle
  * @vdev_id: vdev id
  * @mac_id: mac id
  *
  * Return: none
  */
-static void ol_txrx_update_mac_id(uint8_t vdev_id, uint8_t mac_id)
+static void ol_txrx_update_mac_id(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
+				  uint8_t mac_id)
 {
 	struct ol_txrx_vdev_t *vdev =
 			(struct ol_txrx_vdev_t *)
@@ -4446,21 +4490,23 @@ static void ol_txrx_update_mac_id(uint8_t vdev_id, uint8_t mac_id)
 
 /**
  * ol_txrx_get_tx_ack_count() - get tx ack count
- * @pdev: pdev reference
+ * @soc_hdl: Datapath soc handle
  * @vdev_id: vdev_id
  *
  * Return: tx ack count
  */
-static uint32_t ol_txrx_get_tx_ack_stats(struct cdp_pdev *pdev,
+static uint32_t ol_txrx_get_tx_ack_stats(struct cdp_soc_t *soc_hdl,
 					 uint8_t vdev_id)
 {
 	struct ol_txrx_vdev_t *vdev =
 		(struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
+
 	if (!vdev) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			  "%s: Invalid vdev_id %d", __func__, vdev_id);
 		return 0;
 	}
+
 	return vdev->txrx_stats.txack_success;
 }
 
@@ -5197,15 +5243,19 @@ static void ol_deregister_offld_flush_cb(void)
 
 /**
  * ol_register_data_stall_detect_cb() - register data stall callback
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  * @data_stall_detect_callback: data stall callback function
  *
  *
  * Return: QDF_STATUS Enumeration
  */
 static QDF_STATUS ol_register_data_stall_detect_cb(
-				data_stall_detect_cb data_stall_detect_callback)
+			struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			data_stall_detect_cb data_stall_detect_callback)
 {
-	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	if (!pdev) {
 		ol_txrx_err("pdev NULL!");
@@ -5217,15 +5267,19 @@ static QDF_STATUS ol_register_data_stall_detect_cb(
 
 /**
  * ol_deregister_data_stall_detect_cb() - de-register data stall callback
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  * @data_stall_detect_callback: data stall callback function
  *
  *
  * Return: QDF_STATUS Enumeration
  */
 static QDF_STATUS ol_deregister_data_stall_detect_cb(
-				data_stall_detect_cb data_stall_detect_callback)
+			struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			data_stall_detect_cb data_stall_detect_callback)
 {
-	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	if (!pdev) {
 		ol_txrx_err("pdev NULL!");
@@ -5246,22 +5300,30 @@ static QDF_STATUS ol_deregister_data_stall_detect_cb(
  * Return: None
  */
 static void ol_txrx_post_data_stall_event(
+				struct cdp_soc_t *soc_hdl,
 				enum data_stall_log_event_indicator indicator,
 				enum data_stall_log_event_type data_stall_type,
 				uint32_t pdev_id, uint32_t vdev_id_bitmap,
 				enum data_stall_log_recovery_type recovery_type)
 {
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
 	struct scheduler_msg msg = {0};
 	QDF_STATUS status;
 	struct data_stall_event_info *data_stall_info;
 	ol_txrx_pdev_handle pdev;
 
-	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	if (qdf_unlikely(!soc)) {
+		ol_txrx_err("soc is NULL");
+		return;
+	}
+
+	pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 	if (!pdev) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			  "%s: pdev is NULL.", __func__);
 		return;
 	}
+
 	data_stall_info = qdf_mem_malloc(sizeof(*data_stall_info));
 	if (!data_stall_info)
 		return;
@@ -5351,14 +5413,17 @@ struct cdp_vdev *ol_txrx_get_mon_vdev_from_pdev(struct cdp_pdev *ppdev)
 
 /**
  * ol_txrx_set_wisa_mode() - set wisa mode
- * @vdev: vdev handle
+ * @soc_hdl: Datapath soc handle
+ * @vdev_id: vdev_id
  * @enable: enable flag
  *
  * Return: QDF STATUS
  */
-static QDF_STATUS ol_txrx_set_wisa_mode(struct cdp_vdev *pvdev, bool enable)
+static QDF_STATUS ol_txrx_set_wisa_mode(struct cdp_soc_t *soc_hdl,
+					uint8_t vdev_id, bool enable)
 {
-	struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
+	struct ol_txrx_vdev_t *vdev =
+		(struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
 
 	if (!vdev)
 		return QDF_STATUS_E_INVAL;
@@ -5409,21 +5474,22 @@ static void ol_txrx_soc_detach(void *soc)
 
 /**
  * ol_txrx_pkt_log_con_service() - connect packet log service
- * @ppdev: physical device handle
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  * @scn: device context
  *
  * Return: noe
  */
 #ifdef REMOVE_PKT_LOG
-static void ol_txrx_pkt_log_con_service(struct cdp_pdev *ppdev, void *scn)
+static void ol_txrx_pkt_log_con_service(struct cdp_soc_t *soc_hdl,
+					uint8_t pdev_id, void *scn)
 {
 }
 #else
-static void ol_txrx_pkt_log_con_service(struct cdp_pdev *ppdev, void *scn)
+static void ol_txrx_pkt_log_con_service(struct cdp_soc_t *soc_hdl,
+					uint8_t pdev_id, void *scn)
 {
-	struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev;
-
-	htt_pkt_log_init((struct cdp_pdev *)pdev, scn);
+	htt_pkt_log_init(soc_hdl, pdev_id, scn);
 	pktlog_htc_attach();
 }
 #endif
@@ -5431,14 +5497,34 @@ static void ol_txrx_pkt_log_con_service(struct cdp_pdev *ppdev, void *scn)
 /* OL wrapper functions for CDP abstraction */
 /**
  * ol_txrx_wrapper_flush_rx_frames() - flush rx frames on the queue
- * @peer: peer handle
+ * @soc: data path soc handle
+ * @pdev_id: datapath pdev identifier
+ * @peer_mac: peer mac address
  * @drop: rx packets drop or deliver
  *
  * Return: none
  */
-static void ol_txrx_wrapper_flush_rx_frames(void *peer, bool drop)
+static void ol_txrx_wrapper_flush_rx_frames(struct cdp_soc_t *soc_hdl,
+					    uint8_t pdev_id, void *peer_mac,
+					    bool drop)
 {
-	ol_txrx_flush_rx_frames((ol_txrx_peer_handle)peer, drop);
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
+	struct ol_txrx_peer_t *peer;
+
+	if (!pdev) {
+		ol_txrx_err("pdev is NULL");
+		return;
+	}
+
+	peer = ol_txrx_peer_find_hash_find_get_ref(pdev, peer_mac, 0, 1,
+						   PEER_DEBUG_ID_OL_INTERNAL);
+	if (!peer) {
+		ol_txrx_err("peer %pM not found", peer_mac);
+		return;
+	}
+
+	ol_txrx_flush_rx_frames(peer, drop);
 }
 
 /**
@@ -5692,6 +5778,8 @@ void *ol_get_pldev(struct cdp_pdev *txrx_pdev)
  *  tx data packet, tx mgmt. packet and rx data packet
  *  dump callback handler.
  *
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  * @ol_tx_packetdump_cb: tx packetdump cb
  * @ol_rx_packetdump_cb: rx packetdump cb
  *
@@ -5702,10 +5790,12 @@ void *ol_get_pldev(struct cdp_pdev *txrx_pdev)
  *
  */
 static inline
-void ol_register_packetdump_callback(ol_txrx_pktdump_cb ol_tx_packetdump_cb,
+void ol_register_packetdump_callback(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+				     ol_txrx_pktdump_cb ol_tx_packetdump_cb,
 				     ol_txrx_pktdump_cb ol_rx_packetdump_cb)
 {
-	ol_txrx_pdev_handle pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	if (!pdev) {
 		ol_txrx_err("pdev is NULL");
@@ -5720,6 +5810,8 @@ void ol_register_packetdump_callback(ol_txrx_pktdump_cb ol_tx_packetdump_cb,
  * ol_deregister_packetdump_callback() - deregidters
  *  tx data packet, tx mgmt. packet and rx data packet
  *  dump callback handler
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of data path pdev handle
  *
  * This function is used to deregidter tx data pkt.,
  * tx mgmt. pkt and rx data pkt. dump callback
@@ -5728,9 +5820,11 @@ void ol_register_packetdump_callback(ol_txrx_pktdump_cb ol_tx_packetdump_cb,
  *
  */
 static inline
-void ol_deregister_packetdump_callback(void)
+void ol_deregister_packetdump_callback(struct cdp_soc_t *soc_hdl,
+				       uint8_t pdev_id)
 {
-	ol_txrx_pdev_handle pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	if (!pdev) {
 		ol_txrx_err("pdev is NULL");

+ 14 - 8
core/dp/txrx/ol_txrx.h

@@ -121,11 +121,13 @@ ol_tx_desc_pool_size_hl(struct cdp_cfg *ctrl_pdev);
 #if defined(CONFIG_HL_SUPPORT) && defined(FEATURE_WLAN_TDLS)
 
 void
-ol_txrx_hl_tdls_flag_reset(struct cdp_vdev *vdev, bool flag);
+ol_txrx_hl_tdls_flag_reset(struct cdp_soc_t *soc_hdl,
+			   uint8_t vdev_id, bool flag);
 #else
 
 static inline void
-ol_txrx_hl_tdls_flag_reset(struct cdp_vdev *vdev, bool flag)
+ol_txrx_hl_tdls_flag_reset(struct cdp_soc_t *soc_hdl,
+			   uint8_t vdev_id, bool flag)
 {
 }
 #endif
@@ -222,7 +224,7 @@ void *ol_txrx_find_peer_by_addr(struct cdp_pdev *pdev,
 				uint8_t *peer_addr,
 				uint8_t *peer_id);
 
-void htt_pkt_log_init(struct cdp_pdev *pdev_handle, void *scn);
+void htt_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn);
 void peer_unmap_timer_handler(void *data);
 
 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
@@ -549,12 +551,13 @@ struct ol_txrx_stats_req_internal
 /**
  * ol_txrx_register_hl_flow_control() -register hl netdev flow control callback
  * @soc_hdl: soc handle
- * @vdev_id: vdev_id
+ * @pdev_id: datapath pdev identifier
  * @flowControl: flow control callback
  *
  * Return: 0 for success or error code
  */
 int ol_txrx_register_hl_flow_control(struct cdp_soc_t *soc_hdl,
+				     uint8_t pdev_id,
 				     tx_pause_callback flowcontrol);
 
 /**
@@ -682,10 +685,11 @@ ol_txrx_vdev_alloc_tcp_node(struct ol_txrx_vdev_t *vdev);
  * Return: none
  */
 void
-ol_tx_pdev_reset_driver_del_ack(struct cdp_pdev *ppdev);
+ol_tx_pdev_reset_driver_del_ack(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
 
 /**
  * ol_tx_vdev_set_driver_del_ack_enable() - set driver delayed ack enabled flag
+ * @soc_hdl: datapath soc handle
  * @vdev_id: vdev id
  * @rx_packets: number of rx packets
  * @time_in_ms: time in ms
@@ -695,7 +699,8 @@ ol_tx_pdev_reset_driver_del_ack(struct cdp_pdev *ppdev);
  * Return: none
  */
 void
-ol_tx_vdev_set_driver_del_ack_enable(uint8_t vdev_id,
+ol_tx_vdev_set_driver_del_ack_enable(struct cdp_soc_t *soc_hdl,
+				     uint8_t vdev_id,
 				     unsigned long rx_packets,
 				     uint32_t time_in_ms,
 				     uint32_t high_th,
@@ -788,12 +793,13 @@ void ol_txrx_vdev_deinit_tcp_del_ack(struct ol_txrx_vdev_t *vdev)
 }
 
 static inline
-void ol_tx_pdev_reset_driver_del_ack(void)
+void ol_tx_pdev_reset_driver_del_ack(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 {
 }
 
 static inline
-void ol_tx_vdev_set_driver_del_ack_enable(uint8_t vdev_id,
+void ol_tx_vdev_set_driver_del_ack_enable(struct cdp_soc_t *soc_hdl,
+					  uint8_t vdev_id,
 					  unsigned long rx_packets,
 					  uint32_t time_in_ms,
 					  uint32_t high_th,

+ 4 - 2
core/hdd/src/wlan_hdd_assoc.c

@@ -71,6 +71,8 @@
 #include "wlan_blm_ucfg_api.h"
 #include "wlan_hdd_sta_info.h"
 
+#include <ol_defines.h>
+
 /* These are needed to recognize WPA and RSN suite types */
 #define HDD_WPA_OUI_SIZE 4
 #define HDD_RSN_OUI_SIZE 4
@@ -1745,7 +1747,7 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter,
 	hdd_clear_roam_profile_ie(adapter);
 	hdd_wmm_init(adapter);
 	hdd_debug("Invoking packetdump deregistration API");
-	wlan_deregister_txrx_packetdump();
+	wlan_deregister_txrx_packetdump(OL_TXRX_PDEV_ID);
 
 	/* indicate 'disconnect' status to wpa_supplicant... */
 	hdd_send_association_event(dev, roam_info);
@@ -3586,7 +3588,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 				       roam_result, roam_status);
 			}
 			hdd_debug("Invoking packetdump deregistration API");
-			wlan_deregister_txrx_packetdump();
+			wlan_deregister_txrx_packetdump(OL_TXRX_PDEV_ID);
 
 			/* inform association failure event to nl80211 */
 			if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL ==

+ 4 - 12
core/hdd/src/wlan_hdd_cfg80211.c

@@ -143,6 +143,7 @@
 #include "wlan_hdd_oemdata.h"
 #include "os_if_fwol.h"
 #include "wlan_hdd_sta_info.h"
+#include <ol_defines.h>
 
 #define g_mode_rates_size (12)
 #define a_mode_rates_size (8)
@@ -5610,9 +5611,7 @@ static int __wlan_hdd_cfg80211_handle_wisa_cmd(struct wiphy *wiphy,
 	QDF_STATUS status;
 	bool wisa_mode;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-	void *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 	mac_handle_t mac_handle;
-	struct cdp_vdev *txrx_vdev = NULL;
 
 	hdd_enter_dev(dev);
 	ret_val = wlan_hdd_validate_context(hdd_ctx);
@@ -5646,15 +5645,8 @@ static int __wlan_hdd_cfg80211_handle_wisa_cmd(struct wiphy *wiphy,
 		hdd_err("Unable to set WISA mode: %d to FW", wisa_mode);
 		ret_val = -EINVAL;
 	}
-	if (QDF_IS_STATUS_SUCCESS(status) || !wisa_mode) {
-		txrx_vdev = cdp_get_vdev_from_vdev_id(soc,
-						      (struct cdp_pdev *)pdev,
-						      adapter->vdev_id);
-		if (!txrx_vdev)
-			ret_val = -EINVAL;
-		else
-			cdp_set_wisa_mode(soc, txrx_vdev, wisa_mode);
-	}
+	if (QDF_IS_STATUS_SUCCESS(status) || !wisa_mode)
+		cdp_set_wisa_mode(soc, adapter->vdev_id, wisa_mode);
 err:
 	hdd_exit();
 	return ret_val;
@@ -13366,7 +13358,7 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy,
 		cdp_post_data_stall_event(soc,
 				      DATA_STALL_LOG_INDICATOR_FRAMEWORK,
 				      DATA_STALL_LOG_NUD_FAILURE,
-				      0xFF, 0XFF,
+				      OL_TXRX_PDEV_ID, 0XFF,
 				      DATA_STALL_LOG_RECOVERY_TRIGGER_PDR);
 
 	mac_handle = hdd_ctx->mac_handle;

+ 6 - 3
core/hdd/src/wlan_hdd_data_stall_detection.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019 The Linux Foundation. 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
@@ -26,6 +26,7 @@
 #include "cdp_txrx_cmn.h"
 #include "cdp_txrx_misc.h"
 #include "ol_txrx_types.h"
+#include "ol_defines.h"
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
 #include "host_diag_core_event.h"
 #include "host_diag_core_log.h"
@@ -74,7 +75,8 @@ int hdd_register_data_stall_detect_cb(void)
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	/* Register the data stall callback */
-	status = cdp_data_stall_cb_register(soc, hdd_data_stall_process_cb);
+	status = cdp_data_stall_cb_register(soc, OL_TXRX_PDEV_ID,
+					    hdd_data_stall_process_cb);
 	return qdf_status_to_os_return(status);
 }
 
@@ -84,6 +86,7 @@ int hdd_deregister_data_stall_detect_cb(void)
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	/* De-Register the data stall callback */
-	status = cdp_data_stall_cb_deregister(soc, hdd_data_stall_process_cb);
+	status = cdp_data_stall_cb_deregister(soc, OL_TXRX_PDEV_ID,
+					      hdd_data_stall_process_cb);
 	return qdf_status_to_os_return(status);
 }

+ 2 - 2
core/hdd/src/wlan_hdd_main.c

@@ -11235,7 +11235,7 @@ static int hdd_pre_enable_configure(struct hdd_context *hdd_ctx)
 
 	cdp_register_pause_cb(soc, wlan_hdd_txrx_pause_cb);
 	/* Register HL netdev flow control callback */
-	cdp_hl_fc_register(soc, wlan_hdd_txrx_pause_cb);
+	cdp_hl_fc_register(soc, OL_TXRX_PDEV_ID, wlan_hdd_txrx_pause_cb);
 	/* Register rx mic error indication handler */
 	cdp_register_rx_mic_error_ind_handler(soc, hdd_rx_mic_error_ind);
 
@@ -13459,7 +13459,7 @@ static void __hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
 	ucfg_ipa_set_perf_level(hdd_ctx->pdev, 0, 0);
 	hdd_reset_tcp_delack(hdd_ctx);
 	cdp_pdev_reset_driver_del_ack(cds_get_context(QDF_MODULE_ID_SOC),
-				      cds_get_context(QDF_MODULE_ID_TXRX));
+				      OL_TXRX_PDEV_ID);
 }
 
 void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)

+ 2 - 1
core/hdd/src/wlan_hdd_power.c

@@ -62,6 +62,7 @@
 
 #include <wma_types.h>
 #include <ol_txrx_osif_api.h>
+#include <ol_defines.h>
 #include "hif.h"
 #include "hif_unit_test_suspend.h"
 #include "sme_power_save_api.h"
@@ -1268,7 +1269,7 @@ QDF_STATUS hdd_wlan_shutdown(void)
 	policy_mgr_clear_concurrent_session_count(hdd_ctx->psoc);
 
 	hdd_debug("Invoking packetdump deregistration API");
-	wlan_deregister_txrx_packetdump();
+	wlan_deregister_txrx_packetdump(OL_TXRX_PDEV_ID);
 
 	/* resume wlan threads before adapter reset which does vdev destroy */
 	if (hdd_ctx->is_scheduler_suspended) {

+ 3 - 1
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -45,6 +45,7 @@
 #include "wlan_policy_mgr_ucfg.h"
 #include <wma_types.h>
 #include "wlan_hdd_sta_info.h"
+#include "ol_defines.h"
 
 /* Preprocessor definitions and constants */
 #undef QCA_HDD_SAP_DUMP_SK_BUFF
@@ -695,11 +696,12 @@ static void __hdd_softap_tx_timeout(struct net_device *dev)
 		QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR,
 			  "Detected data stall due to continuous TX timeouts");
 		adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0;
+
 		if (cdp_cfg_get(soc, cfg_dp_enable_data_stall))
 			cdp_post_data_stall_event(soc,
 					  DATA_STALL_LOG_INDICATOR_HOST_DRIVER,
 					  DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT,
-					  0xFF, 0xFF,
+					  OL_TXRX_PDEV_ID, 0xFF,
 					  DATA_STALL_LOG_RECOVERY_TRIGGER_PDR);
 	}
 }

+ 2 - 2
core/hdd/src/wlan_hdd_tx_rx.c

@@ -418,7 +418,6 @@ static inline struct sk_buff *hdd_skb_orphan(struct hdd_adapter *adapter,
 uint32_t hdd_txrx_get_tx_ack_count(struct hdd_adapter *adapter)
 {
 	return cdp_get_tx_ack_stats(cds_get_context(QDF_MODULE_ID_SOC),
-				    cds_get_context(QDF_MODULE_ID_TXRX),
 				    adapter->vdev_id);
 }
 
@@ -1287,11 +1286,12 @@ static void __hdd_tx_timeout(struct net_device *dev)
 		QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR,
 			  "Data stall due to continuous TX timeouts");
 		adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0;
+
 		if (cdp_cfg_get(soc, cfg_dp_enable_data_stall))
 			cdp_post_data_stall_event(soc,
 					  DATA_STALL_LOG_INDICATOR_HOST_DRIVER,
 					  DATA_STALL_LOG_HOST_STA_TX_TIMEOUT,
-					  0xFF, 0xFF,
+					  OL_TXRX_PDEV_ID, 0xFF,
 					  DATA_STALL_LOG_RECOVERY_TRIGGER_PDR);
 	}
 }

+ 4 - 2
core/sme/src/csr/csr_api_roam.c

@@ -65,6 +65,8 @@
 #include "wlan_blm_api.h"
 #include "wlan_policy_mgr_i.h"
 
+#include <ol_defines.h>
+
 #define RSN_AUTH_KEY_MGMT_SAE           WLAN_RSN_SEL(WLAN_AKM_SAE)
 #define MAX_PWR_FCC_CHAN_12 8
 #define MAX_PWR_FCC_CHAN_13 2
@@ -1699,7 +1701,7 @@ static void csr_packetdump_timer_handler(void *pv)
 {
 	QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
 			"%s Invoking packetdump deregistration API", __func__);
-	wlan_deregister_txrx_packetdump();
+	wlan_deregister_txrx_packetdump(OL_TXRX_PDEV_ID);
 }
 
 void csr_packetdump_timer_stop(void)
@@ -16536,7 +16538,7 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
 
 		if (pProfile->csrPersona == QDF_STA_MODE) {
 			sme_debug("Invoking packetdump register API");
-			wlan_register_txrx_packetdump();
+			wlan_register_txrx_packetdump(OL_TXRX_PDEV_ID);
 			packetdump_timer_status = qdf_mc_timer_start(
 						&mac->roam.packetdump_timer,
 						(PKT_DUMP_TIMER_DURATION *

+ 5 - 2
core/wma/inc/wma_types.h

@@ -665,10 +665,13 @@ void wma_tx_abort(uint8_t vdev_id);
  * @txDir: tx diection
  * @tid: TID
  * @tx_frm_download_comp_cb: tx download callback handler
+ * @pData: tx packet
  * @tx_frm_ota_comp_cb: OTA complition handler
  * @tx_flag: tx flag
  * @vdev_id: vdev id
- * @tdlsFlag: tdls flag
+ * @tdls_flag: tdls flag
+ * @channel_freq: channel frequency
+ * @rid: rate id
  *
  * This function sends the frame corresponding to the
  * given vdev id.
@@ -681,7 +684,7 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
 			 wma_tx_dwnld_comp_callback tx_frm_download_comp_cb,
 			 void *pData,
 			 wma_tx_ota_comp_callback tx_frm_ota_comp_cb,
-			 uint8_t tx_flag, uint8_t vdev_id, bool tdlsFlag,
+			 uint8_t tx_flag, uint8_t vdev_id, bool tdls_flag,
 			 uint16_t channel_freq, enum rateid rid);
 
 /**

+ 9 - 15
core/wma/src/wma_data.c

@@ -1041,9 +1041,8 @@ int wma_peer_state_change_event_handler(void *handle,
 	}
 
 	if ((cdp_get_opmode(cds_get_context(QDF_MODULE_ID_SOC),
-			vdev) ==
-			wlan_op_mode_sta) &&
-		event->state == WMI_PEER_STATE_AUTHORIZED) {
+			    event->vdev_id) == wlan_op_mode_sta) &&
+	    event->state == WMI_PEER_STATE_AUTHORIZED) {
 		/*
 		 * set event so that hdd
 		 * can procced and unpause tx queue
@@ -1635,7 +1634,6 @@ QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma,
 					struct t_bad_peer_txtcl_config *config)
 {
 	/* Parameter sanity check */
-	struct cdp_pdev *curr_pdev;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	if (!wma || !config) {
@@ -1643,10 +1641,6 @@ QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	curr_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-	if (!curr_pdev)
-		return QDF_STATUS_E_FAILURE;
-
 	WMA_LOGE("%s enable %d period %d txq limit %d\n", __func__,
 		 config->enable,
 		 config->period,
@@ -1659,7 +1653,7 @@ QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma,
 		int i = 0;
 
 		cdp_bad_peer_txctl_set_setting(soc,
-					curr_pdev,
+					WMI_PDEV_ID_SOC,
 					config->enable,
 					config->period,
 					config->txq_limit);
@@ -1670,7 +1664,7 @@ QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma,
 			threshold = config->threshold[i].thresh[0];
 			limit =	config->threshold[i].txlimit;
 			cdp_bad_peer_txctl_update_threshold(soc,
-						curr_pdev,
+						WMI_PDEV_ID_SOC,
 						i,
 						threshold,
 						limit);
@@ -2401,7 +2395,7 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
 			 wma_tx_dwnld_comp_callback tx_frm_download_comp_cb,
 			 void *pData,
 			 wma_tx_ota_comp_callback tx_frm_ota_comp_cb,
-			 uint8_t tx_flag, uint8_t vdev_id, bool tdlsFlag,
+			 uint8_t tx_flag, uint8_t vdev_id, bool tdls_flag,
 			 uint16_t channel_freq, enum rateid rid)
 {
 	tp_wma_handle wma_handle = (tp_wma_handle) (wma_context);
@@ -2460,7 +2454,7 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	cdp_hl_tdls_flag_reset(soc, txrx_vdev, false);
+	cdp_hl_tdls_flag_reset(soc, vdev_id, false);
 
 	if (frmType >= TXRX_FRM_MAX) {
 		WMA_LOGE("Invalid Frame Type Fail to send Frame");
@@ -2685,14 +2679,14 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
 
 		/* Send the Data frame to TxRx in Non Standard Path */
 		cdp_hl_tdls_flag_reset(soc,
-			txrx_vdev, tdlsFlag);
+			vdev_id, tdls_flag);
 
 		ret = cdp_tx_non_std(soc,
-			txrx_vdev,
+			vdev_id,
 			OL_TX_SPEC_NO_FREE, skb);
 
 		cdp_hl_tdls_flag_reset(soc,
-			txrx_vdev, false);
+			vdev_id, false);
 
 		if (ret) {
 			WMA_LOGE("TxRx Rejected. Fail to do Tx");

+ 1 - 1
core/wma/src/wma_dev_if.c

@@ -5169,7 +5169,7 @@ void wma_delete_bss(tp_wma_handle wma, uint8_t vdev_id)
 		qdf_mem_free(roam_scan_stats_req);
 	}
 
-	if (wlan_op_mode_ibss == cdp_get_opmode(soc, txrx_vdev))
+	if (wlan_op_mode_ibss == cdp_get_opmode(soc, vdev_id))
 		wma->ibss_started = 0;
 
 	if (wma_is_roam_synch_in_progress(wma, vdev_id)) {

+ 6 - 5
core/wma/src/wma_main.c

@@ -2185,7 +2185,7 @@ static int wma_flush_complete_evt_handler(void *handle,
 		cdp_post_data_stall_event(soc,
 					DATA_STALL_LOG_INDICATOR_FIRMWARE,
 					data_stall_event->data_stall_type,
-					0XFF,
+					OL_TXRX_PDEV_ID,
 					data_stall_event->vdev_id_bitmap,
 					data_stall_event->recovery_type);
 	}
@@ -3721,7 +3721,7 @@ static int wma_pdev_set_hw_mode_resp_evt_handler(void *handle,
 
 		vdev_id = vdev_mac_entry[i].vdev_id;
 		pdev_id = vdev_mac_entry[i].pdev_id;
-		if (pdev_id == WMI_PDEV_ID_SOC) {
+		if (pdev_id == OL_TXRX_PDEV_ID) {
 			WMA_LOGE("%s: soc level id received for mac id)",
 				 __func__);
 			goto fail;
@@ -3822,7 +3822,7 @@ void wma_process_pdev_hw_mode_trans_ind(void *handle,
 		vdev_id = vdev_mac_entry[i].vdev_id;
 		pdev_id = vdev_mac_entry[i].pdev_id;
 
-		if (pdev_id == WMI_PDEV_ID_SOC) {
+		if (pdev_id == OL_TXRX_PDEV_ID) {
 			WMA_LOGE("%s: soc level id received for mac id)",
 				 __func__);
 			return;
@@ -5987,7 +5987,8 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
 		goto free_hw_mode_list;
 	}
 
-	cdp_mark_first_wakeup_packet(soc,
+	cdp_mark_first_wakeup_packet(
+		soc, OL_TXRX_PDEV_ID,
 		wmi_service_enabled(wmi_handle,
 				    wmi_service_mark_first_wakeup_packet));
 	wma_handle->is_dfs_offloaded =
@@ -9325,7 +9326,7 @@ QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle,
 		WMITLV_GET_STRUCT_TLVLEN(
 			wmi_pdev_set_antenna_mode_cmd_fixed_param));
 
-	cmd->pdev_id = WMI_PDEV_ID_SOC;
+	cmd->pdev_id = OL_TXRX_PDEV_ID;
 	/* Bits 0-15 is num of RX chains 16-31 is num of TX chains */
 	cmd->num_txrx_chains = msg->num_rx_chains;
 	cmd->num_txrx_chains |= (msg->num_tx_chains << 16);

+ 13 - 38
core/wma/src/wma_mgmt.c

@@ -2377,7 +2377,7 @@ void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
 
 	/* reset timer value if all peers departed */
 	if (new_peer_num == 0) {
-		cdp_set_ibss_vdev_heart_beat_timer(soc, vdev, 0);
+		cdp_set_ibss_vdev_heart_beat_timer(soc, vdev_id, 0);
 		return;
 	}
 
@@ -2389,7 +2389,7 @@ void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
 		return;
 	}
 	if (new_timer_value_sec ==
-	    cdp_set_ibss_vdev_heart_beat_timer(soc, vdev,
+	    cdp_set_ibss_vdev_heart_beat_timer(soc, vdev_id,
 					       new_timer_value_sec)) {
 		WMA_LOGD("timer value %d stays same, no need to notify target",
 			 new_timer_value_sec);
@@ -2443,7 +2443,7 @@ static void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
 	}
 
 	qdf_mem_zero(&key_params, sizeof(key_params));
-	opmode = cdp_get_opmode(soc, txrx_vdev);
+	opmode = cdp_get_opmode(soc, key_info->vdev_id);
 	qdf_mem_zero(&key_params, sizeof(key_params));
 	key_params.vdev_id = key_info->vdev_id;
 	key_params.key_type = key_info->encType;
@@ -2532,7 +2532,7 @@ void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
 		key_info->status = QDF_STATUS_E_FAILURE;
 		goto out;
 	}
-	wlan_opmode = cdp_get_opmode(soc, txrx_vdev);
+	wlan_opmode = cdp_get_opmode(soc, key_info->vdev_id);
 
 	/*
 	 * For IBSS, WMI expects the BSS key to be set per peer key
@@ -2689,7 +2689,7 @@ void wma_set_stakey(tp_wma_handle wma_handle, tpSetStaKeyParams key_info)
 		key_info->status = QDF_STATUS_E_FAILURE;
 		goto out;
 	}
-	opmode = cdp_get_opmode(soc, txrx_vdev);
+	opmode = cdp_get_opmode(soc, key_info->vdev_id);
 
 	if (key_info->defWEPIdx == WMA_INVALID_KEY_IDX &&
 	    (key_info->encType == eSIR_ED_WEP40 ||
@@ -2801,7 +2801,6 @@ QDF_STATUS wma_process_update_edca_param_req(WMA_HANDLE handle,
 	struct wmi_host_wme_vparams wmm_param[QCA_WLAN_AC_ALL];
 	tSirMacEdcaParamRecord *edca_record;
 	int ac;
-	struct cdp_pdev *pdev;
 	struct ol_tx_wmm_param_t ol_tx_wmm_param;
 	uint8_t vdev_id;
 	QDF_STATUS status;
@@ -2848,12 +2847,7 @@ QDF_STATUS wma_process_update_edca_param_req(WMA_HANDLE handle,
 	else if (status == QDF_STATUS_E_FAILURE)
 		goto fail;
 
-	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-	if (pdev)
-		cdp_set_wmm_param(soc, (struct cdp_pdev *)pdev,
-				 ol_tx_wmm_param);
-	else
-		QDF_ASSERT(0);
+	cdp_set_wmm_param(soc, WMI_PDEV_ID_SOC, ol_tx_wmm_param);
 
 	return QDF_STATUS_SUCCESS;
 
@@ -3441,7 +3435,7 @@ static int wma_process_mgmt_tx_completion(tp_wma_handle wma_handle,
 	packetdump_cb = wma_handle->wma_mgmt_tx_packetdump_cb;
 	pktdump_status = wma_mgmt_pktdump_status_map(status);
 	if (packetdump_cb)
-		packetdump_cb(soc, txrx_vdev,
+		packetdump_cb(soc, WMI_PDEV_ID_SOC, vdev_id,
 			      buf, pktdump_status, TX_MGMT_PKT);
 #endif
 
@@ -3809,41 +3803,22 @@ static bool
 wma_is_ccmp_pn_replay_attack(void *cds_ctx, struct ieee80211_frame *wh,
 			 uint8_t *ccmp_ptr)
 {
-	struct cdp_pdev *pdev;
-	struct cdp_vdev *vdev;
-	void *peer;
-	uint8_t vdev_id, peer_id;
+	uint8_t vdev_id;
 	uint8_t *last_pn_valid = NULL;
 	uint64_t *last_pn = NULL, new_pn;
 	uint32_t *rmf_pn_replays = NULL;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	bool ret = false;
 
-	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-	if (!pdev) {
-		WMA_LOGE("%s: Failed to find pdev", __func__);
-		return true;
-	}
-
-	vdev = wma_find_vdev_by_bssid(cds_ctx, wh->i_addr3, &vdev_id);
-	if (!vdev) {
+	if (!wma_find_vdev_by_bssid(cds_ctx, wh->i_addr3, &vdev_id)) {
 		WMA_LOGE("%s: Failed to find vdev", __func__);
 		return true;
 	}
 
-	/* Retrieve the peer based on vdev and addr */
-	peer = cdp_peer_get_ref_by_addr(soc, pdev, wh->i_addr2, &peer_id,
-					PEER_DEBUG_ID_WMA_CCMP_REPLAY_ATTACK);
-
-	if (!peer) {
-		WMA_LOGE("%s: Failed to find peer, Not able to validate PN",
-			    __func__);
-		return true;
-	}
-
 	new_pn = wma_extract_ccmp_pn(ccmp_ptr);
 
-	cdp_get_pn_info(soc, peer, &last_pn_valid, &last_pn, &rmf_pn_replays);
+	cdp_get_pn_info(soc, wh->i_addr3, vdev_id, &last_pn_valid, &last_pn,
+			&rmf_pn_replays);
 
 	if (!last_pn_valid || !last_pn || !rmf_pn_replays) {
 		WMA_LOGE("%s: PN validation seems not supported", __func__);
@@ -3866,7 +3841,6 @@ wma_is_ccmp_pn_replay_attack(void *cds_ctx, struct ieee80211_frame *wh,
 	}
 
 rel_peer_ref:
-	cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_CCMP_REPLAY_ATTACK);
 	return ret;
 }
 
@@ -4404,7 +4378,8 @@ int wma_form_rx_packet(qdf_nbuf_t buf,
 	if ((mgt_type == IEEE80211_FC0_TYPE_MGT &&
 		mgt_subtype != MGMT_SUBTYPE_BEACON) &&
 		packetdump_cb)
-		packetdump_cb(soc, txrx_vdev, rx_pkt->pkt_buf,
+		packetdump_cb(soc, mgmt_rx_params->pdev_id,
+			      rx_pkt->pkt_meta.session_id, rx_pkt->pkt_buf,
 			      QDF_STATUS_SUCCESS, RX_MGMT_PKT);
 #endif
 	return 0;