PCP depends on the presence of VID so it seems to make sense
to set the CFI bit as part of setting the VID rather than the PCP.

Signed-off-by: Simon Horman <ho...@verge.net.au>
---
 lib/classifier.c | 2 +-
 lib/flow.c       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/classifier.c b/lib/classifier.c
index b810f84..e74817e 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -260,7 +260,7 @@ void
 cls_rule_set_dl_vlan_pcp(struct cls_rule *rule, uint8_t dl_vlan_pcp)
 {
     flow_set_vlan_pcp(&rule->flow, dl_vlan_pcp);
-    rule->wc.vlan_tci_mask |= htons(VLAN_CFI | VLAN_PCP_MASK);
+    rule->wc.vlan_tci_mask |= htons(VLAN_PCP_MASK);
 }
 
 /* Modifies 'rule' so that it matches only packets with an outer tag of
diff --git a/lib/flow.c b/lib/flow.c
index 1e907d4..60b95ae 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -1057,10 +1057,10 @@ flow_hash_fields_valid(enum nx_hash_fields fields)
 void
 flow_set_vlan_vid(struct flow *flow, ovs_be16 vid)
 {
+    vid &= htons(VLAN_VID_MASK | VLAN_CFI);
     if (vid == htons(OFP_VLAN_NONE)) {
         flow->vlan_tci = htons(0);
     } else {
-        vid &= htons(VLAN_VID_MASK);
         flow->vlan_tci &= ~htons(VLAN_VID_MASK);
         flow->vlan_tci |= htons(VLAN_CFI) | vid;
     }
@@ -1078,7 +1078,7 @@ flow_set_vlan_pcp(struct flow *flow, uint8_t pcp)
 {
     pcp &= 0x07;
     flow->vlan_tci &= ~htons(VLAN_PCP_MASK);
-    flow->vlan_tci |= htons((pcp << VLAN_PCP_SHIFT) | VLAN_CFI);
+    flow->vlan_tci |= htons(pcp << VLAN_PCP_SHIFT);
 }
 
 /* Sets the VLAN tpid (outer tag) tpid that 'flow' matches. */
-- 
1.7.10.2.484.gcd07cc5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to