]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
idpf: call set_real_num_queues in idpf_open
authorJoshua Hay <joshua.a.hay@intel.com>
Wed, 5 Feb 2025 02:08:11 +0000 (18:08 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 11 Feb 2025 17:13:11 +0000 (09:13 -0800)
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.

Set the real number of queues during open so the netdev knows how many
queues will be allocated.

Fixes: 1c325aac10a8 ("idpf: configure resources for TX queues")
Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
Tested-by: Samuel Salin <Samuel.salin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/idpf_lib.c

index b4fbb99bfad208f5b5f42fd1f697fa21c22e1840..a3d6b8f198a86a00e3ce12b08156aa2ca92dddd3 100644 (file)
@@ -2159,8 +2159,13 @@ static int idpf_open(struct net_device *netdev)
        idpf_vport_ctrl_lock(netdev);
        vport = idpf_netdev_to_vport(netdev);
 
+       err = idpf_set_real_num_queues(vport);
+       if (err)
+               goto unlock;
+
        err = idpf_vport_open(vport);
 
+unlock:
        idpf_vport_ctrl_unlock(netdev);
 
        return err;