From a3188febc0bc690f2dc09e67ac68ad41000dd46c Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 2 Mar 2020 17:36:30 +0100 Subject: rdma: use per-thread buffer template Type: improvement Change-Id: Ie6f2c79e0a769f70eab079c75a500b9308dd51e6 Signed-off-by: Damjan Marion --- src/plugins/rdma/device.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/plugins/rdma/device.c') diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c index 7316edbaa25..29d9842e2e2 100644 --- a/src/plugins/rdma/device.c +++ b/src/plugins/rdma/device.c @@ -796,9 +796,23 @@ clib_error_t * rdma_init (vlib_main_t * vm) { rdma_main_t *rm = &rdma_main; + vlib_thread_main_t *tm = vlib_get_thread_main (); rm->log_class = vlib_log_register_class ("rdma", 0); + /* vlib_buffer_t template */ + vec_validate_aligned (rm->per_thread_data, tm->n_vlib_mains - 1, + CLIB_CACHE_LINE_BYTES); + + for (int i = 0; i < tm->n_vlib_mains; i++) + { + rdma_per_thread_data_t *ptd = vec_elt_at_index (rm->per_thread_data, i); + clib_memset (&ptd->buffer_template, 0, sizeof (vlib_buffer_t)); + ptd->buffer_template.flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; + ptd->buffer_template.ref_count = 1; + vnet_buffer (&ptd->buffer_template)->sw_if_index[VLIB_TX] = (u32) ~ 0; + } + return 0; } -- cgit 1.2.3-korg