FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
l2_output.h
Go to the documentation of this file.
1 /*
2  * l2_output.h : layer 2 output packet 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 #ifndef included_vnet_l2_output_h
19 #define included_vnet_l2_output_h
20 
21 #include <vlib/vlib.h>
22 #include <vnet/vnet.h>
23 #include <vnet/l2/feat_bitmap.h>
24 #include <vnet/l2/l2_vtr.h>
25 
26 
27 /* The L2 output feature configuration, a per-interface struct */
28 typedef struct
29 {
30 
31  /*
32  * vlan tag rewrite for ingress and egress
33  * ingress vtr is located here because the same config data is used for
34  * the egress EFP filter check
35  */
40 
42 
43  /* split horizon group */
45 
46  /* flag for output vtr operation */
48 
50 
51 typedef struct
52 {
53  /*
54  * vector of output next node index, indexed by sw_if_index.
55  * used when all output features have been executed and the
56  * next nodes are the interface output nodes.
57  */
59 
60  /*
61  * array of next node index for each output feature, indexed
62  * by l2output_feat_t. Used to determine next feature node.
63  */
64  u32 l2_out_feat_next[32];
65 
66  /* config vector indexed by sw_if_index */
68 
69  /* Convenience variables */
73 
75 
77 
78 /* L2 output features */
79 
80 /* Mappings from feature ID to graph node name in reverse order */
81 #define foreach_l2output_feat \
82  _(OUTPUT, "interface-output") \
83  _(SPAN, "span-l2-output") \
84  _(GBP_POLICY_LPM, "gbp-policy-lpm") \
85  _(GBP_POLICY_PORT, "gbp-policy-port") \
86  _(GBP_POLICY_MAC, "gbp-policy-mac") \
87  _(CFM, "feature-bitmap-drop") \
88  _(QOS, "feature-bitmap-drop") \
89  _(ACL, "l2-output-acl") \
90  _(L2PT, "feature-bitmap-drop") \
91  _(EFP_FILTER, "l2-efp-filter") \
92  _(IPIW, "feature-bitmap-drop") \
93  _(STP_BLOCKED, "feature-bitmap-drop") \
94  _(LINESTATUS_DOWN, "feature-bitmap-drop") \
95  _(OUTPUT_CLASSIFY, "l2-output-classify") \
96  _(OUTPUT_FEAT_ARC, "l2-output-feat-arc") \
97  _(XCRW, "l2-xcrw")
98 
99 /* Feature bitmap positions */
100 typedef enum
101 {
102 #define _(sym,str) L2OUTPUT_FEAT_##sym##_BIT,
104 #undef _
107 
108 STATIC_ASSERT (L2OUTPUT_N_FEAT <= 32, "too many l2 output features");
109 
110 /* Feature bit masks */
111 typedef enum
112 {
114 #define _(sym,str) L2OUTPUT_FEAT_##sym = (1<<L2OUTPUT_FEAT_##sym##_BIT),
116 #undef _
118 
119 #define foreach_l2output_error \
120 _(L2OUTPUT, "L2 output packets") \
121 _(EFP_DROP, "L2 EFP filter pre-rewrite drops") \
122 _(VTR_DROP, "L2 output tag rewrite drops") \
123 _(SHG_DROP, "L2 split horizon drops") \
124 _(DROP, "L2 output drops") \
125 _(MAPPING_DROP, "L2 Output interface not valid")
126 
127 typedef enum
128 {
133 
134 typedef enum
135 {
136 #define _(sym,str) L2OUTPUT_ERROR_##sym,
138 #undef _
141 
142 /* Return an array of strings containing graph node names of each feature */
143 char **l2output_get_feat_names (void);
144 
145 /* arg0 - u32 feature_bitmap, arg1 - u32 verbose */
146 u8 *format_l2_output_features (u8 * s, va_list * args);
147 
148 /**
149  * The next set of functions is for use by output feature graph nodes.
150  * When the last bit has been cleared from the output feature bitmap,
151  * the next node is the output graph node for the TX sw_if_index.
152  * These functions help the feature nodes get that node index.
153  */
154 
155 /* Create a mapping to the output graph node for the given sw_if_index */
158  u32 sw_if_index);
159 
160 /** Get a pointer to the config for the given interface */
162 
163 /** Enable (or disable) the feature in the bitmap for the given interface */
165  l2output_feat_masks_t feature_bitmap,
166  u32 enable);
167 
168 #endif
169 
170 /*
171  * fd.io coding-style-patch-verification: ON
172  *
173  * Local Variables:
174  * eval: (c-set-style "gnu")
175  * End:
176  */
#define foreach_l2output_error
Definition: l2_output.h:119
char ** l2output_get_feat_names(void)
Definition: l2_output.c:39
l2output_next_t
Definition: l2_output.h:127
u32 * output_node_index_vec
Definition: l2_output.h:58
vlib_node_registration_t l2output_node
(constructor) VLIB_REGISTER_NODE (l2output_node)
Definition: l2_output.c:447
unsigned char u8
Definition: types.h:56
Per-interface vlan tag rewrite configuration There will be one instance of this struct for each sw_if...
Definition: l2_vtr.h:46
vl_api_interface_index_t sw_if_index
Definition: gre.api:59
ptr_config_t output_pbb_vtr
Definition: l2_output.h:39
unsigned int u32
Definition: types.h:88
void l2output_intf_bitmap_enable(u32 sw_if_index, l2output_feat_masks_t feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
Definition: l2_output.c:626
void l2output_create_output_node_mapping(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index)
The next set of functions is for use by output feature graph nodes.
Definition: l2_output.c:602
STATIC_ASSERT(L2OUTPUT_N_FEAT<=32, "too many l2 output features")
vtr_config_t input_vtr
Definition: l2_output.h:36
l2output_main_t l2output_main
Definition: l2_output.c:78
vnet_main_t vnet_main
Definition: misc.c:43
vlib_main_t * vlib_main
Definition: l2_output.h:70
#define foreach_l2output_feat
Definition: l2_output.h:81
vtr_config_t output_vtr
Definition: l2_output.h:37
l2output_feat_masks_t
Definition: l2_output.h:111
u8 * format_l2_output_features(u8 *s, va_list *args)
Definition: l2_output.c:45
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
Definition: main.c:2017
struct _vlib_node_registration vlib_node_registration_t
ptr_config_t input_pbb_vtr
Definition: l2_output.h:38
l2_output_config_t * l2output_intf_config(u32 sw_if_index)
Get a pointer to the config for the given interface.
Definition: l2_output.c:616
l2output_feat_t
Definition: l2_output.h:100
l2_output_config_t * configs
Definition: l2_output.h:67
l2output_error_t
Definition: l2_output.h:134
vnet_main_t * vnet_main
Definition: l2_output.h:71