Skip to content
Commit 7ccdd084 authored by Rana Shahout's avatar Rana Shahout Committed by David S. Miller
Browse files

net/mlx5e: Fix select queue callback

The default fallback function used by mlx5e select queue can return
any TX queues in range [0..dev->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: 08fb1dac

 ('net/mlx5e: Support DCBNL IEEE ETS')
Signed-off-by: default avatarRana Shahout <ranas@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Reported-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e3a19b53
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