mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
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:
parent
53fdcce6ab
commit
8eb8192ea2
1 changed files with 5 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue