summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMonendra Singh Kushwaha <kmonendra@marvell.com>2024-11-20 12:06:52 +0530
committerDamjan Marion <dmarion@0xa5.net>2025-01-10 10:52:29 +0000
commit2704a5812ead7ab1a78f6fd75c157f4501655707 (patch)
treeacf3fb759a5a573a3880c70d4753cdd85b4176fd
parent94223816a2fac1bf9dc35e0e18358150188206f7 (diff)
dev: assign tx queue to all threads
This patch assigns tx queue to all thread and enables tx queue sharing if needed. Type: fix Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com> Change-Id: I8cb561c29c2a508b8b478c646121b1caa61b8520
-rw-r--r--src/vnet/dev/port.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/vnet/dev/port.c b/src/vnet/dev/port.c
index fccedebdcf4..e538b89a630 100644
--- a/src/vnet/dev/port.c
+++ b/src/vnet/dev/port.c
@@ -564,6 +564,7 @@ vnet_dev_port_if_create (vlib_main_t *vm, vnet_dev_port_t *port, void *ptr)
vnet_dev_port_if_create_args_t *a = ptr;
vnet_dev_port_interfaces_t *ifs = port->interfaces;
vnet_dev_instance_t *di;
+ vnet_dev_tx_queue_t *txq, **qp;
vnet_dev_rv_t rv;
u16 ti = 0;
@@ -614,16 +615,19 @@ vnet_dev_port_if_create (vlib_main_t *vm, vnet_dev_port_t *port, void *ptr)
if ((rv = vnet_dev_tx_queue_alloc (vm, port, ifs->txq_sz)) != VNET_DEV_OK)
goto error;
- foreach_vnet_dev_port_tx_queue (q, port)
+ for (ti = 0; ti < n_threads; ti++)
{
/* if consistent_qp is enabled, we start by assigning queues to workers
* and we end with main */
u16 real_ti = (ti + a->consistent_qp) % n_threads;
- q->assigned_threads = clib_bitmap_set (q->assigned_threads, real_ti, 1);
+ qp = pool_elt_at_index (port->tx_queues, ti % ifs->num_tx_queues);
+ txq = qp[0];
+ txq->assigned_threads =
+ clib_bitmap_set (txq->assigned_threads, real_ti, 1);
log_debug (dev, "port %u tx queue %u assigned to thread %u",
- port->port_id, q->queue_id, real_ti);
- if (++ti >= n_threads)
- break;
+ port->port_id, txq->queue_id, real_ti);
+ if (clib_bitmap_count_set_bits (txq->assigned_threads) > 1)
+ txq->lock_needed = 1;
}
pool_get (dm->dev_instances, di);