X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fflow.c;h=6129703a2025314d1c644ecd5598c2b59981d6ac;hb=cc34bc8c8611868474253b8fbd9e79cd66c60c94;hp=984f5d9805be09da8c98463b71a2bffb5e739aa9;hpb=fb0451d9bfbfb1d2803423c4491fe2d4da4cdc3a;p=openvswitch diff --git a/lib/flow.c b/lib/flow.c index 984f5d98..6129703a 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -979,6 +979,17 @@ flow_set_dl_vlan(struct flow *flow, ovs_be16 vid) } } +/* Sets the VLAN VID that 'flow' matches to 'vid', which is interpreted as an + * OpenFlow 1.2 "vlan_vid" value, that is, the low 13 bits of 'vlan_tci' (VID + * plus CFI). */ +void +flow_set_vlan_vid(struct flow *flow, ovs_be16 vid) +{ + ovs_be16 mask = htons(VLAN_VID_MASK | VLAN_CFI); + flow->vlan_tci &= ~mask; + flow->vlan_tci |= vid & mask; +} + /* Sets the VLAN PCP that 'flow' matches to 'pcp', which should be in the * range 0...7. *