FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
encap.c
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) 2015 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 #include <vppinfra/error.h>
17 #include <vppinfra/hash.h>
18 #include <vnet/vnet.h>
19 #include <vnet/ip/ip.h>
20 #include <vnet/ethernet/ethernet.h>
21 #include <vnet/interface_output.h>
22 #include <vnet/vxlan/vxlan.h>
23 #include <vnet/qos/qos_types.h>
24 #include <vnet/adj/rewrite.h>
25 
26 /* Statistics (not all errors) */
27 #define foreach_vxlan_encap_error \
28 _(ENCAPSULATED, "good packets encapsulated")
29 
30 static char *vxlan_encap_error_strings[] = {
31 #define _(sym,string) string,
33 #undef _
34 };
35 
36 typedef enum
37 {
38 #define _(sym,str) VXLAN_ENCAP_ERROR_##sym,
40 #undef _
43 
44 typedef enum
45 {
49 
50 typedef struct
51 {
55 
56 #ifndef CLIB_MARCH_VARIANT
57 u8 *
58 format_vxlan_encap_trace (u8 * s, va_list * args)
59 {
60  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
61  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
62  vxlan_encap_trace_t *t = va_arg (*args, vxlan_encap_trace_t *);
63 
64  s = format (s, "VXLAN encap to vxlan_tunnel%d vni %d",
65  t->tunnel_index, t->vni);
66  return s;
67 }
68 #endif
69 
72  vlib_frame_t *from_frame, u8 is_ip4)
73 {
74  u32 n_left_from, next_index, *from, *to_next;
75  vxlan_main_t *vxm = &vxlan_main;
76  vnet_main_t *vnm = vxm->vnet_main;
78  vlib_combined_counter_main_t *tx_counter =
80  u32 pkts_encapsulated = 0;
82  u32 sw_if_index0 = 0, sw_if_index1 = 0;
83  u32 next0 = 0, next1 = 0;
84  vxlan_tunnel_t *t0 = NULL, *t1 = NULL;
85  index_t dpoi_idx0 = INDEX_INVALID, dpoi_idx1 = INDEX_INVALID;
87  vlib_buffer_t **b = bufs;
88 
90  n_left_from = from_frame->n_vectors;
91 
92  next_index = node->cached_next_index;
93 
94  STATIC_ASSERT_SIZEOF (ip6_vxlan_header_t, 56);
95  STATIC_ASSERT_SIZEOF (ip4_vxlan_header_t, 36);
96 
97  u8 const underlay_hdr_len = is_ip4 ?
98  sizeof (ip4_vxlan_header_t) : sizeof (ip6_vxlan_header_t);
99  u16 const l3_len = is_ip4 ? sizeof (ip4_header_t) : sizeof (ip6_header_t);
100  u32 const outer_packet_csum_offload_flags =
101  is_ip4 ? (VNET_BUFFER_OFFLOAD_F_OUTER_IP_CKSUM |
102  VNET_BUFFER_OFFLOAD_F_TNL_VXLAN) :
103  (VNET_BUFFER_OFFLOAD_F_OUTER_UDP_CKSUM |
104  VNET_BUFFER_OFFLOAD_F_TNL_VXLAN);
105 
107 
108  while (n_left_from > 0)
109  {
110  u32 n_left_to_next;
111 
112  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
113 
114  while (n_left_from >= 4 && n_left_to_next >= 2)
115  {
116  /* Prefetch next iteration. */
117  {
118  vlib_prefetch_buffer_header (b[2], LOAD);
119  vlib_prefetch_buffer_header (b[3], LOAD);
120 
122  2 * CLIB_CACHE_LINE_BYTES, LOAD);
124  2 * CLIB_CACHE_LINE_BYTES, LOAD);
125  }
126 
127  u32 bi0 = to_next[0] = from[0];
128  u32 bi1 = to_next[1] = from[1];
129  from += 2;
130  to_next += 2;
131  n_left_to_next -= 2;
132  n_left_from -= 2;
133 
134  vlib_buffer_t *b0 = b[0];
135  vlib_buffer_t *b1 = b[1];
136  b += 2;
137 
138  u32 flow_hash0 = vnet_l2_compute_flow_hash (b0);
139  u32 flow_hash1 = vnet_l2_compute_flow_hash (b1);
140 
141  /* Get next node index and adj index from tunnel next_dpo */
142  if (sw_if_index0 != vnet_buffer (b0)->sw_if_index[VLIB_TX])
143  {
144  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
145  vnet_hw_interface_t *hi0 =
146  vnet_get_sup_hw_interface (vnm, sw_if_index0);
147  t0 = &vxm->tunnels[hi0->dev_instance];
148  /* Note: change to always set next0 if it may set to drop */
149  next0 = t0->next_dpo.dpoi_next_node;
150  dpoi_idx0 = t0->next_dpo.dpoi_index;
151  }
152 
153  /* Get next node index and adj index from tunnel next_dpo */
154  if (sw_if_index1 != vnet_buffer (b1)->sw_if_index[VLIB_TX])
155  {
156  if (sw_if_index0 == vnet_buffer (b1)->sw_if_index[VLIB_TX])
157  {
158  sw_if_index1 = sw_if_index0;
159  t1 = t0;
160  next1 = next0;
161  dpoi_idx1 = dpoi_idx0;
162  }
163  else
164  {
165  sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
166  vnet_hw_interface_t *hi1 =
167  vnet_get_sup_hw_interface (vnm, sw_if_index1);
168  t1 = &vxm->tunnels[hi1->dev_instance];
169  /* Note: change to always set next1 if it may set to drop */
170  next1 = t1->next_dpo.dpoi_next_node;
171  dpoi_idx1 = t1->next_dpo.dpoi_index;
172  }
173  }
174 
175  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = dpoi_idx0;
176  vnet_buffer (b1)->ip.adj_index[VLIB_TX] = dpoi_idx1;
177 
178  ASSERT (t0->rewrite_header.data_bytes == underlay_hdr_len);
179  ASSERT (t1->rewrite_header.data_bytes == underlay_hdr_len);
182  underlay_hdr_len);
183 
184  vlib_buffer_advance (b0, -underlay_hdr_len);
185  vlib_buffer_advance (b1, -underlay_hdr_len);
186 
187  u32 len0 = vlib_buffer_length_in_chain (vm, b0);
188  u32 len1 = vlib_buffer_length_in_chain (vm, b1);
189  u16 payload_l0 = clib_host_to_net_u16 (len0 - l3_len);
190  u16 payload_l1 = clib_host_to_net_u16 (len1 - l3_len);
191 
192  void *underlay0 = vlib_buffer_get_current (b0);
193  void *underlay1 = vlib_buffer_get_current (b1);
194 
195  ip4_header_t *ip4_0, *ip4_1;
196  qos_bits_t ip4_0_tos = 0, ip4_1_tos = 0;
197  ip6_header_t *ip6_0, *ip6_1;
198  udp_header_t *udp0, *udp1;
199  u8 *l3_0, *l3_1;
200  if (is_ip4)
201  {
202  ip4_vxlan_header_t *hdr0 = underlay0;
203  ip4_vxlan_header_t *hdr1 = underlay1;
204 
205  /* Fix the IP4 checksum and length */
206  ip4_0 = &hdr0->ip4;
207  ip4_1 = &hdr1->ip4;
208  ip4_0->length = clib_host_to_net_u16 (len0);
209  ip4_1->length = clib_host_to_net_u16 (len1);
210 
211  if (PREDICT_FALSE (b0->flags & VNET_BUFFER_F_QOS_DATA_VALID))
212  {
213  ip4_0_tos = vnet_buffer2 (b0)->qos.bits;
214  ip4_0->tos = ip4_0_tos;
215  }
216  if (PREDICT_FALSE (b1->flags & VNET_BUFFER_F_QOS_DATA_VALID))
217  {
218  ip4_1_tos = vnet_buffer2 (b1)->qos.bits;
219  ip4_1->tos = ip4_1_tos;
220  }
221 
222  l3_0 = (u8 *) ip4_0;
223  l3_1 = (u8 *) ip4_1;
224  udp0 = &hdr0->udp;
225  udp1 = &hdr1->udp;
226  }
227  else /* ipv6 */
228  {
229  ip6_vxlan_header_t *hdr0 = underlay0;
230  ip6_vxlan_header_t *hdr1 = underlay1;
231 
232  /* Fix IP6 payload length */
233  ip6_0 = &hdr0->ip6;
234  ip6_1 = &hdr1->ip6;
235  ip6_0->payload_length = payload_l0;
236  ip6_1->payload_length = payload_l1;
237 
238  l3_0 = (u8 *) ip6_0;
239  l3_1 = (u8 *) ip6_1;
240  udp0 = &hdr0->udp;
241  udp1 = &hdr1->udp;
242  }
243 
244  /* Fix UDP length and set source port */
245  udp0->length = payload_l0;
246  udp0->src_port = flow_hash0;
247  udp1->length = payload_l1;
248  udp1->src_port = flow_hash1;
249 
250  if (b0->flags & VNET_BUFFER_F_OFFLOAD)
251  {
252  vnet_buffer2 (b0)->outer_l3_hdr_offset = l3_0 - b0->data;
253  vnet_buffer2 (b0)->outer_l4_hdr_offset = (u8 *) udp0 - b0->data;
255  outer_packet_csum_offload_flags);
256  }
257  /* IPv4 checksum only */
258  else if (is_ip4)
259  {
260  ip_csum_t sum0 = ip4_0->checksum;
261  sum0 = ip_csum_update (sum0, 0, ip4_0->length, ip4_header_t,
262  length /* changed member */);
263  if (PREDICT_FALSE (ip4_0_tos))
264  {
265  sum0 = ip_csum_update (sum0, 0, ip4_0_tos, ip4_header_t,
266  tos /* changed member */);
267  }
268  ip4_0->checksum = ip_csum_fold (sum0);
269  }
270  /* IPv6 UDP checksum is mandatory */
271  else
272  {
273  int bogus = 0;
274 
275  udp0->checksum =
276  ip6_tcp_udp_icmp_compute_checksum (vm, b0, ip6_0, &bogus);
277  ASSERT (bogus == 0);
278  if (udp0->checksum == 0)
279  udp0->checksum = 0xffff;
280  }
281 
282  if (b1->flags & VNET_BUFFER_F_OFFLOAD)
283  {
284  vnet_buffer2 (b1)->outer_l3_hdr_offset = l3_1 - b1->data;
285  vnet_buffer2 (b1)->outer_l4_hdr_offset = (u8 *) udp1 - b1->data;
287  outer_packet_csum_offload_flags);
288  }
289  /* IPv4 checksum only */
290  else if (is_ip4)
291  {
292  ip_csum_t sum1 = ip4_1->checksum;
293  sum1 = ip_csum_update (sum1, 0, ip4_1->length, ip4_header_t,
294  length /* changed member */);
295  if (PREDICT_FALSE (ip4_1_tos))
296  {
297  sum1 = ip_csum_update (sum1, 0, ip4_1_tos, ip4_header_t,
298  tos /* changed member */);
299  }
300  ip4_1->checksum = ip_csum_fold (sum1);
301  }
302  /* IPv6 UDP checksum is mandatory */
303  else
304  {
305  int bogus = 0;
306 
308  (vm, b1, ip6_1, &bogus);
309  ASSERT (bogus == 0);
310  if (udp1->checksum == 0)
311  udp1->checksum = 0xffff;
312  }
313 
314  /* save inner packet flow_hash for load-balance node */
315  vnet_buffer (b0)->ip.flow_hash = flow_hash0;
316  vnet_buffer (b1)->ip.flow_hash = flow_hash1;
317 
318  if (sw_if_index0 == sw_if_index1)
319  {
321  sw_if_index0, 2, len0 + len1);
322  }
323  else
324  {
326  sw_if_index0, 1, len0);
328  sw_if_index1, 1, len1);
329  }
330  pkts_encapsulated += 2;
331 
332  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
333  {
334  vxlan_encap_trace_t *tr =
335  vlib_add_trace (vm, node, b0, sizeof (*tr));
336  tr->tunnel_index = t0 - vxm->tunnels;
337  tr->vni = t0->vni;
338  }
339 
340  if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
341  {
342  vxlan_encap_trace_t *tr =
343  vlib_add_trace (vm, node, b1, sizeof (*tr));
344  tr->tunnel_index = t1 - vxm->tunnels;
345  tr->vni = t1->vni;
346  }
347 
349  to_next, n_left_to_next,
350  bi0, bi1, next0, next1);
351  }
352 
353  while (n_left_from > 0 && n_left_to_next > 0)
354  {
355  u32 bi0 = to_next[0] = from[0];
356  from += 1;
357  to_next += 1;
358  n_left_from -= 1;
359  n_left_to_next -= 1;
360 
361  vlib_buffer_t *b0 = b[0];
362  b += 1;
363 
364  u32 flow_hash0 = vnet_l2_compute_flow_hash (b0);
365 
366  /* Get next node index and adj index from tunnel next_dpo */
367  if (sw_if_index0 != vnet_buffer (b0)->sw_if_index[VLIB_TX])
368  {
369  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
370  vnet_hw_interface_t *hi0 =
371  vnet_get_sup_hw_interface (vnm, sw_if_index0);
372  t0 = &vxm->tunnels[hi0->dev_instance];
373  /* Note: change to always set next0 if it may be set to drop */
374  next0 = t0->next_dpo.dpoi_next_node;
375  dpoi_idx0 = t0->next_dpo.dpoi_index;
376  }
377  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = dpoi_idx0;
378 
379  ASSERT (t0->rewrite_header.data_bytes == underlay_hdr_len);
381  underlay_hdr_len);
382 
383  vlib_buffer_advance (b0, -underlay_hdr_len);
384  void *underlay0 = vlib_buffer_get_current (b0);
385 
386  u32 len0 = vlib_buffer_length_in_chain (vm, b0);
387  u16 payload_l0 = clib_host_to_net_u16 (len0 - l3_len);
388 
389  udp_header_t *udp0;
390  ip4_header_t *ip4_0;
391  qos_bits_t ip4_0_tos = 0;
392  ip6_header_t *ip6_0;
393  u8 *l3_0;
394  if (is_ip4)
395  {
396  ip4_vxlan_header_t *hdr = underlay0;
397 
398  /* Fix the IP4 checksum and length */
399  ip4_0 = &hdr->ip4;
400  ip4_0->length = clib_host_to_net_u16 (len0);
401 
402  if (PREDICT_FALSE (b0->flags & VNET_BUFFER_F_QOS_DATA_VALID))
403  {
404  ip4_0_tos = vnet_buffer2 (b0)->qos.bits;
405  ip4_0->tos = ip4_0_tos;
406  }
407 
408  l3_0 = (u8 *) ip4_0;
409  udp0 = &hdr->udp;
410  }
411  else /* ip6 path */
412  {
413  ip6_vxlan_header_t *hdr = underlay0;
414 
415  /* Fix IP6 payload length */
416  ip6_0 = &hdr->ip6;
417  ip6_0->payload_length = payload_l0;
418 
419  l3_0 = (u8 *) ip6_0;
420  udp0 = &hdr->udp;
421  }
422 
423  /* Fix UDP length and set source port */
424  udp0->length = payload_l0;
425  udp0->src_port = flow_hash0;
426 
427  if (b0->flags & VNET_BUFFER_F_OFFLOAD)
428  {
429  vnet_buffer2 (b0)->outer_l3_hdr_offset = l3_0 - b0->data;
430  vnet_buffer2 (b0)->outer_l4_hdr_offset = (u8 *) udp0 - b0->data;
432  outer_packet_csum_offload_flags);
433  }
434  /* IPv4 checksum only */
435  else if (is_ip4)
436  {
437  ip_csum_t sum0 = ip4_0->checksum;
438  sum0 = ip_csum_update (sum0, 0, ip4_0->length, ip4_header_t,
439  length /* changed member */);
440  if (PREDICT_FALSE (ip4_0_tos))
441  {
442  sum0 = ip_csum_update (sum0, 0, ip4_0_tos, ip4_header_t,
443  tos /* changed member */);
444  }
445  ip4_0->checksum = ip_csum_fold (sum0);
446  }
447  /* IPv6 UDP checksum is mandatory */
448  else
449  {
450  int bogus = 0;
451 
453  (vm, b0, ip6_0, &bogus);
454  ASSERT (bogus == 0);
455  if (udp0->checksum == 0)
456  udp0->checksum = 0xffff;
457  }
458 
459  /* reuse inner packet flow_hash for load-balance node */
460  vnet_buffer (b0)->ip.flow_hash = flow_hash0;
461 
463  sw_if_index0, 1, len0);
464  pkts_encapsulated++;
465 
466  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
467  {
468  vxlan_encap_trace_t *tr =
469  vlib_add_trace (vm, node, b0, sizeof (*tr));
470  tr->tunnel_index = t0 - vxm->tunnels;
471  tr->vni = t0->vni;
472  }
474  to_next, n_left_to_next,
475  bi0, next0);
476  }
477 
478  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
479  }
480 
481  /* Do we still need this now that tunnel tx stats is kept? */
482  vlib_node_increment_counter (vm, node->node_index,
483  VXLAN_ENCAP_ERROR_ENCAPSULATED,
484  pkts_encapsulated);
485 
486  return from_frame->n_vectors;
487 }
488 
492 {
493  /* Disable chksum offload as setup overhead in tx node is not worthwhile
494  for ip4 header checksum only, unless udp checksum is also required */
495  return vxlan_encap_inline (vm, node, from_frame, /* is_ip4 */ 1);
496 }
497 
501 {
502  /* Enable checksum offload for ip6 as udp checksum is mandatory, */
503  return vxlan_encap_inline (vm, node, from_frame, /* is_ip4 */ 0);
504 }
505 
506 /* *INDENT-OFF* */
508  .name = "vxlan4-encap",
509  .vector_size = sizeof (u32),
510  .format_trace = format_vxlan_encap_trace,
513  .error_strings = vxlan_encap_error_strings,
514  .n_next_nodes = VXLAN_ENCAP_N_NEXT,
515  .next_nodes = {
516  [VXLAN_ENCAP_NEXT_DROP] = "error-drop",
517  },
518 };
519 
521  .name = "vxlan6-encap",
522  .vector_size = sizeof (u32),
523  .format_trace = format_vxlan_encap_trace,
526  .error_strings = vxlan_encap_error_strings,
527  .n_next_nodes = VXLAN_ENCAP_N_NEXT,
528  .next_nodes = {
529  [VXLAN_ENCAP_NEXT_DROP] = "error-drop",
530  },
531 };
532 /* *INDENT-ON* */
533 
534 /*
535  * fd.io coding-style-patch-verification: ON
536  *
537  * Local Variables:
538  * eval: (c-set-style "gnu")
539  * End:
540  */
dpo_id_t_::dpoi_next_node
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:186
im
vnet_interface_main_t * im
Definition: interface_output.c:415
VXLAN_ENCAP_NEXT_DROP
@ VXLAN_ENCAP_NEXT_DROP
Definition: encap.c:46
udp_header_t::src_port
u16 src_port
Definition: udp_packet.h:48
udp_header_t::length
u16 length
Definition: udp_packet.h:51
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
vxlan_encap_error_t
vxlan_encap_error_t
Definition: encap.c:36
vxlan.h
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:495
bufs
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
Definition: nat44_ei_out2in.c:717
vlib_prefetch_buffer_header
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:231
ip6_tcp_udp_icmp_compute_checksum
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
Definition: ip6_forward.c:1096
VNET_INTERFACE_COUNTER_TX
@ VNET_INTERFACE_COUNTER_TX
Definition: interface.h:919
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
vlib_get_buffers
vlib_get_buffers(vm, from, b, n_left_from)
qos_types.h
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
VLIB_FRAME_SIZE
#define VLIB_FRAME_SIZE
Definition: node.h:368
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
vnet_buffer_offload_flags_set
static_always_inline void vnet_buffer_offload_flags_set(vlib_buffer_t *b, vnet_buffer_oflags_t oflags)
Definition: buffer.h:528
rewrite.h
vnet_interface_main_t
Definition: interface.h:990
vxlan_encap_trace_t::tunnel_index
u32 tunnel_index
Definition: encap.c:52
format_vxlan_encap_trace
u8 * format_vxlan_encap_trace(u8 *s, va_list *args)
Definition: encap.c:58
u16
unsigned short u16
Definition: types.h:57
vxlan_encap_next_t
vxlan_encap_next_t
Definition: encap.c:44
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
from_frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
Definition: esp_encrypt.c:1328
vnet_buffer2
#define vnet_buffer2(b)
Definition: buffer.h:505
vnet_hw_interface_t::dev_instance
u32 dev_instance
Definition: interface.h:660
vlib_frame_t
Definition: node.h:372
vlib_buffer_length_in_chain
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:433
udp_header_t
Definition: udp_packet.h:45
ip4_header_t
Definition: ip4_packet.h:87
ethernet.h
ip4_header_t::tos
ip_dscp_t tos
Definition: ip4_packet.h:96
ip4_header_t::length
u16 length
Definition: ip4_packet.h:99
CLIB_PREFETCH
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:76
hash.h
vxlan_tunnel_t::vni
u32 vni
Definition: vxlan.h:90
qos_bits_t
u8 qos_bits_t
Type, er, safety for us water based entities.
Definition: qos_types.h:68
vlib_buffer_advance
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:276
error.h
vxlan_main
vxlan_main_t vxlan_main
Definition: vxlan.c:46
VLIB_NODE_FN
#define VLIB_NODE_FN(node)
Definition: node.h:202
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:441
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
vlib_get_thread_index
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:187
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
vlib_frame_vector_args
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:301
interface_output.h
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
uword
u64 uword
Definition: types.h:112
VXLAN_ENCAP_N_ERROR
@ VXLAN_ENCAP_N_ERROR
Definition: encap.c:41
STATIC_ASSERT_SIZEOF
#define STATIC_ASSERT_SIZEOF(d, s)
Definition: error_bootstrap.h:113
vlib_node_increment_counter
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1244
vxlan_encap_trace_t
Definition: encap.c:50
ip4_header_t::checksum
u16 checksum
Definition: ip4_packet.h:118
vxlan_tunnel_t
Definition: vxlan.h:81
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:58
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vnet_interface_main_t::combined_sw_if_counters
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:1024
vxlan_tunnel_t::next_dpo
dpo_id_t next_dpo
Definition: vxlan.h:87
udp_header_t::checksum
u16 checksum
Definition: udp_packet.h:55
vxlan_main_t
Definition: vxlan.h:160
data
u8 data[128]
Definition: ipsec_types.api:95
vxlan6_encap_node
vlib_node_registration_t vxlan6_encap_node
(constructor) VLIB_REGISTER_NODE (vxlan6_encap_node)
Definition: encap.c:520
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
vlib_validate_buffer_enqueue_x1
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
Definition: buffer_node.h:224
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vlib_combined_counter_main_t
A collection of combined counters.
Definition: counter.h:203
vlib_put_next_frame
vlib_put_next_frame(vm, node, next_index, 0)
ip.h
u32
unsigned int u32
Definition: types.h:88
vnet_get_sup_hw_interface
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:92
vxlan_encap_trace_t::vni
u32 vni
Definition: encap.c:53
VXLAN_ENCAP_N_NEXT
@ VXLAN_ENCAP_N_NEXT
Definition: encap.c:47
ip6_header_t
Definition: ip6_packet.h:294
length
char const int length
Definition: cJSON.h:163
vnet_rewrite_two_headers
#define vnet_rewrite_two_headers(rw0, rw1, p0, p1, most_likely_size)
Definition: rewrite.h:222
vlib_main_t
Definition: main.h:102
vxlan_main_t::vnet_main
vnet_main_t * vnet_main
Definition: vxlan.h:187
ip_csum_update
#define ip_csum_update(sum, old, new, type, field)
Definition: ip_packet.h:295
vlib_node_t
Definition: node.h:247
vlib_add_trace
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
u8
unsigned char u8
Definition: types.h:56
vlib_buffer_get_current
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
ip_csum_t
uword ip_csum_t
Definition: ip_packet.h:245
vlib_buffer_t::data
u8 data[]
Packet data.
Definition: buffer.h:204
vxlan_encap_error_strings
static char * vxlan_encap_error_strings[]
Definition: encap.c:30
vnet_rewrite_one_header
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
Definition: rewrite.h:218
vxlan_encap_inline
static uword vxlan_encap_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip4)
Definition: encap.c:71
vlib_validate_buffer_enqueue_x2
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
Definition: buffer_node.h:70
vnet.h
ip6_header_t::payload_length
u16 payload_length
Definition: ip6_packet.h:301
vxlan_main_t::tunnels
vxlan_tunnel_t * tunnels
Definition: vxlan.h:163
vxlan4_encap_node
vlib_node_registration_t vxlan4_encap_node
(constructor) VLIB_REGISTER_NODE (vxlan4_encap_node)
Definition: encap.c:507
vlib_node_runtime_t
Definition: node.h:454
from
from
Definition: nat44_ei_hairpinning.c:415
INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:49
foreach_vxlan_encap_error
#define foreach_vxlan_encap_error
Definition: encap.c:27
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vlib_get_next_frame
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:395
ip_csum_fold
static u16 ip_csum_fold(ip_csum_t c)
Definition: ip_packet.h:301
VLIB_TX
@ VLIB_TX
Definition: defs.h:47
n_left_from
n_left_from
Definition: nat44_ei_hairpinning.c:416
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vnet_main_t::interface_main
vnet_interface_main_t interface_main
Definition: vnet.h:81
vlib_increment_combined_counter
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
vlib_buffer_t::flags
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
Definition: buffer.h:133
vnet_l2_compute_flow_hash
static u32 vnet_l2_compute_flow_hash(vlib_buffer_t *b)
Definition: l2_input.h:342
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169