ethernet: prestera: use eth_hw_addr_gen()

Commit 406f42fa0d ("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.

Vadym and Taras report that the current behavior of the driver
is not exactly expected and it's better to add the port id in
like other drivers do.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2021-10-18 14:10:04 -07:00 committed by David S. Miller
parent 53fdcce6ab
commit 8eb8192ea2

View file

@ -338,11 +338,14 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
goto err_port_init;
}
eth_hw_addr_gen(dev, sw->base_mac, port->fp_id);
/* firmware requires that port's MAC address consist of the first
* 5 bytes of the base MAC address
*/
memcpy(dev->dev_addr, sw->base_mac, dev->addr_len - 1);
dev->dev_addr[dev->addr_len - 1] = port->fp_id;
if (memcmp(dev->dev_addr, sw->base_mac, ETH_ALEN - 1)) {
dev_warn(prestera_dev(sw), "Port MAC address wraps for port(%u)\n", id);
dev_addr_mod(dev, 0, sw->base_mac, ETH_ALEN - 1);
}
err = prestera_hw_port_mac_set(port, dev->dev_addr);
if (err) {