ip: add support for buffer offload metadata in ip midchain
[vpp.git] / src / vnet / adj / adj.h
index a531227..860193c 100644 (file)
@@ -164,14 +164,6 @@ typedef enum adj_attr_t_
      */
     ADJ_ATTR_SYNC_WALK_ACTIVE = 0,
 
-    /**
-     * Packets TX through the midchain do not increment the interface
-     * counters. This should be used when the adj is associated with an L2
-     * interface and that L2 interface is in a bridge domain. In that case
-     * the packet will have traversed the interface's TX node, and hence have
-     * been counted, before it traverses ths midchain
-     */
-    ADJ_ATTR_MIDCHAIN_NO_COUNT,
     /**
      * When stacking midchains on a fib-entry extract the choice from the
      * load-balance returned based on an IP hash of the adj's rewrite
@@ -185,19 +177,25 @@ typedef enum adj_attr_t_
      * the fixup function is standard IP4o4 header
      */
     ADJ_ATTR_MIDCHAIN_FIXUP_IP4O4_HDR,
+    /**
+     * the fixup function performs the flow hash
+     * this means the flow hash is performed on the inner
+     * header, where the entropy is higher.
+     */
+    ADJ_ATTR_MIDCHAIN_FIXUP_FLOW_HASH,
 }  adj_attr_t;
 
 #define ADJ_ATTR_NAMES {                                        \
     [ADJ_ATTR_SYNC_WALK_ACTIVE] = "walk-active",                \
-    [ADJ_ATTR_MIDCHAIN_NO_COUNT] = "midchain-no-count",         \
     [ADJ_ATTR_MIDCHAIN_IP_STACK] = "midchain-ip-stack",         \
     [ADJ_ATTR_MIDCHAIN_LOOPED] = "midchain-looped",             \
     [ADJ_ATTR_MIDCHAIN_FIXUP_IP4O4_HDR] = "midchain-ip4o4-hdr-fixup",   \
+    [ADJ_ATTR_MIDCHAIN_FIXUP_FLOW_HASH] = "midchain-flow-hash",   \
 }
 
 #define FOR_EACH_ADJ_ATTR(_attr)                        \
     for (_attr = ADJ_ATTR_SYNC_WALK_ACTIVE;             \
-        _attr <= ADJ_ATTR_MIDCHAIN_FIXUP_IP4O4_HDR;    \
+        _attr <= ADJ_ATTR_MIDCHAIN_FIXUP_FLOW_HASH;    \
         _attr++)
 
 /**
@@ -207,10 +205,10 @@ typedef enum adj_flags_t_
 {
     ADJ_FLAG_NONE = 0,
     ADJ_FLAG_SYNC_WALK_ACTIVE = (1 << ADJ_ATTR_SYNC_WALK_ACTIVE),
-    ADJ_FLAG_MIDCHAIN_NO_COUNT = (1 << ADJ_ATTR_MIDCHAIN_NO_COUNT),
     ADJ_FLAG_MIDCHAIN_IP_STACK = (1 << ADJ_ATTR_MIDCHAIN_IP_STACK),
     ADJ_FLAG_MIDCHAIN_LOOPED = (1 << ADJ_ATTR_MIDCHAIN_LOOPED),
     ADJ_FLAG_MIDCHAIN_FIXUP_IP4O4_HDR = (1 << ADJ_ATTR_MIDCHAIN_FIXUP_IP4O4_HDR),
+    ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH = (1 << ADJ_ATTR_MIDCHAIN_FIXUP_FLOW_HASH),
 }  __attribute__ ((packed)) adj_flags_t;
 
 /**
@@ -297,7 +295,7 @@ typedef struct ip_adjacency_t_
      */
     struct
     {
-      ip46_address_t receive_addr;
+      fib_prefix_t rx_pfx;
     } glean;
   } sub_type;
 
@@ -365,6 +363,9 @@ STATIC_ASSERT ((STRUCT_OFFSET_OF (ip_adjacency_t, cacheline3) ==
 /* An adj fits into 4 cachelines on your average machine */
 STATIC_ASSERT_SIZEOF (ip_adjacency_t, 4 * 64);
 #endif
+STATIC_ASSERT ((STRUCT_OFFSET_OF (ip_adjacency_t, sub_type.nbr.next_hop) ==
+                STRUCT_OFFSET_OF (ip_adjacency_t, sub_type.midchain.next_hop)),
+              "IP adjacency nbr and midchain offsets don't match");
 
 /**
  * @brief