summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ofproto/ofproto-dpif-xlate.c9
-rw-r--r--ofproto/ofproto-dpif-xlate.h2
-rw-r--r--ofproto/ofproto-dpif.c3
-rw-r--r--ofproto/ofproto.h10
-rw-r--r--tests/ofproto-dpif.at6
-rw-r--r--vswitchd/bridge.c8
-rw-r--r--vswitchd/vswitch.xml5
7 files changed, 29 insertions, 14 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 5cee37f7b..edcac0870 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -149,7 +149,8 @@ struct xbundle {
* NULL if all VLANs are trunked. */
unsigned long *cvlans; /* Bitmap of allowed customer vlans,
* NULL if all VLANs are allowed */
- bool use_priority_tags; /* Use 802.1p tag for frames in VLAN 0? */
+ enum port_priority_tags_mode use_priority_tags;
+ /* Use 802.1p tag for frames in VLAN 0? */
bool floodable; /* No port has OFPUTIL_PC_NO_FLOOD set? */
bool protected; /* Protected port mode */
};
@@ -604,7 +605,7 @@ static void xlate_xbundle_set(struct xbundle *xbundle,
enum port_vlan_mode vlan_mode,
uint16_t qinq_ethtype, int vlan,
unsigned long *trunks, unsigned long *cvlans,
- bool use_priority_tags,
+ enum port_priority_tags_mode,
const struct bond *bond, const struct lacp *lacp,
bool floodable, bool protected);
static void xlate_xport_set(struct xport *xport, odp_port_t odp_port,
@@ -999,7 +1000,7 @@ static void
xlate_xbundle_set(struct xbundle *xbundle,
enum port_vlan_mode vlan_mode, uint16_t qinq_ethtype,
int vlan, unsigned long *trunks, unsigned long *cvlans,
- bool use_priority_tags,
+ enum port_priority_tags_mode use_priority_tags,
const struct bond *bond, const struct lacp *lacp,
bool floodable, bool protected)
{
@@ -1316,7 +1317,7 @@ xlate_bundle_set(struct ofproto_dpif *ofproto, struct ofbundle *ofbundle,
const char *name, enum port_vlan_mode vlan_mode,
uint16_t qinq_ethtype, int vlan,
unsigned long *trunks, unsigned long *cvlans,
- bool use_priority_tags,
+ enum port_priority_tags_mode use_priority_tags,
const struct bond *bond, const struct lacp *lacp,
bool floodable, bool protected)
{
diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h
index 5a51d7b30..f97c7c0f4 100644
--- a/ofproto/ofproto-dpif-xlate.h
+++ b/ofproto/ofproto-dpif-xlate.h
@@ -181,7 +181,7 @@ void xlate_bundle_set(struct ofproto_dpif *, struct ofbundle *,
const char *name, enum port_vlan_mode,
uint16_t qinq_ethtype, int vlan,
unsigned long *trunks, unsigned long *cvlans,
- bool use_priority_tags,
+ enum port_priority_tags_mode,
const struct bond *, const struct lacp *,
bool floodable, bool protected);
void xlate_bundle_remove(struct ofbundle *);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index db461ac07..3db97ca37 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -101,7 +101,8 @@ struct ofbundle {
unsigned long *cvlans;
struct lacp *lacp; /* LACP if LACP is enabled, otherwise NULL. */
struct bond *bond; /* Nonnull iff more than one port. */
- bool use_priority_tags; /* Use 802.1p tag for frames in VLAN 0? */
+ enum port_priority_tags_mode use_priority_tags;
+ /* Use 802.1p tag for frames in VLAN 0? */
bool protected; /* Protected port mode */
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 510ace103..3081cb01f 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -416,6 +416,13 @@ enum port_vlan_mode {
PORT_VLAN_DOT1Q_TUNNEL
};
+/* The behaviour of the port regarding priority tags */
+enum port_priority_tags_mode {
+ PORT_PRIORITY_TAGS_NEVER = 0,
+ PORT_PRIORITY_TAGS_IF_NONZERO,
+};
+
+/* The behaviour of the port regarding priority tags */
/* Configuration of bundles. */
struct ofproto_bundle_settings {
char *name; /* For use in log messages. */
@@ -428,7 +435,8 @@ struct ofproto_bundle_settings {
int vlan; /* VLAN VID, except for PORT_VLAN_TRUNK. */
unsigned long *trunks; /* vlan_bitmap, except for PORT_VLAN_ACCESS. */
unsigned long *cvlans;
- bool use_priority_tags; /* Use 802.1p tag for frames in VLAN 0? */
+ enum port_priority_tags_mode use_priority_tags;
+ /* Use 802.1p tag for frames in VLAN 0? */
struct bond_settings *bond; /* Must be nonnull iff if n_slaves > 1. */
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 9b0231b88..9640d1cb9 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -3467,18 +3467,18 @@ OVS_VSWITCHD_START(
add-port br0 p1 trunks=10,12 -- \
add-port br0 p2 tag=10 -- \
add-port br0 p3 tag=12 \
- other-config:priority-tags=true -- \
+ other-config:priority-tags=if-nonzero -- \
add-port br0 p4 tag=12 -- \
add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
- other-config:priority-tags=true -- \
+ other-config:priority-tags=if-nonzero -- \
add-port br0 p9 vlan_mode=dot1q-tunnel tag=10 other-config:qinq-ethtype=802.1q -- \
add-port br0 p10 vlan_mode=dot1q-tunnel tag=10 cvlans=10,12 other-config:qinq-ethtype=802.1q -- \
add-port br0 p11 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q -- \
add-port br0 p12 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q \
- other-config:priority-tags=true -- \
+ other-config:priority-tags=if-nonzero -- \
set Interface p1 type=dummy -- \
set Interface p2 type=dummy -- \
set Interface p3 type=dummy -- \
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 48d8c4de1..02a33293e 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1023,8 +1023,12 @@ port_configure(struct port *port)
? ETH_TYPE_VLAN_8021Q
: ETH_TYPE_VLAN_8021AD);
- s.use_priority_tags = smap_get_bool(&cfg->other_config, "priority-tags",
- false);
+ const char *pt = smap_get_def(&cfg->other_config, "priority-tags", "");
+ if (!strcmp(pt, "if-nonzero") || !strcmp(pt, "true")) {
+ s.use_priority_tags = PORT_PRIORITY_TAGS_IF_NONZERO;
+ } else {
+ s.use_priority_tags = PORT_PRIORITY_TAGS_NEVER;
+ }
/* Get LACP settings. */
s.lacp = port_configure_lacp(port, &lacp_settings);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index de385cc7b..1613d3569 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1876,7 +1876,8 @@
</column>
<column name="other_config" key="priority-tags"
- type='{"type": "boolean"}'>
+ type='{"type": "string",
+ "enum": ["set", ["never", "if-nonzero"]]}'>
<p>
An 802.1Q header contains two important pieces of information: a VLAN
ID and a priority. A frame with a zero VLAN ID, called a
@@ -1889,7 +1890,7 @@
header at all, even when the VLAN ID is zero. Therefore, by default
Open vSwitch does not output priority-tagged frames, instead omitting
the 802.1Q header entirely if the VLAN ID is zero. Set this key to
- <code>true</code> to enable priority-tagged frames on a port.
+ <code>if-nonzero</code> to enable priority-tagged frames on a port.
</p>
<p>