From: Simon Horman Date: Mon, 23 Jul 2012 02:36:44 +0000 (+0900) Subject: OXM: Add VLAN VID as a prerequisite for VLAN PCP X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8069b0da045f1b8a5879f5d2dfedcaa7e7c86578;p=openvswitch OXM: Add VLAN VID as a prerequisite for VLAN PCP Signed-off-by: Simon Horman Signed-off-by: Ben Pfaff --- diff --git a/lib/meta-flow.c b/lib/meta-flow.c index 101409a2..c50cfc53 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -188,7 +188,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", @@ -826,6 +826,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 28d43ebc..12a4baa2 100644 --- a/lib/meta-flow.h +++ b/lib/meta-flow.h @@ -156,6 +156,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 af364868..c9a349c5 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -1311,10 +1311,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) @@ -1494,10 +1496,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(0123) +nx_pull_match() returned error OFPBMC_BAD_PREREQ # IP ECN OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)