From dfb19cabe20ccf1cbd1aa714f493ccd322839b91 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 3 Jun 2020 20:13:59 +0200 Subject: dpdk: cleanup, add rx queue struct Type: improvement Change-Id: I3defde103ab245404de42d2be7abcb2c43d49a60 Signed-off-by: Damjan Marion --- src/plugins/dpdk/device/device.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'src/plugins/dpdk/device/device.c') diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c index 1ef2c5dc960..2467b7d70e5 100644 --- a/src/plugins/dpdk/device/device.c +++ b/src/plugins/dpdk/device/device.c @@ -158,26 +158,18 @@ static_always_inline struct rte_mbuf **mb, u32 n_left) { dpdk_main_t *dm = &dpdk_main; + dpdk_rx_queue_t *rxq; u32 n_retry; int n_sent = 0; int queue_id; n_retry = 16; - queue_id = vm->thread_index; + queue_id = vm->thread_index % xd->tx_q_used; + rxq = vec_elt_at_index (xd->rx_queues, queue_id); do { - /* - * This device only supports one TX queue, - * and we're running multi-threaded... - */ - if (PREDICT_FALSE (xd->lockp != 0)) - { - queue_id = queue_id % xd->tx_q_used; - while (clib_atomic_test_and_set (xd->lockp[queue_id])) - /* zzzz */ - queue_id = (queue_id + 1) % xd->tx_q_used; - } + clib_spinlock_lock_if_init (&rxq->lock); if (PREDICT_TRUE (xd->flags & DPDK_DEVICE_FLAG_PMD)) { @@ -191,8 +183,7 @@ static_always_inline n_sent = 0; } - if (PREDICT_FALSE (xd->lockp != 0)) - clib_atomic_release (xd->lockp[queue_id]); + clib_spinlock_unlock_if_init (&rxq->lock); if (PREDICT_FALSE (n_sent < 0)) { @@ -205,8 +196,6 @@ static_always_inline xd->hw_if_index)->tx_node_index; vlib_error_count (vm, node_index, DPDK_TX_FUNC_ERROR_BAD_RETVAL, 1); - clib_warning ("rte_eth_tx_burst[%d]: error %d", - xd->port_id, n_sent); return n_left; // untransmitted packets } n_left -= n_sent; -- cgit 1.2.3-korg