]> 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 41fa22c562c1e640119e34b7aa0509349d71d7bb..4e04985fb4307a9cfaeca1e29e5e6ec591642200 100644 (file)
@@ -424,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))
@@ -440,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();
 
@@ -2652,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))
@@ -2682,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) ==
@@ -6748,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;
@@ -6852,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;