From: PJ Waskiewicz <pjwaskiew...@gmail.com> The permanent MAC address is useful to store for things like ethtool, and when bonding with modes such as active/passive or LACP. This follows the model of other Ethernet drivers, such as ixgbe.
This was verified on a C220 chassis with the Cisco VNIC Ethernet device. Signed-off-by: PJ Waskiewicz <pjwaskiew...@gmail.com> --- drivers/net/ethernet/cisco/enic/enic_main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 4b87bee..8bb2114 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -964,6 +964,16 @@ void enic_reset_addr_lists(struct enic *enic) enic->flags = 0; } +static int enic_set_perm_mac_addr(struct net_device *netdev, char *addr) +{ + if (!is_valid_ether_addr(addr) && !is_zero_ether_addr(addr)) + return -EADDRNOTAVAIL; + + memcpy(netdev->perm_addr, addr, netdev->addr_len); + + return 0; +} + static int enic_set_mac_addr(struct net_device *netdev, char *addr) { struct enic *enic = netdev_priv(netdev); @@ -2872,6 +2882,14 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_dev_deinit; } + /* Store off permanent MAC address + */ + err = enic_set_perm_mac_addr(netdev, enic->mac_addr); + if (err) { + dev_err(dev, "Invalid MAC address, aborting\n"); + goto err_out_dev_deinit; + } + enic->tx_coalesce_usecs = enic->config.intr_timer_usec; /* rx coalesce time already got initialized. This gets used * if adaptive coal is turned off -- 2.10.2