diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-10-18 07:29:32 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-10-19 12:41:48 +0100 |
commit | f15fef4c0675d4117d71ae5233e864fd3db14761 (patch) | |
tree | d5bbba3cf251af987cd682abf19eb0115e32aabc /drivers/net/ethernet/smsc | |
parent | 02bfb6beb695dbf5fb8119f4700516be09da70aa (diff) | |
download | linux-f15fef4c0675d4117d71ae5233e864fd3db14761.tar.gz linux-f15fef4c0675d4117d71ae5233e864fd3db14761.tar.bz2 linux-f15fef4c0675d4117d71ae5233e864fd3db14761.zip |
ethernet: smsc: use eth_hw_addr_set()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Break the address up into an array on the stack, then call
eth_hw_addr_set().
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/smsc')
-rw-r--r-- | drivers/net/ethernet/smsc/smsc911x.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/smsc/smsc9420.c | 18 |
2 files changed, 19 insertions, 15 deletions
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 73bcc6f2bb6e..7a50ba00f8ae 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2162,13 +2162,15 @@ static void smsc911x_read_mac_address(struct net_device *dev) struct smsc911x_data *pdata = netdev_priv(dev); u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH); u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL); - - dev->dev_addr[0] = (u8)(mac_low32); - dev->dev_addr[1] = (u8)(mac_low32 >> 8); - dev->dev_addr[2] = (u8)(mac_low32 >> 16); - dev->dev_addr[3] = (u8)(mac_low32 >> 24); - dev->dev_addr[4] = (u8)(mac_high16); - dev->dev_addr[5] = (u8)(mac_high16 >> 8); + u8 addr[ETH_ALEN]; + + addr[0] = (u8)(mac_low32); + addr[1] = (u8)(mac_low32 >> 8); + addr[2] = (u8)(mac_low32 >> 16); + addr[3] = (u8)(mac_low32 >> 24); + addr[4] = (u8)(mac_high16); + addr[5] = (u8)(mac_high16 >> 8); + eth_hw_addr_set(dev, addr); } /* Initializing private device structures, only called from probe */ diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c index d207c0b463ab..d937af18973e 100644 --- a/drivers/net/ethernet/smsc/smsc9420.c +++ b/drivers/net/ethernet/smsc/smsc9420.c @@ -416,6 +416,7 @@ static void smsc9420_set_mac_address(struct net_device *dev) static void smsc9420_check_mac_address(struct net_device *dev) { struct smsc9420_pdata *pd = netdev_priv(dev); + u8 addr[ETH_ALEN]; /* Check if mac address has been specified when bringing interface up */ if (is_valid_ether_addr(dev->dev_addr)) { @@ -427,15 +428,16 @@ static void smsc9420_check_mac_address(struct net_device *dev) * it will already have been set */ u32 mac_high16 = smsc9420_reg_read(pd, ADDRH); u32 mac_low32 = smsc9420_reg_read(pd, ADDRL); - dev->dev_addr[0] = (u8)(mac_low32); - dev->dev_addr[1] = (u8)(mac_low32 >> 8); - dev->dev_addr[2] = (u8)(mac_low32 >> 16); - dev->dev_addr[3] = (u8)(mac_low32 >> 24); - dev->dev_addr[4] = (u8)(mac_high16); - dev->dev_addr[5] = (u8)(mac_high16 >> 8); - - if (is_valid_ether_addr(dev->dev_addr)) { + addr[0] = (u8)(mac_low32); + addr[1] = (u8)(mac_low32 >> 8); + addr[2] = (u8)(mac_low32 >> 16); + addr[3] = (u8)(mac_low32 >> 24); + addr[4] = (u8)(mac_high16); + addr[5] = (u8)(mac_high16 >> 8); + + if (is_valid_ether_addr(addr)) { /* eeprom values are valid so use them */ + eth_hw_addr_set(dev, addr); netif_dbg(pd, probe, pd->dev, "Mac Address is read from EEPROM\n"); } else { |