qcacmn: P2P protocol changes to Disable/Enable NOA

P2P-GO whenever goes offchannel, issues NOA. With this behavior, we
have issue whenever legacy STA connects to P2P-GO since legacy STA
does not understand NOA. To handle this case, changes are done in p2p
protocol component and the revised behavior will be:
 1. By default no change in NOA.
 2. Whenever first legacy STA connects to GO, p2p protocol component
    disables NOA (i.e. P2P-GO will issue Self-CTS whenever it goes
    off-channel).
 3. Whenever last legacy STA disconnects from GO, p2p protocol
    component enables NOA (i.e. P2P-GO will issue NOA whenever it goes
    off-channel).

Change-Id: I113950ac3fa99ca68fcafcfe4c6095cf4b2def43
CRs-Fixed: 2035609
diff --git a/umac/cmn_services/inc/wlan_cmn.h b/umac/cmn_services/inc/wlan_cmn.h
index e5484f1..9f771b6 100644
--- a/umac/cmn_services/inc/wlan_cmn.h
+++ b/umac/cmn_services/inc/wlan_cmn.h
@@ -198,7 +198,9 @@
  * enum wlan_peer_type  - peer type
  * @WLAN_PEER_SELF:     for AP mode, SELF PEER or AP PEER are same
  * @WLAN_PEER_AP:       BSS peer for STA mode, Self peer for AP mode
+ * @WLAN_PEER_P2P_GO:   BSS peer for P2P CLI mode, Self peer for P2P GO mode
  * @WLAN_PEER_STA:      Self Peer for STA mode, STA peer for AP mode
+ * @WLAN_PEER_P2P_CLI:  Self peer for P2P CLI mode, P2P CLI peer for P2P GO mode
  * @WLAN_PEER_TDLS:     TDLS Peer
  * @WLAN_PEER_NAWDS:    NAWDS Peer
  * @WLAN_PEER_STA_TEMP: STA Peer Temp (its host only node)
@@ -207,11 +209,13 @@
 enum wlan_peer_type {
 	WLAN_PEER_SELF     = 1,
 	WLAN_PEER_AP       = 2,
-	WLAN_PEER_STA      = 3,
-	WLAN_PEER_TDLS     = 4,
-	WLAN_PEER_NAWDS    = 5,
-	WLAN_PEER_STA_TEMP = 6,
-	WLAN_PEER_IBSS     = 7,
+	WLAN_PEER_P2P_GO   = 3,
+	WLAN_PEER_STA      = 4,
+	WLAN_PEER_P2P_CLI  = 5,
+	WLAN_PEER_TDLS     = 6,
+	WLAN_PEER_NAWDS    = 7,
+	WLAN_PEER_STA_TEMP = 8,
+	WLAN_PEER_IBSS     = 9,
 };
 
 /**
diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c
index bc130c0..7eb5692 100644
--- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c
+++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c
@@ -164,7 +164,8 @@
 	qdf_spinlock_create(&peer->peer_lock);
 	wlan_objmgr_peer_get_ref(peer, WLAN_OBJMGR_ID);
 	/* Increment ref count for BSS peer, so that BSS peer deletes last*/
-	if ((type == WLAN_PEER_STA) || (type == WLAN_PEER_STA_TEMP))
+	if ((type == WLAN_PEER_STA) || (type == WLAN_PEER_STA_TEMP)
+				    || (type == WLAN_PEER_P2P_CLI))
 		wlan_objmgr_peer_get_ref(wlan_vdev_get_bsspeer(vdev),
 					 WLAN_OBJMGR_ID);
 	/* TODO init other parameters */
diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c
index fe6732e..510610a 100644
--- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c
+++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c
@@ -580,7 +580,8 @@
 	wlan_obj_vdev_peerlist_add_tail(&objmgr->wlan_peer_list, peer);
 	objmgr->wlan_peer_count++;
 
-	if (wlan_peer_get_peer_type(peer) == WLAN_PEER_AP) {
+	if ((wlan_peer_get_peer_type(peer) == WLAN_PEER_AP) ||
+	    (wlan_peer_get_peer_type(peer) == WLAN_PEER_P2P_GO)) {
 		if (WLAN_ADDR_EQ(wlan_peer_get_macaddr(peer),
 				 wlan_vdev_mlme_get_macaddr(vdev)) ==
 					QDF_STATUS_SUCCESS) {
@@ -615,7 +616,8 @@
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (wlan_peer_get_peer_type(peer) == WLAN_PEER_AP) {
+	if ((wlan_peer_get_peer_type(peer) == WLAN_PEER_AP) ||
+	    (wlan_peer_get_peer_type(peer) == WLAN_PEER_P2P_GO)) {
 		if (wlan_vdev_get_selfpeer(vdev) == peer) {
 			/*
 			 * There might be instances where new node is created