aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/common.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-07-07 13:29:16 +0200
committerDamjan Marion <dmarion@me.com>2020-07-09 15:32:51 +0000
commit52e9aaf0b55e7742a39d75e5dffb813a3b0c011d (patch)
tree8e7076d00cef04143d56a5a8466aab2460aaa190 /src/plugins/dpdk/device/common.c
parentea7e7087d21151c89056152579e37510234880d6 (diff)
dpdk: add txq struct and fix dpdk tx lock
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 <bganne@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/device/common.c')
-rw-r--r--src/plugins/dpdk/device/common.c7
1 files changed, 6 insertions, 1 deletions
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,