FD.io VPP  v17.01.1-3-gc6833f8
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 /**
30  * @file
31  * @brief EFP-filter - Ethernet Flow Point Filter.
32  *
33  * It is possible to transmit a packet out a subinterface with VLAN tags
34  * that are not compatible with that subinterface. In other words, if that
35  * packet arrived on the output port, it would not be classified as coming
36  * from the output subinterface. This can happen in various ways: through
37  * misconfiguration, by putting subinterfaces with different VLAN encaps in
38  * the same bridge-domain, etc. The EFP Filter Check detects such packets
39  * and drops them. It consists of two checks, one that verifies the packet
40  * prior to output VLAN tag rewrite and one that verifies the packet after
41  * VLAN tag rewrite.
42  *
43  */
44 typedef struct
45 {
46 
47  /* Next nodes for features and output interfaces */
49 
50  /* convenience variables */
54 
55 
56 typedef struct
57 {
58  /* per-pkt trace data */
59  u8 src[6];
60  u8 dst[6];
61  u8 raw[12]; /* raw data (vlans) */
64 
65 /* packet trace format function */
66 static u8 *
67 format_l2_efp_filter_trace (u8 * s, va_list * args)
68 {
69  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
70  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
71  l2_efp_filter_trace_t *t = va_arg (*args, l2_efp_filter_trace_t *);
72 
73  s = format (s, "l2-output-vtr: sw_if_index %d dst %U src %U data "
74  "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
75  t->sw_if_index,
78  t->raw[0], t->raw[1], t->raw[2], t->raw[3], t->raw[4],
79  t->raw[5], t->raw[6], t->raw[7], t->raw[8], t->raw[9],
80  t->raw[10], t->raw[11]);
81  return s;
82 }
83 
85 
87 
88 #define foreach_l2_efp_filter_error \
89 _(L2_EFP_FILTER, "L2 EFP filter packets") \
90 _(DROP, "L2 EFP filter post-rewrite drops")
91 
92 typedef enum
93 {
94 #define _(sym,str) L2_EFP_FILTER_ERROR_##sym,
96 #undef _
99 
100 static char *l2_efp_filter_error_strings[] = {
101 #define _(sym,string) string,
103 #undef _
104 };
105 
106 typedef enum
107 {
111 
112 
113 /**
114  * Extract fields from the packet that will be used in interface
115  * classification.
116  */
119  u32 sw_if_index0,
120  vlib_buffer_t * b0,
121  u32 * port_sw_if_index0,
122  u16 * first_ethertype0,
123  u16 * outer_id0, u16 * inner_id0, u32 * match_flags0)
124 {
125  ethernet_header_t *e0;
127  u32 tag_len;
128  u32 tag_num;
129 
130  *port_sw_if_index0 =
131  vnet_get_sup_sw_interface (vnet_main, sw_if_index0)->sw_if_index;
132 
133  e0 = vlib_buffer_get_current (b0);
134  h0 = (ethernet_vlan_header_t *) (e0 + 1);
135 
136  *first_ethertype0 = clib_net_to_host_u16 (e0->type);
137  *outer_id0 = clib_net_to_host_u16 (h0[0].priority_cfi_and_id);
138  *inner_id0 = clib_net_to_host_u16 (h0[1].priority_cfi_and_id);
139 
140  tag_len = vnet_buffer (b0)->l2.l2_len - sizeof (ethernet_header_t);
141  tag_num = tag_len / sizeof (ethernet_vlan_header_t);
142  *match_flags0 = eth_create_valid_subint_match_flags (tag_num);
143 }
144 
145 /*
146  * EFP filtering is a basic switch feature which prevents an interface from
147  * transmitting a packet that doesn't match the interface's ingress match
148  * criteria. The check has two parts, one performed before egress vlan tag
149  * rewrite and one after.
150  *
151  * The pre-rewrite check insures the packet matches what an ingress packet looks
152  * like after going through the interface's ingress tag rewrite operation. Only
153  * pushed tags are compared. So:
154  * - if the ingress vlan tag rewrite pushes no tags (or is not enabled),
155  * any packet passes the filter
156  * - if the ingress vlan tag rewrite pushes one tag,
157  * the packet must have at least one tag, and the outer tag must match the pushed tag
158  * - if the ingress vlan tag rewrite pushes two tags,
159  * the packet must have at least two tags, and the outer two tags must match the pushed tags
160  *
161  * The pre-rewrite check is performed in the l2-output node.
162  *
163  * The post-rewrite check insures the packet matches what an ingress packet looks
164  * like before going through the interface's ingress tag rewrite operation. It verifies
165  * that such a packet arriving on the wire at this port would be classified as arriving
166  * an input interface equal to the packet's output interface. This can be done by running
167  * the output packet's vlan tags and output port through the interface classification,
168  * and checking if the resulting interface matches the output interface.
169  *
170  * The post-rewrite check is performed here.
171  */
172 
173 static uword
175  vlib_node_runtime_t * node, vlib_frame_t * frame)
176 {
177  u32 n_left_from, *from, *to_next;
178  l2_efp_filter_next_t next_index;
181  u32 node_counter_base_index = n->error_heap_index;
182  vlib_error_main_t *em = &vm->error_main;
183  u32 cached_sw_if_index = ~0;
184  u32 cached_next_index = ~0;
185 
186  /* invalidate cache to begin with */
187  cached_sw_if_index = ~0;
188 
189  from = vlib_frame_vector_args (frame);
190  n_left_from = frame->n_vectors; /* number of packets to process */
191  next_index = node->cached_next_index;
192 
193  while (n_left_from > 0)
194  {
195  u32 n_left_to_next;
196 
197  /* get space to enqueue frame to graph node "next_index" */
198  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
199 
200  while (n_left_from >= 6 && n_left_to_next >= 2)
201  {
202  u32 bi0, bi1;
203  vlib_buffer_t *b0, *b1;
204  u32 next0, next1;
205  u32 sw_if_index0, sw_if_index1;
206  u32 feature_bitmap0, feature_bitmap1;
207  u16 first_ethertype0, first_ethertype1;
208  u16 outer_id0, inner_id0, outer_id1, inner_id1;
209  u32 match_flags0, match_flags1;
210  u32 port_sw_if_index0, subint_sw_if_index0, port_sw_if_index1,
211  subint_sw_if_index1;
212  vnet_hw_interface_t *hi0, *hi1;
213  main_intf_t *main_intf0, *main_intf1;
214  vlan_intf_t *vlan_intf0, *vlan_intf1;
215  qinq_intf_t *qinq_intf0, *qinq_intf1;
216  u32 is_l20, is_l21;
217  __attribute__ ((unused)) u32 matched0, matched1;
218  u8 error0, error1;
219 
220  /* Prefetch next iteration. */
221  {
222  vlib_buffer_t *p2, *p3, *p4, *p5;
223  __attribute__ ((unused)) u32 sw_if_index2, sw_if_index3;
224 
225  p2 = vlib_get_buffer (vm, from[2]);
226  p3 = vlib_get_buffer (vm, from[3]);
227  p4 = vlib_get_buffer (vm, from[4]);
228  p5 = vlib_get_buffer (vm, from[5]);
229 
230  /* Prefetch the buffer header and packet for the N+2 loop iteration */
231  vlib_prefetch_buffer_header (p4, LOAD);
232  vlib_prefetch_buffer_header (p5, LOAD);
233 
236 
237  /*
238  * Prefetch the input config for the N+1 loop iteration
239  * This depends on the buffer header above
240  */
241  sw_if_index2 = vnet_buffer (p2)->sw_if_index[VLIB_TX];
242  sw_if_index3 = vnet_buffer (p3)->sw_if_index[VLIB_TX];
243  /*
244  * $$$ TODO
245  * CLIB_PREFETCH (vec_elt_at_index(l2output_main.configs, sw_if_index2), CLIB_CACHE_LINE_BYTES, LOAD);
246  * CLIB_PREFETCH (vec_elt_at_index(l2output_main.configs, sw_if_index3), CLIB_CACHE_LINE_BYTES, LOAD);
247  */
248  }
249 
250  /* speculatively enqueue b0 and b1 to the current next frame */
251  /* bi is "buffer index", b is pointer to the buffer */
252  to_next[0] = bi0 = from[0];
253  to_next[1] = bi1 = from[1];
254  from += 2;
255  to_next += 2;
256  n_left_from -= 2;
257  n_left_to_next -= 2;
258 
259  b0 = vlib_get_buffer (vm, bi0);
260  b1 = vlib_get_buffer (vm, bi1);
261 
262  /* TX interface handles */
263  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
264  sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
265 
266  /* process 2 packets */
267  em->counters[node_counter_base_index +
268  L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 2;
269 
270  /* Remove ourself from the feature bitmap */
271  feature_bitmap0 =
272  vnet_buffer (b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
273  feature_bitmap1 =
274  vnet_buffer (b1)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
275 
276  /* Determine next node */
278  msm->vnet_main,
279  node,
280  l2_efp_filter_node.index,
281  &cached_sw_if_index,
282  &cached_next_index,
283  &msm->next_nodes,
284  b0, sw_if_index0, feature_bitmap0, &next0);
286  msm->vnet_main,
287  node,
288  l2_efp_filter_node.index,
289  &cached_sw_if_index,
290  &cached_next_index,
291  &msm->next_nodes,
292  b1, sw_if_index1, feature_bitmap1, &next1);
293 
294  /* perform the efp filter check on two packets */
295 
296  extract_keys (msm->vnet_main,
297  sw_if_index0,
298  b0,
299  &port_sw_if_index0,
300  &first_ethertype0,
301  &outer_id0, &inner_id0, &match_flags0);
302 
303  extract_keys (msm->vnet_main,
304  sw_if_index1,
305  b1,
306  &port_sw_if_index1,
307  &first_ethertype1,
308  &outer_id1, &inner_id1, &match_flags1);
309 
311  msm->vnet_main,
312  port_sw_if_index0,
313  first_ethertype0,
314  outer_id0,
315  inner_id0,
316  &hi0,
317  &main_intf0, &vlan_intf0, &qinq_intf0);
318 
320  msm->vnet_main,
321  port_sw_if_index1,
322  first_ethertype1,
323  outer_id1,
324  inner_id1,
325  &hi1,
326  &main_intf1, &vlan_intf1, &qinq_intf1);
327 
328  matched0 = eth_identify_subint (hi0,
329  b0,
330  match_flags0,
331  main_intf0,
332  vlan_intf0,
333  qinq_intf0,
334  &subint_sw_if_index0,
335  &error0, &is_l20);
336 
337  matched1 = eth_identify_subint (hi1,
338  b1,
339  match_flags1,
340  main_intf1,
341  vlan_intf1,
342  qinq_intf1,
343  &subint_sw_if_index1,
344  &error1, &is_l21);
345 
346  if (PREDICT_FALSE (sw_if_index0 != subint_sw_if_index0))
347  {
348  /* Drop packet */
349  next0 = L2_EFP_FILTER_NEXT_DROP;
350  b0->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
351  }
352 
353  if (PREDICT_FALSE (sw_if_index1 != subint_sw_if_index1))
354  {
355  /* Drop packet */
356  next1 = L2_EFP_FILTER_NEXT_DROP;
357  b1->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
358  }
359 
360  if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
361  {
362  if (b0->flags & VLIB_BUFFER_IS_TRACED)
363  {
366  vlib_add_trace (vm, node, b0, sizeof (*t));
367  t->sw_if_index = sw_if_index0;
368  clib_memcpy (t->src, h0->src_address, 6);
369  clib_memcpy (t->dst, h0->dst_address, 6);
370  clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
371  }
372  if (b1->flags & VLIB_BUFFER_IS_TRACED)
373  {
376  vlib_add_trace (vm, node, b1, sizeof (*t));
377  t->sw_if_index = sw_if_index1;
378  clib_memcpy (t->src, h1->src_address, 6);
379  clib_memcpy (t->dst, h1->dst_address, 6);
380  clib_memcpy (t->raw, &h1->type, sizeof (t->raw));
381  }
382  }
383 
384  /* verify speculative enqueues, maybe switch current next frame */
385  /* if next0==next1==next_index then nothing special needs to be done */
386  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
387  to_next, n_left_to_next,
388  bi0, bi1, next0, next1);
389  }
390 
391  while (n_left_from > 0 && n_left_to_next > 0)
392  {
393  u32 bi0;
394  vlib_buffer_t *b0;
395  u32 next0;
396  u32 sw_if_index0;
397  u32 feature_bitmap0;
398  u16 first_ethertype0;
399  u16 outer_id0, inner_id0;
400  u32 match_flags0;
401  u32 port_sw_if_index0, subint_sw_if_index0;
402  vnet_hw_interface_t *hi0;
403  main_intf_t *main_intf0;
404  vlan_intf_t *vlan_intf0;
405  qinq_intf_t *qinq_intf0;
406  u32 is_l20;
407  __attribute__ ((unused)) u32 matched0;
408  u8 error0;
409 
410  /* speculatively enqueue b0 to the current next frame */
411  bi0 = from[0];
412  to_next[0] = bi0;
413  from += 1;
414  to_next += 1;
415  n_left_from -= 1;
416  n_left_to_next -= 1;
417 
418  b0 = vlib_get_buffer (vm, bi0);
419  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
420 
421  /* process 1 packet */
422  em->counters[node_counter_base_index +
423  L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 1;
424 
425  /* Remove ourself from the feature bitmap */
426  feature_bitmap0 =
427  vnet_buffer (b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
428 
429  /* Determine next node */
431  msm->vnet_main,
432  node,
433  l2_efp_filter_node.index,
434  &cached_sw_if_index,
435  &cached_next_index,
436  &msm->next_nodes,
437  b0, sw_if_index0, feature_bitmap0, &next0);
438 
439  /* perform the efp filter check on one packet */
440 
441  extract_keys (msm->vnet_main,
442  sw_if_index0,
443  b0,
444  &port_sw_if_index0,
445  &first_ethertype0,
446  &outer_id0, &inner_id0, &match_flags0);
447 
449  msm->vnet_main,
450  port_sw_if_index0,
451  first_ethertype0,
452  outer_id0,
453  inner_id0,
454  &hi0,
455  &main_intf0, &vlan_intf0, &qinq_intf0);
456 
457  matched0 = eth_identify_subint (hi0,
458  b0,
459  match_flags0,
460  main_intf0,
461  vlan_intf0,
462  qinq_intf0,
463  &subint_sw_if_index0,
464  &error0, &is_l20);
465 
466  if (PREDICT_FALSE (sw_if_index0 != subint_sw_if_index0))
467  {
468  /* Drop packet */
469  next0 = L2_EFP_FILTER_NEXT_DROP;
470  b0->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
471  }
472 
474  && (b0->flags & VLIB_BUFFER_IS_TRACED)))
475  {
478  vlib_add_trace (vm, node, b0, sizeof (*t));
479  t->sw_if_index = sw_if_index0;
480  clib_memcpy (t->src, h0->src_address, 6);
481  clib_memcpy (t->dst, h0->dst_address, 6);
482  clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
483  }
484 
485  /* verify speculative enqueue, maybe switch current next frame */
486  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
487  to_next, n_left_to_next,
488  bi0, next0);
489  }
490 
491  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
492  }
493 
494  return frame->n_vectors;
495 }
496 
497 
498 /* *INDENT-OFF* */
500  .function = l2_efp_filter_node_fn,
501  .name = "l2-efp-filter",
502  .vector_size = sizeof (u32),
503  .format_trace = format_l2_efp_filter_trace,
505 
507  .error_strings = l2_efp_filter_error_strings,
508 
509  .n_next_nodes = L2_EFP_FILTER_N_NEXT,
510 
511  /* edit / add dispositions here */
512  .next_nodes = {
513  [L2_EFP_FILTER_NEXT_DROP] = "error-drop",
514  },
515 };
516 /* *INDENT-ON* */
517 
520 {
522 
523  mp->vlib_main = vm;
524  mp->vnet_main = vnet_get_main ();
525 
526  /* Initialize the feature next-node indexes */
528  l2_efp_filter_node.index,
532 
533  /* Initialize the output node mapping table */
535 
536  return 0;
537 }
538 
540 
541 
542 /** Enable/disable the EFP Filter check on the subinterface. */
543 void
545 {
546  /* set the interface flag */
547  l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_EFP_FILTER, enable);
548 }
549 
550 
551 /**
552  * Set subinterface egress efp filter enable/disable.
553  * The CLI format is:
554  * set interface l2 efp-filter <interface> [disable]]
555  */
556 static clib_error_t *
558  unformat_input_t * input, vlib_cli_command_t * cmd)
559 {
560  vnet_main_t *vnm = vnet_get_main ();
561  clib_error_t *error = 0;
562  u32 sw_if_index;
563  u32 enable;
564 
565  if (!unformat_user (input, unformat_vnet_sw_interface, vnm, &sw_if_index))
566  {
567  error = clib_error_return (0, "unknown interface `%U'",
568  format_unformat_error, input);
569  goto done;
570  }
571 
572  enable = 1;
573  if (unformat (input, "disable"))
574  {
575  enable = 0;
576  }
577 
578  /* enable/disable the feature */
579  l2_efp_filter_configure (vnm, sw_if_index, enable);
580 
581 done:
582  return error;
583 }
584 
585 
586 /*?
587  * EFP filtering is a basic switch feature which prevents an interface from
588  * transmitting a packet that doesn't match the interface's ingress match
589  * criteria. The check has two parts, one performed before egress vlan tag
590  * rewrite and one after. This command enables or disables the EFP filtering
591  * for a given sub-interface.
592  *
593  * @cliexpar
594  * Example of how to enable a Layer 2 efp-filter on a sub-interface:
595  * @cliexcmd{set interface l2 efp-filter GigabitEthernet0/8/0.200}
596  * Example of how to disable a Layer 2 efp-filter on a sub-interface:
597  * @cliexcmd{set interface l2 efp-filter GigabitEthernet0/8/0.200 disable}
598 ?*/
599 /* *INDENT-OFF* */
600 VLIB_CLI_COMMAND (int_l2_efp_filter_cli, static) = {
601  .path = "set interface l2 efp-filter",
602  .short_help = "set interface l2 efp-filter <interface> [disable]",
603  .function = int_l2_efp_filter,
604 };
605 /* *INDENT-ON* */
606 
607 
608 /*
609  * fd.io coding-style-patch-verification: ON
610  *
611  * Local Variables:
612  * eval: (c-set-style "gnu")
613  * End:
614  */
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:459
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
struct _vlib_node_registration vlib_node_registration_t
unformat_function_t unformat_vnet_sw_interface
vlib_error_t * errors
Definition: node.h:419
static u8 * format_l2_efp_filter_trace(u8 *s, va_list *args)
Definition: l2_efp_filter.c:67
ethernet_main_t ethernet_main
Definition: ethernet.h:270
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
#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:88
#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:194
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:86
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:92
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:684
clib_error_t * l2_efp_filter_init(vlib_main_t *vm)
u32 feat_next_node_index[32]
Definition: l2_output.h:73
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:43
#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:216
#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:350
vnet_main_t * vnet_main
Definition: l2_efp_filter.c:52
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:121
u64 * counters
Definition: error.h:78
u16 n_vectors
Definition: node.h:344
static char * l2_efp_filter_error_strings[]
#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:176
#define clib_memcpy(a, b, c)
Definition: string.h:69
#define ARRAY_LEN(x)
Definition: clib.h:59
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:154
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:423
u16 cached_next_index
Definition: node.h:463
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:462
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
#define vnet_buffer(b)
Definition: buffer.h:361
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:259
#define VLIB_BUFFER_IS_TRACED
Definition: buffer.h:95
vlib_main_t * vlib_main
Definition: l2_efp_filter.c:51
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:48
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)
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:253
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:170
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
Definition: node.h:158
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:143
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:418
l2_efp_filter_main_t l2_efp_filter_main
Definition: l2_efp_filter.c:84
u8 data[0]
Packet data.
Definition: buffer.h:158
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:211
#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:168
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:57