From a4a2643672e4d2f68f8246e406749009a3f3211b Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Mon, 7 Feb 2011 11:07:14 +0900 Subject: [PATCH] datapath: Clear rxhash when using an action that may affect it Signed-off-by: Simon Horman [Jesse: Change version check from 2.6.37 to 2.6.35] Signed-off-by: Jesse Gross --- datapath/actions.c | 3 +++ datapath/actions.h | 7 +++++++ datapath/tunnel.c | 2 ++ 3 files changed, 12 insertions(+) diff --git a/datapath/actions.c b/datapath/actions.c index 89393771..c44e00c4 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -158,6 +158,8 @@ static struct sk_buff *set_nw_addr(struct sk_buff *skb, inet_proto_csum_replace4(check, skb, *nwaddr, new_nwaddr, 1); csum_replace4(&nh->check, *nwaddr, new_nwaddr); + skb_clear_rxhash(skb); + *nwaddr = new_nwaddr; return skb; @@ -217,6 +219,7 @@ static struct sk_buff *set_tp_port(struct sk_buff *skb, port = nla_type(a) == ODP_ACTION_ATTR_SET_TP_SRC ? &th->source : &th->dest; inet_proto_csum_replace2(check, skb, *port, nla_get_be16(a), 0); *port = nla_get_be16(a); + skb_clear_rxhash(skb); return skb; } diff --git a/datapath/actions.h b/datapath/actions.h index 5ad322f7..3348ae2c 100644 --- a/datapath/actions.h +++ b/datapath/actions.h @@ -20,4 +20,11 @@ int execute_actions(struct datapath *dp, struct sk_buff *skb, const struct sw_flow_key *, const struct nlattr *, u32 actions_len); +static inline void skb_clear_rxhash(struct sk_buff *skb) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) + skb->rxhash = 0; +#endif +} + #endif /* actions.h */ diff --git a/datapath/tunnel.c b/datapath/tunnel.c index 4cabd93c..a0d9fd95 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -436,6 +436,7 @@ void tnl_rcv(struct vport *vport, struct sk_buff *skb) skb_dst_drop(skb); nf_reset(skb); + skb_clear_rxhash(skb); secpath_reset(skb); ecn_decapsulate(skb); @@ -1203,6 +1204,7 @@ int tnl_send(struct vport *vport, struct sk_buff *skb) nf_reset(skb); secpath_reset(skb); skb_dst_drop(skb); + skb_clear_rxhash(skb); /* Offloading */ skb = handle_offloads(skb, mutable, rt); -- 2.30.2