2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

meta-flow: Use OXM-defined constant for TCP flags in OpenFlow 1.5.

This also adds the definitions of a few other OXM headers we didn't have
yet.

EXT-109.
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2014-05-14 10:33:35 -07:00
parent 9d84066c6d
commit 52ca734e82
3 changed files with 38 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2011, 2012, 2013 The Board of Trustees of The Leland Stanford
/* Copyright (c) 2008, 2011, 2012, 2013, 2014 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
@@ -117,7 +117,15 @@ enum oxm12_ofb_match_fields {
OFPXMT13_OFB_TUNNEL_ID, /* Logical Port Metadata */
OFPXMT13_OFB_IPV6_EXTHDR, /* IPv6 Extension Header pseudo-field */
#define OFPXMT13_MASK ((1ULL << (OFPXMT13_OFB_IPV6_EXTHDR + 1)) - 1)
};
/* Following added in OpenFlow 1.4. */
OFPXMT14_OFB_PBB_UCA = 41, /* PBB UCA header field. */
#define OFPXMT14_MASK (1ULL << OFPXMT14_OFB_PBB_UCA)
/* Following added in OpenFlow 1.5. */
OFPXMT15_OFB_TCP_FLAGS = 42, /* TCP flags. */
#define OFPXMT15_MASK (1ULL << OFPXMT15_OFB_TCP_FLAGS)
};
/* OXM implementation makes use of NXM as they are the same format
* with different field definitions
@@ -185,6 +193,9 @@ enum oxm12_ofb_match_fields {
#define OXM_OF_TUNNEL_ID_W OXM_HEADER_W (OFPXMT13_OFB_TUNNEL_ID, 8)
#define OXM_OF_IPV6_EXTHDR OXM_HEADER (OFPXMT13_OFB_IPV6_EXTHDR, 2)
#define OXM_OF_IPV6_EXTHDR_W OXM_HEADER_W (OFPXMT13_OFB_IPV6_EXTHDR, 2)
#define OXM_OF_PBB_UCA OXM_HEADER (OFPXMT14_OFB_PBB_UCA, 1)
#define OXM_OF_TCP_FLAGS OXM_HEADER (OFPXMT15_OFB_TCP_FLAGS, 2)
#define OXM_OF_TCP_FLAGS_W OXM_HEADER_W (OFPXMT15_OFB_TCP_FLAGS, 2)
/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
* special conditions.

View File

@@ -637,7 +637,7 @@ const struct mf_field mf_fields[MFF_N_IDS] = {
MFP_TCP,
false,
NXM_NX_TCP_FLAGS, "NXM_NX_TCP_FLAGS",
NXM_NX_TCP_FLAGS, "NXM_NX_TCP_FLAGS", 0,
OXM_OF_TCP_FLAGS, "OXM_OF_TCP_FLAGS", OFP15_VERSION,
OFPUTIL_P_NXM_OXM_ANY,
OFPUTIL_P_NXM_OXM_ANY,
-1,

View File

@@ -2132,6 +2132,30 @@ OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
])
AT_CLEANUP
AT_SETUP([check TCP flags expression in OXM and NXM])
# NXM/OXM input for matching on TCP flags.
tcp_flags='OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_FLAGS(0fff)'
# Check that marshaling into NXM gives all NXM headers.
AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-nxm], [0],
[NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0fff)
])
# Check that marshaling in OXM for OF1.2 through OF1.4 gives OXM
# headers except for TCP flags, which didn't have an OXM definition until
# OF1.5.
for version in OpenFlow12 OpenFlow13 OpenFlow14; do
AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm $version], [0],
[OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0fff)
])
done
# OpenFlow 1.5 added an OXM header for TCP flags:
AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow15], [0],
[OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_FLAGS(0fff)
])
AT_CLEANUP
dnl Check all of the patterns mentioned in the "VLAN Matching" section
dnl in the DESIGN file at top level.
AT_SETUP([ovs-ofctl check-vlan])