summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Khandavalli <akhandav@codeaurora.org>2016-08-22 12:13:41 +0530
committerArun Khandavalli <akhandav@codeaurora.org>2016-08-24 22:47:22 +0530
commit99286457f60483089157d30e5cd9fdc9fddece12 (patch)
tree73aa1ed4d9af6c6b3ca32418b47753269c3310c0
parentb2f6c26fa481321058ac716597c8d0c3d8069988 (diff)
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
-rw-r--r--core/hdd/src/wlan_hdd_p2p.c16
-rw-r--r--core/hdd/src/wlan_hdd_power.c38
2 files changed, 47 insertions, 7 deletions
diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c
index 02ff295d9cc5..16f3953b177d 100644
--- a/core/hdd/src/wlan_hdd_p2p.c
+++ b/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);
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index d538ff112010..dde5cbbeba17 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/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;