ip: Router ID included in flow hash
[vpp.git] / src / vnet / mpls / mpls_lookup.h
index 28c9124..81c67ce 100644 (file)
 
 #include <vnet/mpls/mpls.h>
 #include <vnet/ip/ip.h>
+#include <vnet/bier/bier_fwd.h>
+#include <vnet/ip/ip4_inlines.h>
+#include <vnet/ip/ip6_inlines.h>
 
 /**
  * The arc/edge from the MPLS lookup node to the MPLS replicate node
  */
-u32 mpls_lookup_to_replicate_edge;
+extern u32 mpls_lookup_to_replicate_edge;
+
+/**
+ * Enum of statically configred MPLS lookup next nodes
+ */
+typedef enum mpls_lookup_next_t_
+{
+    MPLS_LOOKUP_NEXT_DROP = 0,
+} mpls_lookup_next_t;
 
 /*
  * Compute flow hash. 
@@ -42,6 +53,7 @@ mpls_compute_flow_hash (const mpls_unicast_header_t * hdr,
 
     ho_label = clib_net_to_host_u32(hdr->label_exp_s_ttl);
     hash = vnet_mpls_uc_get_label(ho_label);
+    hash ^= ip_flow_hash_router_id;
     next_label_is_entropy = 0;
 
     while (MPLS_EOS != vnet_mpls_uc_get_s(ho_label))
@@ -92,6 +104,10 @@ mpls_compute_flow_hash (const mpls_unicast_header_t * hdr,
         hash ^= ip6_compute_flow_hash ((const ip6_header_t *)hdr,
                                        IP_FLOW_HASH_DEFAULT);
         break;
+    case 5:
+        /* incorporate the bier flow-hash */
+        hash ^= bier_compute_flow_hash ((const bier_hdr_t *)hdr);
+        break;
     default:
         break;
     }