On Wed, Jan 29, 2025 at 1:46 AM Joshua Hay <joshua.a....@intel.com> wrote:
> On initial driver load, alloc_etherdev_mqs is called with whatever max
> queue values are provided by the control plane. However, if the driver
> is loaded on a system where num_online_cpus() returns less than the max
> queues, the netdev will think there are more queues than are actually
> available. Only num_online_cpus() will be allocated, but
> skb_get_queue_mapping(skb) could possibly return an index beyond the
> range of allocated queues. Consequently, the packet is silently dropped
> and it appears as if TX is broken.
>
> Move setting real number of queues to idpf_up_complete so the netdev
> knows how many queues were actually allocated after any open flow.
>
> Fixes: 1c325aac10a8 ("idpf: configure resources for TX queues")
> Signed-off-by: Joshua Hay <joshua.a....@intel.com>
> Reviewed-by: Sridhar Samudrala <sridhar.samudr...@intel.com>
> ---
>  drivers/net/ethernet/intel/idpf/idpf_lib.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c 
> b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> index da2128686564..6df7f125ebde 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> @@ -1280,6 +1280,10 @@ static int idpf_set_real_num_queues(struct idpf_vport 
> *vport)
>  static int idpf_up_complete(struct idpf_vport *vport)
>  {
>         struct idpf_netdev_priv *np = netdev_priv(vport->netdev);
> +       int err = idpf_set_real_num_queues(vport);
> +
> +       if (err)
> +               return err;

I dislike using the declaration&initialization section to call
functions with side effects, but there is no hard rule against it, so
be it.
There is a possibility for a future cleanup, outside of the scope of
the current fix: idpf_set_real_num_queues() can be replaced with just
a call to netif_set_real_num_queues().

I know Jordan tested the patch with success and he agrees to being
mentioned, so you can add:

Reviewed-by: Michal Schmidt <mschm...@redhat.com>
Tested-by: Jordan Rhee <jordanr...@google.com>

Reply via email to