diff options
author | Steven Luong <sluong@cisco.com> | 2021-06-17 08:50:32 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-07-01 12:55:29 +0000 |
commit | a57a7005d6c04029d168cfdd053f3e334b935cc3 (patch) | |
tree | 2760cef8fe3ed355e8ab995364e4c336c07ea67d /src/plugins/vmxnet3/output.c | |
parent | 5ff59a1f8b7f6de7738a0fd95e1dbf250dbf1a6a (diff) |
vmxnet3: support manual thread assignment to tx queue
Thread assignment to tx queue has always been automatic and there
was no way to modify it. With this patch, it is now possible to use
the cli "set interface tx-queue" to change the thread assignment to
tx queue for vmxnet3 interface, thanks to the new tx infra.
Type: feature
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I1544e3557f70251d4bd423cc3d9f28ee1d44db4a
Diffstat (limited to 'src/plugins/vmxnet3/output.c')
-rw-r--r-- | src/plugins/vmxnet3/output.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/vmxnet3/output.c b/src/plugins/vmxnet3/output.c index 0de91d9bf21..8ba3f99022f 100644 --- a/src/plugins/vmxnet3/output.c +++ b/src/plugins/vmxnet3/output.c @@ -110,7 +110,8 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm, u16 space_left; u16 n_left = frame->n_vectors; vmxnet3_txq_t *txq; - u16 qid = vm->thread_index % vd->num_tx_queues, produce; + vnet_hw_if_tx_frame_t *tf = vlib_frame_scalar_args (frame); + u16 qid = tf->queue_id, produce; if (PREDICT_FALSE (!(vd->flags & VMXNET3_DEVICE_F_LINK_UP))) { @@ -121,7 +122,8 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm, } txq = vec_elt_at_index (vd->txqs, qid); - clib_spinlock_lock_if_init (&txq->lock); + if (tf->shared_queue) + clib_spinlock_lock (&txq->lock); vmxnet3_txq_release (vm, vd, txq); @@ -228,7 +230,8 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm, if (PREDICT_TRUE (produce != txq->tx_ring.produce)) vmxnet3_reg_write_inline (vd, 0, txq->reg_txprod, txq->tx_ring.produce); - clib_spinlock_unlock_if_init (&txq->lock); + if (tf->shared_queue) + clib_spinlock_unlock (&txq->lock); return (frame->n_vectors - n_left); } |