Browse Source

qcacmn: Modify set 1 of ctrl_ops to acheive umac-dp decoupling

Change set 1 of the ctrl_ops APIs to replace pdev, vdev and peer
dp handles with pdev_id, vdev_id and peer mac address
along with dp soc handle

Change-Id: Iedf6dea2215d3d04b2212c71c8ec8c7328c559e8
Pavankumar Nandeshwar 5 years ago
parent
commit
6c83405439

+ 8 - 7
dp/inc/cdp_txrx_cmn.h

@@ -1778,24 +1778,25 @@ static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
 	return 0;
 }
 
-static inline int cdp_set_key(ol_txrx_soc_handle soc,
-			      struct cdp_peer *peer_handle,
-			      bool is_unicast, uint32_t *key)
+static inline QDF_STATUS
+cdp_set_key(ol_txrx_soc_handle soc,
+	    uint8_t vdev_id,
+	    uint8_t *mac,
+	    bool is_unicast, uint32_t *key)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
 			  "%s: Invalid Instance:", __func__);
 		QDF_BUG(0);
-		return 0;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (!soc->ops->ctrl_ops ||
 	    !soc->ops->ctrl_ops->set_key)
-		return 0;
+		return QDF_STATUS_E_FAILURE;
 
-	soc->ops->ctrl_ops->set_key(peer_handle,
+	return soc->ops->ctrl_ops->set_key(soc, vdev_id, mac,
 			is_unicast, key);
-	return 0;
 }
 
 /**

+ 3 - 2
dp/inc/cdp_txrx_cmn_struct.h

@@ -685,11 +685,12 @@ typedef qdf_nbuf_t (*ol_txrx_tx_fp)(struct cdp_soc_t *soc, uint8_t vdev_id,
 
 /**
  * ol_txrx_tx_exc_fp - top-level transmit function on exception path
- * @data_vdev - handle to the virtual device object
+ * @soc - dp soc handle
+ * @vdev_id - handle to the virtual device object
  * @msdu_list - list of network buffers
  * @tx_exc_metadata - structure that holds parameters to exception path
  */
-typedef qdf_nbuf_t (*ol_txrx_tx_exc_fp)(struct cdp_vdev *data_vdev,
+typedef qdf_nbuf_t (*ol_txrx_tx_exc_fp)(struct cdp_soc_t *soc, uint8_t vdev_id,
 					qdf_nbuf_t msdu_list,
 					struct cdp_tx_exception_metadata
 						*tx_exc_metadata);

+ 79 - 69
dp/inc/cdp_txrx_ctrl.h

@@ -30,7 +30,7 @@
 #include "cdp_txrx_ops.h"
 
 static inline int cdp_is_target_ar900b
-	(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
+	(ol_txrx_soc_handle soc)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
@@ -43,7 +43,7 @@ static inline int cdp_is_target_ar900b
 	    !soc->ops->ctrl_ops->txrx_is_target_ar900b)
 		return 0;
 
-	return soc->ops->ctrl_ops->txrx_is_target_ar900b(vdev);
+	return soc->ops->ctrl_ops->txrx_is_target_ar900b(soc);
 }
 
 
@@ -101,14 +101,14 @@ cdp_set_filter_neighbour_peers(ol_txrx_soc_handle soc,
  *  which needs to be filtered
  *
  * @param soc - the pointer to soc object
- * @param vdev - the pointer to vdev
+ * @param vdev_id - id of the pointer to vdev
  * @param cmd - add/del entry into peer table
  * @param macaddr - the address of neighbour peer
  * @return - int
  */
 static inline int
 cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc,
-	struct cdp_vdev *vdev, uint32_t cmd, uint8_t *macaddr)
+	uint8_t vdev_id, uint32_t cmd, uint8_t *macaddr)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
@@ -122,7 +122,7 @@ cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc,
 		return 0;
 
 	return soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers
-			(vdev, cmd, macaddr);
+			(soc, vdev_id, cmd, macaddr);
 }
 
 /**
@@ -268,38 +268,38 @@ cdp_get_vdev_rx_decap_type(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  *  This will be used to configure the Reo Destination ring for this pdev.
  *
  * @param soc - pointer to the soc
- * @param pdev - the data physical device object
+ * @param pdev_id - id of the data physical device object
  * @param val - the Reo destination ring index (1 to 4)
- * @return - void
+ * @return - QDF_STATUS
  */
-static inline void
+static inline QDF_STATUS
 cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc,
-	struct cdp_pdev *pdev, enum cdp_host_reo_dest_ring val)
+		      uint8_t pdev_id, enum cdp_host_reo_dest_ring val)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
 				"%s: Invalid Instance:", __func__);
 		QDF_BUG(0);
-		return;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (!soc->ops->ctrl_ops ||
 	    !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest)
-		return;
+		return QDF_STATUS_E_FAILURE;
 
-	soc->ops->ctrl_ops->txrx_set_pdev_reo_dest
-			(pdev, val);
+	return soc->ops->ctrl_ops->txrx_set_pdev_reo_dest
+			(soc, pdev_id, val);
 }
 
 /**
  * @brief get the Reo Destination ring for the pdev
  *
  * @param soc - pointer to the soc
- * @param pdev - the data physical device object
+ * @param pdev_id - id of physical device object
  * @return - the Reo destination ring index (1 to 4), 0 if not supported.
  */
 static inline enum cdp_host_reo_dest_ring
-cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
+cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
@@ -312,7 +312,7 @@ cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
 	    !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest)
 		return cdp_host_reo_dest_ring_unknown;
 
-	return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(pdev);
+	return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(soc, pdev_id);
 }
 
 /* Is this similar to ol_txrx_peer_state_update() in MCL */
@@ -469,7 +469,7 @@ cdp_peer_set_nawds(ol_txrx_soc_handle soc,
 
 #ifdef QCA_MULTIPASS_SUPPORT
 static inline void
-cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
+cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, uint8_t vdev_id,
 		     uint8_t *peer_mac, uint8_t vlan_id)
 {
 	if (!soc || !soc->ops) {
@@ -483,7 +483,8 @@ cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
 	    !soc->ops->ctrl_ops->txrx_peer_set_vlan_id)
 		return;
 
-	soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev, peer_mac, vlan_id);
+	soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev_id, peer_mac,
+						  vlan_id);
 }
 #endif
 
@@ -520,7 +521,7 @@ static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
  * cdp_enable_peer_based_pktlog()- Set flag in peer structure
  *
  * @soc: pointer to the soc
- * @pdev: the data physical device object
+ * @pdev_id: id of the data physical device object
  * @enable: enable or disable peer based filter based pktlog
  * @peer_macaddr: Mac address of peer which needs to be
  * filtered
@@ -531,8 +532,8 @@ static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
  * Return: int
  */
 static inline int
-cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc,
-			     struct cdp_pdev *pdev, char *peer_macaddr,
+cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, uint8_t pdev_id,
+			     char *peer_macaddr,
 			     uint8_t enable)
 {
 	if (!soc || !soc->ops) {
@@ -547,37 +548,37 @@ cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc,
 		return 0;
 
 	return soc->ops->ctrl_ops->enable_peer_based_pktlog
-			(pdev, peer_macaddr, enable);
+			(soc, pdev_id, peer_macaddr, enable);
 }
 
 /**
  * cdp_calculate_delay_stats()- get rx delay stats
  *
  * @soc: pointer to the soc
- * @vdev: vdev handle
+ * @vdev_id: id of vdev handle
  * @nbuf: nbuf which is passed
  *
  * This function will calculate rx delay statistics.
  */
-static inline void
-cdp_calculate_delay_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
+static inline QDF_STATUS
+cdp_calculate_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
 			  qdf_nbuf_t nbuf)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
 			  "%s: Invalid Instance:", __func__);
 		QDF_BUG(0);
-		return;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (!soc->ops->ctrl_ops ||
 	    !soc->ops->ctrl_ops->calculate_delay_stats) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
 			  "%s: callback not registered:", __func__);
-		return;
+		return QDF_STATUS_E_FAILURE;
 	}
 
-	return soc->ops->ctrl_ops->calculate_delay_stats(vdev, nbuf);
+	return soc->ops->ctrl_ops->calculate_delay_stats(soc, vdev_id, nbuf);
 }
 
 /**
@@ -591,19 +592,19 @@ cdp_calculate_delay_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  *  invoked is unspecified.
  *
  * @param soc - pointer to the soc
- * @param pdev - the data physical device object
+ * @param pdev_id - id of the data physical device object
  * @param event_cb_sub - the callback and context for the event subscriber
  * @param event - which event's notifications are being subscribed to
  * @return - int
  */
 static inline int
-cdp_wdi_event_sub(ol_txrx_soc_handle soc,
-		struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
+cdp_wdi_event_sub(ol_txrx_soc_handle soc, uint8_t pdev_id,
+		  wdi_event_subscribe *event_cb_sub, uint32_t event)
 {
 
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
-			"%s invalid instance", __func__);
+			  "%s invalid instance", __func__);
 		QDF_BUG(0);
 		return 0;
 	}
@@ -613,7 +614,7 @@ cdp_wdi_event_sub(ol_txrx_soc_handle soc,
 		return 0;
 
 	return soc->ops->ctrl_ops->txrx_wdi_event_sub
-			(pdev, event_cb_sub, event);
+			(soc, pdev_id, event_cb_sub, event);
 }
 
 /**
@@ -625,14 +626,15 @@ cdp_wdi_event_sub(ol_txrx_soc_handle soc,
  *  to event_sub() on the same wdi_event_subscribe object.
  *
  * @param soc - pointer to the soc
- * @param pdev - the data physical device object
+ * @param pdev_id - id of the data physical device object
  * @param event_cb_sub - the callback and context for the event subscriber
  * @param event - which event's notifications are being subscribed to
  * @return - int
  */
 static inline int
 cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
-		struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
+		    uint8_t pdev_id, wdi_event_subscribe *event_cb_sub,
+		    uint32_t event)
 {
 
 	if (!soc || !soc->ops) {
@@ -647,7 +649,7 @@ cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
 		return 0;
 
 	return soc->ops->ctrl_ops->txrx_wdi_event_unsub
-			(pdev, event_cb_sub, event);
+			(soc, pdev_id, event_cb_sub, event);
 }
 
 /**
@@ -658,16 +660,18 @@ cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
  * to the peer handler.
  *
  * @param soc - pointer to the soc
- * @param peer - peer handler
+ * @param vdev_id - id of vdev handle
+ * @param peer mac - peer mac address
  * @param sec_idx - mcast or ucast frame type.
  * @return - int
  */
 static inline int
-cdp_get_sec_type(ol_txrx_soc_handle soc, struct cdp_peer *peer, uint8_t sec_idx)
+cdp_get_sec_type(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
+		 uint8_t sec_idx)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
-			"%s invalid instance", __func__);
+			  "%s invalid instance", __func__);
 		QDF_BUG(0);
 		return A_ERROR;
 	}
@@ -677,33 +681,34 @@ cdp_get_sec_type(ol_txrx_soc_handle soc, struct cdp_peer *peer, uint8_t sec_idx)
 		return A_ERROR;
 
 	return soc->ops->ctrl_ops->txrx_get_sec_type
-			(peer, sec_idx);
+		(soc, vdev_id, peer_mac, sec_idx);
 }
 
 /**
   * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames
-  * @vdev_handle: vdev handle
+  * @param soc - pointer to the soc
+  * @vdev_id : id of vdev handle
   * @subtype_index: subtype
   * @tx_power: Tx power
-  * Return: None
+  * Return: QDF_STATUS
   */
-static inline int cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
-	struct cdp_vdev *vdev, uint8_t subtype, uint8_t tx_power)
+static inline QDF_STATUS
+cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
+		      uint8_t vdev_id, uint8_t subtype, uint8_t tx_power)
 {
 	if (!soc || !soc->ops) {
 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
 				"%s: Invalid Instance:", __func__);
 		QDF_BUG(0);
-		return 0;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (!soc->ops->ctrl_ops ||
 	    !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
-		return 0;
+		return QDF_STATUS_E_FAILURE;
 
-	soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(vdev,
+	return soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(soc, vdev_id,
 							subtype, tx_power);
-	return 0;
 }
 
 static inline void *
@@ -802,7 +807,7 @@ void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable)
 /**
  * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer
  * @soc: SOC TXRX handle
- * @pdev: CDP pdev pointer
+ * @pdev_id: id of CDP pdev pointer
  * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer
  * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer
  * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled
@@ -811,7 +816,7 @@ void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable)
  */
 static inline QDF_STATUS
 cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
-				   struct cdp_pdev *pdev,
+				   uint8_t pdev_id,
 				   bool is_rx_pkt_cap_enable,
 				   bool is_tx_pkt_cap_enable,
 				   uint8_t *peer_mac)
@@ -827,7 +832,8 @@ cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
 		return QDF_STATUS_E_FAILURE;
 
 	return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params
-			(pdev, is_rx_pkt_cap_enable, is_tx_pkt_cap_enable,
+			(soc, pdev_id, is_rx_pkt_cap_enable,
+			 is_tx_pkt_cap_enable,
 			 peer_mac);
 }
 #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */
@@ -837,7 +843,7 @@ cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
  * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol
  *                                    tag in CDP layer from cfg layer
  * @soc: SOC TXRX handle
- * @pdev: CDP pdev pointer
+ * @pdev_id: id of CDP pdev pointer
  * @protocol_mask: Bitmap for protocol for which tagging is enabled
  * @protocol_type: Protocol type for which the tag should be update
  * @tag: Actual tag value for the given prototype
@@ -845,7 +851,7 @@ cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
  */
 static inline QDF_STATUS
 cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc,
-				struct cdp_pdev *pdev, uint32_t protocol_mask,
+				uint8_t pdev_id, uint32_t protocol_mask,
 				uint16_t protocol_type, uint16_t tag)
 {
 	if (!soc || !soc->ops) {
@@ -859,7 +865,7 @@ cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc,
 		return QDF_STATUS_E_FAILURE;
 
 	return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag
-			(pdev, protocol_mask, protocol_type, tag);
+			(soc, pdev_id, protocol_mask, protocol_type, tag);
 }
 
 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
@@ -867,13 +873,13 @@ cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc,
  * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol
 				tag statistics for given or all protocols
  * @soc: SOC TXRX handle
- * @pdev: CDP pdev pointer
+ * @pdev_id: id of CDP pdev pointer
  * @protocol_type: Protocol type for which the tag should be update
  * Return: Returns QDF_STATUS_SUCCESS/FAILURE
  */
 static inline QDF_STATUS
 cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
-				    struct cdp_pdev *pdev,
+				    uint8_t pdev_id,
 				    uint16_t protocol_type)
 {
 	if (!soc || !soc->ops) {
@@ -886,7 +892,7 @@ cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
 	    !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats)
 		return QDF_STATUS_E_FAILURE;
 
-	soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(pdev,
+	soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(soc, pdev_id,
 						protocol_type);
 	return QDF_STATUS_SUCCESS;
 }
@@ -897,7 +903,7 @@ cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
 /**
   * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config
   * @soc: soc pointer
-  * @vdev: vdev pointer
+  * @vdev_id: id of vdev
   * @nac_cmd: specfies nac_rss config action add, del, list
   * @bssid: Neighbour bssid
   * @client_macaddr: Non-Associated client MAC
@@ -906,7 +912,7 @@ cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
   * Return: QDF_STATUS
   */
 static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
-		struct cdp_vdev *vdev, enum cdp_nac_param_cmd nac_cmd,
+		uint8_t vdev_id, enum cdp_nac_param_cmd nac_cmd,
 		char *bssid, char *client_macaddr, uint8_t chan_num)
 {
 	if (!soc || !soc->ops) {
@@ -920,21 +926,21 @@ static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
 			!soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi)
 		return QDF_STATUS_E_FAILURE;
 
-	return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(vdev,
+	return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(soc, vdev_id,
 			nac_cmd, bssid, client_macaddr, chan_num);
 }
 
 /*
  * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac
  * @soc: soc pointer
- * @vdev: vdev pointer
+ * @vdev_id: id of vdev
  * @macaddr: Non-Associated client MAC
  * @rssi: rssi
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
-						     struct cdp_vdev *vdev,
+						     uint8_t vdev_id,
 						     char *macaddr,
 						     uint8_t *rssi)
 {
@@ -949,7 +955,8 @@ static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
 	    !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi)
 		return QDF_STATUS_E_FAILURE;
 
-	return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(vdev, macaddr,
+	return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(soc, vdev_id,
+								macaddr,
 								rssi);
 }
 #endif
@@ -959,13 +966,13 @@ static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
  * cdp_set_rx_flow_tag() - wrapper function to set the flow
  *                         tag in CDP layer from cfg layer
  * @soc: SOC TXRX handle
- * @pdev: CDP pdev pointer
+ * @pdev_id: id of CDP pdev pointer
  * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted
  *
  * Return: Success when add/del operation is successful, error otherwise
  */
 static inline QDF_STATUS
-cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
+cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, uint8_t pdev_id,
 		    struct cdp_rx_flow_info *flow_info)
 {
 	if (!soc || !soc->ops) {
@@ -978,20 +985,21 @@ cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
 	    !soc->ops->ctrl_ops->txrx_set_rx_flow_tag)
 		return QDF_STATUS_E_FAILURE;
 
-	return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(pdev, flow_info);
+	return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(soc, pdev_id,
+				   flow_info);
 }
 
 /**
  * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow
  *                                tag statistics for given flow
  * @soc: SOC TXRX handle
- * @pdev: CDP pdev pointer
+ * @pdev_id: id of CDP pdev
  * @flow_info: Flow tuple for which we want to print the statistics
  *
  * Return: Success when flow is found and stats are printed, error otherwise
  */
 static inline QDF_STATUS
-cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
+cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
 			   struct cdp_rx_flow_info *flow_info)
 {
 	if (!soc || !soc->ops) {
@@ -1004,7 +1012,9 @@ cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
 	    !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats)
 		return QDF_STATUS_E_FAILURE;
 
-	return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(pdev, flow_info);
+	return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(soc,
+								pdev_id,
+								flow_info);
 }
 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
 #endif /* _CDP_TXRX_CTRL_H_ */

+ 47 - 30
dp/inc/cdp_txrx_ops.h

@@ -539,7 +539,7 @@ struct cdp_ctrl_ops {
 				uint32_t val);
 	int
 		(*txrx_update_filter_neighbour_peers)(
-				struct cdp_vdev *vdev,
+				struct cdp_soc_t *soc, uint8_t vdev_id,
 				uint32_t cmd, uint8_t *macaddr);
 	/**
 	 * @brief set the safemode of the device
@@ -643,7 +643,7 @@ struct cdp_ctrl_ops {
 
 	void (*tx_flush_buffers)(struct cdp_vdev *vdev);
 
-	int (*txrx_is_target_ar900b)(struct cdp_vdev *vdev);
+	int (*txrx_is_target_ar900b)(struct cdp_soc_t *soc_hdl);
 
 	void (*txrx_set_vdev_param)(struct cdp_vdev *vdev,
 			enum cdp_vdev_param_type param, uint32_t val);
@@ -655,11 +655,14 @@ struct cdp_ctrl_ops {
 	 *  Set the reo destination ring no on which we will receive
 	 *  pkts for this radio.
 	 *
-	 * @param pdev - the data physical device object
+	 * @txrx_soc - soc handle
+	 * @param pdev_id - id of physical device
+	 * @return the reo destination ring number
 	 * @param reo_dest_ring_num - value ranges between 1 - 4
 	 */
-	void (*txrx_set_pdev_reo_dest)(
-			struct cdp_pdev *pdev,
+	QDF_STATUS (*txrx_set_pdev_reo_dest)(
+			struct cdp_soc_t *txrx_soc,
+			uint8_t pdev_id,
 			enum cdp_host_reo_dest_ring reo_dest_ring_num);
 
 	/**
@@ -668,21 +671,26 @@ struct cdp_ctrl_ops {
 	 *  Get the reo destination ring no on which we will receive
 	 *  pkts for this radio.
 	 *
-	 * @param pdev - the data physical device object
+	 * @txrx_soc - soc handle
+	 * @param pdev_id - id of physical device
 	 * @return the reo destination ring number
 	 */
 	enum cdp_host_reo_dest_ring (*txrx_get_pdev_reo_dest)(
-						struct cdp_pdev *pdev);
+				     struct cdp_soc_t *txrx_soc,
+				     uint8_t pdev_id);
 
-	int (*txrx_wdi_event_sub)(struct cdp_pdev *pdev, void *event_cb_sub,
-			uint32_t event);
+	int (*txrx_wdi_event_sub)(struct cdp_soc_t *soc, uint8_t pdev_id,
+				  wdi_event_subscribe *event_cb_sub,
+				  uint32_t event);
 
-	int (*txrx_wdi_event_unsub)(struct cdp_pdev *pdev, void *event_cb_sub,
-			uint32_t event);
-	int (*txrx_get_sec_type)(struct cdp_peer *peer, uint8_t sec_idx);
+	int (*txrx_wdi_event_unsub)(struct cdp_soc_t *soc, uint8_t pdev_id,
+				    wdi_event_subscribe *event_cb_sub,
+				    uint32_t event);
 
-	void (*txrx_update_mgmt_txpow_vdev)(struct cdp_vdev *vdev,
-			uint8_t subtype, uint8_t tx_power);
+	QDF_STATUS
+	(*txrx_update_mgmt_txpow_vdev)(struct cdp_soc_t *soc,
+				       uint8_t vdev_id,
+				       uint8_t subtype, uint8_t tx_power);
 
 	/**
 	 * txrx_set_pdev_param() - callback to set pdev parameter
@@ -698,49 +706,58 @@ struct cdp_ctrl_ops {
 	void * (*txrx_get_pldev)(struct cdp_pdev *pdev);
 
 #ifdef ATH_SUPPORT_NAC_RSSI
-	QDF_STATUS (*txrx_vdev_config_for_nac_rssi)(struct cdp_vdev *vdev,
-		enum cdp_nac_param_cmd cmd, char *bssid, char *client_macaddr,
-		uint8_t chan_num);
-	QDF_STATUS (*txrx_vdev_get_neighbour_rssi)(struct cdp_vdev *vdev,
+	QDF_STATUS (*txrx_vdev_config_for_nac_rssi)(struct cdp_soc_t *cdp_soc,
+						    uint8_t vdev_id,
+						    enum cdp_nac_param_cmd cmd,
+						    char *bssid,
+						    char *client_macaddr,
+						    uint8_t chan_num);
+
+	QDF_STATUS (*txrx_vdev_get_neighbour_rssi)(struct cdp_soc_t *cdp_soc,
+						   uint8_t vdev_id,
 						   char *macaddr,
 						   uint8_t *rssi);
 #endif
-	void (*set_key)(struct cdp_peer *peer_handle,
-			bool is_unicast, uint32_t *key);
+	QDF_STATUS
+	(*set_key)(struct cdp_soc_t *soc, uint8_t vdev_id, uint8_t *mac,
+		   bool is_unicast, uint32_t *key);
 
 	uint32_t (*txrx_get_vdev_param)(struct cdp_vdev *vdev,
 					enum cdp_vdev_param_type param);
-	int (*enable_peer_based_pktlog)(struct cdp_pdev
-			*txrx_pdev_handle, char *macaddr, uint8_t enb_dsb);
+	int (*enable_peer_based_pktlog)(struct cdp_soc_t *cdp_soc,
+					uint8_t pdev_id,
+					uint8_t *macaddr, uint8_t enb_dsb);
 
-	void (*calculate_delay_stats)(struct cdp_vdev *vdev, qdf_nbuf_t nbuf);
+	QDF_STATUS
+	(*calculate_delay_stats)(struct cdp_soc_t *cdp_soc,
+				 uint8_t vdev_id, qdf_nbuf_t nbuf);
 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
 	QDF_STATUS (*txrx_update_pdev_rx_protocol_tag)(
-			struct cdp_pdev *txrx_pdev_handle,
+			struct cdp_soc_t  *soc, uint8_t pdev_id,
 			uint32_t protocol_mask, uint16_t protocol_type,
 			uint16_t tag);
 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
 	void (*txrx_dump_pdev_rx_protocol_tag_stats)(
-				struct cdp_pdev *txrx_pdev_handle,
+				struct cdp_soc_t  *soc, uint8_t pdev_id,
 				uint16_t protocol_type);
 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
 #ifdef WLAN_SUPPORT_RX_FLOW_TAG
 	QDF_STATUS (*txrx_set_rx_flow_tag)(
-		struct cdp_pdev *txrx_pdev_handle,
+		struct cdp_soc_t *cdp_soc, uint8_t pdev_id,
 		struct cdp_rx_flow_info *flow_info);
 	QDF_STATUS (*txrx_dump_rx_flow_tag_stats)(
-		struct cdp_pdev *txrx_pdev_handle,
+		struct cdp_soc_t *cdp_soc, uint8_t pdev_id,
 		struct cdp_rx_flow_info *flow_info);
 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
 #ifdef QCA_MULTIPASS_SUPPORT
-	void (*txrx_peer_set_vlan_id)(ol_txrx_soc_handle soc,
-				      struct cdp_vdev *vdev, uint8_t *peer_mac,
+	void (*txrx_peer_set_vlan_id)(struct cdp_soc_t *cdp_soc,
+				      uint8_t vdev_id, uint8_t *peer_mac,
 				      uint16_t vlan_id);
 #endif
 #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH)
 	QDF_STATUS (*txrx_update_peer_pkt_capture_params)(
-			struct cdp_pdev *txrx_pdev_handle,
+			ol_txrx_soc_handle soc, uint8_t pdev_id,
 			bool is_rx_pkt_cap_enable, bool is_tx_pkt_cap_enable,
 			uint8_t *peer_mac);
 #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */

+ 17 - 14
dp/wifi3.0/dp_internal.h

@@ -1028,8 +1028,11 @@ dp_set_pn_check_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
 		      uint32_t *rx_pn);
 
 void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id);
-void dp_set_michael_key(struct cdp_peer *peer_handle,
-			bool is_unicast, uint32_t *key);
+
+QDF_STATUS
+dp_set_michael_key(struct cdp_soc_t *soc, uint8_t vdev_id,
+		   uint8_t *peer_mac,
+		   bool is_unicast, uint32_t *key);
 
 /**
  * dp_check_pdev_exists() - Validate pdev before use
@@ -1377,13 +1380,13 @@ QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
 				uint32_t stats_type_upload_mask,
 				uint8_t mac_id);
 
-int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
-	void *event_cb_sub_handle,
-	uint32_t event);
+int dp_wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
+		       wdi_event_subscribe *event_cb_sub_handle,
+		       uint32_t event);
 
-int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
-	void *event_cb_sub_handle,
-	uint32_t event);
+int dp_wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
+		     wdi_event_subscribe *event_cb_sub_handle,
+		     uint32_t event);
 
 void dp_wdi_event_handler(enum WDI_EVENT event, struct dp_soc *soc,
 			  void *data, u_int16_t peer_id,
@@ -1418,16 +1421,16 @@ dp_hif_update_pipe_callback(struct dp_soc *dp_soc,
 QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev, struct dp_peer *peer);
 
 #else
-static inline int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
-	void *event_cb_sub_handle,
-	uint32_t event)
+static inline int dp_wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
+				     wdi_event_subscribe *event_cb_sub_handle,
+				     uint32_t event)
 {
 	return 0;
 }
 
-static inline int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
-	void *event_cb_sub_handle,
-	uint32_t event)
+static inline int dp_wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
+				   wdi_event_subscribe *event_cb_sub_handle,
+				   uint32_t event)
 {
 	return 0;
 }

+ 100 - 44
dp/wifi3.0/dp_main.c

@@ -5943,30 +5943,41 @@ static void dp_get_ba_aging_timeout(struct cdp_soc_t *txrx_soc,
 
 /*
  * dp_set_pdev_reo_dest() - set the reo destination ring for this pdev
- * @pdev_handle: physical device object
+ * @txrx_soc: cdp soc handle
+ * @pdev_id: id of physical device object
  * @val: reo destination ring index (1 - 4)
  *
- * Return: void
+ * Return: QDF_STATUS
  */
-static void dp_set_pdev_reo_dest(struct cdp_pdev *pdev_handle,
-	 enum cdp_host_reo_dest_ring val)
+static QDF_STATUS
+dp_set_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id,
+		     enum cdp_host_reo_dest_ring val)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)txrx_soc,
+						   pdev_id);
 
-	if (pdev)
+	if (pdev) {
 		pdev->reo_dest = val;
+		return QDF_STATUS_SUCCESS;
+	}
+
+	return QDF_STATUS_E_FAILURE;
 }
 
 /*
  * dp_get_pdev_reo_dest() - get the reo destination for this pdev
- * @pdev_handle: physical device object
+ * @txrx_soc: cdp soc handle
+ * @pdev_id: id of physical device object
  *
  * Return: reo destination ring index
  */
 static enum cdp_host_reo_dest_ring
-dp_get_pdev_reo_dest(struct cdp_pdev *pdev_handle)
+dp_get_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)txrx_soc,
+						   pdev_id);
 
 	if (pdev)
 		return pdev->reo_dest;
@@ -5996,20 +6007,29 @@ static int dp_set_filter_neighbour_peers(struct cdp_pdev *pdev_handle,
 /*
  * dp_update_filter_neighbour_peers() - set neighbour peers(nac clients)
  * address for smart mesh filtering
- * @vdev_handle: virtual device object
+ * @txrx_soc: cdp soc handle
+ * @vdev_id: id of virtual device object
  * @cmd: Add/Del command
  * @macaddr: nac client mac address
  *
- * Return: void
+ * Return: success/failure
  */
-static int dp_update_filter_neighbour_peers(struct cdp_vdev *vdev_handle,
+static int dp_update_filter_neighbour_peers(struct cdp_soc_t *soc,
+					    uint8_t vdev_id,
 					    uint32_t cmd, uint8_t *macaddr)
 {
-	struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle;
-	struct dp_pdev *pdev = vdev->pdev;
+	struct dp_pdev *pdev;
 	struct dp_neighbour_peer *peer = NULL;
+	struct dp_vdev *vdev =
+		dp_get_vdev_from_soc_vdev_id_wifi3((struct dp_soc *)soc,
+						   vdev_id);
+
+	if (!vdev || !macaddr)
+		goto fail0;
 
-	if (!macaddr)
+	pdev = vdev->pdev;
+
+	if (!pdev)
 		goto fail0;
 
 	/* Store address of NAC (neighbour peer) which will be checked
@@ -6077,16 +6097,31 @@ fail0:
 
 /*
  * dp_get_sec_type() - Get the security type
- * @peer:		Datapath peer handle
+ * @soc: soc handle
+ * @vdev_id: id of dp handle
+ * @peer_mac: mac of datapath PEER handle
  * @sec_idx:    Security id (mcast, ucast)
  *
  * return sec_type: Security type
  */
-static int dp_get_sec_type(struct cdp_peer *peer, uint8_t sec_idx)
+static int dp_get_sec_type(struct cdp_soc_t *soc, uint8_t vdev_id,
+			   uint8_t *peer_mac, uint8_t sec_idx)
 {
-	struct dp_peer *dpeer = (struct dp_peer *)peer;
+	int sec_type = 0;
+	struct dp_peer *peer = dp_peer_find_hash_find((struct dp_soc *)soc,
+						       peer_mac, 0, vdev_id);
+
+	if (!peer || peer->delete_in_progress) {
+		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
+			  "%s: Peer is NULL!\n", __func__);
+		goto fail;
+	}
 
-	return dpeer->security[sec_idx].sec_type;
+	sec_type = peer->security[sec_idx].sec_type;
+fail:
+	if (peer)
+		dp_peer_unref_delete(peer);
+	return sec_type;
 }
 
 /*
@@ -9377,27 +9412,36 @@ static QDF_STATUS dp_vdev_get_neighbour_rssi(struct cdp_vdev *vdev_hdl,
 	return status;
 }
 
-static QDF_STATUS dp_config_for_nac_rssi(struct cdp_vdev *vdev_handle,
-		enum cdp_nac_param_cmd cmd, char *bssid, char *client_macaddr,
-		uint8_t chan_num)
+static QDF_STATUS
+dp_config_for_nac_rssi(struct cdp_soc_t *cdp_soc,
+		       uint8_t vdev_id,
+		       enum cdp_nac_param_cmd cmd, char *bssid,
+		       char *client_macaddr,
+		       uint8_t chan_num)
 {
+	struct dp_soc *soc = (struct dp_soc *)cdp_soc;
+	struct dp_vdev *vdev =
+		dp_get_vdev_from_soc_vdev_id_wifi3(soc,
+						   vdev_id);
+	struct dp_pdev *pdev;
 
-	struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle;
-	struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev;
-	struct dp_soc *soc = (struct dp_soc *) vdev->pdev->soc;
+	if (!vdev)
+		return QDF_STATUS_E_FAILURE;
 
+	pdev = (struct dp_pdev *)vdev->pdev;
 	pdev->nac_rssi_filtering = 1;
 	/* Store address of NAC (neighbour peer) which will be checked
 	 * against TA of received packets.
 	 */
 
 	if (cmd == CDP_NAC_PARAM_ADD) {
-		dp_update_filter_neighbour_peers(vdev_handle, DP_NAC_PARAM_ADD,
-						 client_macaddr);
+		dp_update_filter_neighbour_peers(cdp_soc, vdev->vdev_id,
+						 DP_NAC_PARAM_ADD,
+						 (uint8_t *)client_macaddr);
 	} else if (cmd == CDP_NAC_PARAM_DEL) {
-		dp_update_filter_neighbour_peers(vdev_handle,
+		dp_update_filter_neighbour_peers(cdp_soc, vdev->vdev_id,
 						 DP_NAC_PARAM_DEL,
-						 client_macaddr);
+						 (uint8_t *)client_macaddr);
 	}
 
 	if (soc->cdp_soc.ol_ops->config_bssid_in_fw_for_nac_rssi)
@@ -9412,21 +9456,29 @@ static QDF_STATUS dp_config_for_nac_rssi(struct cdp_vdev *vdev_handle,
 /**
  * dp_enable_peer_based_pktlog() - Set Flag for peer based filtering
  * for pktlog
- * @txrx_pdev_handle: cdp_pdev handle
+ * @soc: cdp_soc handle
+ * @pdev_id: id of dp pdev handle
+ * @mac_addr: Peer mac address
  * @enb_dsb: Enable or disable peer based filtering
  *
  * Return: QDF_STATUS
  */
 static int
-dp_enable_peer_based_pktlog(
-	struct cdp_pdev *txrx_pdev_handle,
-	char *mac_addr, uint8_t enb_dsb)
+dp_enable_peer_based_pktlog(struct cdp_soc_t *soc, uint8_t pdev_id,
+			    uint8_t *mac_addr, uint8_t enb_dsb)
 {
 	struct dp_peer *peer;
-	struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev_handle;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
 
-	peer = (struct dp_peer *)dp_find_peer_by_addr(txrx_pdev_handle,
-			mac_addr);
+	if (!pdev) {
+		dp_err("Invalid Pdev for pdev_id %d", pdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	peer = (struct dp_peer *)dp_find_peer_by_addr((struct cdp_pdev *)pdev,
+						      mac_addr);
 
 	if (!peer) {
 		dp_err("Invalid Peer");
@@ -9443,13 +9495,14 @@ dp_enable_peer_based_pktlog(
 /**
  * dp_dump_pdev_rx_protocol_tag_stats - dump the number of packets tagged for
  * given protocol type (RX_PROTOCOL_TAG_ALL indicates for all protocol)
- * @pdev_handle: cdp_pdev handle
+ * @soc: cdp_soc handle
+ * @pdev_id: id of cdp_pdev handle
  * @protocol_type: protocol type for which stats should be displayed
  *
  * Return: none
  */
 static inline void
-dp_dump_pdev_rx_protocol_tag_stats(struct cdp_pdev *pdev_handle,
+dp_dump_pdev_rx_protocol_tag_stats(struct cdp_soc_t  *soc, uint8_t pdev_id,
 				   uint16_t protocol_type)
 {
 }
@@ -9459,7 +9512,8 @@ dp_dump_pdev_rx_protocol_tag_stats(struct cdp_pdev *pdev_handle,
 /**
  * dp_update_pdev_rx_protocol_tag - Add/remove a protocol tag that should be
  * applied to the desired protocol type packets
- * @txrx_pdev_handle: cdp_pdev handle
+ * @soc: soc handle
+ * @pdev_id: id of cdp_pdev handle
  * @enable_rx_protocol_tag - bitmask that indicates what protocol types
  * are enabled for tagging. zero indicates disable feature, non-zero indicates
  * enable feature
@@ -9469,7 +9523,7 @@ dp_dump_pdev_rx_protocol_tag_stats(struct cdp_pdev *pdev_handle,
  * Return: Success
  */
 static inline QDF_STATUS
-dp_update_pdev_rx_protocol_tag(struct cdp_pdev *pdev_handle,
+dp_update_pdev_rx_protocol_tag(struct cdp_soc_t  *soc, uint8_t pdev_id,
 			       uint32_t enable_rx_protocol_tag,
 			       uint16_t protocol_type,
 			       uint16_t tag)
@@ -9481,13 +9535,14 @@ dp_update_pdev_rx_protocol_tag(struct cdp_pdev *pdev_handle,
 #ifndef WLAN_SUPPORT_RX_FLOW_TAG
 /**
  * dp_set_rx_flow_tag - add/delete a flow
- * @pdev_handle: cdp_pdev handle
+ * @soc: soc handle
+ * @pdev_id: id of cdp_pdev handle
  * @flow_info: flow tuple that is to be added to/deleted from flow search table
  *
  * Return: Success
  */
 static inline QDF_STATUS
-dp_set_rx_flow_tag(struct cdp_pdev *pdev_handle,
+dp_set_rx_flow_tag(struct cdp_soc_t *cdp_soc, uint8_t pdev_id,
 		   struct cdp_rx_flow_info *flow_info)
 {
 	return QDF_STATUS_SUCCESS;
@@ -9495,13 +9550,14 @@ dp_set_rx_flow_tag(struct cdp_pdev *pdev_handle,
 /**
  * dp_dump_rx_flow_tag_stats - dump the number of packets tagged for
  * given flow 5-tuple
- * @pdev_handle: cdp_pdev handle
+ * @cdp_soc: soc handle
+ * @pdev_id: id of cdp_pdev handle
  * @flow_info: flow 5-tuple for which stats should be displayed
  *
  * Return: Success
  */
 static inline QDF_STATUS
-dp_dump_rx_flow_tag_stats(struct cdp_pdev *pdev_handle,
+dp_dump_rx_flow_tag_stats(struct cdp_soc_t *cdp_soc, uint8_t pdev_id,
 			  struct cdp_rx_flow_info *flow_info)
 {
 	return QDF_STATUS_SUCCESS;

+ 17 - 5
dp/wifi3.0/dp_peer.c

@@ -3511,20 +3511,32 @@ void dp_peer_rxtid_stats(struct dp_peer *peer, void (*dp_stats_cmd_cb),
 	}
 }
 
-void dp_set_michael_key(struct cdp_peer *peer_handle,
-			bool is_unicast, uint32_t *key)
+QDF_STATUS
+dp_set_michael_key(struct cdp_soc_t *soc,
+		   uint8_t vdev_id,
+		   uint8_t *peer_mac,
+		   bool is_unicast, uint32_t *key)
 {
-	struct dp_peer *peer =  (struct dp_peer *)peer_handle;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	uint8_t sec_index = is_unicast ? 1 : 0;
+	struct dp_peer *peer = dp_peer_find_hash_find((struct dp_soc *)soc,
+						      peer_mac, 0, vdev_id);
 
-	if (!peer) {
+	if (!peer || peer->delete_in_progress) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
 			  "peer not found ");
-		return;
+		status = QDF_STATUS_E_FAILURE;
+		goto fail;
 	}
 
 	qdf_mem_copy(&peer->security[sec_index].michael_key[0],
 		     key, IEEE80211_WEP_MICLEN);
+
+fail:
+	if (peer)
+		dp_peer_unref_delete(peer);
+
+	return status;
 }
 
 bool dp_peer_find_by_id_valid(struct dp_soc *soc, uint16_t peer_id)

+ 9 - 3
dp/wifi3.0/dp_tx.c

@@ -2075,7 +2075,8 @@ __dp_tx_send_exception(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf,
 
 /**
  * dp_tx_send_exception() - Transmit a frame on a given VAP in exception path
- * @vap_dev: DP vdev handle
+ * @soc: DP soc handle
+ * @vdev_id: id of DP vdev handle
  * @nbuf: skb
  * @tx_exc_metadata: Handle that holds exception path meta data
  *
@@ -2086,13 +2087,18 @@ __dp_tx_send_exception(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf,
  *         nbuf when it fails to send
  */
 qdf_nbuf_t
-dp_tx_send_exception(struct cdp_vdev *vap_dev, qdf_nbuf_t nbuf,
+dp_tx_send_exception(struct cdp_soc_t *soc, uint8_t vdev_id, qdf_nbuf_t nbuf,
 		     struct cdp_tx_exception_metadata *tx_exc_metadata)
 {
 	qdf_ether_header_t *eh = NULL;
-	struct dp_vdev *vdev = (struct dp_vdev *) vap_dev;
+	struct dp_vdev *vdev =
+		dp_get_vdev_from_soc_vdev_id_wifi3((struct dp_soc *)soc,
+						   vdev_id);
 	struct dp_tx_msdu_info_s msdu_info;
 
+	if (qdf_unlikely(!vdev))
+		goto fail;
+
 	qdf_mem_zero(&msdu_info, sizeof(msdu_info));
 
 	if (!tx_exc_metadata)

+ 17 - 11
dp/wifi3.0/dp_wdi_event.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
@@ -149,7 +149,8 @@ dp_wdi_event_handler(
 
 /*
  * dp_wdi_event_sub() - Subscribe WDI event
- * @txrx_pdev_handle: cdp_pdev handle
+ * @soc: soc handle
+ * @pdev_id: id of pdev
  * @event_cb_sub_handle: subcribe evnet handle
  * @event: Event to be subscribe
  *
@@ -157,13 +158,15 @@ dp_wdi_event_handler(
  */
 int
 dp_wdi_event_sub(
-	struct cdp_pdev *txrx_pdev_handle,
-	void *event_cb_sub_handle,
+	struct cdp_soc_t *soc, uint8_t pdev_id,
+	wdi_event_subscribe *event_cb_sub_handle,
 	uint32_t event)
 {
 	uint32_t event_index;
 	wdi_event_subscribe *wdi_sub;
-	struct dp_pdev *txrx_pdev = (struct dp_pdev *)txrx_pdev_handle;
+	struct dp_pdev *txrx_pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
 	wdi_event_subscribe *event_cb_sub =
 		(wdi_event_subscribe *) event_cb_sub_handle;
 
@@ -206,7 +209,8 @@ dp_wdi_event_sub(
 
 /*
  * dp_wdi_event_unsub() - WDI event unsubscribe
- * @txrx_pdev_handle: cdp_pdev handle
+ * @soc: soc handle
+ * @pdev_id: id of pdev
  * @event_cb_sub_handle: subscribed event handle
  * @event: Event to be unsubscribe
  *
@@ -215,18 +219,20 @@ dp_wdi_event_sub(
  */
 int
 dp_wdi_event_unsub(
-	struct cdp_pdev *txrx_pdev_handle,
-	void *event_cb_sub_handle,
+	struct cdp_soc_t *soc, uint8_t pdev_id,
+	wdi_event_subscribe *event_cb_sub_handle,
 	uint32_t event)
 {
 	uint32_t event_index = event - WDI_EVENT_BASE;
-	struct dp_pdev *txrx_pdev = (struct dp_pdev *)txrx_pdev_handle;
+	struct dp_pdev *txrx_pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
 	wdi_event_subscribe *event_cb_sub =
 		(wdi_event_subscribe *) event_cb_sub_handle;
 
-	if (!event_cb_sub) {
+	if (!txrx_pdev || !event_cb_sub) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
-			"Invalid callback in %s", __func__);
+			"Invalid callback or pdev in %s", __func__);
 		return -EINVAL;
 	}