From 5fdba8a77be6e7814698d5ac068cc31775b9930d Mon Sep 17 00:00:00 2001 From: Sean Wang Date: Wed, 6 May 2020 11:55:42 +0200 Subject: [PATCH] mt76: mt7663: add support to sched scan with randomise addr Add support to sched scan with randomise addr Co-developed-by: Wan-Feng Jiang Signed-off-by: Wan-Feng Jiang Co-developed-by: Soul Huang Signed-off-by: Soul Huang Signed-off-by: Sean Wang Co-developed-by: Lorenzo Bianconi Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 7 ++++++- drivers/net/wireless/mediatek/mt76/mt7615/mcu.h | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index 1d49d65..37fc701 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -139,7 +139,8 @@ void mt7615_check_offload_capability(struct mt7615_dev *dev) ieee80211_hw_set(hw, SUPPORTS_PS); ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS); - wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; + wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR | + NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; } else { dev->ops->hw_scan = NULL; dev->ops->cancel_hw_scan = NULL; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 2775238..19b59a7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -2907,7 +2907,12 @@ int mt7615_mcu_sched_scan_req(struct mt7615_phy *phy, req = (struct mt7615_sched_scan_req *)skb_put(skb, sizeof(*req)); req->version = 1; req->seq_num = mvif->scan_seq_num | ext_phy << 7; - req->scan_func = !!(sreq->flags & NL80211_SCAN_FLAG_RANDOM_ADDR); + + if (sreq->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + get_random_mask_addr(req->random_mac, sreq->mac_addr, + sreq->mac_addr_mask); + req->scan_func = 1; + } req->ssids_num = sreq->n_ssids; for (i = 0; i < req->ssids_num; i++) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h index 737ccec..0f12e6da 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h @@ -405,10 +405,11 @@ struct mt7615_sched_scan_req { u8 channel_type; u8 channels_num; u8 intervals_num; - u8 scan_func; + u8 scan_func; /* BIT(0) eable random mac address */ struct mt7615_mcu_scan_channel channels[64]; __le16 intervals[MT7615_MAX_SCHED_SCAN_INTERVAL]; - u8 pad2[64]; + u8 random_mac[ETH_ALEN]; /* valid when BIT(0) in scan_func is set */ + u8 pad2[58]; } __packed; struct nt7615_sched_scan_done { -- 2.7.4