FD.io VPP  v21.01.1
Vector Packet Processing
output.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vlib/unix/unix.h>
20 #include <vlib/pci/pci.h>
21 #include <vppinfra/ring.h>
22 
23 #include <vnet/ethernet/ethernet.h>
24 #include <vnet/ip/ip4_packet.h>
25 #include <vnet/ip/ip6_packet.h>
26 #include <vnet/udp/udp_packet.h>
27 #include <vnet/tcp/tcp_packet.h>
28 
29 #include <vnet/devices/devices.h>
30 
31 #include <avf/avf.h>
32 
35 {
36  return d->qword[1] & 0x0f;
37 }
38 
40 {
46 };
47 
49 {
50  ip6_address_t src;
51  ip6_address_t dst;
54 };
55 
58 {
59  u64 flags = 0;
60  if (!is_tso && !(b->flags & ((VNET_BUFFER_F_OFFLOAD_IP_CKSUM |
61  VNET_BUFFER_F_OFFLOAD_TCP_CKSUM |
62  VNET_BUFFER_F_OFFLOAD_UDP_CKSUM))))
63  return 0;
64  u32 is_tcp = is_tso || b->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM;
65  u32 is_udp = !is_tso && b->flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
66  u32 is_ip4 = b->flags & VNET_BUFFER_F_IS_IP4;
67  u32 is_ip6 = b->flags & VNET_BUFFER_F_IS_IP6;
68  ASSERT (!is_tcp || !is_udp);
69  ASSERT (is_ip4 || is_ip6);
70  i16 l2_hdr_offset = b->current_data;
71  i16 l3_hdr_offset = vnet_buffer (b)->l3_hdr_offset;
72  i16 l4_hdr_offset = vnet_buffer (b)->l4_hdr_offset;
73  u16 l2_len = l3_hdr_offset - l2_hdr_offset;
74  u16 l3_len = l4_hdr_offset - l3_hdr_offset;
75  ip4_header_t *ip4 = (void *) (b->data + l3_hdr_offset);
76  ip6_header_t *ip6 = (void *) (b->data + l3_hdr_offset);
77  tcp_header_t *tcp = (void *) (b->data + l4_hdr_offset);
78  udp_header_t *udp = (void *) (b->data + l4_hdr_offset);
79  u16 l4_len =
80  is_tcp ? tcp_header_bytes (tcp) : is_udp ? sizeof (udp_header_t) : 0;
81  u16 sum = 0;
82 
83  flags |= AVF_TXD_OFFSET_MACLEN (l2_len) |
84  AVF_TXD_OFFSET_IPLEN (l3_len) | AVF_TXD_OFFSET_L4LEN (l4_len);
85  flags |= is_ip4 ? AVF_TXD_CMD_IIPT_IPV4 : AVF_TXD_CMD_IIPT_IPV6;
86  flags |= is_tcp ? AVF_TXD_CMD_L4T_TCP : is_udp ? AVF_TXD_CMD_L4T_UDP : 0;
87 
88  if (is_ip4)
89  ip4->checksum = 0;
90 
91  if (is_tso)
92  {
93  if (is_ip4)
94  ip4->length = 0;
95  else
96  ip6->payload_length = 0;
97  }
98 
99  if (is_tcp || is_udp)
100  {
101  if (is_ip4)
102  {
103  struct avf_ip4_psh psh = { 0 };
104  psh.src = ip4->src_address.as_u32;
105  psh.dst = ip4->dst_address.as_u32;
106  psh.proto = ip4->protocol;
107  psh.l4len =
108  is_tso ? 0 :
109  clib_host_to_net_u16 (clib_net_to_host_u16 (ip4->length) -
110  (l4_hdr_offset - l3_hdr_offset));
111  sum = ~ip_csum (&psh, sizeof (psh));
112  }
113  else
114  {
115  struct avf_ip6_psh psh = { 0 };
116  psh.src = ip6->src_address;
117  psh.dst = ip6->dst_address;
118  psh.proto = clib_host_to_net_u32 ((u32) ip6->protocol);
119  psh.l4len = is_tso ? 0 : ip6->payload_length;
120  sum = ~ip_csum (&psh, sizeof (psh));
121  }
122  }
123  /* ip_csum does a byte swap for some reason... */
124  sum = clib_net_to_host_u16 (sum);
125  if (is_tcp)
126  tcp->checksum = sum;
127  else if (is_udp)
128  udp->checksum = sum;
129  return flags;
130 }
131 
134  vlib_buffer_t * b)
135 {
137  if (PREDICT_FALSE (ctx_ph->ref_count == 255))
138  {
139  /* We need a new placeholder buffer */
140  u32 new_bi;
142  if (PREDICT_TRUE
143  (vlib_buffer_alloc_from_pool (vm, &new_bi, 1, bpi) == 1))
144  {
145  /* Remove our own reference on the current placeholder buffer */
146  ctx_ph->ref_count--;
147  /* Replace with the new placeholder buffer */
148  txq->ctx_desc_placeholder_bi = new_bi;
149  ctx_ph = vlib_get_buffer (vm, new_bi);
150  }
151  else
152  /* Impossible to enqueue a ctx descriptor, fail */
153  return 1;
154  }
155 
156  /* Acquire a reference on the placeholder buffer */
157  ctx_ph->ref_count++;
158 
159  u16 l234hdr_sz = vnet_buffer (b)->l4_hdr_offset - b->current_data +
160  vnet_buffer2 (b)->gso_l4_hdr_sz;
161  u16 tlen = vlib_buffer_length_in_chain (vm, b) - l234hdr_sz;
162  d[0].qword[0] = 0;
164  | AVF_TXD_CTX_SEG_MSS (vnet_buffer2 (b)->gso_size) |
165  AVF_TXD_CTX_SEG_TLEN (tlen);
166  return 0;
167 }
168 
169 
172  u32 * buffers, u32 n_packets, int use_va_dma)
173 {
174  u16 next = txq->next;
176  const u32 offload_mask = VNET_BUFFER_F_OFFLOAD_IP_CKSUM |
177  VNET_BUFFER_F_OFFLOAD_TCP_CKSUM | VNET_BUFFER_F_OFFLOAD_UDP_CKSUM |
178  VNET_BUFFER_F_GSO;
179  u64 one_by_one_offload_flags = 0;
180  int is_tso;
181  u16 n_desc = 0;
182  u16 *slot, n_desc_left, n_packets_left = n_packets;
183  u16 mask = txq->size - 1;
184  vlib_buffer_t *b[4];
185  avf_tx_desc_t *d = txq->descs + next;
186  u16 n_desc_needed;
187  vlib_buffer_t *b0;
188 
189  /* avoid ring wrap */
190  n_desc_left = txq->size - clib_max (txq->next, txq->n_enqueued + 8);
191 
192  if (n_desc_left == 0)
193  return 0;
194 
195  /* Fast path, no ring wrap */
196  while (n_packets_left && n_desc_left)
197  {
198  u32 or_flags;
199  if (n_packets_left < 8 || n_desc_left < 4)
200  goto one_by_one;
201 
202  vlib_prefetch_buffer_with_index (vm, buffers[4], LOAD);
203  vlib_prefetch_buffer_with_index (vm, buffers[5], LOAD);
204  vlib_prefetch_buffer_with_index (vm, buffers[6], LOAD);
205  vlib_prefetch_buffer_with_index (vm, buffers[7], LOAD);
206 
207  b[0] = vlib_get_buffer (vm, buffers[0]);
208  b[1] = vlib_get_buffer (vm, buffers[1]);
209  b[2] = vlib_get_buffer (vm, buffers[2]);
210  b[3] = vlib_get_buffer (vm, buffers[3]);
211 
212  or_flags = b[0]->flags | b[1]->flags | b[2]->flags | b[3]->flags;
213 
214  if (or_flags & (VLIB_BUFFER_NEXT_PRESENT | offload_mask))
215  goto one_by_one;
216 
217  vlib_buffer_copy_indices (txq->bufs + next, buffers, 4);
218 
219  if (use_va_dma)
220  {
221  d[0].qword[0] = vlib_buffer_get_current_va (b[0]);
222  d[1].qword[0] = vlib_buffer_get_current_va (b[1]);
223  d[2].qword[0] = vlib_buffer_get_current_va (b[2]);
224  d[3].qword[0] = vlib_buffer_get_current_va (b[3]);
225  }
226  else
227  {
228  d[0].qword[0] = vlib_buffer_get_current_pa (vm, b[0]);
229  d[1].qword[0] = vlib_buffer_get_current_pa (vm, b[1]);
230  d[2].qword[0] = vlib_buffer_get_current_pa (vm, b[2]);
231  d[3].qword[0] = vlib_buffer_get_current_pa (vm, b[3]);
232  }
233 
234  d[0].qword[1] = ((u64) b[0]->current_length) << 34 | bits;
235  d[1].qword[1] = ((u64) b[1]->current_length) << 34 | bits;
236  d[2].qword[1] = ((u64) b[2]->current_length) << 34 | bits;
237  d[3].qword[1] = ((u64) b[3]->current_length) << 34 | bits;
238 
239  next += 4;
240  n_desc += 4;
241  buffers += 4;
242  n_packets_left -= 4;
243  n_desc_left -= 4;
244  d += 4;
245  continue;
246 
247  one_by_one:
248  one_by_one_offload_flags = 0;
249  txq->bufs[next] = buffers[0];
250  b[0] = vlib_get_buffer (vm, buffers[0]);
251  is_tso = ! !(b[0]->flags & VNET_BUFFER_F_GSO);
252  if (PREDICT_FALSE (is_tso || b[0]->flags & offload_mask))
253  one_by_one_offload_flags |= avf_tx_prepare_cksum (b[0], is_tso);
254 
255  /* Deal with chain buffer if present */
256  if (is_tso || b[0]->flags & VLIB_BUFFER_NEXT_PRESENT)
257  {
258  n_desc_needed = 1 + is_tso;
259  b0 = b[0];
260 
261  /* Wish there were a buffer count for chain buffer */
262  while (b0->flags & VLIB_BUFFER_NEXT_PRESENT)
263  {
264  b0 = vlib_get_buffer (vm, b0->next_buffer);
265  n_desc_needed++;
266  }
267 
268  /* spec says data descriptor is limited to 8 segments */
269  if (PREDICT_FALSE (!is_tso && n_desc_needed > 8))
270  {
271  vlib_buffer_free_one (vm, buffers[0]);
272  vlib_error_count (vm, node->node_index,
273  AVF_TX_ERROR_SEGMENT_SIZE_EXCEEDED, 1);
274  n_packets_left -= 1;
275  buffers += 1;
276  continue;
277  }
278 
279  if (PREDICT_FALSE (n_desc_left < n_desc_needed))
280  /*
281  * Slow path may be able to to deal with this since it can handle
282  * ring wrap
283  */
284  break;
285 
286  /* Enqueue a context descriptor if needed */
287  if (PREDICT_FALSE (is_tso))
288  {
289  if (avf_tx_fill_ctx_desc (vm, txq, d, b[0]))
290  /* Failure to acquire ref on ctx placeholder */
291  break;
292  txq->bufs[next + 1] = txq->bufs[next];
293  txq->bufs[next] = txq->ctx_desc_placeholder_bi;
294  next += 1;
295  n_desc += 1;
296  n_desc_left -= 1;
297  d += 1;
298  }
299  while (b[0]->flags & VLIB_BUFFER_NEXT_PRESENT)
300  {
301  if (use_va_dma)
302  d[0].qword[0] = vlib_buffer_get_current_va (b[0]);
303  else
304  d[0].qword[0] = vlib_buffer_get_current_pa (vm, b[0]);
305 
306  d[0].qword[1] = (((u64) b[0]->current_length) << 34) |
307  AVF_TXD_CMD_RSV | one_by_one_offload_flags;
308 
309  next += 1;
310  n_desc += 1;
311  n_desc_left -= 1;
312  d += 1;
313 
314  txq->bufs[next] = b[0]->next_buffer;
315  b[0] = vlib_get_buffer (vm, b[0]->next_buffer);
316  }
317  }
318 
319  if (use_va_dma)
320  d[0].qword[0] = vlib_buffer_get_current_va (b[0]);
321  else
322  d[0].qword[0] = vlib_buffer_get_current_pa (vm, b[0]);
323 
324  d[0].qword[1] =
325  (((u64) b[0]->current_length) << 34) | bits |
326  one_by_one_offload_flags;
327 
328  next += 1;
329  n_desc += 1;
330  buffers += 1;
331  n_packets_left -= 1;
332  n_desc_left -= 1;
333  d += 1;
334  }
335 
336  /* Slow path to support ring wrap */
337  if (PREDICT_FALSE (n_packets_left))
338  {
339  txq->n_enqueued += n_desc;
340 
341  n_desc = 0;
342  d = txq->descs + (next & mask);
343 
344  /* +8 to be consistent with fast path */
345  n_desc_left = txq->size - (txq->n_enqueued + 8);
346 
347  while (n_packets_left && n_desc_left)
348  {
349 
350  txq->bufs[next & mask] = buffers[0];
351  b[0] = vlib_get_buffer (vm, buffers[0]);
352 
353  one_by_one_offload_flags = 0;
354  is_tso = ! !(b[0]->flags & VNET_BUFFER_F_GSO);
355  if (PREDICT_FALSE (is_tso || b[0]->flags & offload_mask))
356  one_by_one_offload_flags |= avf_tx_prepare_cksum (b[0], is_tso);
357 
358  /* Deal with chain buffer if present */
359  if (is_tso || b[0]->flags & VLIB_BUFFER_NEXT_PRESENT)
360  {
361  n_desc_needed = 1 + is_tso;
362  b0 = b[0];
363 
364  while (b0->flags & VLIB_BUFFER_NEXT_PRESENT)
365  {
366  b0 = vlib_get_buffer (vm, b0->next_buffer);
367  n_desc_needed++;
368  }
369 
370  /* Spec says data descriptor is limited to 8 segments */
371  if (PREDICT_FALSE (!is_tso && n_desc_needed > 8))
372  {
373  vlib_buffer_free_one (vm, buffers[0]);
374  vlib_error_count (vm, node->node_index,
375  AVF_TX_ERROR_SEGMENT_SIZE_EXCEEDED, 1);
376  n_packets_left -= 1;
377  buffers += 1;
378  continue;
379  }
380 
381  if (PREDICT_FALSE (n_desc_left < n_desc_needed))
382  break;
383 
384  /* Enqueue a context descriptor if needed */
385  if (PREDICT_FALSE (is_tso))
386  {
387  if (avf_tx_fill_ctx_desc (vm, txq, d, b[0]))
388  /* Failure to acquire ref on ctx placeholder */
389  break;
390 
391  txq->bufs[(next + 1) & mask] = txq->bufs[next & mask];
392  txq->bufs[next & mask] = txq->ctx_desc_placeholder_bi;
393  next += 1;
394  n_desc += 1;
395  n_desc_left -= 1;
396  d = txq->descs + (next & mask);
397  }
398  while (b[0]->flags & VLIB_BUFFER_NEXT_PRESENT)
399  {
400  if (use_va_dma)
401  d[0].qword[0] = vlib_buffer_get_current_va (b[0]);
402  else
403  d[0].qword[0] = vlib_buffer_get_current_pa (vm, b[0]);
404 
405  d[0].qword[1] = (((u64) b[0]->current_length) << 34) |
406  AVF_TXD_CMD_RSV | one_by_one_offload_flags;
407 
408  next += 1;
409  n_desc += 1;
410  n_desc_left -= 1;
411  d = txq->descs + (next & mask);
412 
413  txq->bufs[next & mask] = b[0]->next_buffer;
414  b[0] = vlib_get_buffer (vm, b[0]->next_buffer);
415  }
416  }
417 
418  if (use_va_dma)
419  d[0].qword[0] = vlib_buffer_get_current_va (b[0]);
420  else
421  d[0].qword[0] = vlib_buffer_get_current_pa (vm, b[0]);
422 
423  d[0].qword[1] =
424  (((u64) b[0]->current_length) << 34) | bits |
425  one_by_one_offload_flags;
426 
427  next += 1;
428  n_desc += 1;
429  buffers += 1;
430  n_packets_left -= 1;
431  n_desc_left -= 1;
432  d = txq->descs + (next & mask);
433  }
434  }
435 
436  if ((slot = clib_ring_enq (txq->rs_slots)))
437  {
438  u16 rs_slot = slot[0] = (next - 1) & mask;
439  d = txq->descs + rs_slot;
440  d[0].qword[1] |= AVF_TXD_CMD_RS;
441  }
442 
443  txq->next = next & mask;
445  txq->n_enqueued += n_desc;
446  return n_packets - n_packets_left;
447 }
448 
452 {
453  vnet_interface_output_runtime_t *rd = (void *) node->runtime_data;
455  u32 thread_index = vm->thread_index;
456  u8 qid = thread_index;
457  avf_txq_t *txq = vec_elt_at_index (ad->txqs, qid % ad->num_queue_pairs);
458  u32 *buffers = vlib_frame_vector_args (frame);
459  u16 n_enq, n_left;
460  u16 n_retry = 2;
461 
463 
464  n_left = frame->n_vectors;
465 
466 retry:
467  /* release consumed bufs */
468  if (txq->n_enqueued)
469  {
470  i32 complete_slot = -1;
471  while (1)
472  {
474 
475  if (slot == 0)
476  break;
477 
478  if (avf_tx_desc_get_dtyp (txq->descs + slot[0]) != 0x0F)
479  break;
480 
481  complete_slot = slot[0];
482 
483  clib_ring_deq (txq->rs_slots);
484  }
485 
486  if (complete_slot >= 0)
487  {
488  u16 first, mask, n_free;
489  mask = txq->size - 1;
490  first = (txq->next - txq->n_enqueued) & mask;
491  n_free = (complete_slot + 1 - first) & mask;
492 
493  txq->n_enqueued -= n_free;
494  vlib_buffer_free_from_ring_no_next (vm, txq->bufs, first, txq->size,
495  n_free);
496  }
497  }
498 
499  if (ad->flags & AVF_DEVICE_F_VA_DMA)
500  n_enq = avf_tx_enqueue (vm, node, txq, buffers, n_left, 1);
501  else
502  n_enq = avf_tx_enqueue (vm, node, txq, buffers, n_left, 0);
503 
504  n_left -= n_enq;
505 
506  if (n_left)
507  {
508  buffers += n_enq;
509 
510  if (n_retry--)
511  goto retry;
512 
513  vlib_buffer_free (vm, buffers, n_left);
514  vlib_error_count (vm, node->node_index,
515  AVF_TX_ERROR_NO_FREE_SLOTS, n_left);
516  }
517 
519 
520  return frame->n_vectors - n_left;
521 }
522 
523 /*
524  * fd.io coding-style-patch-verification: ON
525  *
526  * Local Variables:
527  * eval: (c-set-style "gnu")
528  * End:
529  */
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:124
static uword vlib_buffer_get_current_pa(vlib_main_t *vm, vlib_buffer_t *b)
Definition: buffer_funcs.h:463
#define AVF_TXD_OFFSET_MACLEN(val)
Definition: avf.h:72
static uword vlib_buffer_get_current_va(vlib_buffer_t *b)
Definition: buffer.h:241
#define AVF_TXD_CTX_SEG_TLEN(val)
Definition: avf.h:79
u32 ctx_desc_placeholder_bi
Definition: avf.h:175
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
Definition: buffer_funcs.h:937
ip4_address_t src_address
Definition: ip4_packet.h:125
#define vnet_buffer2(b)
Definition: buffer.h:481
#define PREDICT_TRUE(x)
Definition: clib.h:122
u16 l4len
Definition: output.c:45
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:110
unsigned long u64
Definition: types.h:89
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
Definition: error_funcs.h:57
#define AVF_TXD_DTYP_CTX
Definition: avf.h:76
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
Definition: lock.h:129
#define AVF_TXD_CTX_CMD_TSO
Definition: avf.h:77
u32 thread_index
Definition: main.h:250
vlib_main_t * vm
Definition: in2out_ed.c:1580
u32 numa_node
Definition: main.h:252
#define AVF_TXD_CMD_IIPT_IPV4
Definition: avf.h:64
u16 mask
Definition: flow_types.api:52
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:402
struct _tcp_header tcp_header_t
volatile u32 * qtx_tail
Definition: avf.h:172
ip6_address_t src_address
Definition: ip6_packet.h:310
unsigned char u8
Definition: types.h:56
u16 * rs_slots
Definition: avf.h:180
#define static_always_inline
Definition: clib.h:109
#define AVF_TXD_CMD_RSV
Definition: avf.h:59
#define vlib_prefetch_buffer_with_index(vm, bi, type)
Prefetch buffer metadata by buffer index The first 64 bytes of buffer contains most header informatio...
Definition: buffer_funcs.h:476
clib_spinlock_t lock
Definition: avf.h:176
vl_api_ip6_address_t ip6
Definition: one.api:424
ip4_address_t dst_address
Definition: ip4_packet.h:125
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
VNET_DEVICE_CLASS_TX_FN() avf_device_class(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: output.c:449
const cJSON *const b
Definition: cJSON.h:255
#define AVF_TXD_CMD_L4T_TCP
Definition: avf.h:67
#define AVF_TXD_CMD_L4T_UDP
Definition: avf.h:69
#define VNET_DEVICE_CLASS_TX_FN(devclass)
Definition: interface.h:316
unsigned int u32
Definition: types.h:88
bool is_ip6
Definition: ip.api:43
static heap_elt_t * first(heap_header_t *h)
Definition: heap.c:59
#define clib_ring_deq(ring)
Definition: ring.h:120
#define AVF_TXD_CMD_EOP
Definition: avf.h:57
static_always_inline int avf_tx_fill_ctx_desc(vlib_main_t *vm, avf_txq_t *txq, avf_tx_desc_t *d, vlib_buffer_t *b)
Definition: output.c:133
unsigned short u16
Definition: types.h:57
#define clib_ring_get_first(ring)
Definition: ring.h:123
#define PREDICT_FALSE(x)
Definition: clib.h:121
vl_api_ip4_address_t ip4
Definition: one.api:376
u32 node_index
Node index.
Definition: node.h:488
static_always_inline u16 ip_csum(void *data, u16 n_left)
Definition: ip_packet.h:155
static_always_inline u64 avf_tx_prepare_cksum(vlib_buffer_t *b, u8 is_tso)
Definition: output.c:57
u8 slot
Definition: pci_types.api:22
static_always_inline u16 avf_tx_enqueue(vlib_main_t *vm, vlib_node_runtime_t *node, avf_txq_t *txq, u32 *buffers, u32 n_packets, int use_va_dma)
Definition: output.c:171
#define AVF_TXD_OFFSET_IPLEN(val)
Definition: avf.h:73
ip6_address_t src
Definition: output.c:50
u8 zero
Definition: output.c:43
u8 data[]
Packet data.
Definition: buffer.h:181
#define clib_ring_enq(ring)
Definition: ring.h:94
avf_tx_desc_t * descs
Definition: avf.h:177
static_always_inline avf_device_t * avf_get_device(u32 dev_instance)
Definition: avf.h:311
vlib_main_t vlib_node_runtime_t * node
Definition: in2out_ed.c:1580
static_always_inline u8 avf_tx_desc_get_dtyp(avf_tx_desc_t *d)
Definition: output.c:34
u32 * bufs
Definition: avf.h:178
signed int i32
Definition: types.h:77
#define ASSERT(truth)
#define AVF_TXD_CTX_SEG_MSS(val)
Definition: avf.h:80
Definition: avf.h:169
u8 proto
Definition: output.c:44
u16 n_enqueued
Definition: avf.h:179
u32 dst
Definition: output.c:42
#define clib_atomic_store_rel_n(a, b)
Definition: atomics.h:49
#define clib_max(x, y)
Definition: clib.h:321
#define AVF_TXD_CMD_RS
Definition: avf.h:58
u16 next
Definition: avf.h:173
static_always_inline void vlib_buffer_copy_indices(u32 *dst, u32 *src, u32 n_indices)
Definition: buffer_funcs.h:102
u32 proto
Definition: output.c:53
u16 payload_length
Definition: ip6_packet.h:301
#define AVF_TXD_CMD_IIPT_IPV6
Definition: avf.h:62
u32 next_buffer
Next buffer for this linked-list of buffers.
Definition: buffer.h:140
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: in2out_ed.c:1581
VLIB buffer representation.
Definition: buffer.h:102
u64 qword[2]
Definition: avf.h:147
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:297
u32 src
Definition: output.c:41
#define vnet_buffer(b)
Definition: buffer.h:417
static int tcp_header_bytes(tcp_header_t *t)
Definition: tcp_packet.h:93
u16 size
Definition: avf.h:174
#define AVF_TXD_OFFSET_L4LEN(val)
Definition: avf.h:74
u32 l4len
Definition: output.c:52
static void vlib_buffer_free_one(vlib_main_t *vm, u32 buffer_index)
Free one buffer Shorthand to free a single buffer chain.
Definition: buffer_funcs.h:970
static u8 vlib_buffer_pool_get_default_for_numa(vlib_main_t *vm, u32 numa_node)
Definition: buffer_funcs.h:199
static void vlib_buffer_free_from_ring_no_next(vlib_main_t *vm, u32 *ring, u32 start, u32 ring_size, u32 n_buffers)
Free buffers from ring without freeing tail buffers.
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
Definition: lock.h:106
volatile u8 ref_count
Reference count for this buffer.
Definition: buffer.h:130
ip6_address_t dst
Definition: output.c:51
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:85
ip6_address_t dst_address
Definition: ip6_packet.h:310
static __clib_warn_unused_result u32 vlib_buffer_alloc_from_pool(vlib_main_t *vm, u32 *buffers, u32 n_buffers, u8 buffer_pool_index)
Allocate buffers from specific pool into supplied array.
Definition: buffer_funcs.h:566
signed short i16
Definition: types.h:46