diff options
author | arikachen <eaglesora@gmail.com> | 2021-11-10 08:51:51 +0000 |
---|---|---|
committer | arikachen <eaglesora@gmail.com> | 2021-11-19 02:10:11 +0000 |
commit | ad80663eb3fd954f42607168ad4babb91cb0edcc (patch) | |
tree | 7fb5a6d49f91e84e8c15a3dbfa612a02cfbfa2f7 /src/plugins/af_xdp/output.c | |
parent | 57bdb26ba42c3fc6da601d007b27fa5c3f09dd96 (diff) |
af_xdp: integrate with new tx infra
Type: improvement
Signed-off-by: arikachen <eaglesora@gmail.com>
Signed-off-by: BenoƮt Ganne <bganne@cisco.com>
Change-Id: If8d57bcf033864935bd5e3a9912b2c1a7c712f44
Diffstat (limited to 'src/plugins/af_xdp/output.c')
-rw-r--r-- | src/plugins/af_xdp/output.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/af_xdp/output.c b/src/plugins/af_xdp/output.c index c5b73f98894..d1500a63cbb 100644 --- a/src/plugins/af_xdp/output.c +++ b/src/plugins/af_xdp/output.c @@ -215,9 +215,9 @@ VNET_DEVICE_CLASS_TX_FN (af_xdp_device_class) (vlib_main_t * vm, af_xdp_main_t *rm = &af_xdp_main; vnet_interface_output_runtime_t *ord = (void *) node->runtime_data; af_xdp_device_t *ad = pool_elt_at_index (rm->devices, ord->dev_instance); - u32 thread_index = vm->thread_index; - af_xdp_txq_t *txq = vec_elt_at_index ( - ad->txqs, (thread_index - 1 + ad->txq_num) % ad->txq_num); + const vnet_hw_if_tx_frame_t *tf = vlib_frame_scalar_args (frame); + const int shared_queue = tf->shared_queue; + af_xdp_txq_t *txq = vec_elt_at_index (ad->txqs, tf->queue_id); u32 *from; u32 n, n_tx; int i; @@ -225,7 +225,8 @@ VNET_DEVICE_CLASS_TX_FN (af_xdp_device_class) (vlib_main_t * vm, from = vlib_frame_vector_args (frame); n_tx = frame->n_vectors; - clib_spinlock_lock_if_init (&txq->lock); + if (shared_queue) + clib_spinlock_lock (&txq->lock); for (i = 0, n = 0; i < AF_XDP_TX_RETRIES && n < n_tx; i++) { @@ -238,7 +239,8 @@ VNET_DEVICE_CLASS_TX_FN (af_xdp_device_class) (vlib_main_t * vm, af_xdp_device_output_tx_db (vm, node, ad, txq, n); - clib_spinlock_unlock_if_init (&txq->lock); + if (shared_queue) + clib_spinlock_unlock (&txq->lock); if (PREDICT_FALSE (n != n_tx)) { |