From bcd576e7101f7f459ae231bb723b1bf037bef9ee Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 17 Dec 2017 11:44:11 +0100 Subject: [PATCH] Revert "mt76x2: drop wiphy->addresses" This reverts commit 9de77e1efc9c5b3b6532047bae5717b2813f99a5. --- mt76x2.h | 2 ++ mt76x2_init.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mt76x2.h b/mt76x2.h index 7f961cc45..a993cc09c 100644 --- a/mt76x2.h +++ b/mt76x2.h @@ -84,6 +84,8 @@ struct mt76x2_calibration { struct mt76x2_dev { struct mt76_dev mt76; /* must be first */ + struct mac_address macaddr_list[8]; + struct mutex mutex; const u16 *beacon_offsets; diff --git a/mt76x2_init.c b/mt76x2_init.c index 45a7d16ff..384960420 100644 --- a/mt76x2_init.c +++ b/mt76x2_init.c @@ -797,7 +797,7 @@ int mt76x2_register_device(struct mt76x2_dev *dev) struct wiphy *wiphy = hw->wiphy; void *status_fifo; int fifo_size; - int ret; + int i, ret; fifo_size = roundup_pow_of_two(32 * sizeof(struct mt76x2_tx_status)); status_fifo = devm_kzalloc(dev->mt76.dev, fifo_size, GFP_KERNEL); @@ -819,6 +819,20 @@ int mt76x2_register_device(struct mt76x2_dev *dev) hw->sta_data_size = sizeof(struct mt76x2_sta); hw->vif_data_size = sizeof(struct mt76x2_vif); + for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) { + u8 *addr = dev->macaddr_list[i].addr; + + memcpy(addr, dev->mt76.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); + wiphy->iface_combinations = if_comb; wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);