Commit 269906ac authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: introduce mt76x02_config_mac_addr_list routine

Add mt76x02_config_mac_addr_list routine in order to set
the mac address list supported by the driver. Initialize
wiphy->addresses/n_addresses for mt76x0e driver
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 6bf4a8e9
...@@ -289,6 +289,8 @@ int mt76x0_register_device(struct mt76x02_dev *dev) ...@@ -289,6 +289,8 @@ int mt76x0_register_device(struct mt76x02_dev *dev)
int ret; int ret;
mt76x02_init_device(dev); mt76x02_init_device(dev);
mt76x02_config_mac_addr_list(dev);
ret = mt76_register_device(&dev->mt76, true, mt76x02_rates, ret = mt76_register_device(&dev->mt76, true, mt76x02_rates,
ARRAY_SIZE(mt76x02_rates)); ARRAY_SIZE(mt76x02_rates));
if (ret) if (ret)
......
...@@ -115,6 +115,7 @@ int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -115,6 +115,7 @@ int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta); struct ieee80211_sta *sta);
void mt76x02_config_mac_addr_list(struct mt76x02_dev *dev);
void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif, void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
unsigned int idx); unsigned int idx);
int mt76x02_add_interface(struct ieee80211_hw *hw, int mt76x02_add_interface(struct ieee80211_hw *hw,
......
...@@ -700,4 +700,26 @@ void mt76x02_bss_info_changed(struct ieee80211_hw *hw, ...@@ -700,4 +700,26 @@ void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
} }
EXPORT_SYMBOL_GPL(mt76x02_bss_info_changed); EXPORT_SYMBOL_GPL(mt76x02_bss_info_changed);
void mt76x02_config_mac_addr_list(struct mt76x02_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->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);
}
EXPORT_SYMBOL_GPL(mt76x02_config_mac_addr_list);
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
...@@ -390,7 +390,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev) ...@@ -390,7 +390,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev)
{ {
struct ieee80211_hw *hw = mt76_hw(dev); struct ieee80211_hw *hw = mt76_hw(dev);
struct wiphy *wiphy = hw->wiphy; struct wiphy *wiphy = hw->wiphy;
int i, ret; int ret;
INIT_DELAYED_WORK(&dev->cal_work, mt76x2_phy_calibrate); INIT_DELAYED_WORK(&dev->cal_work, mt76x2_phy_calibrate);
...@@ -400,20 +400,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev) ...@@ -400,20 +400,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev)
if (ret) if (ret)
return ret; return ret;
for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) { mt76x02_config_mac_addr_list(dev);
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_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS); wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
/* init led callbacks */ /* init led callbacks */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment