summaryrefslogtreecommitdiffstats
path: root/src/plugins/rdma/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/rdma/device.c')
-rw-r--r--src/plugins/rdma/device.c14
1 files changed, 14 insertions, 0 deletions
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;
}