diff options
author | Damjan Marion <damarion@cisco.com> | 2020-03-02 17:36:30 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2020-03-02 19:27:31 +0100 |
commit | a3188febc0bc690f2dc09e67ac68ad41000dd46c (patch) | |
tree | 392f97fa3b0766a6a4a58fc5be8085571d7f1bb6 /src/plugins/rdma/device.c | |
parent | 516e4ed668705bdf0fc138f29275db8c152d19f5 (diff) |
rdma: use per-thread buffer template
Type: improvement
Change-Id: Ie6f2c79e0a769f70eab079c75a500b9308dd51e6
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/rdma/device.c')
-rw-r--r-- | src/plugins/rdma/device.c | 14 |
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; } |