From 5d0fe41a93ff6ef5a11f079ed3968262126b1dc9 Mon Sep 17 00:00:00 2001 From: Bala Venkatesh Date: Thu, 25 Jul 2019 15:48:24 +0530 Subject: [PATCH] qcacld-3.0: Do not allow get_tx_power for all interfaces Currently, get_tx_power is given for all interfaces but FW may not respond for interfaces like p2p device mode or NAN. Allow cfg80211_get_tx_power only for STA/P2P_client associated state and SAP/GO started cases. In rest all cases do not give this command to FW. Change-Id: I01ff4f11c35ca00183002d2d1c2c481f3bea77c6 CRs-Fixed: 2502905 --- core/hdd/src/wlan_hdd_power.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index bc3c021d8cc0..af3fda007ddc 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2154,6 +2154,7 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, struct net_device *ndev = wdev->netdev; struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev); int status; + struct hdd_station_ctx *sta_ctx; hdd_enter_dev(ndev); @@ -2172,22 +2173,30 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, status = wlan_hdd_validate_vdev_id(adapter->vdev_id); if (status) return status; - - if (adapter->device_mode == QDF_STA_MODE || - adapter->device_mode == QDF_P2P_CLIENT_MODE) { - struct hdd_station_ctx *sta_ctx; - + switch (adapter->device_mode) { + case QDF_STA_MODE: + case QDF_P2P_CLIENT_MODE: sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (sta_ctx->hdd_reassoc_scenario) { hdd_debug("Roaming is in progress, rej this req"); return -EINVAL; } - if (sta_ctx->conn_info.conn_state != eConnectionState_Associated) { hdd_debug("Not associated"); return 0; } + break; + case QDF_SAP_MODE: + case QDF_P2P_GO_MODE: + if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { + hdd_err("SAP is not started yet"); + return 0; + } + break; + default: + hdd_debug_rl("Current interface is not supported for get tx_power"); + return 0; } if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {