From 82bed73deb1acf6b608682428de1826e0903117e Mon Sep 17 00:00:00 2001 From: Kavitha Velayutham Date: Wed, 13 Mar 2019 15:20:15 +0530 Subject: [PATCH] [NEUS7920-133][9610][7885][7872][7570] wlbt: Ignore address(mac/mask) sent by CFG when randomization is disabled in Fw Ignore the Mac address sent by cfg when mac randomization is enabled in host and disabled in fw. so that Fw has the control of enabling/disabling Mac randomization Change-Id: If3dfd5925b0271fd93c9c4c0e462bd1ea9031ce3 SCSC-Bug-Id: SB-50533 Signed-off-by: Kavitha Velayutham --- drivers/net/wireless/scsc/cfg80211_ops.c | 13 +++++++++---- drivers/net/wireless/scsc/dev.h | 3 +++ drivers/net/wireless/scsc/mgt.c | 14 +++++++++++--- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/scsc/cfg80211_ops.c b/drivers/net/wireless/scsc/cfg80211_ops.c index cab34ef00256..17e90344fc28 100755 --- a/drivers/net/wireless/scsc/cfg80211_ops.c +++ b/drivers/net/wireless/scsc/cfg80211_ops.c @@ -579,10 +579,15 @@ int slsi_scan(struct wiphy *wiphy, struct net_device *dev, #ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - memcpy(sdev->scan_mac_addr, request->mac_addr, ETH_ALEN); - r = slsi_set_mac_randomisation_mask(sdev, request->mac_addr_mask); - if (!r) - sdev->scan_addr_set = 1; + if (sdev->fw_mac_randomization_enabled) { + memcpy(sdev->scan_mac_addr, request->mac_addr, ETH_ALEN); + r = slsi_set_mac_randomisation_mask(sdev, request->mac_addr_mask); + if (!r) + sdev->scan_addr_set = 1; + } else { + SLSI_NET_INFO(dev, "Mac Randomization is not enabled in Firmware\n"); + sdev->scan_addr_set = 0; + } } else #endif if (sdev->scan_addr_set) { diff --git a/drivers/net/wireless/scsc/dev.h b/drivers/net/wireless/scsc/dev.h index f4c5e0a0abe7..ad46ecf0b0da 100755 --- a/drivers/net/wireless/scsc/dev.h +++ b/drivers/net/wireless/scsc/dev.h @@ -1106,6 +1106,9 @@ struct slsi_dev { u16 rtt_vif[8]; bool acs_channel_switched; int recovery_timeout; /* ms autorecovery completion timeout */ +#ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION + bool fw_mac_randomization_enabled; +#endif }; /* Compact representation of channels a ESS has been seen on diff --git a/drivers/net/wireless/scsc/mgt.c b/drivers/net/wireless/scsc/mgt.c index befb8164ae2a..3d009a9e2506 100755 --- a/drivers/net/wireless/scsc/mgt.c +++ b/drivers/net/wireless/scsc/mgt.c @@ -1259,7 +1259,10 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) #endif #ifdef CONFIG_SCSC_WLAN_AP_INFO_FILE { SLSI_PSID_UNIFI_DUAL_BAND_CONCURRENCY, {0, 0} }, - { SLSI_PSID_UNIFI_MAX_CLIENT, {0, 0} } + { SLSI_PSID_UNIFI_MAX_CLIENT, {0, 0} }, +#endif +#ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION + { SLSI_PSID_UNIFI_MAC_ADDRESS_RANDOMISATION_ACTIVATED, {0, 0} } #endif };/*Check the mibrsp.dataLength when a new mib is added*/ @@ -1271,7 +1274,7 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) if (r != SLSI_MIB_STATUS_SUCCESS) return -ENOMEM; - mibrsp.dataLength = 154; + mibrsp.dataLength = 164; mibrsp.data = kmalloc(mibrsp.dataLength, GFP_KERNEL); if (!mibrsp.data) { kfree(mibreq.data); @@ -1412,7 +1415,12 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) else SLSI_WARN(sdev, "Error reading SoftAP max client\n"); #endif - +#ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION + if (values[++mib_index].type != SLSI_MIB_TYPE_NONE) /* Mac Randomization enable? */ + sdev->fw_mac_randomization_enabled = values[mib_index].u.boolValue; + else + SLSI_WARN(sdev, "Error reading Mac Randomization Support\n"); +#endif kfree(values); } kfree(mibrsp.data); -- 2.20.1