]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e: Explicitly write platform-specific mac address after PF reset
authorTushar Dave <tushar.n.dave@oracle.com>
Fri, 1 Jul 2016 17:11:20 +0000 (10:11 -0700)
committerDhaval Giani <dhaval.giani@oracle.com>
Wed, 8 Mar 2017 00:31:07 +0000 (19:31 -0500)
Orabug: 24568124

i40e PF reset clears mac filters. If platform-specific mac address
is used, driver has to explicitly write default mac address to mac
filters otherwise all incoming traffic destined to default mac
address will be dropped after reset.

This issue was found on SPARC while toggling i40e ntuple via ethtool.

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit b1b15df5923232114a908fe1fd8b701c36259259)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/intel/i40e/i40e_main.c

Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index 2f6c655cd7dfe5838abaaec1e64160f1e31e829a..e404aa96470099509725e233d5126243c0aa3e53 100644 (file)
@@ -2521,6 +2521,44 @@ static int i40e_vlan_rx_kill_vid(struct net_device *netdev,
        return 0;
 }
 
+/**
+ * i40e_macaddr_init - explicitly write the mac address filters
+ *
+ * @vsi: pointer to the vsi
+ * @macaddr: the MAC address
+ *
+ * This is needed when the macaddr has been obtained by other
+ * means than the default, e.g., from Open Firmware or IDPROM.
+ * Returns 0 on success, negative on failure
+ **/
+static int i40e_macaddr_init(struct i40e_vsi *vsi, u8 *macaddr)
+{
+       int ret;
+       struct i40e_aqc_add_macvlan_element_data element;
+
+       ret = i40e_aq_mac_address_write(&vsi->back->hw,
+                                       I40E_AQC_WRITE_TYPE_LAA_WOL,
+                                       macaddr, NULL);
+       if (ret) {
+               dev_info(&vsi->back->pdev->dev,
+                        "Addr change for VSI failed: %d\n", ret);
+               return -EADDRNOTAVAIL;
+       }
+
+       memset(&element, 0, sizeof(element));
+       ether_addr_copy(element.mac_addr, macaddr);
+       element.flags = cpu_to_le16(I40E_AQC_MACVLAN_ADD_PERFECT_MATCH);
+       ret = i40e_aq_add_macvlan(&vsi->back->hw, vsi->seid, &element, 1, NULL);
+       if (ret) {
+               dev_info(&vsi->back->pdev->dev,
+                        "add filter failed err %s aq_err %s\n",
+                        i40e_stat_str(&vsi->back->hw, ret),
+                        i40e_aq_str(&vsi->back->hw,
+                                    vsi->back->hw.aq.asq_last_status));
+       }
+       return ret;
+}
+
 /**
  * i40e_restore_vlan - Reinstate vlans when vsi/netdev comes back up
  * @vsi: the vsi being brought back up
@@ -2966,8 +3004,19 @@ static void i40e_vsi_config_dcb_rings(struct i40e_vsi *vsi)
  **/
 static void i40e_set_vsi_rx_mode(struct i40e_vsi *vsi)
 {
+       struct i40e_pf *pf = vsi->back;
+       int err;
+
        if (vsi->netdev)
                i40e_set_rx_mode(vsi->netdev);
+
+       if (!!(pf->flags & I40E_FLAG_PF_MAC)) {
+               err = i40e_macaddr_init(vsi, pf->hw.mac.addr);
+               if (err) {
+                       dev_warn(&pf->pdev->dev,
+                                "could not set up macaddr; err %d\n", err);
+               }
+       }
 }
 
 /**
@@ -9511,44 +9560,6 @@ err_vsi:
        return NULL;
 }
 
-/**
- * i40e_macaddr_init - explicitly write the mac address filters. This
- * is needed when the macaddr has been obtained by other means than
- * the default, e.g., from Open Firmware or IDPROM.
- *
- * @vsi: pointer to the vsi.
- * @macaddr: the MAC address
- *
- * Returns 0 on success, negative on failure
- **/
-static int i40e_macaddr_init(struct i40e_vsi *vsi, u8 *macaddr)
-{
-       int ret, aq_err;
-       struct i40e_aqc_add_macvlan_element_data element;
-
-       ret = i40e_aq_mac_address_write(&vsi->back->hw,
-                                       I40E_AQC_WRITE_TYPE_LAA_WOL,
-                                       macaddr, NULL);
-       if (ret) {
-               dev_info(&vsi->back->pdev->dev,
-                        "Addr change for VSI failed: %d\n", ret);
-               return -EADDRNOTAVAIL;
-       }
-
-       memset(&element, 0, sizeof(element));
-       ether_addr_copy(element.mac_addr, macaddr);
-       element.flags = cpu_to_le16(I40E_AQC_MACVLAN_ADD_PERFECT_MATCH);
-       ret = i40e_aq_add_macvlan(&vsi->back->hw, vsi->seid, &element, 1, NULL);
-       aq_err = vsi->back->hw.aq.asq_last_status;
-       if (aq_err != I40E_AQ_RC_OK) {
-               dev_info(&vsi->back->pdev->dev,
-                        "add filter failed err %s aq_err %s\n",
-                        i40e_stat_str(&vsi->back->hw, ret),
-                        i40e_aq_str(&vsi->back->hw, aq_err));
-       }
-       return ret;
-}
-
 /**
  * i40e_vsi_setup - Set up a VSI by a given type
  * @pf: board private structure