FD.io VPP  v16.09
Vector Packet Processing
l2_efp_filter.c
Go to the documentation of this file.
1 /*
2  * l2_efp_filter.c : layer 2 egress EFP Filter processing
3  *
4  * Copyright (c) 2013 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vnet/vnet.h>
20 #include <vnet/ethernet/ethernet.h>
21 #include <vnet/ethernet/packet.h>
22 #include <vnet/l2/feat_bitmap.h>
23 #include <vnet/l2/l2_output.h>
24 #include <vnet/ethernet/ethernet.h>
25 
26 #include <vppinfra/error.h>
27 #include <vppinfra/cache.h>
28 
29 typedef struct
30 {
31 
32  /* Next nodes for features and output interfaces */
34 
35  /* convenience variables */
39 
40 
41 typedef struct
42 {
43  /* per-pkt trace data */
44  u8 src[6];
45  u8 dst[6];
46  u8 raw[12]; /* raw data (vlans) */
49 
50 /* packet trace format function */
51 static u8 *
52 format_l2_efp_filter_trace (u8 * s, va_list * args)
53 {
54  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
55  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
56  l2_efp_filter_trace_t *t = va_arg (*args, l2_efp_filter_trace_t *);
57 
58  s = format (s, "l2-output-vtr: sw_if_index %d dst %U src %U data "
59  "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
60  t->sw_if_index,
63  t->raw[0], t->raw[1], t->raw[2], t->raw[3], t->raw[4],
64  t->raw[5], t->raw[6], t->raw[7], t->raw[8], t->raw[9],
65  t->raw[10], t->raw[11]);
66  return s;
67 }
68 
70 
72 
73 #define foreach_l2_efp_filter_error \
74 _(L2_EFP_FILTER, "L2 EFP filter packets") \
75 _(DROP, "L2 EFP filter post-rewrite drops")
76 
77 typedef enum
78 {
79 #define _(sym,str) L2_EFP_FILTER_ERROR_##sym,
81 #undef _
84 
85 static char *l2_efp_filter_error_strings[] = {
86 #define _(sym,string) string,
88 #undef _
89 };
90 
91 typedef enum
92 {
96 
97 
98 /**
99  * Extract fields from the packet that will be used in interface
100  * classification.
101  */
104  u32 sw_if_index0,
105  vlib_buffer_t * b0,
106  u32 * port_sw_if_index0,
107  u16 * first_ethertype0,
108  u16 * outer_id0, u16 * inner_id0, u32 * match_flags0)
109 {
110  ethernet_header_t *e0;
112  u32 tag_len;
113  u32 tag_num;
114 
115  *port_sw_if_index0 =
116  vnet_get_sup_sw_interface (vnet_main, sw_if_index0)->sw_if_index;
117 
118  e0 = vlib_buffer_get_current (b0);
119  h0 = (ethernet_vlan_header_t *) (e0 + 1);
120 
121  *first_ethertype0 = clib_net_to_host_u16 (e0->type);
122  *outer_id0 = clib_net_to_host_u16 (h0[0].priority_cfi_and_id);
123  *inner_id0 = clib_net_to_host_u16 (h0[1].priority_cfi_and_id);
124 
125  tag_len = vnet_buffer (b0)->l2.l2_len - sizeof (ethernet_header_t);
126  tag_num = tag_len / sizeof (ethernet_vlan_header_t);
127  *match_flags0 = eth_create_valid_subint_match_flags (tag_num);
128 }
129 
130 /*
131  * EFP filtering is a basic switch feature which prevents an interface from
132  * transmitting a packet that doesn't match the interface's ingress match
133  * criteria. The check has two parts, one performed before egress vlan tag
134  * rewrite and one after.
135  *
136  * The pre-rewrite check insures the packet matches what an ingress packet looks
137  * like after going through the interface's ingress tag rewrite operation. Only
138  * pushed tags are compared. So:
139  * - if the ingress vlan tag rewrite pushes no tags (or is not enabled),
140  * any packet passes the filter
141  * - if the ingress vlan tag rewrite pushes one tag,
142  * the packet must have at least one tag, and the outer tag must match the pushed tag
143  * - if the ingress vlan tag rewrite pushes two tags,
144  * the packet must have at least two tags, and the outer two tags must match the pushed tags
145  *
146  * The pre-rewrite check is performed in the l2-output node.
147  *
148  * The post-rewrite check insures the packet matches what an ingress packet looks
149  * like before going through the interface's ingress tag rewrite operation. It verifies
150  * that such a packet arriving on the wire at this port would be classified as arriving
151  * an input interface equal to the packet's output interface. This can be done by running
152  * the output packet's vlan tags and output port through the interface classification,
153  * and checking if the resulting interface matches the output interface.
154  *
155  * The post-rewrite check is performed here.
156  */
157 
158 static uword
160  vlib_node_runtime_t * node, vlib_frame_t * frame)
161 {
162  u32 n_left_from, *from, *to_next;
163  l2_efp_filter_next_t next_index;
166  u32 node_counter_base_index = n->error_heap_index;
167  vlib_error_main_t *em = &vm->error_main;
168  u32 cached_sw_if_index = ~0;
169  u32 cached_next_index = ~0;
170 
171  /* invalidate cache to begin with */
172  cached_sw_if_index = ~0;
173 
174  from = vlib_frame_vector_args (frame);
175  n_left_from = frame->n_vectors; /* number of packets to process */
176  next_index = node->cached_next_index;
177 
178  while (n_left_from > 0)
179  {
180  u32 n_left_to_next;
181 
182  /* get space to enqueue frame to graph node "next_index" */
183  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
184 
185  while (n_left_from >= 6 && n_left_to_next >= 2)
186  {
187  u32 bi0, bi1;
188  vlib_buffer_t *b0, *b1;
189  u32 next0, next1;
190  u32 sw_if_index0, sw_if_index1;
191  u32 feature_bitmap0, feature_bitmap1;
192  u16 first_ethertype0, first_ethertype1;
193  u16 outer_id0, inner_id0, outer_id1, inner_id1;
194  u32 match_flags0, match_flags1;
195  u32 port_sw_if_index0, subint_sw_if_index0, port_sw_if_index1,
196  subint_sw_if_index1;
197  vnet_hw_interface_t *hi0, *hi1;
198  main_intf_t *main_intf0, *main_intf1;
199  vlan_intf_t *vlan_intf0, *vlan_intf1;
200  qinq_intf_t *qinq_intf0, *qinq_intf1;
201  u32 is_l20, is_l21;
202  __attribute__ ((unused)) u32 matched0, matched1;
203  u8 error0, error1;
204 
205  /* Prefetch next iteration. */
206  {
207  vlib_buffer_t *p2, *p3, *p4, *p5;
208  __attribute__ ((unused)) u32 sw_if_index2, sw_if_index3;
209 
210  p2 = vlib_get_buffer (vm, from[2]);
211  p3 = vlib_get_buffer (vm, from[3]);
212  p4 = vlib_get_buffer (vm, from[4]);
213  p5 = vlib_get_buffer (vm, from[5]);
214 
215  /* Prefetch the buffer header and packet for the N+2 loop iteration */
216  vlib_prefetch_buffer_header (p4, LOAD);
217  vlib_prefetch_buffer_header (p5, LOAD);
218 
221 
222  /*
223  * Prefetch the input config for the N+1 loop iteration
224  * This depends on the buffer header above
225  */
226  sw_if_index2 = vnet_buffer (p2)->sw_if_index[VLIB_TX];
227  sw_if_index3 = vnet_buffer (p3)->sw_if_index[VLIB_TX];
228  /*
229  * $$$ TODO
230  * CLIB_PREFETCH (vec_elt_at_index(l2output_main.configs, sw_if_index2), CLIB_CACHE_LINE_BYTES, LOAD);
231  * CLIB_PREFETCH (vec_elt_at_index(l2output_main.configs, sw_if_index3), CLIB_CACHE_LINE_BYTES, LOAD);
232  */
233  }
234 
235  /* speculatively enqueue b0 and b1 to the current next frame */
236  /* bi is "buffer index", b is pointer to the buffer */
237  to_next[0] = bi0 = from[0];
238  to_next[1] = bi1 = from[1];
239  from += 2;
240  to_next += 2;
241  n_left_from -= 2;
242  n_left_to_next -= 2;
243 
244  b0 = vlib_get_buffer (vm, bi0);
245  b1 = vlib_get_buffer (vm, bi1);
246 
247  /* TX interface handles */
248  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
249  sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
250 
251  /* process 2 packets */
252  em->counters[node_counter_base_index +
253  L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 2;
254 
255  /* Remove ourself from the feature bitmap */
256  feature_bitmap0 =
257  vnet_buffer (b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
258  feature_bitmap1 =
259  vnet_buffer (b1)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
260 
261  /* Determine next node */
263  msm->vnet_main,
264  node,
265  l2_efp_filter_node.index,
266  &cached_sw_if_index,
267  &cached_next_index,
268  &msm->next_nodes,
269  b0, sw_if_index0, feature_bitmap0, &next0);
271  msm->vnet_main,
272  node,
273  l2_efp_filter_node.index,
274  &cached_sw_if_index,
275  &cached_next_index,
276  &msm->next_nodes,
277  b1, sw_if_index1, feature_bitmap1, &next1);
278 
279  /* perform the efp filter check on two packets */
280 
281  extract_keys (msm->vnet_main,
282  sw_if_index0,
283  b0,
284  &port_sw_if_index0,
285  &first_ethertype0,
286  &outer_id0, &inner_id0, &match_flags0);
287 
288  extract_keys (msm->vnet_main,
289  sw_if_index1,
290  b1,
291  &port_sw_if_index1,
292  &first_ethertype1,
293  &outer_id1, &inner_id1, &match_flags1);
294 
296  msm->vnet_main,
297  port_sw_if_index0,
298  first_ethertype0,
299  outer_id0,
300  inner_id0,
301  &hi0,
302  &main_intf0, &vlan_intf0, &qinq_intf0);
303 
305  msm->vnet_main,
306  port_sw_if_index1,
307  first_ethertype1,
308  outer_id1,
309  inner_id1,
310  &hi1,
311  &main_intf1, &vlan_intf1, &qinq_intf1);
312 
313  matched0 = eth_identify_subint (hi0,
314  b0,
315  match_flags0,
316  main_intf0,
317  vlan_intf0,
318  qinq_intf0,
319  &subint_sw_if_index0,
320  &error0, &is_l20);
321 
322  matched1 = eth_identify_subint (hi1,
323  b1,
324  match_flags1,
325  main_intf1,
326  vlan_intf1,
327  qinq_intf1,
328  &subint_sw_if_index1,
329  &error1, &is_l21);
330 
331  if (PREDICT_FALSE (sw_if_index0 != subint_sw_if_index0))
332  {
333  /* Drop packet */
334  next0 = L2_EFP_FILTER_NEXT_DROP;
335  b0->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
336  }
337 
338  if (PREDICT_FALSE (sw_if_index1 != subint_sw_if_index1))
339  {
340  /* Drop packet */
341  next1 = L2_EFP_FILTER_NEXT_DROP;
342  b1->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
343  }
344 
345  if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
346  {
347  if (b0->flags & VLIB_BUFFER_IS_TRACED)
348  {
351  vlib_add_trace (vm, node, b0, sizeof (*t));
352  t->sw_if_index = sw_if_index0;
353  clib_memcpy (t->src, h0->src_address, 6);
354  clib_memcpy (t->dst, h0->dst_address, 6);
355  clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
356  }
357  if (b1->flags & VLIB_BUFFER_IS_TRACED)
358  {
361  vlib_add_trace (vm, node, b1, sizeof (*t));
362  t->sw_if_index = sw_if_index1;
363  clib_memcpy (t->src, h1->src_address, 6);
364  clib_memcpy (t->dst, h1->dst_address, 6);
365  clib_memcpy (t->raw, &h1->type, sizeof (t->raw));
366  }
367  }
368 
369  /* verify speculative enqueues, maybe switch current next frame */
370  /* if next0==next1==next_index then nothing special needs to be done */
371  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
372  to_next, n_left_to_next,
373  bi0, bi1, next0, next1);
374  }
375 
376  while (n_left_from > 0 && n_left_to_next > 0)
377  {
378  u32 bi0;
379  vlib_buffer_t *b0;
380  u32 next0;
381  u32 sw_if_index0;
382  u32 feature_bitmap0;
383  u16 first_ethertype0;
384  u16 outer_id0, inner_id0;
385  u32 match_flags0;
386  u32 port_sw_if_index0, subint_sw_if_index0;
387  vnet_hw_interface_t *hi0;
388  main_intf_t *main_intf0;
389  vlan_intf_t *vlan_intf0;
390  qinq_intf_t *qinq_intf0;
391  u32 is_l20;
392  __attribute__ ((unused)) u32 matched0;
393  u8 error0;
394 
395  /* speculatively enqueue b0 to the current next frame */
396  bi0 = from[0];
397  to_next[0] = bi0;
398  from += 1;
399  to_next += 1;
400  n_left_from -= 1;
401  n_left_to_next -= 1;
402 
403  b0 = vlib_get_buffer (vm, bi0);
404  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
405 
406  /* process 1 packet */
407  em->counters[node_counter_base_index +
408  L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 1;
409 
410  /* Remove ourself from the feature bitmap */
411  feature_bitmap0 =
412  vnet_buffer (b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
413 
414  /* Determine next node */
416  msm->vnet_main,
417  node,
418  l2_efp_filter_node.index,
419  &cached_sw_if_index,
420  &cached_next_index,
421  &msm->next_nodes,
422  b0, sw_if_index0, feature_bitmap0, &next0);
423 
424  /* perform the efp filter check on one packet */
425 
426  extract_keys (msm->vnet_main,
427  sw_if_index0,
428  b0,
429  &port_sw_if_index0,
430  &first_ethertype0,
431  &outer_id0, &inner_id0, &match_flags0);
432 
434  msm->vnet_main,
435  port_sw_if_index0,
436  first_ethertype0,
437  outer_id0,
438  inner_id0,
439  &hi0,
440  &main_intf0, &vlan_intf0, &qinq_intf0);
441 
442  matched0 = eth_identify_subint (hi0,
443  b0,
444  match_flags0,
445  main_intf0,
446  vlan_intf0,
447  qinq_intf0,
448  &subint_sw_if_index0,
449  &error0, &is_l20);
450 
451  if (PREDICT_FALSE (sw_if_index0 != subint_sw_if_index0))
452  {
453  /* Drop packet */
454  next0 = L2_EFP_FILTER_NEXT_DROP;
455  b0->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
456  }
457 
459  && (b0->flags & VLIB_BUFFER_IS_TRACED)))
460  {
463  vlib_add_trace (vm, node, b0, sizeof (*t));
464  t->sw_if_index = sw_if_index0;
465  clib_memcpy (t->src, h0->src_address, 6);
466  clib_memcpy (t->dst, h0->dst_address, 6);
467  clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
468  }
469 
470  /* verify speculative enqueue, maybe switch current next frame */
471  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
472  to_next, n_left_to_next,
473  bi0, next0);
474  }
475 
476  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
477  }
478 
479  return frame->n_vectors;
480 }
481 
482 
483 /* *INDENT-OFF* */
485  .function = l2_efp_filter_node_fn,
486  .name = "l2-efp-filter",
487  .vector_size = sizeof (u32),
488  .format_trace = format_l2_efp_filter_trace,
490 
492  .error_strings = l2_efp_filter_error_strings,
493 
494  .n_next_nodes = L2_EFP_FILTER_N_NEXT,
495 
496  /* edit / add dispositions here */
497  .next_nodes = {
498  [L2_EFP_FILTER_NEXT_DROP] = "error-drop",
499  },
500 };
501 /* *INDENT-ON* */
502 
505 {
507 
508  mp->vlib_main = vm;
509  mp->vnet_main = vnet_get_main ();
510 
511  /* Initialize the feature next-node indexes */
513  l2_efp_filter_node.index,
517 
518  /* Initialize the output node mapping table */
520 
521  return 0;
522 }
523 
525 
526 
527 /** Enable/disable the EFP Filter check on the subinterface. */
528 void
530 {
531  /* set the interface flag */
532  l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_EFP_FILTER, enable);
533 }
534 
535 
536 /**
537  * Set subinterface egress efp filter enable/disable.
538  * The CLI format is:
539  * set interface l2 efp-filter <interface> [disable]]
540  */
541 static clib_error_t *
543  unformat_input_t * input, vlib_cli_command_t * cmd)
544 {
545  vnet_main_t *vnm = vnet_get_main ();
546  clib_error_t *error = 0;
547  u32 sw_if_index;
548  u32 enable;
549 
550  if (!unformat_user (input, unformat_vnet_sw_interface, vnm, &sw_if_index))
551  {
552  error = clib_error_return (0, "unknown interface `%U'",
553  format_unformat_error, input);
554  goto done;
555  }
556 
557  enable = 1;
558  if (unformat (input, "disable"))
559  {
560  enable = 0;
561  }
562 
563  /* enable/disable the feature */
564  l2_efp_filter_configure (vnm, sw_if_index, enable);
565 
566 done:
567  return error;
568 }
569 
570 
571 /* *INDENT-OFF* */
572 VLIB_CLI_COMMAND (int_l2_efp_filter_cli, static) = {
573  .path = "set interface l2 efp-filter",
574  .short_help = "set interface l2 efp-filter <interface> [disable]",
575  .function = int_l2_efp_filter,
576 };
577 /* *INDENT-ON* */
578 
579 
580 /*
581  * fd.io coding-style-patch-verification: ON
582  *
583  * Local Variables:
584  * eval: (c-set-style "gnu")
585  * End:
586  */
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.
Definition: main.c:457
u32 error_heap_index
Definition: node.h:278
#define CLIB_UNUSED(x)
Definition: clib.h:79
char ** l2output_get_feat_names(void)
Definition: l2_output.c:38
uword unformat(unformat_input_t *i, char *fmt,...)
Definition: unformat.c:966
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
u8 src_address[6]
Definition: packet.h:54
l2_efp_filter_next_t
Definition: l2_efp_filter.c:91
struct _vlib_node_registration vlib_node_registration_t
unformat_function_t unformat_vnet_sw_interface
vlib_error_t * errors
Definition: node.h:418
static u8 * format_l2_efp_filter_trace(u8 *s, va_list *args)
Definition: l2_efp_filter.c:52
ethernet_main_t ethernet_main
Definition: ethernet.h:241
vnet_main_t * vnet_get_main(void)
Definition: misc.c:45
#define static_always_inline
Definition: clib.h:85
u8 * format_ethernet_address(u8 *s, va_list *args)
Definition: format.c:44
#define foreach_l2_efp_filter_error
Definition: l2_efp_filter.c:73
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:111
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:187
u8 dst_address[6]
Definition: packet.h:53
static vlib_node_registration_t l2_efp_filter_node
(constructor) VLIB_REGISTER_NODE (l2_efp_filter_node)
Definition: l2_efp_filter.c:71
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static_always_inline void extract_keys(vnet_main_t *vnet_main, u32 sw_if_index0, vlib_buffer_t *b0, u32 *port_sw_if_index0, u16 *first_ethertype0, u16 *outer_id0, u16 *inner_id0, u32 *match_flags0)
Extract fields from the packet that will be used in interface classification.
l2_efp_filter_error_t
Definition: l2_efp_filter.c:77
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:977
void l2output_intf_bitmap_enable(u32 sw_if_index, u32 feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
Definition: l2_output.c:666
clib_error_t * l2_efp_filter_init(vlib_main_t *vm)
u32 feat_next_node_index[32]
Definition: l2_output.h:68
vlib_error_main_t error_main
Definition: main.h:124
#define PREDICT_FALSE(x)
Definition: clib.h:97
void l2_efp_filter_configure(vnet_main_t *vnet_main, u32 sw_if_index, u32 enable)
Enable/disable the EFP Filter check on the subinterface.
vnet_main_t vnet_main
Definition: misc.c:42
#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
#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:130
#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:348
vnet_main_t * vnet_main
Definition: l2_efp_filter.c:37
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:118
u64 * counters
Definition: error.h:78
u16 n_vectors
Definition: node.h:344
static char * l2_efp_filter_error_strings[]
Definition: l2_efp_filter.c:85
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
Definition: feat_bitmap.h:43
static u32 eth_create_valid_subint_match_flags(u32 num_tags)
Definition: ethernet.h:148
#define clib_memcpy(a, b, c)
Definition: string.h:63
#define ARRAY_LEN(x)
Definition: clib.h:59
static void eth_vlan_table_lookups(ethernet_main_t *em, vnet_main_t *vnm, u32 port_sw_if_index0, u16 first_ethertype, u16 outer_id, u16 inner_id, vnet_hw_interface_t **hi, main_intf_t **main_intf, vlan_intf_t **vlan_intf, qinq_intf_t **qinq_intf)
Definition: ethernet.h:395
u16 cached_next_index
Definition: node.h:462
unsigned int u32
Definition: types.h:88
static u32 eth_identify_subint(vnet_hw_interface_t *hi, vlib_buffer_t *b0, u32 match_flags, main_intf_t *main_intf, vlan_intf_t *vlan_intf, qinq_intf_t *qinq_intf, u32 *new_sw_if_index, u8 *error0, u32 *is_l2)
Definition: ethernet.h:434
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
#define vnet_buffer(b)
Definition: buffer.h:335
u8 * format(u8 *s, char *fmt,...)
Definition: format.c:418
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:259
#define VLIB_BUFFER_IS_TRACED
Definition: buffer.h:93
vlib_main_t * vlib_main
Definition: l2_efp_filter.c:36
u64 uword
Definition: types.h:112
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace_funcs.h:55
Definition: defs.h:47
l2_output_next_nodes_st next_nodes
Definition: l2_efp_filter.c:33
unsigned short u16
Definition: types.h:57
static uword l2_efp_filter_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
unsigned char u8
Definition: types.h:56
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:251
static clib_error_t * int_l2_efp_filter(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface egress efp filter enable/disable.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:163
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
Definition: node.h:158
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:143
l2_efp_filter_main_t l2_efp_filter_main
Definition: l2_efp_filter.c:69
u8 data[0]
Packet data.
Definition: buffer.h:151
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
Definition: node_funcs.h:58
#define clib_error_return(e, args...)
Definition: error.h:111
struct _unformat_input_t unformat_input_t
static void l2_output_dispatch(vlib_main_t *vlib_main, vnet_main_t *vnet_main, vlib_node_runtime_t *node, u32 node_index, u32 *cached_sw_if_index, u32 *cached_next_index, l2_output_next_nodes_st *next_nodes, vlib_buffer_t *b0, u32 sw_if_index, u32 feature_bitmap, u32 *next0)
Determine the next L2 node based on the output feature bitmap.
Definition: l2_output.h:203
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:67
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:85
static void l2output_init_output_node_vec(u32 **output_node_index_vec)
Definition: l2_output.h:160
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:69