Message ID | 20241029090406.841836-1-wei.fang@nxp.com (mailing list archive) |
---|---|
State | Accepted |
Commit | badccd49b93bb945bf4e5cc8707db67cdc5e27e5 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [v2,net] net: enetc: set MAC address to the VF net_device | expand |
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Tue, 29 Oct 2024 17:04:06 +0800 you wrote: > The MAC address of VF can be configured through the mailbox mechanism of > ENETC, but the previous implementation forgot to set the MAC address in > net_device, resulting in the SMAC of the sent frames still being the old > MAC address. Since the MAC address in the hardware has been changed, Rx > cannot receive frames with the DMAC address as the new MAC address. The > most obvious phenomenon is that after changing the MAC address, we can > see that the MAC address of eno0vf0 has not changed through the "ifconfig > eno0vf0" command and the IP address cannot be obtained . > > [...] Here is the summary with links: - [v2,net] net: enetc: set MAC address to the VF net_device https://git.kernel.org/netdev/net/c/badccd49b93b You are awesome, thank you!
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index dfcaac302e24..b15db70769e5 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -78,11 +78,18 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev, void *addr) { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct sockaddr *saddr = addr; + int err; if (!is_valid_ether_addr(saddr->sa_data)) return -EADDRNOTAVAIL; - return enetc_msg_vsi_set_primary_mac_addr(priv, saddr); + err = enetc_msg_vsi_set_primary_mac_addr(priv, saddr); + if (err) + return err; + + eth_hw_addr_set(ndev, saddr->sa_data); + + return 0; } static int enetc_vf_set_features(struct net_device *ndev,