Commit 41c4c2b5 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher

i40e: allow look-up of MAC address from Open Firmware or IDPROM

Look up the MAC address from the eth_get_platform_mac_address() function
first before checking what the firmware provides. We already handle the
case of re-writing the MAC-VLAN filter, so there is no need to add extra
code for this. However, update the comment where we do this to indicate
that it does impact the Open Firmware MAC address case.

Change-ID: I73e59fbe0b0e7e6f3ee9f5170d0bd3a4d5faf4db
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 17daabb5
...@@ -9326,10 +9326,15 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -9326,10 +9326,15 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
if (vsi->type == I40E_VSI_MAIN) { if (vsi->type == I40E_VSI_MAIN) {
SET_NETDEV_DEV(netdev, &pf->pdev->dev); SET_NETDEV_DEV(netdev, &pf->pdev->dev);
ether_addr_copy(mac_addr, hw->mac.perm_addr); ether_addr_copy(mac_addr, hw->mac.perm_addr);
/* The following steps are necessary to properly keep track of /* The following steps are necessary for two reasons. First,
* MAC-VLAN filters loaded into firmware - first we remove * some older NVM configurations load a default MAC-VLAN
* filter that is automatically generated by firmware and then * filter that will accept any tagged packet, and we want to
* add new filter both to the driver hash table and firmware. * replace this with a normal filter. Additionally, it is
* possible our MAC address was provided by the platform using
* Open Firmware or similar.
*
* Thus, we need to remove the default filter and install one
* specific to the MAC address.
*/ */
i40e_rm_default_mac_filter(vsi, mac_addr); i40e_rm_default_mac_filter(vsi, mac_addr);
spin_lock_bh(&vsi->mac_filter_hash_lock); spin_lock_bh(&vsi->mac_filter_hash_lock);
...@@ -10834,20 +10839,18 @@ static void i40e_print_features(struct i40e_pf *pf) ...@@ -10834,20 +10839,18 @@ static void i40e_print_features(struct i40e_pf *pf)
/** /**
* i40e_get_platform_mac_addr - get platform-specific MAC address * i40e_get_platform_mac_addr - get platform-specific MAC address
*
* @pdev: PCI device information struct * @pdev: PCI device information struct
* @pf: board private structure * @pf: board private structure
* *
* Look up the MAC address in Open Firmware on systems that support it, * Look up the MAC address for the device. First we'll try
* and use IDPROM on SPARC if no OF address is found. On return, the * eth_platform_get_mac_address, which will check Open Firmware, or arch
* I40E_FLAG_PF_MAC will be wset in pf->flags if a platform-specific value * specific fallback. Otherwise, we'll default to the stored value in
* has been selected. * firmware.
**/ **/
static void i40e_get_platform_mac_addr(struct pci_dev *pdev, struct i40e_pf *pf) static void i40e_get_platform_mac_addr(struct pci_dev *pdev, struct i40e_pf *pf)
{ {
pf->flags &= ~I40E_FLAG_PF_MAC; if (eth_platform_get_mac_address(&pdev->dev, pf->hw.mac.addr))
if (!eth_platform_get_mac_address(&pdev->dev, pf->hw.mac.addr)) i40e_get_mac_addr(&pf->hw, pf->hw.mac.addr);
pf->flags |= I40E_FLAG_PF_MAC;
} }
/** /**
...@@ -11061,9 +11064,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -11061,9 +11064,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
i40e_aq_stop_lldp(hw, true, NULL); i40e_aq_stop_lldp(hw, true, NULL);
} }
i40e_get_mac_addr(hw, hw->mac.addr);
/* allow a platform config to override the HW addr */ /* allow a platform config to override the HW addr */
i40e_get_platform_mac_addr(pdev, pf); i40e_get_platform_mac_addr(pdev, pf);
if (!is_valid_ether_addr(hw->mac.addr)) { if (!is_valid_ether_addr(hw->mac.addr)) {
dev_info(&pdev->dev, "invalid MAC address %pM\n", hw->mac.addr); dev_info(&pdev->dev, "invalid MAC address %pM\n", hw->mac.addr);
err = -EIO; err = -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment