Skip to content

Commit 3d23a05

Browse files
claudiu-mdavem330
authored andcommitted
gianfar: Enable changing mac addr when if up
Use device flag IFF_LIVE_ADDR_CHANGE to signal that the device supports changing the hardware address when the device is running. This allows eth_mac_addr() to change the mac address also when the network device's interface is open. This capability is required by certain applications, like bonding mode 6 (Adaptive Load Balancing). Signed-off-by: Claudiu Manoil <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bc60228 commit 3d23a05

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/net/ethernet/freescale/gianfar.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,15 @@ static struct net_device_stats *gfar_get_stats(struct net_device *dev)
516516
return &dev->stats;
517517
}
518518

519+
static int gfar_set_mac_addr(struct net_device *dev, void *p)
520+
{
521+
eth_mac_addr(dev, p);
522+
523+
gfar_set_mac_for_addr(dev, 0, dev->dev_addr);
524+
525+
return 0;
526+
}
527+
519528
static const struct net_device_ops gfar_netdev_ops = {
520529
.ndo_open = gfar_enet_open,
521530
.ndo_start_xmit = gfar_start_xmit,
@@ -526,7 +535,7 @@ static const struct net_device_ops gfar_netdev_ops = {
526535
.ndo_tx_timeout = gfar_timeout,
527536
.ndo_do_ioctl = gfar_ioctl,
528537
.ndo_get_stats = gfar_get_stats,
529-
.ndo_set_mac_address = eth_mac_addr,
538+
.ndo_set_mac_address = gfar_set_mac_addr,
530539
.ndo_validate_addr = eth_validate_addr,
531540
#ifdef CONFIG_NET_POLL_CONTROLLER
532541
.ndo_poll_controller = gfar_netpoll,
@@ -1411,6 +1420,8 @@ static int gfar_probe(struct platform_device *ofdev)
14111420
dev->features |= NETIF_F_HW_VLAN_CTAG_RX;
14121421
}
14131422

1423+
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
1424+
14141425
gfar_init_addr_hash_table(priv);
14151426

14161427
/* Insert receive time stamps into padding alignment bytes */

0 commit comments

Comments
 (0)