]> git.ipfire.org Git - people/arne_f/kernel.git/blobdiff - drivers/net/ethernet/intel/i40e/i40e_main.c
i40e: Queues are reserved despite "Invalid argument" error
[people/arne_f/kernel.git] / drivers / net / ethernet / intel / i40e / i40e_main.c
index ac685ad4d8773125b059f1209d2b60747996b39b..4e04985fb4307a9cfaeca1e29e5e6ec591642200 100644 (file)
@@ -336,6 +336,10 @@ static void i40e_tx_timeout(struct net_device *netdev)
                      (pf->tx_timeout_last_recovery + netdev->watchdog_timeo)))
                return;   /* don't do any new action before the next timeout */
 
+       /* don't kick off another recovery if one is already pending */
+       if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state))
+               return;
+
        if (tx_ring) {
                head = i40e_get_head(tx_ring);
                /* Read interrupt register */
@@ -420,9 +424,9 @@ static void i40e_get_netdev_stats_struct(struct net_device *netdev,
                                  struct rtnl_link_stats64 *stats)
 {
        struct i40e_netdev_priv *np = netdev_priv(netdev);
-       struct i40e_ring *tx_ring, *rx_ring;
        struct i40e_vsi *vsi = np->vsi;
        struct rtnl_link_stats64 *vsi_stats = i40e_get_vsi_stats_struct(vsi);
+       struct i40e_ring *ring;
        int i;
 
        if (test_bit(__I40E_VSI_DOWN, vsi->state))
@@ -436,24 +440,26 @@ static void i40e_get_netdev_stats_struct(struct net_device *netdev,
                u64 bytes, packets;
                unsigned int start;
 
-               tx_ring = READ_ONCE(vsi->tx_rings[i]);
-               if (!tx_ring)
+               ring = READ_ONCE(vsi->tx_rings[i]);
+               if (!ring)
                        continue;
-               i40e_get_netdev_stats_struct_tx(tx_ring, stats);
+               i40e_get_netdev_stats_struct_tx(ring, stats);
 
-               rx_ring = &tx_ring[1];
+               if (i40e_enabled_xdp_vsi(vsi)) {
+                       ring++;
+                       i40e_get_netdev_stats_struct_tx(ring, stats);
+               }
 
+               ring++;
                do {
-                       start = u64_stats_fetch_begin_irq(&rx_ring->syncp);
-                       packets = rx_ring->stats.packets;
-                       bytes   = rx_ring->stats.bytes;
-               } while (u64_stats_fetch_retry_irq(&rx_ring->syncp, start));
+                       start   = u64_stats_fetch_begin_irq(&ring->syncp);
+                       packets = ring->stats.packets;
+                       bytes   = ring->stats.bytes;
+               } while (u64_stats_fetch_retry_irq(&ring->syncp, start));
 
                stats->rx_packets += packets;
                stats->rx_bytes   += bytes;
 
-               if (i40e_enabled_xdp_vsi(vsi))
-                       i40e_get_netdev_stats_struct_tx(&rx_ring[1], stats);
        }
        rcu_read_unlock();
 
@@ -1409,7 +1415,7 @@ void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f)
        }
 
        vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
-       set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->state);
+       set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->back->state);
 }
 
 /**
@@ -1539,17 +1545,17 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
                netdev_info(netdev, "set new mac address %pM\n", addr->sa_data);
 
        /* Copy the address first, so that we avoid a possible race with
-        * .set_rx_mode(). If we copy after changing the address in the filter
-        * list, we might open ourselves to a narrow race window where
-        * .set_rx_mode could delete our dev_addr filter and prevent traffic
-        * from passing.
+        * .set_rx_mode().
+        * - Remove old address from MAC filter
+        * - Copy new address
+        * - Add new address to MAC filter
         */
-       ether_addr_copy(netdev->dev_addr, addr->sa_data);
-
        spin_lock_bh(&vsi->mac_filter_hash_lock);
        i40e_del_mac_filter(vsi, netdev->dev_addr);
-       i40e_add_mac_filter(vsi, addr->sa_data);
+       ether_addr_copy(netdev->dev_addr, addr->sa_data);
+       i40e_add_mac_filter(vsi, netdev->dev_addr);
        spin_unlock_bh(&vsi->mac_filter_hash_lock);
+
        if (vsi->type == I40E_VSI_MAIN) {
                i40e_status ret;
 
@@ -2648,6 +2654,10 @@ void i40e_vlan_stripping_enable(struct i40e_vsi *vsi)
        struct i40e_vsi_context ctxt;
        i40e_status ret;
 
+       /* Don't modify stripping options if a port VLAN is active */
+       if (vsi->info.pvid)
+               return;
+
        if ((vsi->info.valid_sections &
             cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) &&
            ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_MODE_MASK) == 0))
@@ -2678,6 +2688,10 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi)
        struct i40e_vsi_context ctxt;
        i40e_status ret;
 
+       /* Don't modify stripping options if a port VLAN is active */
+       if (vsi->info.pvid)
+               return;
+
        if ((vsi->info.valid_sections &
             cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) &&
            ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_EMOD_MASK) ==
@@ -6744,10 +6758,12 @@ static int i40e_setup_tc(struct net_device *netdev, void *type_data)
        struct i40e_pf *pf = vsi->back;
        u8 enabled_tc = 0, num_tc, hw;
        bool need_reset = false;
+       int old_queue_pairs;
        int ret = -EINVAL;
        u16 mode;
        int i;
 
+       old_queue_pairs = vsi->num_queue_pairs;
        num_tc = mqprio_qopt->qopt.num_tc;
        hw = mqprio_qopt->qopt.hw;
        mode = mqprio_qopt->mode;
@@ -6848,6 +6864,7 @@ config_tc:
                }
                ret = i40e_configure_queue_channels(vsi);
                if (ret) {
+                       vsi->num_queue_pairs = old_queue_pairs;
                        netdev_info(netdev,
                                    "Failed configuring queue channels\n");
                        need_reset = true;
@@ -9566,6 +9583,7 @@ end_core_reset:
        clear_bit(__I40E_RESET_FAILED, pf->state);
 clear_recovery:
        clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state);
+       clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state);
 }
 
 /**
@@ -11926,6 +11944,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
                          NETIF_F_GSO_GRE               |
                          NETIF_F_GSO_GRE_CSUM          |
                          NETIF_F_GSO_PARTIAL           |
+                         NETIF_F_GSO_IPXIP4            |
+                         NETIF_F_GSO_IPXIP6            |
                          NETIF_F_GSO_UDP_TUNNEL        |
                          NETIF_F_GSO_UDP_TUNNEL_CSUM   |
                          NETIF_F_SCTP_CRC              |
@@ -12009,6 +12029,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
        ether_addr_copy(netdev->dev_addr, mac_addr);
        ether_addr_copy(netdev->perm_addr, mac_addr);
 
+       /* i40iw_net_event() reads 16 bytes from neigh->primary_key */
+       netdev->neigh_priv_len = sizeof(u32) * 4;
+
        netdev->priv_flags |= IFF_UNICAST_FLT;
        netdev->priv_flags |= IFF_SUPP_NOFCS;
        /* Setup netdev TC information */