[ovs-dev] [PATCH 5/6] OXM: Add VLAN VID as a prerequsite for VLAN PCP

Simon Horman horms at verge.net.au
Thu Jul 5 08:27:31 UTC 2012


Signed-off-by: Simon Horman <horms at verge.net.au>
---
 lib/meta-flow.c    | 4 +++-
 lib/meta-flow.h    | 1 +
 tests/ovs-ofctl.at | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index b7f6fcc..b52db4d 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -170,7 +170,7 @@ static const struct mf_field mf_fields[MFF_N_IDS] = {
         1, 3,
         MFM_NONE, 0,
         MFS_DECIMAL,
-        MFP_NONE,
+        MFP_VLAN_VID,
         true,
         OXM_OF_VLAN_PCP, "OXM_OF_VLAN_PCP",
         OXM_OF_VLAN_PCP, "OXM_OF_VLAN_PCP",
@@ -789,6 +789,8 @@ mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow)
         return flow->dl_type == htons(ETH_TYPE_IP);
     case MFP_IPV6:
         return flow->dl_type == htons(ETH_TYPE_IPV6);
+    case MFP_VLAN_VID:
+        return flow->vlan_tci & htons(VLAN_CFI);
     case MFP_IP_ANY:
         return is_ip_any(flow);
 
diff --git a/lib/meta-flow.h b/lib/meta-flow.h
index 1fecc15..84540b1 100644
--- a/lib/meta-flow.h
+++ b/lib/meta-flow.h
@@ -154,6 +154,7 @@ enum mf_prereqs {
 
     /* L2 requirements. */
     MFP_ARP,
+    MFP_VLAN_VID,
     MFP_IPV4,
     MFP_IPV6,
     MFP_IP_ANY,
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 7ef2992..b438a08 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -1018,10 +1018,12 @@ OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012)
 # vlan
 OXM_OF_VLAN_VID(1009) OXM_OF_VLAN_VID(1009) # Duplicate Field
 OXM_OF_VLAN_VID(f009)           # Bad Value
+OXM_OF_VLAN_PCP(00)             # Bad Pre-Requisite
 OXM_OF_VLAN_VID(0000)           # Packets without 802.1Q header or with VID=0
 OXM_OF_VLAN_VID(1123)           # Packets with VID=123, any PCP
 OXM_OF_VLAN_VID(1123) OXM_OF_VLAN_PCP(01) # Packets with VID=123, PCP=1.
 OXM_OF_VLAN_VID(0123)           # Does not make sense (but supported anyway)
+OXM_OF_VLAN_VID(0123) OXM_OF_VLAN_PCP(01)  #Bad Pre-Requisite
 
 # IP ECN
 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03)
@@ -1162,10 +1164,12 @@ OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800)
 # vlan
 nx_pull_match() returned error OFPBMC_DUP_FIELD
 nx_pull_match() returned error OFPBMC_BAD_VALUE
+nx_pull_match() returned error OFPBMC_BAD_PREREQ
 OXM_OF_VLAN_VID(0000)
 OXM_OF_VLAN_VID(1123)
 OXM_OF_VLAN_VID(1123), OXM_OF_VLAN_PCP(01)
 OXM_OF_VLAN_VID(0000)
+nx_pull_match() returned error OFPBMC_BAD_PREREQ
 
 # IP ECN
 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list