Skip to content
  • Rana Shahout's avatar
    net/mlx5e: Fix select queue callback · 7ccdd084
    Rana Shahout authored
    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>
    7ccdd084