[ovs-dev] [PATCH] datapath: Fix FLOW_BUFSIZE definition.

Jesse Gross jesse at nicira.com
Mon Sep 3 22:24:38 UTC 2012


This is analogous to the change made in userspace with
2508ac16defd417b94fb69689b6b1da4fbc76282 (odp-util: Update
ODPUTIL_FLOW_KEY_BYTES for current kernel flow format.).  The extra
space for vlan encapsulation was not included in the allocation for
maximum length flows.

Found by code inspection and to my knowledge has never been hit, likely
because skb allocations are padded out to a cacheline, making userspace
more susceptible to this problem than the kernel.  In theory, however,
the right combination of flow and packet size could result in a kernel
panic.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 datapath/flow.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/datapath/flow.h b/datapath/flow.h
index 5be481e..02c563a 100644
--- a/datapath/flow.h
+++ b/datapath/flow.h
@@ -152,15 +152,17 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies);
  *  OVS_KEY_ATTR_TUN_ID        8    --     4     12
  *  OVS_KEY_ATTR_IN_PORT       4    --     4      8
  *  OVS_KEY_ATTR_ETHERNET     12    --     4     16
+ *  OVS_KEY_ATTR_ETHERTYPE     2     2     4      8  (outer VLAN ethertype)
  *  OVS_KEY_ATTR_8021Q         4    --     4      8
- *  OVS_KEY_ATTR_ETHERTYPE     2     2     4      8
+ *  OVS_KEY_ATTR_ENCAP         0    --     4      4  (VLAN encapsulation)
+ *  OVS_KEY_ATTR_ETHERTYPE     2     2     4      8  (inner VLAN ethertype)
  *  OVS_KEY_ATTR_IPV6         40    --     4     44
  *  OVS_KEY_ATTR_ICMPV6        2     2     4      8
  *  OVS_KEY_ATTR_ND           28    --     4     32
  *  -------------------------------------------------
- *  total                                       144
+ *  total                                       156
  */
-#define FLOW_BUFSIZE 144
+#define FLOW_BUFSIZE 156
 
 int ovs_flow_to_nlattrs(const struct sw_flow_key *, struct sk_buff *);
 int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
-- 
1.7.9.5




More information about the dev mailing list