path: root/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
diff options
authorRana Shahout <>2016-06-30 17:34:48 +0300
committerDavid S. Miller <>2016-07-01 06:12:04 -0400
commit7ccdd0841b305323e10e779c476d3fbae2165756 (patch)
tree3ea5b15101ac29674352097a210d49d3352bc5e5 /drivers/net/ethernet/mellanox/mlx5/core/en_main.c
parente3a19b53cbb0e6738b7a547f262179065b72e3fa (diff)
net/mlx5e: Fix select queue callback
The default fallback function used by mlx5e select queue can return any TX queues in range [>num_real_tx_queues). The current implementation assumes that the fallback function returns a number in the range [0.. number of channels). Actually dev->num_real_tx_queues = (number of channels) * dev->num_tc; which is more than the expected range if num_tc is configured and could lead to crashes. To fix this we test if num_tc is not configured we can safely return the fallback suggestion, if not we will reciprocal_scale the fallback result and normalize it to the desired range. Fixes: 08fb1dacdd76 ('net/mlx5e: Support DCBNL IEEE ETS') Signed-off-by: Rana Shahout <> Signed-off-by: Saeed Mahameed <> Reported-by: Doug Ledford <> Signed-off-by: David S. Miller <>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_main.c')
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 103feaba8eec..216fe3e1c1b0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1707,8 +1707,11 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)
netdev_set_num_tc(netdev, ntc);
+ /* Map netdev TCs to offset 0
+ * We have our own UP to TXQ mapping for QoS
+ */
for (tc = 0; tc < ntc; tc++)
- netdev_set_tc_queue(netdev, tc, nch, tc * nch);
+ netdev_set_tc_queue(netdev, tc, nch, 0);
int mlx5e_open_locked(struct net_device *netdev)