From 4e2d5eb3e70b7dd66b425b005898e7ad5bc09343 Mon Sep 17 00:00:00 2001 From: Nitesh Shah Date: Tue, 6 Sep 2016 19:45:13 +0530 Subject: [PATCH] qcacld-3.0: Allow Link speed only for P2P GO/Client Link speed is returning incorrect value. Fix is to allow link speed only for P2P GO/Client. Return error for other device modes, as link speed feature in FW is only supported for P2P interfaces as it was implemented to support Miracast. Change-Id: I5747d9ebbcbac3ae1ebf69f261d721a96e22d53c CRs-Fixed: 1063541 (cherry picked from commit 9327fc30217078d165f7be85a3fb277e9d09e669) (cherry picked from commit a346e371732b5fc24f171a3bde4666e7950f3c01) --- core/hdd/src/wlan_hdd_hostapd.c | 9 +++++++++ core/hdd/src/wlan_hdd_wext.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index f556bc1824d5..07eb75f08ccd 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -5045,6 +5045,15 @@ int __iw_get_softap_linkspeed(struct net_device *dev, hdd_notice("wrqu->data.length(%d)", wrqu->data.length); + /* Linkspeed is allowed only for P2P mode */ + if (pHostapdAdapter->device_mode != QDF_P2P_GO_MODE) { + hdd_err("Link Speed is not allowed in Device mode %s(%d)", + hdd_device_mode_to_string( + pHostapdAdapter->device_mode), + pHostapdAdapter->device_mode); + return -ENOTSUPP; + } + if (wrqu->data.length >= MAC_ADDRESS_STR_LEN - 1) { if (copy_from_user((void *)pmacAddress, wrqu->data.pointer, MAC_ADDRESS_STR_LEN)) { diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 325152d3da28..68fff4a800f0 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -1520,6 +1520,14 @@ int wlan_hdd_get_link_speed(hdd_adapter_t *sta_adapter, uint32_t *link_speed) if (ret) return ret; + /* Linkspeed is allowed only for P2P mode */ + if (sta_adapter->device_mode != QDF_P2P_CLIENT_MODE) { + hdd_err("Link Speed is not allowed in Device mode %s(%d)", + hdd_device_mode_to_string(sta_adapter->device_mode), + sta_adapter->device_mode); + return -ENOTSUPP; + } + if (eConnectionState_Associated != hdd_stactx->conn_info.connState) { /* we are not connected so we don't have a classAstats */ *link_speed = 0;