SPAN:add l2 mirror
[vpp.git] / src / vnet / l2 / l2_input.h
index 262f75c..e6b3bc7 100644 (file)
@@ -53,9 +53,6 @@ typedef struct
   /* split horizon group */
   u8 shg;
 
-  /* sequence number for interface based flush of MACs */
-  u8 seq_num;
-
 } l2_input_config_t;
 
 
@@ -89,12 +86,23 @@ l2input_bd_config_from_index (l2input_main_t * l2im, u32 bd_index)
   return bd_is_valid (bd_config) ? bd_config : NULL;
 }
 
+static_always_inline l2_bridge_domain_t *
+l2input_bd_config (u32 bd_index)
+{
+  l2input_main_t *mp = &l2input_main;
+  l2_bridge_domain_t *bd_config;
+
+  vec_validate (mp->bd_configs, bd_index);
+  bd_config = vec_elt_at_index (mp->bd_configs, bd_index);
+  return bd_config;
+}
+
 /* L2 input indication packet is from BVI, using -2 */
 #define L2INPUT_BVI ((u32) (~0-1))
 
 /* L2 input features */
 
-/* Mappings from feature ID to graph node name */
+/* Mappings from feature ID to graph node name in reverse order */
 #define foreach_l2input_feat                    \
  _(DROP,          "feature-bitmap-drop")        \
  _(XCONNECT,      "l2-output")                  \
@@ -108,7 +116,8 @@ l2input_bd_config_from_index (l2input_main_t * l2im, u32 bd_index)
  _(VPATH,         "vpath-input-l2")             \
  _(ACL,           "l2-input-acl")               \
  _(POLICER_CLAS,  "l2-policer-classify")       \
- _(INPUT_CLASSIFY, "l2-input-classify")
+ _(INPUT_CLASSIFY, "l2-input-classify")         \
+ _(SPAN,          "span-l2-input")
 
 /* Feature bitmap positions */
 typedef enum
@@ -116,17 +125,26 @@ typedef enum
 #define _(sym,str) L2INPUT_FEAT_##sym##_BIT,
   foreach_l2input_feat
 #undef _
-    L2INPUT_N_FEAT,
+  L2INPUT_N_FEAT
 } l2input_feat_t;
 
+STATIC_ASSERT (L2INPUT_N_FEAT <= 32, "too many l2 input features");
+
 /* Feature bit masks */
 typedef enum
 {
 #define _(sym,str) L2INPUT_FEAT_##sym = (1<<L2INPUT_FEAT_##sym##_BIT),
   foreach_l2input_feat
 #undef _
+    L2INPUT_VALID_MASK =
+#define _(sym,str) L2INPUT_FEAT_##sym |
+    foreach_l2input_feat
+#undef _
+  0
 } l2input_feat_masks_t;
 
+STATIC_ASSERT ((u64) L2INPUT_VALID_MASK == (1ull << L2INPUT_N_FEAT) - 1, "");
+
 /** Return an array of strings containing graph node names of each feature */
 char **l2input_get_feat_names (void);