summaryrefslogtreecommitdiffstats
path: root/src/vnet/adj/adj_dp.h
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2020-11-17 09:47:07 +0000
committerNeale Ranns <nranns@cisco.com>2020-12-08 16:38:19 +0000
commit5c544c8c3e084f7ccad041d168b6fff736b46cba (patch)
tree051585e200f2a2669535665aae8e53a2f37ad10e /src/vnet/adj/adj_dp.h
parent59b792ffb1d77309b0ab17e441fd14237adb74db (diff)
fib: Adjacency flag for midchain to perfom flow hash (on inner packet)
Type: feature Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Change-Id: I964afd9266645de5c87d49c58ce6b48c2c18f97f
Diffstat (limited to 'src/vnet/adj/adj_dp.h')
-rw-r--r--src/vnet/adj/adj_dp.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/vnet/adj/adj_dp.h b/src/vnet/adj/adj_dp.h
index 27c0581fcfb..aff1a2b1f43 100644
--- a/src/vnet/adj/adj_dp.h
+++ b/src/vnet/adj/adj_dp.h
@@ -18,6 +18,9 @@
#include <vnet/adj/adj.h>
#include <vnet/tunnel/tunnel_dp.h>
+#include <vnet/ip/ip4_inlines.h>
+#include <vnet/ip/ip6_inlines.h>
+#include <vnet/mpls/mpls_lookup.h>
static_always_inline void
adj_midchain_ipip44_fixup (vlib_main_t * vm,
@@ -54,13 +57,32 @@ adj_midchain_ipip44_fixup (vlib_main_t * vm,
static_always_inline void
adj_midchain_fixup (vlib_main_t *vm,
const ip_adjacency_t *adj,
- vlib_buffer_t * b)
+ vlib_buffer_t * b,
+ vnet_link_t lt)
{
- if (PREDICT_TRUE(adj->rewrite_header.flags & VNET_REWRITE_FIXUP_IP4_O_4))
+ if (PREDICT_TRUE(adj->rewrite_header.flags &
+ VNET_REWRITE_FIXUP_IP4_O_4))
adj_midchain_ipip44_fixup (vm, adj, b);
else if (adj->sub_type.midchain.fixup_func)
adj->sub_type.midchain.fixup_func
(vm, adj, b, adj->sub_type.midchain.fixup_data);
+
+ if (PREDICT_FALSE(adj->rewrite_header.flags &
+ VNET_REWRITE_FIXUP_FLOW_HASH))
+ {
+ if (VNET_LINK_IP4 == lt)
+ vnet_buffer (b)->ip.flow_hash =
+ ip4_compute_flow_hash (vlib_buffer_get_current (b) + adj->rewrite_header.data_bytes,
+ IP_FLOW_HASH_DEFAULT);
+ else if (VNET_LINK_IP6 == lt)
+ vnet_buffer (b)->ip.flow_hash =
+ ip6_compute_flow_hash (vlib_buffer_get_current (b) + adj->rewrite_header.data_bytes,
+ IP_FLOW_HASH_DEFAULT);
+ else if (VNET_LINK_MPLS == lt)
+ vnet_buffer (b)->ip.flow_hash =
+ mpls_compute_flow_hash (vlib_buffer_get_current (b) + adj->rewrite_header.data_bytes,
+ IP_FLOW_HASH_DEFAULT);
+ }
}
#endif