Browse Source

qcacld-3.0: Activate debug functions in P2P component

Remove P2P debug functions from legacy code and apply the new
functions in UMAC P2P component.

Change-Id: I1ff627a553108c74be144232fd0a0406d88de395
CRs-Fixed: 2105808
Wu Gao 7 years ago
parent
commit
c02785db21

+ 0 - 16
core/hdd/inc/wlan_hdd_p2p.h

@@ -72,22 +72,6 @@
 #define ACTION_FRAME_RSP_WAIT 500
 #define ACTION_FRAME_ACK_WAIT 300
 
-#ifdef WLAN_FEATURE_P2P_DEBUG
-enum p2p_connection_status {
-	P2P_NOT_ACTIVE,
-	P2P_GO_NEG_PROCESS,
-	P2P_GO_NEG_COMPLETED,
-	P2P_CLIENT_CONNECTING_STATE_1,
-	P2P_GO_COMPLETED_STATE,
-	P2P_CLIENT_CONNECTED_STATE_1,
-	P2P_CLIENT_DISCONNECTED_STATE,
-	P2P_CLIENT_CONNECTING_STATE_2,
-	P2P_CLIENT_COMPLETED_STATE
-};
-
-extern enum p2p_connection_status global_p2p_connection_status;
-#endif
-
 struct p2p_app_set_ps {
 	uint8_t opp_ps;
 	uint32_t ctWindow;

+ 5 - 37
core/hdd/src/wlan_hdd_assoc.c

@@ -66,6 +66,7 @@
 #include "wlan_pmo_ucfg_api.h"
 #include "wlan_hdd_tsf.h"
 #include "wlan_utility.h"
+#include "wlan_p2p_ucfg_api.h"
 
 /* These are needed to recognize WPA and RSN suite types */
 #define HDD_WPA_OUI_SIZE 4
@@ -1272,21 +1273,8 @@ static void hdd_send_association_event(struct net_device *dev,
 		memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId,
 		       sizeof(pCsrRoamInfo->pBssDesc->bssId));
 
-#ifdef WLAN_FEATURE_P2P_DEBUG
-		if (adapter->device_mode == QDF_P2P_CLIENT_MODE) {
-			if (global_p2p_connection_status ==
-			    P2P_CLIENT_CONNECTING_STATE_1) {
-				global_p2p_connection_status =
-					P2P_CLIENT_CONNECTED_STATE_1;
-				hdd_debug("[P2P State] Changing state from Connecting state to Connected State for 8-way Handshake");
-			} else if (global_p2p_connection_status ==
-				   P2P_CLIENT_CONNECTING_STATE_2) {
-				global_p2p_connection_status =
-					P2P_CLIENT_COMPLETED_STATE;
-				hdd_debug("[P2P State] Changing state from Connecting state to P2P Client Connection Completed");
-			}
-		}
-#endif
+		ucfg_p2p_status_connect(adapter->hdd_vdev);
+
 		pr_info("wlan: " MAC_ADDRESS_STR " connected to "
 			MAC_ADDRESS_STR "\n",
 			MAC_ADDR_ARRAY(adapter->macAddressCurrent.bytes),
@@ -1689,29 +1677,9 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter,
 				roam_info->reasonCode :
 				WLAN_REASON_UNSPECIFIED);
 		}
-		/*
-		 * During the WLAN uninitialization,supplicant is stopped
-		 * before the driver so not sending the status of the
-		 * connection to supplicant.
-		 */
-		if (cds_is_load_or_unload_in_progress()) {
-#ifdef WLAN_FEATURE_P2P_DEBUG
-			if (adapter->device_mode == QDF_P2P_CLIENT_MODE) {
-				if (global_p2p_connection_status ==
-				    P2P_CLIENT_CONNECTED_STATE_1) {
-					global_p2p_connection_status =
-						P2P_CLIENT_DISCONNECTED_STATE;
-					hdd_debug("[P2P State] 8 way Handshake completed and moved to disconnected state");
-				} else if (global_p2p_connection_status ==
-					   P2P_CLIENT_COMPLETED_STATE) {
-					global_p2p_connection_status =
-						P2P_NOT_ACTIVE;
-					hdd_debug("[P2P State] P2P Client is removed and moved to inactive state");
-				}
-			}
-#endif
 
-		}
+		/* update P2P connection status */
+		ucfg_p2p_status_disconnect(adapter->hdd_vdev);
 	}
 
 	hdd_wmm_adapter_clear(adapter);

+ 6 - 18
core/hdd/src/wlan_hdd_hostapd.c

@@ -87,6 +87,7 @@
 #include "wlan_dfs_utils_api.h"
 #include <wlan_reg_ucfg_api.h>
 #include "wlan_utility.h"
+#include <wlan_p2p_ucfg_api.h>
 
 #define    IS_UP(_dev) \
 	(((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
@@ -8068,17 +8069,8 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 		wlan_hdd_set_dhcp_server_offload(adapter);
 #endif /* DHCP_SERVER_OFFLOAD */
 
-#ifdef WLAN_FEATURE_P2P_DEBUG
-	if (adapter->device_mode == QDF_P2P_GO_MODE) {
-		if (global_p2p_connection_status == P2P_GO_NEG_COMPLETED) {
-			global_p2p_connection_status = P2P_GO_COMPLETED_STATE;
-			hdd_debug("[P2P State] From Go nego completed to Non-autonomous Group started");
-		} else if (global_p2p_connection_status == P2P_NOT_ACTIVE) {
-			global_p2p_connection_status = P2P_GO_COMPLETED_STATE;
-			hdd_debug("[P2P State] From Inactive to Autonomous Group started");
-		}
-	}
-#endif
+	ucfg_p2p_status_start_bss(adapter->hdd_vdev);
+
 	/* Check and restart SAP if it is on unsafe channel */
 	hdd_unsafe_channel_restart_sap(hdd_ctx);
 
@@ -8304,13 +8296,9 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 	/* Reset WNI_CFG_PROBE_RSP Flags */
 	wlan_hdd_reset_prob_rspies(adapter);
 	hdd_destroy_acs_timer(adapter);
-#ifdef WLAN_FEATURE_P2P_DEBUG
-	if ((adapter->device_mode == QDF_P2P_GO_MODE) &&
-	    (global_p2p_connection_status == P2P_GO_COMPLETED_STATE)) {
-		hdd_debug("[P2P State] From GO completed to Inactive state GO got removed");
-		global_p2p_connection_status = P2P_NOT_ACTIVE;
-	}
-#endif
+
+	ucfg_p2p_status_stop_bss(adapter->hdd_vdev);
+
 	EXIT();
 
 	return ret;

+ 0 - 94
core/hdd/src/wlan_hdd_p2p.c

@@ -105,13 +105,6 @@ const char *p2p_action_frame_type[] = { "GO Negotiation Request",
 					"Provision Discovery Request",
 					"Provision Discovery Response"};
 
-/* We no need to protect this variable since
- * there is no chance of race to condition
- * and also not make any complicating the code
- * just for debugging log
- */
-enum p2p_connection_status global_p2p_connection_status = P2P_NOT_ACTIVE;
-
 #endif
 #define MAX_TDLS_ACTION_FRAME_TYPE 11
 const char *tdls_action_frame_type[] = { "TDLS Setup Request",
@@ -1479,38 +1472,6 @@ static int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 		   buf[WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET +
 		   WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET]);
 
-#ifdef WLAN_FEATURE_P2P_DEBUG
-	if ((type == SIR_MAC_MGMT_FRAME) &&
-	    (subType == SIR_MAC_MGMT_ACTION) &&
-	    wlan_hdd_is_type_p2p_action(&buf
-				[WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET])) {
-		actionFrmType = buf[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET];
-		if (actionFrmType >= MAX_P2P_ACTION_FRAME_TYPE) {
-			hdd_debug("[P2P] unknown[%d] ---> OTA to " MAC_ADDRESS_STR,
-				actionFrmType,
-				MAC_ADDR_ARRAY(&buf
-					       [WLAN_HDD_80211_FRM_DA_OFFSET]));
-		} else {
-			hdd_debug("[P2P] %s ---> OTA to "
-			       MAC_ADDRESS_STR,
-			       p2p_action_frame_type[actionFrmType],
-			       MAC_ADDR_ARRAY(&buf
-					      [WLAN_HDD_80211_FRM_DA_OFFSET]));
-			if ((actionFrmType == WLAN_HDD_PROV_DIS_REQ)
-			    && (global_p2p_connection_status == P2P_NOT_ACTIVE)) {
-				global_p2p_connection_status = P2P_GO_NEG_PROCESS;
-				hdd_debug("[P2P State]Inactive state to GO negotiation progress state");
-			} else if ((actionFrmType == WLAN_HDD_GO_NEG_CNF) &&
-				   (global_p2p_connection_status ==
-				    P2P_GO_NEG_PROCESS)) {
-				global_p2p_connection_status =
-					P2P_GO_NEG_COMPLETED;
-				hdd_debug("[P2P State]GO nego progress to GO nego completed state");
-			}
-		}
-	}
-#endif
-
 	noack = dont_wait_for_ack;
 
 	/* If the wait is coming as 0 with off channel set */
@@ -2522,56 +2483,6 @@ int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 	return ret;
 }
 
-#ifdef WLAN_FEATURE_P2P_DEBUG
-/*
- * wlan_hdd_p2p_action_debug() - Log P2P state and update global status
- * @actionFrmType: action frame type
- * @macFrom: peer mac address
- *
- * return: void
- */
-static void wlan_hdd_p2p_action_debug(enum action_frm_type actionFrmType,
-					uint8_t *macFrom)
-{
-	if (actionFrmType >= MAX_P2P_ACTION_FRAME_TYPE) {
-		hdd_debug("[P2P] unknown[%d] <--- OTA from " MAC_ADDRESS_STR,
-			actionFrmType, MAC_ADDR_ARRAY(macFrom));
-	} else {
-		hdd_debug("[P2P] %s <--- OTA from " MAC_ADDRESS_STR,
-			p2p_action_frame_type[actionFrmType],
-			MAC_ADDR_ARRAY(macFrom));
-		if ((actionFrmType == WLAN_HDD_PROV_DIS_REQ)
-		    && (global_p2p_connection_status == P2P_NOT_ACTIVE)) {
-			global_p2p_connection_status = P2P_GO_NEG_PROCESS;
-			hdd_debug("[P2P State]Inactive state to GO negotiation progress state");
-		} else
-		if ((actionFrmType == WLAN_HDD_GO_NEG_CNF)
-		    && (global_p2p_connection_status == P2P_GO_NEG_PROCESS)) {
-			global_p2p_connection_status = P2P_GO_NEG_COMPLETED;
-			hdd_debug("[P2P State]GO negotiation progress to GO negotiation completed state");
-		} else
-		if ((actionFrmType == WLAN_HDD_INVITATION_REQ)
-		    && (global_p2p_connection_status == P2P_NOT_ACTIVE)) {
-			global_p2p_connection_status = P2P_GO_NEG_COMPLETED;
-			hdd_debug("[P2P State]Inactive state to GO negotiation completed state Autonomous GO formation");
-		}
-	}
-}
-#else
-/*
- * wlan_hdd_p2p_action_debug() - dummy
- * @actionFrmType: action frame type
- * @macFrom: peer mac address
- *
- * return: void
- */
-static void wlan_hdd_p2p_action_debug(enum action_frm_type actionFrmType,
-					uint8_t *macFrom)
-{
-
-}
-#endif
-
 void __hdd_indicate_mgmt_frame(struct hdd_adapter *adapter,
 			     uint32_t nFrameLength,
 			     uint8_t *pbFrames,
@@ -2686,17 +2597,12 @@ void __hdd_indicate_mgmt_frame(struct hdd_adapter *adapter,
 					     + 2], SIR_MAC_P2P_OUI,
 					    SIR_MAC_P2P_OUI_SIZE)) {
 			/* P2P action frames */
-				uint8_t *macFrom = &pbFrames
-					[WLAN_HDD_80211_PEER_ADDR_OFFSET];
 				actionFrmType =
 					pbFrames
 					[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET];
 				hdd_debug("Rx Action Frame %u",
 					 actionFrmType);
 
-				wlan_hdd_p2p_action_debug(actionFrmType,
-								macFrom);
-
 				mutex_lock(&cfgState->remain_on_chan_ctx_lock);
 				pRemainChanCtx = cfgState->remain_on_chan_ctx;
 				if (pRemainChanCtx != NULL) {

+ 7 - 23
core/hdd/src/wlan_hdd_scan.c

@@ -47,6 +47,7 @@
 #include "wlan_hdd_power.h"
 #include "wma_api.h"
 #include "cds_utils.h"
+#include "wlan_p2p_ucfg_api.h"
 
 #ifdef WLAN_UMAC_CONVERGENCE
 #include "wlan_cfg80211.h"
@@ -635,6 +636,12 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 		pwextBuf->roamProfile.nAddIEScanLength =
 			pScanInfo->scanAddIE.length;
 	}
+
+	if ((request->n_ssids == 1) && (request->ssids != NULL) &&
+	    (request->ssids[0].ssid_len > 7) &&
+	     !qdf_mem_cmp(&request->ssids[0], "DIRECT-", 7))
+		ucfg_p2p_status_scan(adapter->hdd_vdev);
+
 #ifdef NAPIER_SCAN
 	status = wlan_cfg80211_scan(hdd_ctx->hdd_pdev, request, &params);
 	if (params.default_ie.ptr)
@@ -775,29 +782,6 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 		pP2pIe = wlan_hdd_get_p2p_ie_ptr((uint8_t *) request->ie,
 						 request->ie_len);
 		if (pP2pIe != NULL) {
-#ifdef WLAN_FEATURE_P2P_DEBUG
-			if (((global_p2p_connection_status ==
-							P2P_GO_NEG_COMPLETED)
-			     || (global_p2p_connection_status ==
-				 P2P_GO_NEG_PROCESS))
-			    && (QDF_P2P_CLIENT_MODE ==
-						adapter->device_mode)) {
-				global_p2p_connection_status =
-					P2P_CLIENT_CONNECTING_STATE_1;
-				hdd_debug("[P2P State] Changing state from Go nego completed to Connection is started");
-				hdd_debug("[P2P]P2P Scanning is started for 8way Handshake");
-			} else
-			if ((global_p2p_connection_status ==
-			     P2P_CLIENT_DISCONNECTED_STATE)
-			    && (QDF_P2P_CLIENT_MODE ==
-				adapter->device_mode)) {
-				global_p2p_connection_status =
-					P2P_CLIENT_CONNECTING_STATE_2;
-				hdd_debug("[P2P State] Changing state from Disconnected state to Connection is started");
-				hdd_debug("[P2P]P2P Scanning is started for 4way Handshake");
-			}
-#endif
-
 			/* no_cck will be set during p2p find to
 			 * disable 11b rates
 			 */