[ovs-dev] [PATCH] [rfc] datapath: Clear rxhash when using an action that may affect it
Simon Horman
horms at verge.net.au
Sun Jan 30 21:14:11 UTC 2011
Signed-off-by: Simon Horman <horms at verge.net.au>
---
Several moons ago Jesse Gross mentioned that the rxhash ought
to be cleared when the datapath makes a modification that could
affect it. This patch is a first pass at making that change.
Compile tested only.
---
acinclude.m4 | 2 ++
datapath/actions.c | 11 +++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 6fc1c7a..4999d05 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -186,6 +186,8 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [
[OVS_DEFINE([HAVE_SKBUFF_HEADER_HELPERS])])
OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_warn_if_lro],
[OVS_DEFINE([HAVE_SKB_WARN_LRO])])
+ OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [rxhash],
+ [OVS_DEFINE([HAVE_RXHASH])])
OVS_GREP_IFELSE([$KSRC26/include/linux/string.h], [kmemdup], [],
[OVS_GREP_IFELSE([$KSRC26/include/linux/slab.h], [kmemdup])])
diff --git a/datapath/actions.c b/datapath/actions.c
index 3223c65..b8495aa 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -26,6 +26,13 @@
#include "openvswitch/datapath-protocol.h"
#include "vport.h"
+static void skb_clear_rxhash(struct sk_buff *skb)
+{
+#ifdef HAVE_RXHASH
+ skb->rxhash = 0;
+#endif
+}
+
static int do_execute_actions(struct datapath *, struct sk_buff *,
const struct sw_flow_key *,
const struct nlattr *actions, u32 actions_len);
@@ -250,6 +257,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;
@@ -309,6 +318,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;
}
@@ -413,6 +423,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
case ODP_ACTION_ATTR_SET_TUNNEL:
OVS_CB(skb)->tun_id = nla_get_be64(a);
+ skb_clear_rxhash(skb);
break;
case ODP_ACTION_ATTR_SET_DL_TCI:
--
1.7.2.3
More information about the dev
mailing list