diff options
author | Lorenzo Bianconi <lorenzo.bianconi@redhat.com> | 2018-02-08 23:08:08 +0100 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-02-28 15:56:05 +0100 |
commit | e96826bde3db15d37ebb7905c24a071d457e9132 (patch) | |
tree | d6b706f02a520ee15b1d4a94a54d79bfca89c5af /drivers/net/wireless/mediatek/mt7601u/mac.c | |
parent | mt76x2: remove warnings in mt76x2_mac_write_txwi() (diff) | |
download | linux-e96826bde3db15d37ebb7905c24a071d457e9132.tar.xz linux-e96826bde3db15d37ebb7905c24a071d457e9132.zip |
mt7601u: move mt7601u_set_macaddr in mac related code
Remove static qualifier from mt7601u_set_macaddr routine and move it
in mac related code in order to be used to properly support vif with
different mac address respect to the default one
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt7601u/mac.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt7601u/mac.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt7601u/mac.c b/drivers/net/wireless/mediatek/mt7601u/mac.c index d6dc59bb00df..4d3077941138 100644 --- a/drivers/net/wireless/mediatek/mt7601u/mac.c +++ b/drivers/net/wireless/mediatek/mt7601u/mac.c @@ -16,6 +16,22 @@ #include "trace.h" #include <linux/etherdevice.h> +void mt7601u_set_macaddr(struct mt7601u_dev *dev, const u8 *addr) +{ + ether_addr_copy(dev->macaddr, addr); + + if (!is_valid_ether_addr(dev->macaddr)) { + eth_random_addr(dev->macaddr); + dev_info(dev->dev, + "Invalid MAC address, using random address %pM\n", + dev->macaddr); + } + + mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(dev->macaddr)); + mt76_wr(dev, MT_MAC_ADDR_DW1, get_unaligned_le16(dev->macaddr + 4) | + FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff)); +} + static void mt76_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate) { |