Sfoglia il codice sorgente

qcacld-3.0: Set the correct the peer type in p2p go mode

In p2p go mode the peer type in wlan peer common object is always
set to P2P_CLI. This leads to non-cancellation of NoA after connecting
to legacy stations. Correct the peer type for legacy stations.

Change-Id: Ib706f9a80d0ad367e27fd21eca6cf026cba63f57
CRs-Fixed: 2406127
Jayachandran Sreekumaran 6 anni fa
parent
commit
2613f32128

+ 2 - 14
components/p2p/core/src/wlan_p2p_main.c

@@ -317,9 +317,7 @@ static QDF_STATUS p2p_peer_obj_create_notification(
 	struct wlan_objmgr_peer *peer, void *arg)
 {
 	struct wlan_objmgr_vdev *vdev;
-	struct p2p_vdev_priv_obj *p2p_vdev_obj;
 	enum QDF_OPMODE mode;
-	enum wlan_peer_type peer_type;
 
 	if (!peer) {
 		p2p_err("peer context passed is NULL");
@@ -331,18 +329,6 @@ static QDF_STATUS p2p_peer_obj_create_notification(
 	if (mode != QDF_P2P_GO_MODE)
 		return QDF_STATUS_SUCCESS;
 
-	p2p_vdev_obj = wlan_objmgr_vdev_get_comp_private_obj(vdev,
-						WLAN_UMAC_COMP_P2P);
-	peer_type = wlan_peer_get_peer_type(peer);
-	if ((peer_type == WLAN_PEER_STA) && p2p_vdev_obj) {
-
-		mode = wlan_vdev_mlme_get_opmode(vdev);
-		if (mode == QDF_P2P_GO_MODE) {
-			p2p_vdev_obj->non_p2p_peer_count++;
-			p2p_debug("Non P2P peer count: %d",
-				  p2p_vdev_obj->non_p2p_peer_count);
-		}
-	}
 	p2p_debug("p2p peer object create successful");
 
 	return QDF_STATUS_SUCCESS;
@@ -521,6 +507,8 @@ static QDF_STATUS process_peer_for_noa(struct wlan_objmgr_vdev *vdev,
 	mode = wlan_vdev_mlme_get_opmode(vdev);
 
 	peer_type = wlan_peer_get_peer_type(peer);
+	if (peer_type == WLAN_PEER_STA)
+		p2p_vdev_obj->non_p2p_peer_count++;
 
 	disable_noa = ((mode == QDF_P2P_GO_MODE)
 			&& p2p_vdev_obj->non_p2p_peer_count

+ 0 - 4
core/wma/src/wma_dev_if.c

@@ -2004,10 +2004,6 @@ static int wma_get_obj_mgr_peer_type(tp_wma_handle wma, uint8_t vdev_id,
 		else
 			obj_peer_type = WLAN_PEER_AP;
 	} else if (wma->interfaces[vdev_id].type == WMI_VDEV_TYPE_AP) {
-		if (wma->interfaces[vdev_id].sub_type ==
-				WMI_UNIFIED_VDEV_SUBTYPE_P2P_GO)
-			obj_peer_type = WLAN_PEER_P2P_CLI;
-		else
 			obj_peer_type = WLAN_PEER_STA;
 	} else if (wma->interfaces[vdev_id].type == WMI_VDEV_TYPE_IBSS) {
 		obj_peer_type = WLAN_PEER_IBSS;

+ 34 - 1
core/wma/src/wma_mgmt.c

@@ -1195,6 +1195,36 @@ static void wma_objmgr_set_peer_mlme_phymode(tp_wma_handle wma,
 	wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_WMA_ID);
 }
 
+/**
+ * wma_objmgr_set_peer_mlme_type() - set peer type to peer object
+ * @wma:      wma handle
+ * @mac_addr: mac addr of peer
+ * @peer_type:  peer type value to set
+ *
+ * Return: None
+ */
+static void wma_objmgr_set_peer_mlme_type(tp_wma_handle wma,
+					  uint8_t *mac_addr,
+					  enum wlan_peer_type peer_type)
+{
+	uint8_t pdev_id;
+	struct wlan_objmgr_peer *peer;
+	struct wlan_objmgr_psoc *psoc = wma->psoc;
+
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(wma->pdev);
+	peer = wlan_objmgr_get_peer(psoc, pdev_id, mac_addr,
+				    WLAN_LEGACY_WMA_ID);
+	if (!peer) {
+		WMA_LOGE(FL("peer object null"));
+		return;
+	}
+
+	wlan_peer_obj_lock(peer);
+	wlan_peer_set_peer_type(peer, peer_type);
+	wlan_peer_obj_unlock(peer);
+	wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_WMA_ID);
+}
+
 /**
  * wmi_unified_send_peer_assoc() - send peer assoc command to fw
  * @wma: wma handle
@@ -1384,8 +1414,11 @@ QDF_STATUS wma_send_peer_assoc(tp_wma_handle wma,
 		cmd->peer_flags |= WMI_PEER_160MHZ;
 
 	cmd->peer_vht_caps = params->vht_caps;
-	if (params->p2pCapableSta)
+	if (params->p2pCapableSta) {
 		cmd->peer_flags |= WMI_PEER_IS_P2P_CAPABLE;
+		wma_objmgr_set_peer_mlme_type(wma, params->staMac,
+					      WLAN_PEER_P2P_CLI);
+	}
 
 	if (params->rmfEnabled)
 		cmd->peer_flags |= WMI_PEER_PMF;