diff options
author | Jakub Kicinski | 2017-07-04 11:27:20 +0200 |
---|---|---|
committer | David S. Miller | 2017-07-05 10:13:07 +0200 |
commit | cb2cda484840730f0f7683286fa2a25dc1dbecf0 (patch) | |
tree | 28056845e57903f376a84fd05789d1d53700906d /drivers/net/ethernet/netronome/nfp/nfp_net_main.c | |
parent | nfp: improve order of interfaces in breakout mode (diff) | |
download | kernel-qcow2-linux-cb2cda484840730f0f7683286fa2a25dc1dbecf0.tar.gz kernel-qcow2-linux-cb2cda484840730f0f7683286fa2a25dc1dbecf0.tar.xz kernel-qcow2-linux-cb2cda484840730f0f7683286fa2a25dc1dbecf0.zip |
nfp: remove legacy MAC address lookup
The legacy MAC address lookup doesn't work well with breakout
cables. We are probably better off picking random addresses
than the wrong ones in the theoretical scenario where management
FW didn't tell us what the port config is.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_net_main.c')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index bfcdada29cc0..5797dbf2b507 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -84,46 +84,22 @@ static int nfp_is_ready(struct nfp_pf *pf) * nfp_net_get_mac_addr() - Get the MAC address. * @pf: NFP PF handle * @port: NFP port structure - * @id: NFP port id * * First try to get the MAC address from NSP ETH table. If that - * fails try HWInfo. As a last resort generate a random address. + * fails generate a random address. */ -void -nfp_net_get_mac_addr(struct nfp_pf *pf, struct nfp_port *port, unsigned int id) +void nfp_net_get_mac_addr(struct nfp_pf *pf, struct nfp_port *port) { struct nfp_eth_table_port *eth_port; - u8 mac_addr[ETH_ALEN]; - const char *mac_str; - char name[32]; eth_port = __nfp_port_get_eth_port(port); - if (eth_port) { - ether_addr_copy(port->netdev->dev_addr, eth_port->mac_addr); - ether_addr_copy(port->netdev->perm_addr, eth_port->mac_addr); - return; - } - - snprintf(name, sizeof(name), "eth%d.mac", id); - - mac_str = nfp_hwinfo_lookup(pf->hwinfo, name); - if (!mac_str) { - nfp_warn(pf->cpp, "Can't lookup MAC address. Generate\n"); - eth_hw_addr_random(port->netdev); - return; - } - - if (sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", - &mac_addr[0], &mac_addr[1], &mac_addr[2], - &mac_addr[3], &mac_addr[4], &mac_addr[5]) != 6) { - nfp_warn(pf->cpp, "Can't parse MAC address (%s). Generate.\n", - mac_str); + if (!eth_port) { eth_hw_addr_random(port->netdev); return; } - ether_addr_copy(port->netdev->dev_addr, mac_addr); - ether_addr_copy(port->netdev->perm_addr, mac_addr); + ether_addr_copy(port->netdev->dev_addr, eth_port->mac_addr); + ether_addr_copy(port->netdev->perm_addr, eth_port->mac_addr); } static struct nfp_eth_table_port * |