[ovs-dev] [of1.1 rollup 01/20] openflow-1.1.h: Fix OFPFW11_* definitions.

Simon Horman horms at verge.net.au
Wed Jun 13 00:35:14 UTC 2012


On Tue, Jun 12, 2012 at 12:32:05AM -0700, Ben Pfaff wrote:
> OFPFW_DL_SRC and OFPFW_DL_DST don't exist in OpenFlow 1.1.  Replace them
> by the correct enums.
> 
> Most of the change here is due to respacing since DL_VLAN_PCP is one
> character wider than any previous name.
> 
> This doesn't fix a real bug because these constants didn't have any users
> in the tree.

Follow-up patch for Open Flow 1.2:

From: Simon Horman <horms at verge.net.au>

openflow-1.2.h Add OFPFW12_* definitions.

OFPFW_NW_SRC_ALL and OFPFW_NW_DST_ALL differ between Open Flow 1.0 and 1.2,
otherwise enum ofp_flow_wildcards is the same for both Open Flow versions.

Open Flow 1.1 is different again and is dealt with separately.

Signed-off-by: Simon Horman <horms at verge.net.au>
---
 include/openflow/openflow-1.2.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/include/openflow/openflow-1.2.h b/include/openflow/openflow-1.2.h
index bb55881..ec0a308 100644
--- a/include/openflow/openflow-1.2.h
+++ b/include/openflow/openflow-1.2.h
@@ -55,6 +55,38 @@
 
 #include "openflow/openflow-1.1.h"
 
+/* This is subtly different to enum ofp_flow_wildcards */
+enum ofp12_flow_wildcards {
+    OFPFW12_IN_PORT  = 1 << 0,  /* Switch input port. */
+    OFPFW12_DL_VLAN  = 1 << 1,  /* VLAN. */
+    OFPFW12_DL_SRC   = 1 << 2,  /* Ethernet source address. */
+    OFPFW12_DL_DST   = 1 << 3,  /* Ethernet destination address. */
+    OFPFW12_DL_TYPE  = 1 << 4,  /* Ethernet frame type. */
+    OFPFW12_NW_PROTO = 1 << 5,  /* IP protocol. */
+    OFPFW12_TP_SRC   = 1 << 6,  /* TCP/UDP source port. */
+    OFPFW12_TP_DST   = 1 << 7,  /* TCP/UDP destination port. */
+
+    /* IP source address wildcard bit count.  0 is exact match, 1 ignores the
+     * LSB, 2 ignores the 2 least-significant bits, ..., 32 and higher wildcard
+     * the entire field.  This is the *opposite* of the usual convention where
+     * e.g. /24 indicates that 8 bits (not 24 bits) are wildcarded. */
+    OFPFW12_NW_SRC_SHIFT = 8,
+    OFPFW12_NW_SRC_BITS = 6,
+    OFPFW12_NW_SRC_MASK = ((1 << OFPFW12_NW_SRC_BITS) - 1) <<
+                            OFPFW12_NW_SRC_SHIFT,
+    OFPFW12_NW_SRC_ALL = 32 << OFPFW12_NW_SRC_SHIFT,
+
+    /* IP destination address wildcard bit count.  Same format as source. */
+    OFPFW12_NW_DST_SHIFT = 14,
+    OFPFW12_NW_DST_BITS = 6,
+    OFPFW12_NW_DST_MASK = ((1 << OFPFW12_NW_DST_BITS) - 1) <<
+                            OFPFW12_NW_DST_SHIFT,
+    OFPFW12_NW_DST_ALL = 32 << OFPFW12_NW_DST_SHIFT,
+
+    /* Wildcard all fields. */
+    OFPFW12_ALL = ((1 << 20) - 1)
+};
+
 /* OpenFlow 1.2 specific message types, in addition to the common message
  * types. */
 enum ofp12_type {
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list