qcacld-3.0: cdp: Converge cdp_ctrl_ops

Currently cdp ops are given pdev/vdev 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/vdev_id which will be used to get the
respective handles and hence avoiding unwanted
access of the handles if it has been deleted.

Also deleting few ops which stores and retrieves
such handles and adding ops to set/get pdev params.

- txrx_set_safemode
- txrx_set_drop_unenc
- txrx_get_pdev_param
- txrx_set_pdev_param
- wdi_event_sub
- wdi_event_unsub

Change-Id: Ib3511cbdead75b30e899dbf00f936ffdae316b71
CRs-Fixed: 2541657
diff --git a/components/tdls/core/src/wlan_tdls_cmds_process.c b/components/tdls/core/src/wlan_tdls_cmds_process.c
index 0c97544..70730e6 100644
--- a/components/tdls/core/src/wlan_tdls_cmds_process.c
+++ b/components/tdls/core/src/wlan_tdls_cmds_process.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 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
@@ -1187,9 +1187,9 @@
 
 	if (soc_obj->tdls_dp_vdev_update)
 		soc_obj->tdls_dp_vdev_update(&soc_obj->soc,
-					&peer->peer_mac,
-					soc_obj->tdls_update_dp_vdev_flags,
-					false);
+					     wlan_vdev_get_id(vdev),
+					     soc_obj->tdls_update_dp_vdev_flags,
+					     false);
 
 	cmd.cmd_type = WLAN_SER_CMD_TDLS_DEL_PEER;
 	cmd.cmd_id = 0;
@@ -1674,11 +1674,12 @@
 	feature = soc_obj->tdls_configs.tdls_feature_flags;
 
 	if (soc_obj->tdls_dp_vdev_update)
-		soc_obj->tdls_dp_vdev_update(&soc_obj->soc,
-					&peer->peer_mac,
-					soc_obj->tdls_update_dp_vdev_flags,
-					((peer->link_status ==
-					TDLS_LINK_CONNECTED) ? true : false));
+		soc_obj->tdls_dp_vdev_update(
+				&soc_obj->soc,
+				wlan_vdev_get_id(vdev),
+				soc_obj->tdls_update_dp_vdev_flags,
+				((peer->link_status == TDLS_LINK_CONNECTED) ?
+				 true : false));
 
 	tdls_debug("TDLS buffer sta: %d, uapsd_mask %d",
 		   TDLS_IS_BUFFER_STA_ENABLED(feature),
@@ -1890,8 +1891,9 @@
 					  TDLS_LINK_UNSPECIFIED);
 
 	if (soc_obj->tdls_dp_vdev_update)
-		soc_obj->tdls_dp_vdev_update(&soc_obj->soc,
-				&peer->peer_mac,
+		soc_obj->tdls_dp_vdev_update(
+				&soc_obj->soc,
+				wlan_vdev_get_id(vdev),
 				soc_obj->tdls_update_dp_vdev_flags,
 				false);
 
diff --git a/components/tdls/core/src/wlan_tdls_ct.c b/components/tdls/core/src/wlan_tdls_ct.c
index 0723929..1d44841 100644
--- a/components/tdls/core/src/wlan_tdls_ct.c
+++ b/components/tdls/core/src/wlan_tdls_ct.c
@@ -531,8 +531,9 @@
 	tdls_notice("Teardown reason %d", reason);
 
 	if (tdls_soc->tdls_dp_vdev_update)
-		tdls_soc->tdls_dp_vdev_update(&tdls_soc->soc,
-				&curr_peer->peer_mac,
+		tdls_soc->tdls_dp_vdev_update(
+				&tdls_soc->soc,
+				wlan_vdev_get_id(tdls_vdev->vdev),
 				tdls_soc->tdls_update_dp_vdev_flags,
 				false);
 
diff --git a/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h b/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h
index 1fdca4d..14da227 100644
--- a/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h
+++ b/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h
@@ -610,7 +610,7 @@
 /* This callback is used to update datapath vdev flags */
 typedef QDF_STATUS
 (*tdls_dp_vdev_update_flags_callback)(void *cbk_data,
-				      struct qdf_mac_addr *peer_mac,
+				      uint8_t vdev_id,
 				      uint32_t vdev_param,
 				      bool is_link_up);
 
diff --git a/core/dp/htt/htt_t2h.c b/core/dp/htt/htt_t2h.c
index e9d6c7b..b792a85 100644
--- a/core/dp/htt/htt_t2h.c
+++ b/core/dp/htt/htt_t2h.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2020 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
@@ -526,7 +526,8 @@
 		}
 
 		/*len is reduced by sizeof(*msg_word)*/
-		pktlog_process_fw_msg(msg_word + 1, len - sizeof(*msg_word));
+		pktlog_process_fw_msg(OL_TXRX_PDEV_ID, msg_word + 1,
+				      len - sizeof(*msg_word));
 		break;
 	}
 #endif
diff --git a/core/dp/ol/inc/ol_txrx_ctrl_api.h b/core/dp/ol/inc/ol_txrx_ctrl_api.h
index 7d70216..3934271 100644
--- a/core/dp/ol/inc/ol_txrx_ctrl_api.h
+++ b/core/dp/ol/inc/ol_txrx_ctrl_api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2020 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
@@ -303,32 +303,6 @@
  */
 void ol_txrx_discard_tx_pending(ol_txrx_pdev_handle pdev);
 
-/**
- * @brief set the safemode of the device
- * @details
- *  This flag is used to bypass the encrypt and decrypt processes when send and
- *  receive packets. It works like open AUTH mode, HW will treate all packets
- *  as non-encrypt frames because no key installed. For rx fragmented frames,
- *  it bypasses all the rx defragmentaion.
- *
- * @param vdev - the data virtual device object
- * @param val - the safemode state
- * @return - void
- */
-void ol_txrx_set_safemode(ol_txrx_vdev_handle vdev, uint32_t val);
-
-/**
- * @brief configure the drop unencrypted frame flag
- * @details
- *  Rx related. When set this flag, all the unencrypted frames
- *  received over a secure connection will be discarded
- *
- * @param vdev - the data virtual device object
- * @param val - flag
- * @return - void
- */
-void ol_txrx_set_drop_unenc(ol_txrx_vdev_handle vdev, uint32_t val);
-
 void
 ol_txrx_peer_keyinstalled_state_update(ol_txrx_peer_handle data_peer,
 				       uint8_t val);
diff --git a/core/dp/txrx/ol_rx.c b/core/dp/txrx/ol_rx.c
index 089833e..382ece0 100644
--- a/core/dp/txrx/ol_rx.c
+++ b/core/dp/txrx/ol_rx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2020 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
@@ -153,7 +153,7 @@
 	else
 		data.mac_id = 0;
 
-	wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE, (struct cdp_pdev *)pdev,
+	wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE, pdev->id,
 			  &data);
 }
 #else
@@ -176,7 +176,7 @@
 	else
 		data.mac_id = 0;
 
-	wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE, (struct cdp_pdev *)pdev,
+	wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE, pdev->id,
 			  &data);
 }
 #endif
@@ -308,7 +308,7 @@
 	msg.wh = wh;
 	msg.msdu = msdu;
 	msg.vdev_id = vdev->vdev_id;
-	wdi_event_handler(WDI_EVENT_RX_PEER_INVALID, (struct cdp_pdev *)pdev,
+	wdi_event_handler(WDI_EVENT_RX_PEER_INVALID, pdev->id,
 			  &msg);
 }
 #else
diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c
index 28e223a..4b26c0a 100644
--- a/core/dp/txrx/ol_txrx.c
+++ b/core/dp/txrx/ol_txrx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2020 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
@@ -110,7 +110,7 @@
 				     enum ol_txrx_peer_state state);
 static void ol_vdev_rx_set_intrabss_fwd(struct cdp_soc_t *soc_hdl,
 					uint8_t vdev_id, bool val);
-int ol_txrx_get_tx_pending(struct cdp_pdev *pdev_handle);
+uint32_t ol_txrx_get_tx_pending(struct cdp_pdev *pdev_handle);
 extern void
 ol_txrx_set_wmm_param(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 		      struct ol_tx_wmm_param_t wmm_param);
@@ -832,6 +832,7 @@
 	if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE &&
 			!QDF_IS_EPPING_ENABLED(cds_get_conparam())) {
 		pktlog_sethandle(&handle->pl_dev, scn);
+		pktlog_set_pdev_id(handle->pl_dev, pdev_id);
 		pktlog_set_callback_regtype(PKTLOG_DEFAULT_CALLBACK_REGISTRATION);
 		if (pktlogmod_init(scn))
 			qdf_print(" pktlogmod_init failed");
@@ -1849,11 +1850,6 @@
 	return QDF_STATUS_SUCCESS;
 }
 
-void ol_txrx_set_safemode(ol_txrx_vdev_handle vdev, uint32_t val)
-{
-	vdev->safemode = val;
-}
-
 /**
  * ol_txrx_set_privacy_filters - set the privacy filter
  * @vdev - the data virtual device object
@@ -1873,11 +1869,6 @@
 	vdev->num_filters = num;
 }
 
-void ol_txrx_set_drop_unenc(ol_txrx_vdev_handle vdev, uint32_t val)
-{
-	vdev->drop_unenc = val;
-}
-
 #if defined(CONFIG_HL_SUPPORT) || defined(QCA_LL_LEGACY_TX_FLOW_CONTROL)
 
 static void
@@ -3637,7 +3628,7 @@
  *
  * Return: count of pending frames
  */
-int ol_txrx_get_tx_pending(struct cdp_pdev *ppdev)
+uint32_t ol_txrx_get_tx_pending(struct cdp_pdev *ppdev)
 {
 	struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev;
 	uint32_t total;
@@ -5785,11 +5776,79 @@
 	return value;
 }
 
-#ifdef WDI_EVENT_ENABLE
-void *ol_get_pldev(struct cdp_pdev *txrx_pdev)
+/*
+ * ol_get_pdev_param: function to get parameters from pdev
+ * @cdp_soc: txrx soc handle
+ * @pdev_id: id of pdev handle
+ * @param: parameter type to be get
+ * @val: parameter type to be get
+ *
+ * Return: SUCCESS or FAILURE
+ */
+static QDF_STATUS ol_get_pdev_param(struct cdp_soc_t *soc_hdl,  uint8_t pdev_id,
+				    enum cdp_pdev_param_type param,
+				    cdp_config_param_type *val)
 {
-	struct ol_txrx_pdev_t *pdev =
-				 (struct ol_txrx_pdev_t *)txrx_pdev;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	struct ol_txrx_pdev_t *olpdev = ol_txrx_get_pdev_from_pdev_id(soc,
+								      pdev_id);
+	struct cdp_pdev *pdev = ol_txrx_pdev_t_to_cdp_pdev(olpdev);
+
+	if (!pdev)
+		return QDF_STATUS_E_FAILURE;
+
+	switch (param) {
+	case CDP_TX_PENDING:
+		val->cdp_pdev_param_tx_pending = ol_txrx_get_tx_pending(pdev);
+		break;
+	default:
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/*
+ * ol_set_pdev_param: function to get parameters from pdev
+ * @cdp_soc: txrx soc handle
+ * @pdev_id: id of pdev handle
+ * @param: parameter type to be get
+ * @val: parameter type to be get
+ *
+ * Return: SUCCESS or FAILURE
+ */
+static QDF_STATUS ol_set_pdev_param(struct cdp_soc_t *soc_hdl,  uint8_t pdev_id,
+				    enum cdp_pdev_param_type param,
+				    cdp_config_param_type val)
+{
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	struct ol_txrx_pdev_t *olpdev = ol_txrx_get_pdev_from_pdev_id(soc,
+								      pdev_id);
+	struct cdp_pdev *pdev = ol_txrx_pdev_t_to_cdp_pdev(olpdev);
+
+	if (!pdev)
+		return QDF_STATUS_E_FAILURE;
+
+	switch (param) {
+	case CDP_MONITOR_CHANNEL:
+	{
+		ol_htt_mon_note_chan(pdev, val.cdp_pdev_param_monitor_chan);
+		break;
+	}
+	default:
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+#ifdef WDI_EVENT_ENABLE
+void *ol_get_pldev(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
+{
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	struct ol_txrx_pdev_t *pdev = ol_txrx_get_pdev_from_pdev_id(soc,
+								    pdev_id);
+
 	if (pdev)
 		return pdev->pl_dev;
 
@@ -5882,7 +5941,6 @@
 	.txrx_mgmt_tx_cb_set = ol_txrx_mgmt_tx_cb_set,
 	.txrx_data_tx_cb_set = ol_txrx_data_tx_cb_set,
 	.txrx_peer_unmap_sync_cb_set = ol_txrx_peer_unmap_sync_cb_set,
-	.txrx_get_tx_pending = ol_txrx_get_tx_pending,
 	.flush_cache_rx_queue = ol_txrx_flush_cache_rx_queue,
 	.txrx_fw_stats_get = ol_txrx_fw_stats_get,
 	.display_stats = ol_txrx_display_stats,
@@ -6086,6 +6144,8 @@
 	.txrx_get_pldev = ol_get_pldev,
 	.txrx_wdi_event_sub = wdi_event_sub,
 	.txrx_wdi_event_unsub = wdi_event_unsub,
+	.txrx_get_pdev_param = ol_get_pdev_param,
+	.txrx_set_pdev_param = ol_set_pdev_param
 };
 
 /* WINplatform specific structures */
@@ -6094,7 +6154,7 @@
 };
 
 static struct cdp_mon_ops ol_ops_mon = {
-	.txrx_monitor_record_channel = ol_htt_mon_note_chan,
+	/* EMPTY FOR MCL */
 };
 
 static struct cdp_host_stats_ops ol_ops_host_stats = {
diff --git a/core/dp/txrx/ol_txrx.h b/core/dp/txrx/ol_txrx.h
index ee41e1e..8dedf44 100644
--- a/core/dp/txrx/ol_txrx.h
+++ b/core/dp/txrx/ol_txrx.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2020 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
@@ -132,10 +132,10 @@
 #endif
 
 #ifdef WDI_EVENT_ENABLE
-void *ol_get_pldev(struct cdp_pdev *txrx_pdev);
+void *ol_get_pldev(struct cdp_soc_t *soc, uint8_t pdev_id);
 #else
 static inline
-void *ol_get_pldev(struct cdp_pdev *txrx_pdev)
+void *ol_get_pldev(struct cdp_soc_t *soc, uint8_t pdev_id)
 {
 	return NULL;
 }
diff --git a/core/dp/txrx/ol_txrx_event.c b/core/dp/txrx/ol_txrx_event.c
index 3dc5d97..7960607 100644
--- a/core/dp/txrx/ol_txrx_event.c
+++ b/core/dp/txrx/ol_txrx_event.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2020 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
@@ -17,6 +17,7 @@
  */
 
 #include "ol_txrx_types.h"
+#include "ol_txrx.h"
 
 static inline wdi_event_subscribe *wdi_event_next_sub(wdi_event_subscribe *
 						      wdi_sub)
@@ -66,12 +67,13 @@
 
 void
 wdi_event_handler(enum WDI_EVENT event,
-		  struct cdp_pdev *ppdev, void *data)
+		  uint8_t pdev_id, void *data)
 {
 	uint32_t event_index;
 	wdi_event_subscribe *wdi_sub;
-	struct ol_txrx_pdev_t *txrx_pdev =
-				(struct ol_txrx_pdev_t *)ppdev;
+	struct ol_txrx_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	ol_txrx_pdev_handle txrx_pdev =
+		ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 
 	/*
 	 * Input validation
@@ -99,15 +101,15 @@
 }
 
 int
-wdi_event_sub(struct cdp_pdev *ppdev,
-	      void *pevent_cb_sub, uint32_t event)
+wdi_event_sub(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+	      wdi_event_subscribe *pevent_cb_sub, uint32_t event)
 {
 	uint32_t event_index;
 	wdi_event_subscribe *wdi_sub;
-	struct ol_txrx_pdev_t *txrx_pdev =
-				(struct ol_txrx_pdev_t *)ppdev;
-	wdi_event_subscribe *event_cb_sub =
-				(wdi_event_subscribe *)pevent_cb_sub;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle txrx_pdev = ol_txrx_get_pdev_from_pdev_id(soc,
+								      pdev_id);
+	wdi_event_subscribe *event_cb_sub = pevent_cb_sub;
 
 	/* Input validation */
 	if (!txrx_pdev || !txrx_pdev->wdi_event_list) {
@@ -149,16 +151,22 @@
 }
 
 int
-wdi_event_unsub(struct cdp_pdev *ppdev,
-		void *pevent_cb_sub, uint32_t event)
+wdi_event_unsub(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+		wdi_event_subscribe *pevent_cb_sub, uint32_t event)
 {
 	uint32_t event_index = event - WDI_EVENT_BASE;
+	struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl);
+	ol_txrx_pdev_handle txrx_pdev = ol_txrx_get_pdev_from_pdev_id(soc,
+								      pdev_id);
 
-	struct ol_txrx_pdev_t *txrx_pdev =
-				(struct ol_txrx_pdev_t *)ppdev;
+	wdi_event_subscribe *event_cb_sub = pevent_cb_sub;
 
-	wdi_event_subscribe *event_cb_sub =
-				(wdi_event_subscribe *)pevent_cb_sub;
+	/* Input validation */
+	if (!txrx_pdev) {
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
+			  "Invalid txrx_pdev in %s", __func__);
+		return -EINVAL;
+	}
 
 	/* Input validation */
 	if (!event_cb_sub) {
diff --git a/core/dp/txrx/wdi_event_api.h b/core/dp/txrx/wdi_event_api.h
index 3997d07..11358b2 100644
--- a/core/dp/txrx/wdi_event_api.h
+++ b/core/dp/txrx/wdi_event_api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014, 2017-2020 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
@@ -21,6 +21,7 @@
 
 #include "wdi_event.h"
 #include <cdp_txrx_handle.h>
+#include <cdp_txrx_cmn_struct.h>
 struct ol_txrx_pdev_t;
 
 #ifdef WDI_EVENT_ENABLE
@@ -34,14 +35,14 @@
  *  The order in which callback functions from multiple subscribers are
  *  invoked is unspecified.
  *
- * @param pdev - the event physical device, that maintains the event lists
+ * @param soc_hdl - datapath soc handle
+ * @param pdev_id - physical device instance id
  * @param event_cb_sub - the callback and context for the event subscriber
  * @param event - which event's notifications are being subscribed to
  * @return error code, or 0 for success
  */
-int wdi_event_sub(struct cdp_pdev *ppdev,
-		  void *event_cb_sub,
-		  uint32_t event);
+int wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
+		  wdi_event_subscribe *event_cb_sub, uint32_t event);
 
 /**
  * @brief Unsubscribe from a specified WDI event.
@@ -51,25 +52,25 @@
  *  This function shall only be called if there was a successful prior call
  *  to event_sub() on the same wdi_event_subscribe object.
  *
- * @param pdev - the event physical device with the list of event subscribers
+ * @param soc_hdl - datapath soc handle
+ * @param pdev_id - physical device instance id
  * @param event_cb_sub - the event subscription object
  * @param event - which event is being unsubscribed
  * @return error code, or 0 for success
  */
-int wdi_event_unsub(struct cdp_pdev *ppdev,
-		    void *event_cb_sub,
-		    uint32_t event);
+int wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
+		    wdi_event_subscribe *event_cb_sub, uint32_t event);
 
 
 void wdi_event_handler(enum WDI_EVENT event,
-		       struct cdp_pdev *txrx_pdev, void *data);
+		       uint8_t pdev_id, void *data);
 A_STATUS wdi_event_attach(struct ol_txrx_pdev_t *txrx_pdev);
 A_STATUS wdi_event_detach(struct ol_txrx_pdev_t *txrx_pdev);
 
 #else
 
 static inline void wdi_event_handler(enum WDI_EVENT event,
-		       struct cdp_pdev *txrx_pdev, void *data)
+				     uint8_t pdev_id, void *data)
 {
 }
 
@@ -83,14 +84,15 @@
 	return A_OK;
 }
 
-static inline int wdi_event_sub(struct cdp_pdev *ppdev, void *event_cb_sub,
+static inline int wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
+				wdi_event_subscribe *event_cb_sub,
 				uint32_t event)
 {
 	return 0;
 }
 
-static inline int wdi_event_unsub(struct cdp_pdev *ppdev,
-				  void *event_cb_sub,
+static inline int wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
+				  wdi_event_subscribe *event_cb_sub,
 				  uint32_t event)
 {
 	return 0;
diff --git a/core/hdd/inc/wlan_hdd_assoc.h b/core/hdd/inc/wlan_hdd_assoc.h
index 169f7b6..47820b5 100644
--- a/core/hdd/inc/wlan_hdd_assoc.h
+++ b/core/hdd/inc/wlan_hdd_assoc.h
@@ -400,14 +400,14 @@
 /**
  * hdd_update_dp_vdev_flags() - update datapath vdev flags
  * @cbk_data: callback data
- * @mac_addr: mac address of the station
+ * @vdev_id: virtual interface id
  * @vdev_param: vdev parameter
  * @is_link_up: link state up or down
  *
  * Return: QDF status
  */
 QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data,
-				    struct qdf_mac_addr *mac_addr,
+				    uint8_t vdev_id,
 				    uint32_t vdev_param,
 				    bool is_link_up);
 
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index 7769a70..cb53260 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -2018,16 +2018,15 @@
 }
 
 QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data,
-				    struct qdf_mac_addr *mac_addr,
+				    uint8_t vdev_id,
 				    uint32_t vdev_param,
 				    bool is_link_up)
 {
-	struct cdp_vdev *data_vdev;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct hdd_context *hdd_ctx;
-	void *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 	struct wlan_objmgr_psoc **psoc;
+	cdp_config_param_type val;
 
 	if (!cbk_data)
 		return status;
@@ -2043,13 +2042,13 @@
 	if (!hdd_ctx->tdls_nap_active)
 		return status;
 
-	data_vdev = cdp_peer_get_vdev_by_peer_addr(soc, pdev, *mac_addr);
-	if (!data_vdev) {
+	if (vdev_id == WLAN_INVALID_VDEV_ID) {
 		status = QDF_STATUS_E_FAILURE;
 		return status;
 	}
 
-	cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up);
+	val.cdp_vdev_param_tdls_flags = is_link_up;
+	cdp_txrx_set_vdev_param(soc, vdev_id, vdev_param, val);
 
 	return status;
 }
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index 4578ec6..d40dbda 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -59,6 +59,7 @@
 #include <cdp_txrx_cfg.h>
 #include <cdp_txrx_cmn.h>
 #include <cdp_txrx_misc.h>
+#include <cdp_txrx_ctrl.h>
 
 #include "wlan_policy_mgr_api.h"
 #include "wma_nan_datapath.h"
@@ -4997,6 +4998,7 @@
 {
 	struct cdp_pdev *pdev;
 	uint8_t max_wait_iterations = 0;
+	cdp_config_param_type val;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	if (!wma_is_vdev_valid(session_id)) {
@@ -5015,10 +5017,19 @@
 		wma->interfaces[session_id].delay_before_vdev_stop /
 		WMA_TX_Q_RECHECK_TIMER_WAIT;
 
-	while (cdp_get_tx_pending(soc, pdev) && max_wait_iterations) {
+	if (cdp_txrx_get_pdev_param(soc,
+				    wlan_objmgr_pdev_get_pdev_id(wma->pdev),
+				    CDP_TX_PENDING, &val))
+		return;
+	while (val.cdp_pdev_param_tx_pending && max_wait_iterations) {
 		WMA_LOGW(FL("Waiting for outstanding packet to drain."));
 		qdf_wait_for_event_completion(&wma->tx_queue_empty_event,
 				      WMA_TX_Q_RECHECK_TIMER_WAIT);
+		if (cdp_txrx_get_pdev_param(
+					soc,
+					wlan_objmgr_pdev_get_pdev_id(wma->pdev),
+					CDP_TX_PENDING, &val))
+			return;
 		max_wait_iterations--;
 	}
 }
@@ -5028,7 +5039,8 @@
 	struct cdp_pdev *pdev;
 	void *peer = NULL;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	struct cdp_vdev *txrx_vdev = NULL;
+	uint32_t tx_pending = 0;
+	cdp_config_param_type val;
 	bool roam_synch_in_progress = false;
 	struct wma_txrx_node *iface;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
@@ -5089,13 +5101,6 @@
 	qdf_mem_zero(bssid_addr,
 		     QDF_MAC_ADDR_SIZE);
 
-	txrx_vdev = wma_find_vdev_by_id(wma, vdev_id);
-	if (!txrx_vdev) {
-		WMA_LOGE("%s:Invalid vdev handle", __func__);
-		status = QDF_STATUS_E_FAILURE;
-		goto out;
-	}
-
 	wma_delete_invalid_peer_entries(vdev_id, NULL);
 
 	if (iface->psnr_req) {
@@ -5137,13 +5142,17 @@
 		goto out;
 	}
 
-	WMA_LOGD(FL("Outstanding msdu packets: %d"),
-		 cdp_get_tx_pending(soc, pdev));
+	cdp_txrx_get_pdev_param(soc, wlan_objmgr_pdev_get_pdev_id(wma->pdev),
+				CDP_TX_PENDING, &val);
+	tx_pending = val.cdp_pdev_param_tx_pending;
+	WMA_LOGD(FL("Outstanding msdu packets: %u"), tx_pending);
 	wma_wait_tx_complete(wma, vdev_id);
 
-	if (cdp_get_tx_pending(soc, pdev)) {
-		WMA_LOGW(FL("Outstanding msdu packets before VDEV_STOP : %d"),
-			 cdp_get_tx_pending(soc, pdev));
+	cdp_txrx_get_pdev_param(soc, wlan_objmgr_pdev_get_pdev_id(wma->pdev),
+				CDP_TX_PENDING, &val);
+	if (tx_pending) {
+		WMA_LOGW(FL("Outstanding msdu packets before VDEV_STOP : %u"),
+			 tx_pending);
 	}
 
 	WMA_LOGD("%s, vdev_id: %d, pausing tx_ll_queue for VDEV_STOP (del_bss)",
diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c
index df6ce1e..de1111f 100644
--- a/core/wma/src/wma_scan_roam.c
+++ b/core/wma/src/wma_scan_roam.c
@@ -78,6 +78,7 @@
 #include <wlan_mlme_main.h>
 #include <wlan_crypto_global_api.h>
 #include <cdp_txrx_mon.h>
+#include <cdp_txrx_ctrl.h>
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT    /* FEATURE_WLAN_DIAG_SUPPORT */
 #include "host_diag_core_log.h"
@@ -4277,10 +4278,10 @@
 QDF_STATUS wma_post_chan_switch_setup(uint8_t vdev_id)
 {
 	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
-	struct cdp_pdev *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 	struct wma_txrx_node *intr = &wma->interfaces[vdev_id];
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct wlan_channel *des_chan;
+	cdp_config_param_type val;
 
 	/*
 	 * Record monitor mode channel here in case HW
@@ -4288,8 +4289,14 @@
 	 */
 	if (intr->type == WMI_VDEV_TYPE_MONITOR) {
 		des_chan = intr->vdev->vdev_mlme.des_chan;
-		cdp_record_monitor_chan_num(soc, pdev, des_chan->ch_ieee);
-		cdp_record_monitor_chan_freq(soc, pdev, des_chan->ch_freq);
+		val.cdp_pdev_param_monitor_chan = des_chan->ch_ieee;
+		cdp_txrx_set_pdev_param(soc,
+					wlan_objmgr_pdev_get_pdev_id(wma->pdev),
+					CDP_MONITOR_CHANNEL, val);
+		val.cdp_pdev_param_mon_freq = des_chan->ch_freq;
+		cdp_txrx_set_pdev_param(soc,
+					wlan_objmgr_pdev_get_pdev_id(wma->pdev),
+					CDP_MONITOR_FREQUENCY, val);
 	}
 	return QDF_STATUS_SUCCESS;
 }