From 52e9aaf0b55e7742a39d75e5dffb813a3b0c011d Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Tue, 7 Jul 2020 13:29:16 +0200 Subject: dpdk: add txq struct and fix dpdk tx lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces a txq structure mirroring the rxq structure. This fixes the case when #txq > #rxq, because lock must be per txq. Type: fix Fixes: dfb19cabe20ccf1cbd1aa714f493ccd322839b91 Change-Id: Ic1bce64d2b08b9a98c8242a1ba1bfcdbda322bec Signed-off-by: Benoît Ganne --- src/plugins/dpdk/device/common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/plugins/dpdk/device/common.c') diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c index 18d4555315a..0c43bfe02bb 100644 --- a/src/plugins/dpdk/device/common.c +++ b/src/plugins/dpdk/device/common.c @@ -41,6 +41,7 @@ dpdk_device_setup (dpdk_device_t * xd) dpdk_main_t *dm = &dpdk_main; vlib_main_t *vm = vlib_get_main (); vnet_main_t *vnm = vnet_get_main (); + vlib_thread_main_t *tm = vlib_get_thread_main (); vnet_sw_interface_t *sw = vnet_get_sw_interface (vnm, xd->sw_if_index); vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, xd->hw_if_index); struct rte_eth_dev_info dev_info; @@ -95,7 +96,8 @@ dpdk_device_setup (dpdk_device_t * xd) goto error; } - /* Set up one TX-queue per worker thread */ + vec_validate_aligned (xd->tx_queues, xd->tx_q_used - 1, + CLIB_CACHE_LINE_BYTES); for (j = 0; j < xd->tx_q_used; j++) { rv = @@ -110,6 +112,9 @@ dpdk_device_setup (dpdk_device_t * xd) &xd->tx_conf); if (rv < 0) dpdk_device_error (xd, "rte_eth_tx_queue_setup", rv); + + if (xd->tx_q_used < tm->n_vlib_mains) + clib_spinlock_init (&vec_elt (xd->tx_queues, j).lock); } vec_validate_aligned (xd->rx_queues, xd->rx_q_used - 1, -- cgit 1.2.3-korg