mt76: connac: update sched_scan cmd usage
authorSean Wang <sean.wang@mediatek.com>
Fri, 19 Feb 2021 17:28:51 +0000 (18:28 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sun, 11 Apr 2021 22:01:21 +0000 (00:01 +0200)
Update sched_scan command usage according to the current firmware
submitted into linux-firmware.git.

Fixes: 80fc1e37c0eb ("mt76: mt7921: rely on mt76_connac_mcu module for sched_scan and hw_scan")
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
drivers/net/wireless/mediatek/mt76/mt76_connac.h
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h

index 491841b..5ef19fb 100644 (file)
@@ -408,11 +408,6 @@ static inline bool is_mt7615(struct mt76_dev *dev)
        return mt76_chip(dev) == 0x7615 || mt76_chip(dev) == 0x7611;
 }
 
-static inline bool is_mt7663(struct mt76_dev *dev)
-{
-       return mt76_chip(dev) == 0x7663;
-}
-
 static inline bool is_mt7611(struct mt76_dev *dev)
 {
        return mt76_chip(dev) == 0x7611;
index 0d58606..b811f3c 100644 (file)
@@ -73,6 +73,11 @@ static inline bool is_mt7921(struct mt76_dev *dev)
        return mt76_chip(dev) == 0x7961;
 }
 
+static inline bool is_mt7663(struct mt76_dev *dev)
+{
+       return mt76_chip(dev) == 0x7663;
+}
+
 int mt76_connac_pm_wake(struct mt76_phy *phy, struct mt76_connac_pm *pm);
 void mt76_connac_power_save_sched(struct mt76_phy *phy,
                                  struct mt76_connac_pm *pm);
index 8151541..125e02b 100644 (file)
@@ -1438,10 +1438,13 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
        req->version = 1;
        req->seq_num = mvif->scan_seq_num | ext_phy << 7;
 
-       if (sreq->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
-               get_random_mask_addr(req->random_mac, sreq->mac_addr,
+       if (is_mt7663(phy->dev) &&
+           (sreq->flags & NL80211_SCAN_FLAG_RANDOM_ADDR)) {
+               get_random_mask_addr(req->mt7663.random_mac, sreq->mac_addr,
                                     sreq->mac_addr_mask);
                req->scan_func = 1;
+       } else if (is_mt7921(phy->dev)) {
+               req->mt7921.bss_idx = mvif->idx;
        }
 
        req->ssids_num = sreq->n_ssids;
index 9c26b90..8478f01 100644 (file)
@@ -756,11 +756,19 @@ struct mt76_connac_sched_scan_req {
        u8 channel_type;
        u8 channels_num;
        u8 intervals_num;
-       u8 scan_func; /* BIT(0) eable random mac address */
+       u8 scan_func; /* MT7663: BIT(0) eable random mac address */
        struct mt76_connac_mcu_scan_channel channels[64];
        __le16 intervals[MT76_CONNAC_MAX_SCHED_SCAN_INTERVAL];
-       u8 random_mac[ETH_ALEN]; /* valid when BIT(0) in scan_func is set */
-       u8 pad2[58];
+       union {
+               struct {
+                       u8 random_mac[ETH_ALEN];
+                       u8 pad2[58];
+               } mt7663;
+               struct {
+                       u8 bss_idx;
+                       u8 pad2[63];
+               } mt7921;
+       };
 } __packed;
 
 struct mt76_connac_sched_scan_done {