Skip to content

Commit

Permalink
net: thunderbolt: use eth_hw_addr_set()
Browse files Browse the repository at this point in the history
Commit 406f42f ("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 go through appropriate helpers.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20211026175547.3198242-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Oct 28, 2021
1 parent 8b6ce9b commit 5a48585
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/thunderbolt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,17 +1202,19 @@ static void tbnet_generate_mac(struct net_device *dev)
{
const struct tbnet *net = netdev_priv(dev);
const struct tb_xdomain *xd = net->xd;
u8 addr[ETH_ALEN];
u8 phy_port;
u32 hash;

phy_port = tb_phy_port_from_link(TBNET_L0_PORT_NUM(xd->route));

/* Unicast and locally administered MAC */
dev->dev_addr[0] = phy_port << 4 | 0x02;
addr[0] = phy_port << 4 | 0x02;
hash = jhash2((u32 *)xd->local_uuid, 4, 0);
memcpy(dev->dev_addr + 1, &hash, sizeof(hash));
memcpy(addr + 1, &hash, sizeof(hash));
hash = jhash2((u32 *)xd->local_uuid, 4, hash);
dev->dev_addr[5] = hash & 0xff;
addr[5] = hash & 0xff;
eth_hw_addr_set(dev, addr);
}

static int tbnet_probe(struct tb_service *svc, const struct tb_service_id *id)
Expand Down

0 comments on commit 5a48585

Please sign in to comment.