Prechádzať zdrojové kódy

qcacld-3.0: Disconnect any existing session before new connection

If user is issuing connect command again and again with some AP,
driver should first do a disconnect and wait for completion of disconnect.
Once disconnect is done, driver should start new connection.

Change-Id: I8d64384ea1feef1173800a6f2910945d9046020b
CRs-Fixed: 1114683
Agrawal Ashish 8 rokov pred
rodič
commit
3d000b4cca

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

@@ -5495,7 +5495,6 @@ static int __iw_set_essid(struct net_device *dev,
 		 struct iw_request_info *info,
 		 union iwreq_data *wrqu, char *extra)
 {
-	unsigned long rc;
 	uint32_t status = 0;
 	hdd_wext_state_t *pWextState;
 	hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
@@ -5504,7 +5503,6 @@ static int __iw_set_essid(struct net_device *dev,
 	tCsrRoamProfile *pRoamProfile;
 	eCsrAuthType RSNAuthType;
 	tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-	hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 	int ret;
 
 	ENTER_DEV(dev);
@@ -5537,23 +5535,11 @@ static int __iw_set_essid(struct net_device *dev,
 		return -EINVAL;
 
 	pRoamProfile = &pWextState->roamProfile;
-	if (hdd_conn_is_connected(pHddStaCtx) ||
-	    (pAdapter->device_mode == QDF_IBSS_MODE)) {
-		QDF_STATUS qdf_status;
-
-		/* Need to issue a disconnect to CSR. */
-		INIT_COMPLETION(pAdapter->disconnect_comp_var);
-		qdf_status = sme_roam_disconnect(hHal, pAdapter->sessionId,
-					 eCSR_DISCONNECT_REASON_UNSPECIFIED);
-
-		if (QDF_STATUS_SUCCESS == qdf_status) {
-			rc = wait_for_completion_timeout(&pAdapter->
-						 disconnect_comp_var,
-						 msecs_to_jiffies
-						 (WLAN_WAIT_TIME_DISCONNECT));
-			if (!rc)
-				hdd_err("Disconnect event timed out");
-		}
+	/*Try disconnecting if already in connected state*/
+	status = wlan_hdd_try_disconnect(pAdapter);
+	if (0 > status) {
+	    hdd_err("Failed to disconnect the existing connection");
+	    return -EALREADY;
 	}
 
 	/*

+ 1 - 9
core/hdd/src/wlan_hdd_cfg80211.c

@@ -13792,15 +13792,7 @@ static int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter,
 	return status;
 }
 
-/**
- * wlan_hdd_try_disconnect() - try disconnnect from previous connection
- * @pAdapter: Pointer to adapter
- *
- * This function is used to disconnect from previous connection
- *
- * Return: 0 for success, non-zero for failure
- */
-static int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter)
+int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter)
 {
 	unsigned long rc;
 	hdd_station_ctx_t *pHddStaCtx;

+ 10 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -3740,4 +3740,14 @@ void hdd_lost_link_info_cb(void *context,
  * Return : Corresponding band for SAP operating channel
  */
 uint8_t hdd_get_sap_operating_band(hdd_context_t *hdd_ctx);
+
+/**
+ * wlan_hdd_try_disconnect() - try disconnnect from previous connection
+ * @adapter: Pointer to adapter
+ *
+ * This function is used to disconnect from previous connection
+ *
+ * Return: 0 for success, non-zero for failure
+ */
+int wlan_hdd_try_disconnect(hdd_adapter_t *adapter);
 #endif