Commit 8eb8192e authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

ethernet: prestera: use eth_hw_addr_gen()

Commit 406f42fa ("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: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 53fdcce6
...@@ -338,11 +338,14 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id) ...@@ -338,11 +338,14 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
goto err_port_init; 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 /* firmware requires that port's MAC address consist of the first
* 5 bytes of the base MAC address * 5 bytes of the base MAC address
*/ */
memcpy(dev->dev_addr, sw->base_mac, dev->addr_len - 1); if (memcmp(dev->dev_addr, sw->base_mac, ETH_ALEN - 1)) {
dev->dev_addr[dev->addr_len - 1] = port->fp_id; 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); err = prestera_hw_port_mac_set(port, dev->dev_addr);
if (err) { if (err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment