Selaa lähdekoodia

qca-wifi: umac-dp decoupling changes in ctrl_ops for datapath

Modify datapath APIs to make sure they do not need
to receive dp handles from umac interface.

Change-Id: I0979795a6356a29394daa2719dfbd36cdde3d0e2
Pavankumar Nandeshwar 6 vuotta sitten
vanhempi
sitoutus
5ccd5a8727

+ 1 - 2
dp/inc/dp_rate_stats.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-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
@@ -84,7 +84,6 @@ struct wlan_peer_rate_stats_ctx {
 	struct wlan_peer_rx_rate_stats rx;
 	uint8_t mac_addr[WLAN_MAC_ADDR_LEN];
 	uint64_t peer_cookie;
-	struct cdp_pdev *pdev;
 	uint8_t pdev_id;
 };
 

+ 4 - 7
dp/wifi3.0/dp_rx_mon_feature.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
@@ -597,9 +597,8 @@ dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
  * Return: 0 for success. nonzero for failure.
  */
 QDF_STATUS
-dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, uint32_t val)
+dp_config_enh_rx_capture(struct dp_pdev *pdev, uint32_t val)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
 	uint8_t rx_cap_mode = (val & CDP_RX_ENH_CAPTURE_MODE_MASK);
 	uint32_t rx_enh_capture_peer;
 	bool is_mpdu_hdr = false;
@@ -625,7 +624,7 @@ dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, uint32_t val)
 		pdev->rx_enh_monitor_vdev = pdev->monitor_vdev;
 	}
 
-	dp_reset_monitor_mode(pdev_handle);
+	dp_reset_monitor_mode((struct cdp_soc_t *)pdev->soc, pdev->pdev_id);
 
 	if (pdev->rx_enh_capture_mode != CDP_RX_ENH_CAPTURE_DISABLED &&
 	    rx_cap_mode == CDP_RX_ENH_CAPTURE_DISABLED) {
@@ -647,10 +646,8 @@ dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, uint32_t val)
 }
 
 void
-dp_peer_set_rx_capture_enabled(struct cdp_peer *peer_handle, bool value)
+dp_peer_set_rx_capture_enabled(struct dp_peer *peer, bool value)
 {
-	struct dp_peer *peer = (struct dp_peer *)peer_handle;
-
 	peer->rx_cap_enabled = value;
 }
 #endif /* WLAN_RX_PKT_CAPTURE_ENH */

+ 4 - 4
dp/wifi3.0/dp_rx_mon_feature.h

@@ -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
@@ -66,13 +66,13 @@ dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
 
 /*
  * dp_config_enh_rx_capture()- API to enable/disable enhanced rx capture
- * @pdev_handle: DP_PDEV handle
+ * @pdev: DP_PDEV handle
  * @val: user provided value
  *
  * Return: 0 for success. nonzero for failure.
  */
 QDF_STATUS
-dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, uint8_t val);
+dp_config_enh_rx_capture(struct dp_pdev *pdev, uint8_t val);
 
 /**
  * dp_peer_set_rx_capture_enabled: Set rx_cap_enabled bit in peer
@@ -82,6 +82,6 @@ dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, uint8_t val);
  * Return: None
  */
 void
-dp_peer_set_rx_capture_enabled(struct cdp_peer *peer_handle, bool value);
+dp_peer_set_rx_capture_enabled(struct dp_peer *peer, bool value);
 #endif /* WLAN_RX_PKT_CAPTURE_ENH */
 #endif /* _DP_RX_MON_FEATURE_H_ */

+ 71 - 31
dp/wifi3.0/dp_rx_tag.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-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
@@ -321,15 +321,14 @@ void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
 /**
  * dp_summarize_tag_stats - sums up the given protocol type's counters
  * across all the rings and dumps the same
- * @pdev_handle: cdp_pdev handle
+ * @pdev: dp_pdev handle
  * @protocol_type: protocol type for which stats should be displayed
  *
  * Return: none
  */
-uint64_t dp_summarize_tag_stats(struct cdp_pdev *pdev_handle,
+uint64_t dp_summarize_tag_stats(struct dp_pdev *pdev,
 				uint16_t protocol_type)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
 	uint8_t ring_idx;
 	uint64_t total_tag_cnt = 0;
 
@@ -348,16 +347,23 @@ uint64_t dp_summarize_tag_stats(struct cdp_pdev *pdev_handle,
 /**
  * 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
  */
 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)
 {
 	uint16_t proto_idx;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
+
+	if (!pdev)
+		return;
 
 	if (protocol_type != RX_PROTOCOL_TAG_ALL &&
 	    protocol_type >= RX_PROTOCOL_TAG_MAX) {
@@ -367,57 +373,76 @@ dp_dump_pdev_rx_protocol_tag_stats(struct cdp_pdev *pdev_handle,
 
 	/* protocol_type in [0 ... RX_PROTOCOL_TAG_MAX] */
 	if (protocol_type != RX_PROTOCOL_TAG_ALL) {
-		dp_summarize_tag_stats(pdev_handle, protocol_type);
+		dp_summarize_tag_stats(pdev, protocol_type);
 		return;
 	}
 
 	/* protocol_type == RX_PROTOCOL_TAG_ALL */
 	for (proto_idx = 0; proto_idx < RX_PROTOCOL_TAG_MAX; proto_idx++)
-		dp_summarize_tag_stats(pdev_handle, proto_idx);
+		dp_summarize_tag_stats(pdev, proto_idx);
 }
 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
 
 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
+static void
+__dp_reset_pdev_rx_protocol_tag_stats(struct dp_pdev *pdev,
+				      uint16_t protocol_type)
+{
+	uint8_t ring_idx;
+
+	for (ring_idx = 0; ring_idx < MAX_REO_DEST_RINGS; ring_idx++)
+		pdev->reo_proto_tag_stats[ring_idx][protocol_type].tag_ctr = 0;
+	pdev->rx_err_proto_tag_stats[protocol_type].tag_ctr = 0;
+}
+
 /**
  * dp_reset_pdev_rx_protocol_tag_stats - resets the stats counters for
  * given protocol type
- * @pdev_handle: cdp_pdev handle
+ * @soc: soc handle
+ * @pdev_id: id of cdp_pdev handle
  * @protocol_type: protocol type for which stats should be reset
  *
  * Return: none
  */
-void
-dp_reset_pdev_rx_protocol_tag_stats(struct cdp_pdev *pdev_handle,
+static void
+dp_reset_pdev_rx_protocol_tag_stats(struct cdp_soc_t  *soc, uint8_t pdev_id,
 				    uint16_t protocol_type)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
-	uint8_t ring_idx;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
+	if (!pdev)
+		return;
 
-	for (ring_idx = 0; ring_idx < MAX_REO_DEST_RINGS; ring_idx++)
-		pdev->reo_proto_tag_stats[ring_idx][protocol_type].tag_ctr = 0;
-	pdev->rx_err_proto_tag_stats[protocol_type].tag_ctr = 0;
+	__dp_reset_pdev_rx_protocol_tag_stats(pdev, protocol_type);
 }
 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
 
 /**
  * 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
  * @protocol_type: new protocol type for which the tag is being added
  * @tag: user configured tag for the new protocol
  *
- * Return: QDF_STATUS
+ * Return: Success
  */
 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)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
+	if (!pdev)
+		return QDF_STATUS_E_FAILURE;
+
 	/*
 	 * dynamically enable/disable tagging based on enable_rx_protocol_tag
 	 * flag.
@@ -434,7 +459,7 @@ dp_update_pdev_rx_protocol_tag(struct cdp_pdev *pdev_handle,
 	}
 
 	/** Reset stats counter across all rings for given protocol */
-	dp_reset_pdev_rx_protocol_tag_stats(pdev_handle, protocol_type);
+	__dp_reset_pdev_rx_protocol_tag_stats(pdev, protocol_type);
 
 	pdev->rx_proto_tag_map[protocol_type].tag = tag;
 
@@ -445,17 +470,25 @@ dp_update_pdev_rx_protocol_tag(struct cdp_pdev *pdev_handle,
 #ifdef 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: 0 for success, nonzero for failure
+ * Return: Success
  */
 QDF_STATUS
-dp_set_rx_flow_tag(struct cdp_pdev *pdev_handle,
+dp_set_rx_flow_tag(struct cdp_soc_t *soc, uint8_t pdev_id,
 		   struct cdp_rx_flow_info *flow_info)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
-	struct wlan_cfg_dp_soc_ctxt *cfg = pdev->soc->wlan_cfg_ctx;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
+	struct wlan_cfg_dp_soc_ctxt *cfg;
+
+	if (qdf_unlikely(!pdev))
+		return QDF_STATUS_E_FAILURE;
+
+	cfg = pdev->soc->wlan_cfg_ctx;
 
 	if (qdf_unlikely(!wlan_cfg_is_rx_flow_tag_enabled(cfg))) {
 		dp_err("RX Flow tag feature disabled");
@@ -473,20 +506,27 @@ 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: 0 for success, nonzero for failure
+ * Return: Success
  */
 QDF_STATUS
-dp_dump_rx_flow_tag_stats(struct cdp_pdev *pdev_handle,
+dp_dump_rx_flow_tag_stats(struct cdp_soc_t *soc, uint8_t pdev_id,
 			  struct cdp_rx_flow_info *flow_info)
 {
 	QDF_STATUS status;
 	struct cdp_flow_stats stats;
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
-	struct wlan_cfg_dp_soc_ctxt *cfg = pdev->soc->wlan_cfg_ctx;
+	struct wlan_cfg_dp_soc_ctxt *cfg;
+	struct dp_pdev *pdev =
+		dp_get_pdev_from_soc_pdev_id_wifi3((struct dp_soc *)soc,
+						   pdev_id);
+
+	if (!pdev)
+		return QDF_STATUS_E_FAILURE;
 
+	cfg = pdev->soc->wlan_cfg_ctx;
 	if (qdf_unlikely(!wlan_cfg_is_rx_flow_tag_enabled(cfg))) {
 		dp_err("RX Flow tag feature disabled");
 		return QDF_STATUS_E_NOSUPPORT;

+ 14 - 11
dp/wifi3.0/dp_rx_tag.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-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
@@ -26,17 +26,18 @@
 /**
  * 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
  * @protocol_type: new protocol type for which the tag is being added
  * @tag: user configured tag for the new protocol
  *
- * Return: QDF_STATUS
+ * Return: Success
  */
 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);
@@ -69,7 +70,7 @@ dp_rx_update_protocol_tag(struct dp_soc *soc, struct dp_vdev *vdev,
  * Return: none
  */
 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);
 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
@@ -92,25 +93,27 @@ dp_rx_update_flow_tag(struct dp_soc *soc, struct dp_vdev *vdev,
 
 /**
  * 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: 0 for success, nonzero for failure
+ * Return: Success
  */
 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);
 
 /**
  * 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: 0 for success, nonzero for failure
+ * Return: Success
  */
 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);
 
 /**

+ 4 - 7
dp/wifi3.0/dp_tx_capture.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
@@ -709,9 +709,8 @@ static void  dp_iterate_free_peer_msdu_q(void *pdev_hdl)
  * Return: QDF_STATUS
  */
 QDF_STATUS
-dp_config_enh_tx_capture(struct cdp_pdev *pdev_handle, uint8_t val)
+dp_config_enh_tx_capture(struct dp_pdev *pdev, uint8_t val)
 {
-	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
 	int i, j;
 
 	qdf_spin_lock(&pdev->tx_capture.config_lock);
@@ -3200,16 +3199,14 @@ QDF_STATUS dp_send_ack_frame_to_stack(struct dp_soc *soc,
 
 /**
  * dp_peer_set_tx_capture_enabled: Set tx_cap_enabled bit in peer
- * @peer_handle: Peer handle
+ * @peer: Peer handle
  * @value: Enable/disable setting for tx_cap_enabled
  *
  * Return: None
  */
 void
-dp_peer_set_tx_capture_enabled(struct cdp_peer *peer_handle, bool value)
+dp_peer_set_tx_capture_enabled(struct dp_peer *peer, bool value)
 {
-	struct dp_peer *peer = (struct dp_peer *)peer_handle;
-
 	peer->tx_cap_enabled = value;
 	if (!value)
 		dp_peer_tx_cap_tid_queue_flush(peer);

+ 4 - 4
dp/wifi3.0/dp_tx_capture.h

@@ -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
@@ -179,7 +179,7 @@ QDF_STATUS dp_tx_add_to_comp_queue(struct dp_soc *soc,
  * Return: QDF_STATUS
  */
 QDF_STATUS
-dp_config_enh_tx_capture(struct cdp_pdev *pdev_handle, uint8_t val);
+dp_config_enh_tx_capture(struct dp_pdev *pdev_handle, uint8_t val);
 
 /*
  * dp_deliver_mgmt_frm: Process
@@ -258,12 +258,12 @@ QDF_STATUS dp_send_ack_frame_to_stack(struct dp_soc *soc,
 
 /**
  * dp_peer_set_tx_capture_enabled: Set tx_cap_enabled bit in peer
- * @peer_handle: Peer handle
+ * @peer: Peer handle
  * @value: Enable/disable setting for tx_cap_enabled
  *
  * Return: None
  */
 void
-dp_peer_set_tx_capture_enabled(struct cdp_peer *peer_handle, bool value);
+dp_peer_set_tx_capture_enabled(struct dp_peer *peer, bool value);
 #endif
 #endif

+ 35 - 9
dp/wifi3.0/dp_txrx_me.c

@@ -18,6 +18,7 @@
 
 #include "hal_hw_headers.h"
 #include "dp_types.h"
+#include "dp_peer.h"
 #include "qdf_nbuf.h"
 #include "qdf_atomic.h"
 #include "qdf_types.h"
@@ -96,14 +97,19 @@ dp_tx_me_init(struct dp_pdev *pdev)
 
 /**
  * dp_tx_me_alloc_descriptor():Allocate ME descriptor
- * @pdev_handle: DP PDEV handle
+ * @soc: DP SOC handle
+ * @pdev_id: id of DP PDEV handle
  *
  * Return:void
  */
-void
-dp_tx_me_alloc_descriptor(struct cdp_pdev *pdev_handle)
+void dp_tx_me_alloc_descriptor(struct cdp_soc_t *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 *)soc,
+						   pdev_id);
+
+	if (!pdev)
+		return;
 
 	if (qdf_atomic_read(&pdev->mc_num_vap_attached) == 0) {
 		dp_tx_me_init(pdev);
@@ -162,14 +168,20 @@ dp_tx_me_exit(struct dp_pdev *pdev)
 
 /**
  * dp_tx_me_free_descriptor():free ME descriptor
- * @pdev_handle:DP_PDEV handle
+ * @soc: DP SOC handle
+ * @pdev_id: id of DP PDEV handle
  *
  * Return:void
  */
 void
-dp_tx_me_free_descriptor(struct cdp_pdev *pdev_handle)
+dp_tx_me_free_descriptor(struct cdp_soc_t *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 *)soc,
+						   pdev_id);
+
+	if (!pdev)
+		return;
 
 	if (atomic_read(&pdev->mc_num_vap_attached)) {
 		if (qdf_atomic_dec_and_test(&pdev->mc_num_vap_attached)) {
@@ -241,12 +253,11 @@ static void dp_tx_me_mem_free(struct dp_pdev *pdev,
  * return: no of converted packets
  */
 uint16_t
-dp_tx_me_send_convert_ucast(ol_txrx_soc_handle soc, uint8_t vdev_id,
+dp_tx_me_send_convert_ucast(struct cdp_soc_t *soc, uint8_t vdev_id,
 			    qdf_nbuf_t nbuf,
 			    uint8_t newmac[][QDF_MAC_ADDR_SIZE],
 			    uint8_t new_mac_cnt)
 {
-	struct dp_vdev *vdev;
 	struct dp_pdev *pdev;
 	qdf_ether_header_t *eh;
 	uint8_t *data;
@@ -269,6 +280,21 @@ dp_tx_me_send_convert_ucast(ol_txrx_soc_handle soc, uint8_t vdev_id,
 	qdf_dma_addr_t paddr_mcbuf = 0;
 	uint8_t empty_entry_mac[QDF_MAC_ADDR_SIZE] = {0};
 	QDF_STATUS status;
+	struct dp_vdev *vdev =
+		dp_get_vdev_from_soc_vdev_id_wifi3((struct dp_soc *)soc,
+						   vdev_id);
+
+	if (!vdev) {
+		qdf_nbuf_free(nbuf);
+		return 1;
+	}
+
+	pdev = vdev->pdev;
+
+	if (!pdev) {
+		qdf_nbuf_free(nbuf);
+		return 1;
+	}
 
 	vdev = dp_get_vdev_from_soc_vdev_id_wifi3((struct dp_soc *)soc,
 						  vdev_id);

+ 7 - 7
dp/wifi3.0/dp_txrx_me.h

@@ -17,13 +17,13 @@
  */
 #ifndef _DP_TXRX_ME_H_
 #define _DP_TXRX_ME_H_
-uint16_t dp_tx_me_send_convert_ucast(ol_txrx_soc_handle soc, uint8_t vdev_id,
-				     qdf_nbuf_t nbuf,
-				     uint8_t newmac[][QDF_MAC_ADDR_SIZE],
-				     uint8_t new_mac_cnt);
-void dp_tx_me_alloc_descriptor(struct cdp_pdev *pdev);
-
-void dp_tx_me_free_descriptor(struct cdp_pdev *pdev);
+uint16_t
+dp_tx_me_send_convert_ucast(struct cdp_soc_t *soc, uint8_t vdev_id,
+			    qdf_nbuf_t nbuf,
+			    uint8_t newmac[][QDF_MAC_ADDR_SIZE],
+			    uint8_t new_mac_cnt);
+void dp_tx_me_alloc_descriptor(struct cdp_soc_t *soc, uint8_t pdev_id);
+void dp_tx_me_free_descriptor(struct cdp_soc_t *soc, uint8_t pdev_id);
 void dp_tx_me_exit(struct dp_pdev *pdev);
 QDF_STATUS
 dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);

+ 14 - 19
dp/wifi3.0/dp_txrx_wds.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-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
@@ -662,28 +662,20 @@ void dp_peer_multipass_list_remove(struct dp_peer *peer)
 /**
  * dp_peer_multipass_list_add: add to new multipass list
  * @dp_soc: soc handle
- * @dp_vdev: vdev handle
- * @peer_mac: mac address
+ * @peer: peer handle
  *
  * return: void
  */
-static void dp_peer_multipass_list_add(struct dp_soc *soc, struct dp_vdev *vdev,
-					uint8_t *peer_mac)
+static void dp_peer_multipass_list_add(struct dp_soc *soc, struct dp_peer *peer)
 {
-	struct dp_peer *peer = dp_peer_find_hash_find(soc, peer_mac, 0,
-						      vdev->vdev_id);
-
-	if (!peer) {
-		return;
-	}
-
 	/*
 	 * Ref_cnt is incremented inside dp_peer_find_hash_find().
 	 * Decrement it when element is deleted from the list.
 	 */
-	qdf_spin_lock_bh(&vdev->mpass_peer_mutex);
-	TAILQ_INSERT_HEAD(&vdev->mpass_peer_list, peer, mpass_peer_list_elem);
-	qdf_spin_unlock_bh(&vdev->mpass_peer_mutex);
+	qdf_spin_lock_bh(&peer->vdev->mpass_peer_mutex);
+	TAILQ_INSERT_HEAD(&peer->vdev->mpass_peer_list, peer,
+			  mpass_peer_list_elem);
+	qdf_spin_unlock_bh(&peer->vdev->mpass_peer_mutex);
 }
 
 /**
@@ -695,14 +687,16 @@ static void dp_peer_multipass_list_add(struct dp_soc *soc, struct dp_vdev *vdev,
  * return: void
  */
 void dp_peer_set_vlan_id(struct cdp_soc_t *cdp_soc,
-		struct cdp_vdev *vdev_handle, uint8_t *peer_mac,
+		uint8_t vdev_id, uint8_t *peer_mac,
 		uint16_t vlan_id)
 {
 	struct dp_soc *soc = (struct dp_soc *)cdp_soc;
-	struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle;
 	struct dp_peer *peer = NULL;
+	struct dp_vdev *vdev =
+		dp_get_vdev_from_soc_vdev_id_wifi3((struct dp_soc *)soc,
+						   vdev_id);
 
-	if (!vdev->multipass_en)
+	if (!vdev || !vdev->multipass_en)
 		return;
 
 	peer = dp_peer_find_hash_find(soc, peer_mac, 0, vdev->vdev_id);
@@ -714,11 +708,12 @@ void dp_peer_set_vlan_id(struct cdp_soc_t *cdp_soc,
 
 	peer->vlan_id = vlan_id;
 
+	dp_peer_multipass_list_add(soc, peer);
+
 	/* Ref_cnt is incremented inside dp_peer_find_hash_find().
 	 * Decrement it here.
 	 */
 	dp_peer_unref_delete(peer);
-	dp_peer_multipass_list_add(soc, vdev, peer_mac);
 }
 
 /**