FIB2.0: Adjacency complete pull model (VPP-487)
[vpp.git] / vnet / vnet / fib / fib_types.h
index 232a230..2f23527 100644 (file)
@@ -73,21 +73,17 @@ typedef enum fib_protocol_t_ {
  * Link Type. This maps directly into the ethertype.
  */
 typedef enum fib_link_t_ {
-#if CLIB_DEBUG > 0
-    FIB_LINK_IP4 = 1,
-#else
-    FIB_LINK_IP4 = 0,
-#endif
-    FIB_LINK_IP6,
-    FIB_LINK_ETHERNET,
-    FIB_LINK_MPLS,
+    FIB_LINK_IP4 = VNET_LINK_IP4,
+    FIB_LINK_IP6 = VNET_LINK_IP6,
+    FIB_LINK_MPLS = VNET_LINK_MPLS,
+    FIB_LINK_ETHERNET = VNET_LINK_ETHERNET,
 }  __attribute__ ((packed)) fib_link_t;
 
 /**
  * Definition outside of enum so it does not need to be included in non-defaulted
  * switch statements
  */
-#define FIB_LINK_NUM (FIB_LINK_MPLS+1)
+#define FIB_LINK_NUM (FIB_LINK_ETHERNET+1)
 
 #define FIB_LINKS {                  \
     [FIB_LINK_ETHERNET] = "ethernet", \
@@ -117,10 +113,6 @@ fib_link_t fib_proto_to_link (fib_protocol_t proto);
  * sceanrios
  */
 typedef enum fib_forward_chain_type_t_ {
-    /**
-     * Contribute an object that is to be used to forward Ethernet packets
-     */
-    FIB_FORW_CHAIN_TYPE_ETHERNET,
     /**
      * Contribute an object that is to be used to forward IP4 packets
      */
@@ -141,20 +133,32 @@ typedef enum fib_forward_chain_type_t_ {
      * option is converted into one of the other three internally.
      */
     FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+    /**
+     * Contribute an object that is to be used to forward Ethernet packets.
+     * This is last in the list since it is not valid for many FIB objects,
+     * and thus their array of per-chain-type DPOs can be sized smaller.
+     */
+    FIB_FORW_CHAIN_TYPE_ETHERNET,
 }  __attribute__ ((packed)) fib_forward_chain_type_t;
 
 #define FIB_FORW_CHAINS {                                      \
-    [FIB_FORW_CHAIN_TYPE_ETHERNET]      = "ehternet",          \
+    [FIB_FORW_CHAIN_TYPE_ETHERNET]      = "ethernet",          \
     [FIB_FORW_CHAIN_TYPE_UNICAST_IP4]   = "unicast-ip4",       \
     [FIB_FORW_CHAIN_TYPE_UNICAST_IP6]   = "unicast-ip6",       \
     [FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS]  = "mpls-neos",         \
     [FIB_FORW_CHAIN_TYPE_MPLS_EOS]      = "mpls-eos",          \
 }
 
-#define FIB_FORW_CHAIN_NUM (FIB_FORW_CHAIN_TYPE_MPLS_EOS+1)
+#define FIB_FORW_CHAIN_NUM (FIB_FORW_CHAIN_TYPE_MPLS_ETHERNET+1)
+#define FIB_FORW_CHAIN_MPLS_NUM (FIB_FORW_CHAIN_TYPE_MPLS_EOS+1)
 
 #define FOR_EACH_FIB_FORW_CHAIN(_item)                   \
-    for (_item = FIB_FORW_CHAIN_TYPE_ETHERNET;           \
+    for (_item = FIB_FORW_CHAIN_TYPE_UNICAST_IP4;        \
+        _item <= FIB_FORW_CHAIN_TYPE_ETHERNET;           \
+        _item++)
+
+#define FOR_EACH_FIB_FORW_MPLS_CHAIN(_item)              \
+    for (_item = FIB_FORW_CHAIN_TYPE_UNICAST_IP4;        \
         _item <= FIB_FORW_CHAIN_TYPE_MPLS_EOS;           \
         _item++)