26 #define foreach_rdma_input_error \ 27 _(BUFFER_ALLOC, "buffer alloc error") 31 #define _(f,s) RDMA_INPUT_ERROR_##f, 50 struct ibv_recv_wr wr[VLIB_FRAME_SIZE], *w = wr;
51 struct ibv_sge sge[VLIB_FRAME_SIZE], *s = sge;
70 s[0].lkey = rd->
mr->lkey;
74 s[1].lkey = rd->
mr->lkey;
78 s[2].lkey = rd->
mr->lkey;
82 s[3].lkey = rd->
mr->lkey;
85 w[0].next = &w[0] + 1;
90 w[1].next = &w[1] + 1;
95 w[2].next = &w[2] + 1;
100 w[3].next = &w[3] + 1;
101 w[3].sg_list = &s[3];
115 s[0].lkey = rd->
mr->lkey;
118 w[0].next = &w[0] + 1;
119 w[0].sg_list = &s[0];
132 ibv_post_wq_recv (rxq->
wq, wr, &w);
133 n = wr == w ? n_alloc : (uintptr_t) (w - wr);
151 while (n_trace && n_left)
198 u32 n_rx_bytes[4] = { 0 };
200 while (n_left_from >= 4)
209 CLIB_PREFETCH (&to_next[4 + 0], 4 *
sizeof (to_next[0]), STORE);
212 to_next[0] = wc[0].wr_id;
213 to_next[1] = wc[1].wr_id;
214 to_next[2] = wc[2].wr_id;
215 to_next[3] = wc[3].wr_id;
217 bufsz[0] = wc[0].byte_len;
218 bufsz[1] = wc[1].byte_len;
219 bufsz[2] = wc[2].byte_len;
220 bufsz[3] = wc[3].byte_len;
222 n_rx_bytes[0] += wc[0].byte_len;
223 n_rx_bytes[1] += wc[1].byte_len;
224 n_rx_bytes[2] += wc[2].byte_len;
225 n_rx_bytes[3] += wc[3].byte_len;
233 while (n_left_from >= 1)
235 to_next[0] = wc[0].wr_id;
236 bufsz[0] = wc[0].byte_len;
237 n_rx_bytes[0] += wc[0].byte_len;
245 return n_rx_bytes[0] + n_rx_bytes[1] + n_rx_bytes[2] + n_rx_bytes[3];
252 while (n_left_from >= 4)
283 while (n_left_from >= 1)
301 struct ibv_wc wc[VLIB_FRAME_SIZE];
304 u32 *to_next, n_left_to_next;
305 u32 n_rx_packets, n_rx_bytes;
307 n_rx_packets = ibv_poll_cq (rxq->
cq, VLIB_FRAME_SIZE, wc);
324 n_left_to_next - n_rx_packets);
331 rxq->
n_enq -= n_rx_packets;
359 .name =
"rdma-input",
360 .sibling_of =
"device-input",
363 .state = VLIB_NODE_STATE_DISABLED,
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
u16 current_length
Nbytes between current data and the end of this buffer.
u32 per_interface_next_index
format_function_t format_rdma_input_trace
#define VLIB_NODE_FN(node)
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
#define static_always_inline
#define ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX
vlib_combined_counter_main_t * combined_sw_if_counters
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define vlib_get_new_next_frame(vm, node, next_index, vectors, n_vectors_left)
static vlib_next_frame_t * vlib_node_runtime_get_next_frame(vlib_main_t *vm, vlib_node_runtime_t *n, u32 next_index)
static vlib_frame_t * vlib_get_frame(vlib_main_t *vm, uword frame_index)
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static void * vlib_frame_scalar_args(vlib_frame_t *f)
Get pointer to frame scalar data.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define foreach_device_and_queue(var, vec)
VLIB buffer representation.
static uword vlib_buffer_get_va(vlib_buffer_t *b)
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define CLIB_CACHE_LINE_BYTES
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.