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 <[email protected]>
Reviewed-by: Sridhar Samudrala <[email protected]>
---
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;
if (vport->link_up && !netif_carrier_ok(vport->netdev)) {
netif_carrier_on(vport->netdev);
@@ -1913,10 +1917,6 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
if (reset_cause == IDPF_SR_Q_CHANGE)
idpf_vport_alloc_vec_indexes(vport);
- err = idpf_set_real_num_queues(vport);
- if (err)
- goto err_open;
-
if (current_state == __IDPF_VPORT_UP)
err = idpf_vport_open(vport);
@@ -1928,7 +1928,6 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
idpf_send_add_queues_msg(vport, vport->num_txq, vport->num_complq,
vport->num_rxq, vport->num_bufq);
-err_open:
if (current_state == __IDPF_VPORT_UP)
idpf_vport_open(vport);
--
2.39.2