Răsfoiți Sursa

qcacld-3.0: Check and kickstart the modules state if they are closed

There are few NL80211 commands which can be triggered from the upper
layer even when the interfaces are down. Check the driver state
machine when these commands gets triggered from the upper layer and
start the modules if they are closed, so these commands can be honoured
correctly.

Change-Id: I4a1d2e95379a5e690b00eea37e80ceb8a91925fb
CRs-Fixed: 1056959
Arun Khandavalli 8 ani în urmă
părinte
comite
99286457f6
2 a modificat fișierele cu 47 adăugiri și 7 ștergeri
  1. 16 0
      core/hdd/src/wlan_hdd_p2p.c
  2. 31 7
      core/hdd/src/wlan_hdd_power.c

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

@@ -2048,6 +2048,15 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
 		return ERR_PTR(-ENOSPC);
 	}
 
+	/*
+	 * Add interface can be requested from the upper layer at any time
+	 * check the statemachine for modules state and if they are closed
+	 * open the modules.
+	 */
+	ret = hdd_wlan_start_modules(pHddCtx, pAdapter, false);
+	if (ret)
+		return ERR_PTR(ret);
+
 	if (NL80211_IFTYPE_AP == type) {
 		ret = hdd_start_adapter(pAdapter);
 		if (ret) {
@@ -2145,6 +2154,13 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 	if (0 != status)
 		return status;
 
+	/*
+	 * check state machine state and kickstart modules if they are closed.
+	 */
+	status = hdd_wlan_start_modules(pHddCtx, pVirtAdapter, false);
+	if (status)
+		return status;
+
 	wlan_hdd_release_intf_addr(pHddCtx,
 				   pVirtAdapter->macAddressCurrent.bytes);
 

+ 31 - 7
core/hdd/src/wlan_hdd_power.c

@@ -1919,6 +1919,14 @@ static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
 	if (0 != status)
 		return status;
 
+	mutex_lock(&pHddCtx->iface_change_lock);
+	if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) {
+		mutex_unlock(&pHddCtx->iface_change_lock);
+		hdd_info("Driver Module not enabled return success");
+		return 0;
+	}
+	mutex_unlock(&pHddCtx->iface_change_lock);
+
 	if ((DRIVER_POWER_MODE_AUTO == !mode) &&
 	    (true == pHddCtx->hdd_wlan_suspended) &&
 	    (pHddCtx->config->fhostArpOffload) &&
@@ -2081,8 +2089,9 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
 				  int *dbm)
 {
 
-	hdd_adapter_t *pAdapter;
 	hdd_context_t *pHddCtx = (hdd_context_t *) wiphy_priv(wiphy);
+	struct net_device *ndev = wdev->netdev;
+	hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
 	int status;
 
 	ENTER();
@@ -2098,17 +2107,32 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
 		return status;
 	}
 
-	pAdapter = hdd_get_adapter(pHddCtx, QDF_STA_MODE);
-	if (NULL == pAdapter) {
-		hdd_err("pAdapter is NULL");
+	if (!adapter) {
+		hdd_err("adapter is NULL");
 		return -ENOENT;
 	}
 
+	/* Validate adapter sessionId */
+	if (adapter->sessionId == HDD_SESSION_ID_INVALID) {
+		hdd_err("Adapter Session Invalid!");
+		return -ENOTSUPP;
+	}
+
+	mutex_lock(&pHddCtx->iface_change_lock);
+	if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) {
+		mutex_unlock(&pHddCtx->iface_change_lock);
+		hdd_info("Driver Module not enabled return success");
+		/* Send cached data to upperlayer*/
+		*dbm = adapter->hdd_stats.ClassA_stat.max_pwr;
+		return 0;
+	}
+	mutex_unlock(&pHddCtx->iface_change_lock);
+
 	MTRACE(qdf_trace(QDF_MODULE_ID_HDD,
 			 TRACE_CODE_HDD_CFG80211_GET_TXPOWER,
-			 pAdapter->sessionId, pAdapter->device_mode));
-	wlan_hdd_get_class_astats(pAdapter);
-	*dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr;
+			 adapter->sessionId, adapter->device_mode));
+	wlan_hdd_get_class_astats(adapter);
+	*dbm = adapter->hdd_stats.ClassA_stat.max_pwr;
 
 	EXIT();
 	return 0;