Browse Source

Merge "qcacmn: Update API signature for vdev and peer search to include pdev_id"

Linux Build Service Account 7 years ago
parent
commit
636cbc2170

+ 51 - 14
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -505,10 +505,15 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
 			wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID);
 		}
 	} else {
+		uint8_t pdev_id;
+
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
 		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
 					psoc,
-					req_key->macaddr,
+					pdev_id,
 					macaddr,
+					req_key->macaddr,
 					WLAN_CRYPTO_ID);
 
 		if (peer == NULL) {
@@ -773,11 +778,15 @@ QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev,
 			return QDF_STATUS_E_INVAL;
 	} else {
 		struct wlan_objmgr_peer *peer;
+		uint8_t pdev_id;
 
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
 		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
 					psoc,
-					mac_addr,
+					pdev_id,
 					macaddr,
+					mac_addr,
 					WLAN_CRYPTO_ID);
 		if (peer == NULL) {
 			QDF_TRACE(QDF_MODULE_ID_CRYPTO, QDF_TRACE_LEVEL_ERROR,
@@ -871,10 +880,14 @@ QDF_STATUS wlan_crypto_delkey(struct wlan_objmgr_vdev *vdev,
 		}
 	} else {
 		struct wlan_objmgr_peer *peer;
+		uint8_t pdev_id;
 
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
 		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
-				psoc, macaddr,
+				psoc, pdev_id,
 				bssid_mac,
+				macaddr,
 				WLAN_CRYPTO_ID);
 		if (peer == NULL) {
 			return QDF_STATUS_E_INVAL;
@@ -974,9 +987,14 @@ QDF_STATUS wlan_crypto_default_key(struct wlan_objmgr_vdev *vdev,
 			return QDF_STATUS_E_INVAL;
 	} else {
 		struct wlan_objmgr_peer *peer;
+		uint8_t pdev_id;
+
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
 		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
-				psoc, macaddr,
+				psoc, pdev_id,
 				bssid_mac,
+				macaddr,
 				WLAN_CRYPTO_ID);
 
 		if (peer == NULL) {
@@ -1031,6 +1049,7 @@ QDF_STATUS wlan_crypto_encap(struct wlan_objmgr_vdev *vdev,
 	struct wlan_objmgr_psoc *psoc;
 	struct wlan_objmgr_peer *peer;
 	uint8_t bssid_mac[WLAN_ALEN];
+	uint8_t pdev_id;
 
 	wlan_vdev_obj_lock(vdev);
 	qdf_mem_copy(bssid_mac, wlan_vdev_mlme_get_macaddr(vdev), WLAN_ALEN);
@@ -1042,8 +1061,9 @@ QDF_STATUS wlan_crypto_encap(struct wlan_objmgr_vdev *vdev,
 	}
 	wlan_vdev_obj_unlock(vdev);
 
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(wlan_vdev_get_pdev(vdev));
 	/* FILS Encap required only for (Re-)Assoc response */
-	peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_CRYPTO_ID);
+	peer = wlan_objmgr_get_peer(psoc, pdev_id, mac_addr, WLAN_CRYPTO_ID);
 
 	if (!wlan_crypto_is_data_protected((uint8_t *)qdf_nbuf_data(wbuf)) &&
 	    peer && !wlan_crypto_get_peer_fils_aead(peer)) {
@@ -1069,9 +1089,13 @@ QDF_STATUS wlan_crypto_encap(struct wlan_objmgr_vdev *vdev,
 
 	} else {
 		struct wlan_objmgr_peer *peer;
+		uint8_t pdev_id;
 
-		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
-				psoc, mac_addr, bssid_mac, WLAN_CRYPTO_ID);
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
+		peer = wlan_objmgr_get_peer_by_mac_n_vdev(psoc, pdev_id,
+							  bssid_mac, mac_addr,
+							  WLAN_CRYPTO_ID);
 
 		if (peer == NULL) {
 			qdf_print("%s[%d] crypto_priv NULL\n",
@@ -1125,6 +1149,7 @@ QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev,
 	struct wlan_objmgr_peer *peer;
 	uint8_t bssid_mac[WLAN_ALEN];
 	uint8_t keyid;
+	uint8_t pdev_id;
 
 	wlan_vdev_obj_lock(vdev);
 	qdf_mem_copy(bssid_mac, wlan_vdev_mlme_get_macaddr(vdev), WLAN_ALEN);
@@ -1141,8 +1166,9 @@ QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev,
 	if (keyid >= WLAN_CRYPTO_MAXKEYIDX)
 		return QDF_STATUS_E_INVAL;
 
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(wlan_vdev_get_pdev(vdev));
 	/* FILS Decap required only for (Re-)Assoc request */
-	peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_CRYPTO_ID);
+	peer = wlan_objmgr_get_peer(psoc, pdev_id, mac_addr, WLAN_CRYPTO_ID);
 
 	if (!wlan_crypto_is_data_protected((uint8_t *)qdf_nbuf_data(wbuf)) &&
 	    peer && !wlan_crypto_get_peer_fils_aead(peer)) {
@@ -1168,10 +1194,13 @@ QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev,
 
 	} else {
 		struct wlan_objmgr_peer *peer;
+		uint8_t pdev_id;
 
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
 		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
-					psoc, mac_addr, bssid_mac,
-					WLAN_CRYPTO_ID);
+					psoc, pdev_id, bssid_mac,
+					mac_addr, WLAN_CRYPTO_ID);
 		if (peer == NULL) {
 			qdf_print("%s[%d] peer NULL\n", __func__, __LINE__);
 			return QDF_STATUS_E_INVAL;
@@ -1222,6 +1251,7 @@ QDF_STATUS wlan_crypto_enmic(struct wlan_objmgr_vdev *vdev,
 	struct wlan_objmgr_psoc *psoc;
 	uint8_t bssid_mac[WLAN_ALEN];
 
+
 	wlan_vdev_obj_lock(vdev);
 	qdf_mem_copy(bssid_mac, wlan_vdev_mlme_get_macaddr(vdev), WLAN_ALEN);
 	psoc = wlan_vdev_get_psoc(vdev);
@@ -1247,10 +1277,13 @@ QDF_STATUS wlan_crypto_enmic(struct wlan_objmgr_vdev *vdev,
 
 	} else {
 		struct wlan_objmgr_peer *peer;
+		uint8_t pdev_id;
 
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
 		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
-					psoc, mac_addr, bssid_mac,
-					WLAN_CRYPTO_ID);
+					psoc, pdev_id, bssid_mac,
+					mac_addr, WLAN_CRYPTO_ID);
 		if (peer == NULL) {
 			qdf_print("%s[%d] crypto_priv NULL\n",
 							__func__, __LINE__);
@@ -1303,6 +1336,7 @@ QDF_STATUS wlan_crypto_demic(struct wlan_objmgr_vdev *vdev,
 	struct wlan_objmgr_psoc *psoc;
 	uint8_t bssid_mac[WLAN_ALEN];
 
+
 	wlan_vdev_obj_lock(vdev);
 	qdf_mem_copy(bssid_mac, wlan_vdev_mlme_get_macaddr(vdev), WLAN_ALEN);
 	psoc = wlan_vdev_get_psoc(vdev);
@@ -1328,10 +1362,13 @@ QDF_STATUS wlan_crypto_demic(struct wlan_objmgr_vdev *vdev,
 
 	} else {
 		struct wlan_objmgr_peer *peer;
+		uint8_t pdev_id;
 
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(
+				wlan_vdev_get_pdev(vdev));
 		peer = wlan_objmgr_get_peer_by_mac_n_vdev(
-					psoc, mac_addr, bssid_mac,
-					WLAN_CRYPTO_ID);
+					psoc, pdev_id, bssid_mac,
+					mac_addr, WLAN_CRYPTO_ID);
 		if (peer == NULL) {
 			qdf_print("%s[%d] peer NULL\n", __func__, __LINE__);
 			return QDF_STATUS_E_INVAL;

+ 4 - 2
umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c

@@ -875,10 +875,12 @@ QDF_STATUS tgt_mgmt_txrx_rx_frame_handler(
 	 * scenario.
 	 */
 	mac_addr = (uint8_t *)wh->i_addr2;
-	peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_MGMT_SB_ID);
+	peer = wlan_objmgr_get_peer(psoc, mgmt_rx_params->pdev_id,
+				    mac_addr, WLAN_MGMT_SB_ID);
 	if (!peer) {
 		mac_addr = (uint8_t *)wh->i_addr1;
-		peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_MGMT_SB_ID);
+		peer = wlan_objmgr_get_peer(psoc, mgmt_rx_params->pdev_id,
+					    mac_addr, WLAN_MGMT_SB_ID);
 	}
 
 	/**

+ 26 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_peer_obj.h

@@ -171,12 +171,14 @@ struct wlan_peer_activity {  /*TODO */
  * @obj_status[]:     status of each component object
  * @obj_state:        Status of Peer object
  * @dp_handle:        DP module handle
+ * @pdev_id:          Pdev ID
  * @peer_lock:        Lock for access/update peer contents
  */
 struct wlan_objmgr_peer {
 	qdf_list_node_t psoc_peer;
 	qdf_list_node_t vdev_peer;
 	uint8_t macaddr[QDF_MAC_ADDR_SIZE];
+	uint8_t pdev_id;
 	struct wlan_objmgr_peer_mlme peer_mlme;
 	struct wlan_peer_activity peer_activity;
 	struct wlan_objmgr_peer_objmgr peer_objmgr;
@@ -872,4 +874,28 @@ static inline struct wlan_objmgr_psoc *wlan_peer_get_psoc(
 	return psoc;
 }
 
+/*
+ * wlan_peer_get_pdev_id() - get pdev id
+ * @peer: peer object pointer
+ *
+ * Return: pdev id
+ */
+static inline uint8_t wlan_peer_get_pdev_id(struct wlan_objmgr_peer *peer)
+{
+	return peer->pdev_id;
+}
+
+/**
+ * wlan_peer_set_pdev_id() - set pdev id
+ * @peer: peer object pointer
+ * @pdev_id: pdev id
+ *
+ * Return: void
+ */
+static inline void wlan_peer_set_pdev_id(struct wlan_objmgr_peer *peer,
+					 uint8_t pdev_id)
+{
+	peer->pdev_id = pdev_id;
+}
+
 #endif /* _WLAN_OBJMGR_PEER_OBJ_H_*/

+ 58 - 26
umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h

@@ -527,7 +527,7 @@ QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_deletion(
 		enum wlan_umac_comp_id id);
 
 /**
- * wlan_objmgr_get_peer() - find peer from psoc's peer list
+ * wlan_objmgr_get_peer_by_mac() - find peer from psoc's peer list
  * @psoc: PSOC object
  * @macaddr: MAC address
  * @dbg_id: id of the caller
@@ -541,13 +541,34 @@ QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_deletion(
  * Return: peer pointer
  *         NULL on FAILURE
  */
+struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac(
+		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
+		wlan_objmgr_ref_dbgid dbg_id);
+
+/**
+ * wlan_objmgr_get_peer() - find peer from psoc's peer list
+ * @psoc: PSOC object
+ * @pdev_id: Pdev id
+ * @macaddr: MAC address
+ * @dbg_id: id of the caller
+ *
+ * API to find peer object pointer by MAC addr and pdev id
+ *
+ * This API increments the ref count of the peer object internally, the
+ * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
+ * ref count
+ *
+ * Return: peer pointer
+ *         NULL on FAILURE
+ */
 struct wlan_objmgr_peer *wlan_objmgr_get_peer(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			wlan_objmgr_ref_dbgid dbg_id);
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_objmgr_get_peer_nolock() - find peer from psoc's peer list (lock free)
  * @psoc: PSOC object
+ * @pdev_id: Pdev id
  * @macaddr: MAC address
  * @dbg_id: id of the caller
  *
@@ -561,8 +582,8 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer(
  *         NULL on FAILURE
  */
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_nolock(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			wlan_objmgr_ref_dbgid dbg_id);
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_objmgr_get_peer_logically_deleted() - find peer
@@ -587,10 +608,12 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_logically_deleted(
 /**
  * wlan_objmgr_get_peer_no_state() - find peer from psoc's peer list
  * @psoc: PSOC object
+ * @pdev_id: Pdev id
  * @macaddr: MAC address
  * @dbg_id: id of the caller
  *
- * API to find peer object pointer by MAC addr, ignores the state check
+ * API to find peer object pointer by MAC addr and pdev id,
+ * ignores the state check
  *
  * This API increments the ref count of the peer object internally, the
  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
@@ -600,8 +623,8 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_logically_deleted(
  *         NULL on FAILURE
  */
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			wlan_objmgr_ref_dbgid dbg_id);
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev() - get peer from
@@ -609,12 +632,13 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
  *                                                mac and vdev
  *                                                self mac
  * @psoc: PSOC object
- * @macaddr: MAC address
+ * @pdev_id: Pdev id
  * @bssid: BSSID address
+ * @macaddr: MAC address
  * @dbg_id: id of the caller
  *
- * API to find peer object pointer by MAC addr and vdev self mac
- * address for a node that is logically in deleted state
+ * API to find peer object pointer by MAC addr, vdev self mac
+ * address and pdev id for a node that is logically in deleted state
  *
  * This API increments the ref count of the peer object internally, the
  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
@@ -624,18 +648,21 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
  *         NULL on FAILURE
  */
 qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			uint8_t *bssid, wlan_objmgr_ref_dbgid dbg_id);
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *bssid, uint8_t *macaddr,
+			wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_objmgr_get_peer_by_mac_n_vdev() - find peer from psoc's peer list
  *                                          using mac address and bssid
  * @psoc: PSOC object
- * @macaddr: MAC address
+ * @pdev_id: Pdev id
  * @bssid: MAC address of AP its associated
+ * @macaddr: MAC address
  * @dbg_id: id of the caller
  *
  * API to find peer object pointer by MAC addr and vdev self mac address
+ * and pdev id
  *
  * This API increments the ref count of the peer object internally, the
  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
@@ -645,19 +672,21 @@ qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev(
  *         NULL on FAILURE
  */
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			uint8_t *bssid, wlan_objmgr_ref_dbgid dbg_id);
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *bssid, uint8_t *macaddr,
+			wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_objmgr_get_peer_by_mac_n_vdev_no_state() - find peer from psoc's peer
  *                                          list using mac address and bssid
  * @psoc: PSOC object
- * @macaddr: MAC address
+ * @pdev_id: Pdev id
  * @bssid: MAC address of AP its associated
+ * @macaddr: MAC address
  * @dbg_id: id of the caller
  *
- * API to find peer object pointer by MAC addr and vdev self mac address,
- * ignores the state
+ * API to find peer object pointer by MAC addr, vdev self mac address,
+ * and pdev id ,ignores the state
  *
  * This API increments the ref count of the peer object internally, the
  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
@@ -667,8 +696,9 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev(
  *         NULL on FAILURE
  */
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_no_state(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			uint8_t *bssid, wlan_objmgr_ref_dbgid dbg_id);
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *bssid,  uint8_t *macaddr,
+			wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_objmgr_get_pdev_by_id() - retrieve pdev by id
@@ -808,10 +838,11 @@ struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_no_state(
 /**
  * wlan_objmgr_get_vdev_by_macaddr_from_psoc() - retrieve vdev by macaddr
  * @psoc: PSOC object
+ * @pdev_id: Pdev id
  * @macaddr: macaddr
  * @dbg_id: id of the caller
  *
- * API to find vdev object pointer by vdev macaddr from psoc
+ * API to find vdev object pointer by vdev macaddr from pdev
  *
  * This API increments the ref count of the vdev object internally, the
  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
@@ -821,13 +852,14 @@ struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_no_state(
  *         NULL on FAILURE
  */
 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc(
-		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-		wlan_objmgr_ref_dbgid dbg_id);
+		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+		uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state() - retrieve vdev by
  *                                                           macaddr
  * @psoc: PSOC object
+ * @pdev_id: Pdev id
  * @macaddr: macaddr
  * @dbg_id: id of the caller
  *
@@ -842,8 +874,8 @@ struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc(
  *         NULL on FAILURE
  */
 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state(
-		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-		wlan_objmgr_ref_dbgid dbg_id);
+		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+		uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
 
 /**
  * wlan_psoc_obj_lock() - Acquire PSOC spinlock

+ 2 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c

@@ -211,6 +211,8 @@ struct wlan_objmgr_peer *wlan_objmgr_peer_obj_create(
 		qdf_mem_free(peer);
 		return NULL;
 	}
+	wlan_peer_set_pdev_id(peer, wlan_objmgr_pdev_get_pdev_id(
+			wlan_vdev_get_pdev(vdev)));
 	/* Increment ref count for BSS peer, so that BSS peer deletes last*/
 	if ((type == WLAN_PEER_STA) || (type == WLAN_PEER_STA_TEMP)
 				    || (type == WLAN_PEER_P2P_CLI))

+ 150 - 79
umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c

@@ -1060,73 +1060,54 @@ struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_no_state(
 qdf_export_symbol(wlan_objmgr_get_vdev_by_id_from_psoc_no_state);
 
 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc(
-		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-		wlan_objmgr_ref_dbgid dbg_id)
+		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+		uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_vdev *vdev;
-	uint8_t id;
-	uint16_t max_vdev_cnt;
+	struct wlan_objmgr_pdev *pdev;
 
 	/* if PSOC is NULL, return */
 	if (psoc == NULL)
 		return NULL;
 
-	wlan_psoc_obj_lock(psoc);
-	max_vdev_cnt = wlan_psoc_get_max_vdev_count(psoc);
-	/* Iterate through PSOC's vdev list */
-	for (id = 0; id < max_vdev_cnt; id++) {
-		vdev = psoc->soc_objmgr.wlan_vdev_list[id];
-		if (vdev == NULL)
-			continue;
-		/* MAC address matches, break */
-		if (WLAN_ADDR_EQ(wlan_vdev_mlme_get_macaddr(vdev), macaddr)
-			== QDF_STATUS_SUCCESS) {
-			if (wlan_objmgr_vdev_try_get_ref(vdev, dbg_id) !=
-							QDF_STATUS_SUCCESS)
-				vdev = NULL;
-
-			wlan_psoc_obj_unlock(psoc);
+	if (!macaddr)
+		return NULL;
 
-			return vdev;
-		}
+	pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, dbg_id);
+	if (!pdev) {
+		obj_mgr_err("pdev is null");
+		return NULL;
 	}
-	wlan_psoc_obj_unlock(psoc);
+	vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(pdev, macaddr, dbg_id);
+	wlan_objmgr_pdev_release_ref(pdev, dbg_id);
 
-	return NULL;
+	return vdev;
 }
 qdf_export_symbol(wlan_objmgr_get_vdev_by_macaddr_from_psoc);
 
 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state(
-		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-		wlan_objmgr_ref_dbgid dbg_id)
+		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+		uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_vdev *vdev;
-	uint8_t id;
-	uint16_t max_vdev_cnt;
+	struct wlan_objmgr_pdev *pdev;
 
 	/* if PSOC is NULL, return */
 	if (psoc == NULL)
 		return NULL;
 
-	wlan_psoc_obj_lock(psoc);
-	max_vdev_cnt = wlan_psoc_get_max_vdev_count(psoc);
-	/* Iterate through PSOC's vdev list */
-	for (id = 0; id < max_vdev_cnt; id++) {
-		vdev = psoc->soc_objmgr.wlan_vdev_list[id];
-		if (vdev == NULL)
-			continue;
-		/* MAC address matches, break */
-		if (WLAN_ADDR_EQ(wlan_vdev_mlme_get_macaddr(vdev), macaddr)
-			== QDF_STATUS_SUCCESS) {
-			wlan_objmgr_vdev_get_ref(vdev, dbg_id);
-			wlan_psoc_obj_unlock(psoc);
+	if (!macaddr)
+		return NULL;
 
-			return vdev;
-		}
+	pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, dbg_id);
+	if (!pdev) {
+		obj_mgr_err("pdev is null");
+		return NULL;
 	}
-	wlan_psoc_obj_unlock(psoc);
+	vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state(pdev, macaddr, dbg_id);
+	wlan_objmgr_pdev_release_ref(pdev, dbg_id);
 
-	return NULL;
+	return vdev;
 }
 qdf_export_symbol(wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state);
 
@@ -1219,8 +1200,8 @@ static struct wlan_objmgr_peer *
  *         NULL on FAILURE
  */
 static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer(
-				qdf_list_t *obj_list, uint8_t *macaddr,
-				wlan_objmgr_ref_dbgid dbg_id)
+		qdf_list_t *obj_list, uint8_t *macaddr,
+		wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_peer *peer;
 	struct wlan_objmgr_peer *peer_temp;
@@ -1230,7 +1211,46 @@ static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer(
 	while (peer != NULL) {
 		/* For peer, macaddr is key */
 		if (WLAN_ADDR_EQ(wlan_peer_get_macaddr(peer), macaddr)
-			== QDF_STATUS_SUCCESS) {
+				== QDF_STATUS_SUCCESS) {
+			if (wlan_objmgr_peer_try_get_ref(peer, dbg_id) ==
+					QDF_STATUS_SUCCESS) {
+				return peer;
+			}
+		}
+		/* Move to next peer */
+		peer_temp = peer;
+		peer = wlan_peer_get_next_peer_of_psoc(obj_list, peer_temp);
+	}
+
+	/* Not found, return NULL */
+	return NULL;
+}
+
+/**
+ * wlan_obj_psoc_peerlist_get_peer_by_pdev_id() - get peer from psoc peer list
+ * @psoc: PSOC object
+ * @macaddr: MAC address
+ * #pdev_id: Pdev id
+ *
+ * API to finds peer object pointer by MAC addr and pdev id from hash list
+ *
+ * Return: peer pointer
+ *         NULL on FAILURE
+ */
+static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer_by_pdev_id(
+				qdf_list_t *obj_list, uint8_t *macaddr,
+				uint8_t pdev_id, wlan_objmgr_ref_dbgid dbg_id)
+{
+	struct wlan_objmgr_peer *peer;
+	struct wlan_objmgr_peer *peer_temp;
+
+	/* Iterate through hash list to get the peer */
+	peer = wlan_psoc_peer_list_peek_head(obj_list);
+	while (peer != NULL) {
+		/* For peer, macaddr is key */
+		if ((WLAN_ADDR_EQ(wlan_peer_get_macaddr(peer), macaddr)
+			== QDF_STATUS_SUCCESS) &&
+				(wlan_peer_get_pdev_id(peer) == pdev_id)) {
 			if (wlan_objmgr_peer_try_get_ref(peer, dbg_id) ==
 							QDF_STATUS_SUCCESS) {
 				return peer;
@@ -1247,7 +1267,7 @@ static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer(
 
 static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer_no_state(
 				qdf_list_t *obj_list, uint8_t *macaddr,
-				wlan_objmgr_ref_dbgid dbg_id)
+				uint8_t pdev_id, wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_peer *peer;
 	struct wlan_objmgr_peer *peer_temp;
@@ -1255,9 +1275,10 @@ static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer_no_state(
 	/* Iterate through hash list to get the peer */
 	peer = wlan_psoc_peer_list_peek_head(obj_list);
 	while (peer != NULL) {
-		/* For peer, macaddr is key */
-		if (WLAN_ADDR_EQ(wlan_peer_get_macaddr(peer), macaddr)
-			== QDF_STATUS_SUCCESS) {
+		/* For peer, macaddr and pdev_id is key */
+		if ((WLAN_ADDR_EQ(wlan_peer_get_macaddr(peer), macaddr)
+			== QDF_STATUS_SUCCESS) &&
+				(wlan_peer_get_pdev_id(peer) == pdev_id)) {
 			wlan_objmgr_peer_get_ref(peer, dbg_id);
 
 			return peer;
@@ -1292,7 +1313,7 @@ static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer_no_state(
 static qdf_list_t
 	*wlan_obj_psoc_populate_logically_del_peerlist_by_mac_n_bssid(
 				qdf_list_t *obj_list, uint8_t *macaddr,
-				uint8_t *bssid,
+				uint8_t *bssid, uint8_t pdev_id,
 				wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_peer *peer;
@@ -1313,9 +1334,10 @@ static qdf_list_t
 	peer = wlan_psoc_peer_list_peek_head(obj_list);
 	while (peer != NULL) {
 		wlan_peer_obj_lock(peer);
-		/* For peer, macaddr is key */
-		if (WLAN_ADDR_EQ(wlan_peer_get_macaddr(peer), macaddr)
-			== QDF_STATUS_SUCCESS) {
+		/* For peer, macaddr and pdev id are keys */
+		if ((WLAN_ADDR_EQ(wlan_peer_get_macaddr(peer), macaddr)
+			== QDF_STATUS_SUCCESS) &&
+				(wlan_peer_get_pdev_id(peer) == pdev_id)) {
 			/*
 			 *  if BSSID not NULL,
 			 *  then match is requested by caller, check BSSID
@@ -1388,7 +1410,7 @@ static qdf_list_t
  */
 static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer_by_mac_n_bssid(
 					qdf_list_t *obj_list, uint8_t *macaddr,
-					uint8_t *bssid,
+					uint8_t *bssid, uint8_t pdev_id,
 					wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_peer *peer;
@@ -1405,8 +1427,9 @@ static struct wlan_objmgr_peer *wlan_obj_psoc_peerlist_get_peer_by_mac_n_bssid(
 			 *  (vdev mac == bssid) --  return peer
 			 *  (vdev mac != bssid) --  perform next iteration
 			 */
-			if (wlan_peer_bssid_match(peer, bssid) ==
-							QDF_STATUS_SUCCESS) {
+			if ((wlan_peer_bssid_match(peer, bssid) ==
+				QDF_STATUS_SUCCESS) &&
+				(wlan_peer_get_pdev_id(peer) == pdev_id)) {
 				if (wlan_objmgr_peer_try_get_ref(peer, dbg_id)
 					== QDF_STATUS_SUCCESS) {
 					return peer;
@@ -1425,6 +1448,7 @@ static struct wlan_objmgr_peer
 		*wlan_obj_psoc_peerlist_get_peer_by_mac_n_bssid_no_state(
 					qdf_list_t *obj_list, uint8_t *macaddr,
 					uint8_t *bssid,
+					uint8_t pdev_id,
 					wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_peer *peer;
@@ -1441,8 +1465,9 @@ static struct wlan_objmgr_peer
 			 *  (vdev mac == bssid) --  return peer
 			 *  (vdev mac != bssid) --  perform next iteration
 			 */
-			if (wlan_peer_bssid_match(peer, bssid) ==
-							QDF_STATUS_SUCCESS) {
+			if ((wlan_peer_bssid_match(peer, bssid) ==
+				QDF_STATUS_SUCCESS) &&
+				(wlan_peer_get_pdev_id(peer) == pdev_id)) {
 				wlan_objmgr_peer_get_ref(peer, dbg_id);
 
 				return peer;
@@ -1555,15 +1580,18 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_logically_deleted(
 	return peer;
 }
 
-struct wlan_objmgr_peer *wlan_objmgr_get_peer(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			wlan_objmgr_ref_dbgid dbg_id)
+struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac(
+		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
+		wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	uint8_t hash_index;
 	struct wlan_objmgr_peer *peer = NULL;
 	struct wlan_peer_list *peer_list;
 
+	if (!macaddr)
+		return NULL;
+
 	/* psoc lock should be taken before peer list lock */
 	wlan_psoc_obj_lock(psoc);
 	objmgr = &psoc->soc_objmgr;
@@ -1578,7 +1606,44 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer(
 	qdf_spin_lock_bh(&peer_list->peer_list_lock);
 	/* Iterate through peer list, get peer */
 	peer = wlan_obj_psoc_peerlist_get_peer(
-		&peer_list->peer_hash[hash_index], macaddr, dbg_id);
+			&peer_list->peer_hash[hash_index], macaddr, dbg_id);
+	qdf_spin_unlock_bh(&peer_list->peer_list_lock);
+	wlan_psoc_obj_unlock(psoc);
+
+	return peer;
+}
+qdf_export_symbol(wlan_objmgr_get_peer_by_mac);
+
+struct wlan_objmgr_peer *wlan_objmgr_get_peer(
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id)
+{
+	struct wlan_objmgr_psoc_objmgr *objmgr;
+	uint8_t hash_index;
+	struct wlan_objmgr_peer *peer = NULL;
+	struct wlan_peer_list *peer_list;
+
+	if (pdev_id >= WLAN_UMAC_MAX_PDEVS)
+		QDF_ASSERT(0);
+
+	if (!macaddr)
+		return NULL;
+
+	/* psoc lock should be taken before peer list lock */
+	wlan_psoc_obj_lock(psoc);
+	objmgr = &psoc->soc_objmgr;
+	/* List is empty, return NULL */
+	if (objmgr->wlan_peer_count == 0) {
+		wlan_psoc_obj_unlock(psoc);
+		return NULL;
+	}
+	/* reduce the search window, with hash key */
+	hash_index = WLAN_PEER_HASH(macaddr);
+	peer_list = &objmgr->peer_list;
+	qdf_spin_lock_bh(&peer_list->peer_list_lock);
+	/* Iterate through peer list, get peer */
+	peer = wlan_obj_psoc_peerlist_get_peer_by_pdev_id(
+		&peer_list->peer_hash[hash_index], macaddr, pdev_id, dbg_id);
 	qdf_spin_unlock_bh(&peer_list->peer_list_lock);
 	wlan_psoc_obj_unlock(psoc);
 
@@ -1587,8 +1652,8 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer(
 qdf_export_symbol(wlan_objmgr_get_peer);
 
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_nolock(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			wlan_objmgr_ref_dbgid dbg_id)
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	uint8_t hash_index;
@@ -1605,8 +1670,8 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_nolock(
 	hash_index = WLAN_PEER_HASH(macaddr);
 	peer_list = &objmgr->peer_list;
 	/* Iterate through peer list, get peer */
-	peer = wlan_obj_psoc_peerlist_get_peer(
-		&peer_list->peer_hash[hash_index], macaddr, dbg_id);
+	peer = wlan_obj_psoc_peerlist_get_peer_by_pdev_id(
+		&peer_list->peer_hash[hash_index], macaddr, pdev_id, dbg_id);
 
 	return peer;
 }
@@ -1614,8 +1679,8 @@ qdf_export_symbol(wlan_objmgr_get_peer_nolock);
 
 
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			wlan_objmgr_ref_dbgid dbg_id)
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	uint8_t hash_index;
@@ -1636,7 +1701,7 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
 	qdf_spin_lock_bh(&peer_list->peer_list_lock);
 	/* Iterate through peer list, get peer */
 	peer = wlan_obj_psoc_peerlist_get_peer_no_state(
-		&peer_list->peer_hash[hash_index], macaddr, dbg_id);
+		&peer_list->peer_hash[hash_index], macaddr, pdev_id, dbg_id);
 	qdf_spin_unlock_bh(&peer_list->peer_list_lock);
 	wlan_psoc_obj_unlock(psoc);
 
@@ -1645,8 +1710,9 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
 qdf_export_symbol(wlan_objmgr_get_peer_no_state);
 
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			uint8_t *bssid, wlan_objmgr_ref_dbgid dbg_id)
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *bssid, uint8_t *macaddr,
+			wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	uint8_t hash_index;
@@ -1667,7 +1733,8 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev(
 	qdf_spin_lock_bh(&peer_list->peer_list_lock);
 	/* Iterate through peer list, get peer */
 	peer = wlan_obj_psoc_peerlist_get_peer_by_mac_n_bssid(
-		&peer_list->peer_hash[hash_index], macaddr, bssid, dbg_id);
+		&peer_list->peer_hash[hash_index], macaddr, bssid,
+		pdev_id, dbg_id);
 	qdf_spin_unlock_bh(&peer_list->peer_list_lock);
 	wlan_psoc_obj_unlock(psoc);
 
@@ -1682,6 +1749,7 @@ qdf_export_symbol(wlan_objmgr_get_peer_by_mac_n_vdev);
  *                                                           mac and vdev
  *                                                           self mac
  * @psoc: PSOC object
+ * @pdev_id: Pdev id
  * @macaddr: MAC address
  * @bssid: BSSID address. NULL mac means search all.
  * @dbg_id: id of the caller
@@ -1694,8 +1762,9 @@ qdf_export_symbol(wlan_objmgr_get_peer_by_mac_n_vdev);
  */
 
 qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			uint8_t *bssid, wlan_objmgr_ref_dbgid dbg_id)
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *bssid, uint8_t *macaddr,
+			wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	uint8_t hash_index;
@@ -1719,7 +1788,7 @@ qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev(
 	logical_del_peer_list =
 		wlan_obj_psoc_populate_logically_del_peerlist_by_mac_n_bssid(
 			&peer_list->peer_hash[hash_index], macaddr,
-			bssid, dbg_id);
+			bssid, pdev_id, dbg_id);
 
 	qdf_spin_unlock_bh(&peer_list->peer_list_lock);
 	wlan_psoc_obj_unlock(psoc);
@@ -1729,8 +1798,9 @@ qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev(
 qdf_export_symbol(wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev);
 
 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_no_state(
-			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
-			uint8_t *bssid, wlan_objmgr_ref_dbgid dbg_id)
+			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+			uint8_t *bssid, uint8_t *macaddr,
+			wlan_objmgr_ref_dbgid dbg_id)
 {
 	struct wlan_objmgr_psoc_objmgr *objmgr;
 	uint8_t hash_index;
@@ -1751,7 +1821,8 @@ struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_no_state(
 	qdf_spin_lock_bh(&peer_list->peer_list_lock);
 	/* Iterate through peer list, get peer */
 	peer = wlan_obj_psoc_peerlist_get_peer_by_mac_n_bssid_no_state(
-		&peer_list->peer_hash[hash_index], macaddr, bssid, dbg_id);
+		&peer_list->peer_hash[hash_index], macaddr, bssid,
+		pdev_id, dbg_id);
 	qdf_spin_unlock_bh(&peer_list->peer_list_lock);
 	wlan_psoc_obj_unlock(psoc);
 

+ 2 - 2
umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c

@@ -178,7 +178,7 @@ tgt_mc_cp_stats_prepare_raw_peer_rssi(struct wlan_objmgr_psoc *psoc,
 						  peer_rssi_iterator, &ev,
 						  true, WLAN_CP_STATS_ID);
 	} else {
-		peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_CP_STATS_ID);
+		peer = wlan_objmgr_get_peer(psoc, last_req->pdev_id, mac_addr, WLAN_CP_STATS_ID);
 		if (!peer) {
 			cp_stats_err("peer[%pM] is null", mac_addr);
 			goto end;
@@ -229,7 +229,7 @@ tgt_mc_cp_stats_update_peer_stats(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_INVAL;
 
 	peer_mac_addr = peer_stats->peer_macaddr;
-	peer = wlan_objmgr_get_peer(psoc, peer_mac_addr,
+	peer = wlan_objmgr_get_peer_by_mac(psoc, peer_mac_addr,
 				    WLAN_CP_STATS_ID);
 	if (!peer) {
 		cp_stats_err("peer is null");

+ 3 - 1
umac/p2p/core/src/wlan_p2p_main.c

@@ -1164,6 +1164,7 @@ void p2p_peer_authorized(struct wlan_objmgr_vdev *vdev, uint8_t *mac_addr)
 	QDF_STATUS status;
 	struct wlan_objmgr_psoc *psoc;
 	struct wlan_objmgr_peer *peer;
+	uint8_t pdev_id;
 
 	if (!vdev) {
 		p2p_err("vdev:%pK", vdev);
@@ -1174,7 +1175,8 @@ void p2p_peer_authorized(struct wlan_objmgr_vdev *vdev, uint8_t *mac_addr)
 		p2p_err("psoc:%pK", psoc);
 		return;
 	}
-	peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_P2P_ID);
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(wlan_vdev_get_pdev(vdev));
+	peer = wlan_objmgr_get_peer(psoc, pdev_id,  mac_addr, WLAN_P2P_ID);
 	if (!peer) {
 		p2p_debug("peer info not found");
 		return;

+ 12 - 6
umac/p2p/core/src/wlan_p2p_off_chan_tx.c

@@ -466,16 +466,19 @@ static QDF_STATUS p2p_populate_mac_header(
 	struct wlan_objmgr_psoc *psoc;
 	void *mac_addr;
 	uint16_t seq_num;
+	uint8_t pdev_id;
 
 	psoc = tx_ctx->p2p_soc_obj->soc;
 
 	wh = (struct wlan_frame_hdr *)tx_ctx->buf;
 	mac_addr = wh->i_addr1;
-	peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_P2P_ID);
+	pdev_id = wlan_get_pdev_id_from_vdev_id(psoc, tx_ctx->vdev_id,
+						WLAN_P2P_ID);
+	peer = wlan_objmgr_get_peer(psoc, pdev_id, mac_addr, WLAN_P2P_ID);
 	if (!peer) {
 		mac_addr = wh->i_addr2;
-		peer = wlan_objmgr_get_peer(psoc, mac_addr,
-					WLAN_P2P_ID);
+		peer = wlan_objmgr_get_peer(psoc, pdev_id, mac_addr,
+					    WLAN_P2P_ID);
 	}
 
 	if (!peer) {
@@ -877,6 +880,7 @@ static QDF_STATUS p2p_mgmt_tx(struct tx_action_context *tx_ctx,
 	struct wmi_mgmt_params mgmt_param = { 0 };
 	struct wlan_objmgr_psoc *psoc;
 	void *mac_addr;
+	uint8_t pdev_id;
 
 	psoc = tx_ctx->p2p_soc_obj->soc;
 	mgmt_param.tx_frame = packet;
@@ -893,11 +897,13 @@ static QDF_STATUS p2p_mgmt_tx(struct tx_action_context *tx_ctx,
 
 	wh = (struct wlan_frame_hdr *)frame;
 	mac_addr = wh->i_addr1;
-	peer = wlan_objmgr_get_peer(psoc, mac_addr, WLAN_P2P_ID);
+	pdev_id = wlan_get_pdev_id_from_vdev_id(psoc, tx_ctx->vdev_id,
+						WLAN_P2P_ID);
+	peer = wlan_objmgr_get_peer(psoc, pdev_id,  mac_addr, WLAN_P2P_ID);
 	if (!peer) {
 		mac_addr = wh->i_addr2;
-		peer = wlan_objmgr_get_peer(psoc, mac_addr,
-					WLAN_P2P_ID);
+		peer = wlan_objmgr_get_peer(psoc, pdev_id, mac_addr,
+					    WLAN_P2P_ID);
 	}
 
 	if (!peer) {