mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
09e93f28aa
commit
e96826bde3
|
@ -19,6 +19,7 @@
|
|||
#include <asm/unaligned.h>
|
||||
#include "mt7601u.h"
|
||||
#include "eeprom.h"
|
||||
#include "mac.h"
|
||||
|
||||
static bool
|
||||
field_valid(u8 val)
|
||||
|
@ -134,27 +135,6 @@ mt7601u_set_chip_cap(struct mt7601u_dev *dev, u8 *eeprom)
|
|||
"Error: device has more than 1 RX/TX stream!\n");
|
||||
}
|
||||
|
||||
static int
|
||||
mt7601u_set_macaddr(struct mt7601u_dev *dev, const u8 *eeprom)
|
||||
{
|
||||
const void *src = eeprom + MT_EE_MAC_ADDR;
|
||||
|
||||
ether_addr_copy(dev->macaddr, src);
|
||||
|
||||
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));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mt7601u_set_channel_target_power(struct mt7601u_dev *dev,
|
||||
u8 *eeprom, u8 max_pwr)
|
||||
{
|
||||
|
@ -400,7 +380,7 @@ mt7601u_eeprom_init(struct mt7601u_dev *dev)
|
|||
dev_info(dev->dev, "EEPROM ver:%02hhx fae:%02hhx\n",
|
||||
eeprom[MT_EE_VERSION_EE], eeprom[MT_EE_VERSION_FAE]);
|
||||
|
||||
mt7601u_set_macaddr(dev, eeprom);
|
||||
mt7601u_set_macaddr(dev, eeprom + MT_EE_MAC_ADDR);
|
||||
mt7601u_set_chip_cap(dev, eeprom);
|
||||
mt7601u_set_channel_power(dev, eeprom);
|
||||
mt7601u_set_country_reg(dev, eeprom);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -174,5 +174,6 @@ u16 mt76_mac_tx_rate_val(struct mt7601u_dev *dev,
|
|||
struct mt76_tx_status
|
||||
mt7601u_mac_fetch_tx_status(struct mt7601u_dev *dev);
|
||||
void mt76_send_tx_status(struct mt7601u_dev *dev, struct mt76_tx_status *stat);
|
||||
void mt7601u_set_macaddr(struct mt7601u_dev *dev, const u8 *addr);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue