Skip to content

Commit badccd4

Browse files
Wei Fangkuba-moo
authored andcommitted
net: enetc: set MAC address to the VF net_device
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 . root@ls1028ardb:~# ifconfig eno0vf0 down root@ls1028ardb:~# ifconfig eno0vf0 hw ether 00:04:9f:3a:4d:56 up root@ls1028ardb:~# ifconfig eno0vf0 eno0vf0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 66:36:2c:3b:87:76 txqueuelen 1000 (Ethernet) RX packets 794 bytes 69239 (69.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 11 bytes 2226 (2.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Fixes: beb74ac ("enetc: Add vf to pf messaging support") Signed-off-by: Wei Fang <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Reviewed-by: Claudiu Manoil <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5635f18 commit badccd4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/net/ethernet/freescale/enetc/enetc_vf.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,18 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev, void *addr)
7878
{
7979
struct enetc_ndev_priv *priv = netdev_priv(ndev);
8080
struct sockaddr *saddr = addr;
81+
int err;
8182

8283
if (!is_valid_ether_addr(saddr->sa_data))
8384
return -EADDRNOTAVAIL;
8485

85-
return enetc_msg_vsi_set_primary_mac_addr(priv, saddr);
86+
err = enetc_msg_vsi_set_primary_mac_addr(priv, saddr);
87+
if (err)
88+
return err;
89+
90+
eth_hw_addr_set(ndev, saddr->sa_data);
91+
92+
return 0;
8693
}
8794

8895
static int enetc_vf_set_features(struct net_device *ndev,

0 commit comments

Comments
 (0)