Commit 6ace9bde authored by Adam Ludkiewicz's avatar Adam Ludkiewicz Committed by Greg Kroah-Hartman

i40e: Queues are reserved despite "Invalid argument" error

[ Upstream commit 3e957b37 ]

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: default avatarAdam Ludkiewicz <adam.ludkiewicz@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ee3798fc
...@@ -6854,10 +6854,12 @@ static int i40e_setup_tc(struct net_device *netdev, void *type_data) ...@@ -6854,10 +6854,12 @@ static int i40e_setup_tc(struct net_device *netdev, void *type_data)
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
u8 enabled_tc = 0, num_tc, hw; u8 enabled_tc = 0, num_tc, hw;
bool need_reset = false; bool need_reset = false;
int old_queue_pairs;
int ret = -EINVAL; int ret = -EINVAL;
u16 mode; u16 mode;
int i; int i;
old_queue_pairs = vsi->num_queue_pairs;
num_tc = mqprio_qopt->qopt.num_tc; num_tc = mqprio_qopt->qopt.num_tc;
hw = mqprio_qopt->qopt.hw; hw = mqprio_qopt->qopt.hw;
mode = mqprio_qopt->mode; mode = mqprio_qopt->mode;
...@@ -6958,6 +6960,7 @@ static int i40e_setup_tc(struct net_device *netdev, void *type_data) ...@@ -6958,6 +6960,7 @@ static int i40e_setup_tc(struct net_device *netdev, void *type_data)
} }
ret = i40e_configure_queue_channels(vsi); ret = i40e_configure_queue_channels(vsi);
if (ret) { if (ret) {
vsi->num_queue_pairs = old_queue_pairs;
netdev_info(netdev, netdev_info(netdev,
"Failed configuring queue channels\n"); "Failed configuring queue channels\n");
need_reset = true; need_reset = true;
......
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