[SRU][J:linux-gcp/J:linux-gke/N:linux-gcp/N:linux-gke/N:linux-gkeop][PATCH 1/1] idpf: call set_real_num_queues in idpf_open
Ian Whitfield
ian.whitfield at canonical.com
Thu Mar 27 03:08:55 UTC 2025
From: Joshua Hay <joshua.a.hay at intel.com>
BugLink: https://bugs.launchpad.net/bugs/2104324
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 at intel.com>
Reviewed-by: Madhu Chittim <madhu.chittim at intel.com>
Tested-by: Samuel Salin <Samuel.salin at intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen at intel.com>
(backported from commit 52c11d31b5a1d1c747bb5f36cc4808e93e2348f4)
[ijwhitfield: Context adjusted due to missing commit
f01032a2ca09 ("idpf: fix memory leaks and crashes while performing a soft reset")]
Signed-off-by: Ian Whitfield <ian.whitfield at canonical.com>
---
drivers/net/ethernet/intel/idpf/idpf_lib.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index f769a9fc1084..32e33e22d995 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -2238,8 +2238,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, true);
+unlock:
idpf_vport_ctrl_unlock(netdev);
return err;
--
2.43.0
More information about the kernel-team
mailing list