On Fri, Oct 15, 2021 at 05:17:30PM -0700, Jakub Kicinski wrote:
On Sat, 16 Oct 2021 02:51:30 +0300 Vladimir Oltean wrote:
quoted
quoted
@@ -341,8 +342,8 @@ static int prestera_port_create(struct prestera_switch *sw, u32 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;
+ memcpy(addr, sw->base_mac, dev->addr_len - 1);
+ eth_hw_addr_set_port(dev, addr, port->fp_id);
Instead of having yet another temporary copy, can't we zero out
sw->base_mac[ETH_ALEN - 1] in prestera_switch_set_base_mac_addr()?
Will do unless Marvel & friends tell us FW cares about the last byte
(prestera_hw_switch_mac_set() send the whole thing).
You can always zero out the last byte after the call to
prestera_hw_switch_mac_set(), and then it shouldn't even matter.