Ver código fonte

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)
Nitesh Shah 8 anos atrás
pai
commit
4e2d5eb3e7
2 arquivos alterados com 17 adições e 0 exclusões
  1. 9 0
      core/hdd/src/wlan_hdd_hostapd.c
  2. 8 0
      core/hdd/src/wlan_hdd_wext.c

+ 9 - 0
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)) {

+ 8 - 0
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;