]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: introduce mt792x_config_mac_addr_list routine
authorAllan Wang <allan.wang@mediatek.com>
Wed, 16 Oct 2024 10:10:17 +0000 (18:10 +0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 14 Jan 2025 12:34:34 +0000 (13:34 +0100)
Add mt792x_config_mac_addr_list routine in order to set
the mac address list supported by the driver. Initialize
wiphy->addresses/n_addresses for mt792x driver

Signed-off-by: Hao Zhang <hao.zhang@mediatek.com>
Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
Signed-off-by: Allan Wang <allan.wang@mediatek.com>
Link: https://patch.msgid.link/20241016101017.19598-1-allan.wang@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7921/init.c
drivers/net/wireless/mediatek/mt76/mt7925/init.c
drivers/net/wireless/mediatek/mt76/mt792x.h
drivers/net/wireless/mediatek/mt76/mt792x_core.c

index d1d64fa7d35d02ca74c7ed207312009e41f80734..cdcb002b3094692492d0faf62c5fa3b5950e8f4e 100644 (file)
@@ -227,6 +227,7 @@ static void mt7921_init_work(struct work_struct *work)
 
        mt76_set_stream_caps(&dev->mphy, true);
        mt7921_set_stream_he_caps(&dev->phy);
+       mt792x_config_mac_addr_list(dev);
 
        ret = mt76_register_device(&dev->mt76, true, mt76_rates,
                                   ARRAY_SIZE(mt76_rates));
index 039949b344b98142fab2f011e61cc172745738a4..ddc654b9ea5e952dae0df595d964f3fad7d4522b 100644 (file)
@@ -178,6 +178,7 @@ static void mt7925_init_work(struct work_struct *work)
 
        mt76_set_stream_caps(&dev->mphy, true);
        mt7925_set_stream_he_eht_caps(&dev->phy);
+       mt792x_config_mac_addr_list(dev);
 
        ret = mt7925_init_mlo_caps(&dev->phy);
        if (ret) {
index ab12616ec2b87ca346128a9f403f2ef7be40e41c..10e1eaa5270602613e194a4c6d6eeac2c4e0f1cd 100644 (file)
@@ -206,6 +206,8 @@ struct mt792x_dev {
                struct mt76_phy mphy;
        };
 
+       struct mac_address macaddr_list[8];
+
        const struct mt76_bus_ops *bus_ops;
        struct mt792x_phy phy;
 
@@ -414,6 +416,7 @@ int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev);
 void mt792x_mac_link_bss_remove(struct mt792x_dev *dev,
                                struct mt792x_bss_conf *mconf,
                                struct mt792x_link_sta *mlink);
+void mt792x_config_mac_addr_list(struct mt792x_dev *dev);
 
 static inline char *mt792x_ram_name(struct mt792x_dev *dev)
 {
index 042aa8d1b6e796ecc3b5f5aa2057887b4749bc63..868cb97fa2ff58b2c10532bfef9b03220d8dc852 100644 (file)
@@ -916,6 +916,28 @@ int mt792x_load_firmware(struct mt792x_dev *dev)
 }
 EXPORT_SYMBOL_GPL(mt792x_load_firmware);
 
+void mt792x_config_mac_addr_list(struct mt792x_dev *dev)
+{
+       struct ieee80211_hw *hw = mt76_hw(dev);
+       struct wiphy *wiphy = hw->wiphy;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) {
+               u8 *addr = dev->macaddr_list[i].addr;
+
+               memcpy(addr, dev->mphy.macaddr, ETH_ALEN);
+
+               if (!i)
+                       continue;
+
+               addr[0] |= BIT(1);
+               addr[0] ^= ((i - 1) << 2);
+       }
+       wiphy->addresses = dev->macaddr_list;
+       wiphy->n_addresses = ARRAY_SIZE(dev->macaddr_list);
+}
+EXPORT_SYMBOL_GPL(mt792x_config_mac_addr_list);
+
 MODULE_DESCRIPTION("MediaTek MT792x core driver");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");