diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2021-11-11 15:40:10 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-11-12 12:33:46 +0000 |
commit | 2bae16b238bdc446c865ce79508c0d2e2c710f16 (patch) | |
tree | 9555898e0ddec7a534fa08bc9c9c040f8a14b7d4 | |
parent | 9432340362a0eb8fe5ed39cdac0a907f0f50a461 (diff) |
memif: fix the default txq placement
Type: fix
Fixes: 3effb4e63068 ("memif: integrate with new tx infra")
"memif: integrate with new tx infra" patch integrated memif
with new tx infra. There might be scenarios when txqs were
less than vpp threads, in which case, txqs should be shared
among threads. This patch fixes it.
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I1c64a1370f5024240ab56311f75665db31714b60
-rw-r--r-- | src/plugins/memif/memif.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index 4d662faae9e..31dd4a539da 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -235,7 +235,8 @@ memif_connect (memif_if_t * mif) vnet_main_t *vnm = vnet_get_main (); clib_file_t template = { 0 }; memif_region_t *mr; - int i; + int i, j; + u32 n_txqs, n_threads = vlib_get_n_threads (); clib_error_t *err = NULL; memif_log_debug (mif, "connect %u", mif->dev_instance); @@ -268,7 +269,6 @@ memif_connect (memif_if_t * mif) template.write_function = memif_int_fd_write_ready; /* *INDENT-OFF* */ - u32 n_threads = vlib_get_n_threads (); vec_foreach_index (i, mif->tx_queues) { memif_queue_t *mq = vec_elt_at_index (mif->tx_queues, i); @@ -281,10 +281,16 @@ memif_connect (memif_if_t * mif) } mq->queue_index = vnet_hw_if_register_tx_queue (vnm, mif->hw_if_index, i); - vnet_hw_if_tx_queue_assign_thread (vnm, mq->queue_index, i % n_threads); clib_spinlock_init (&mq->lockp); } + n_txqs = vec_len (mif->tx_queues); + for (j = 0; j < n_threads; j++) + { + u32 qi = mif->tx_queues[j % n_txqs].queue_index; + vnet_hw_if_tx_queue_assign_thread (vnm, qi, j); + } + vec_foreach_index (i, mif->rx_queues) { memif_queue_t *mq = vec_elt_at_index (mif->rx_queues, i); |