]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
i40e: Queues are reserved despite "Invalid argument" error
authorAdam Ludkiewicz <adam.ludkiewicz@intel.com>
Wed, 6 Feb 2019 23:08:15 +0000 (15:08 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Jun 2019 09:54:07 +0000 (11:54 +0200)
[ Upstream commit 3e957b377bf4262aec2dd424f28ece94e36814d4 ]

Added a new local variable in the i40e_setup_tc function named
old_queue_pairs so num_queue_pairs can be restored to the correct
value in case configuring queue channels fails. Additionally, moved
the exit label in the i40e_setup_tc function so the if (need_reset)
block can be executed.
Also, fixed data packing in the i40e_setup_tc function.

Signed-off-by: Adam Ludkiewicz <adam.ludkiewicz@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_main.c

index df8808cd7e11442bb521a7c27e13160a85126ed5..4e04985fb4307a9cfaeca1e29e5e6ec591642200 100644 (file)
@@ -6758,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;
@@ -6862,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;