mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 13:58:14 +00:00
ofproto-dpif-xlate: Add "always" mode to priority tags
Configure "if-nonzero" priority tags to retain the 802.1Q header when the VLAN ID is zero, except both the VLAN ID and priority are zero. Add a "always" configuration option to retain the 802.1Q header in such frames as well. Signed-off-by: Eli Britstein <elibr@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
2
NEWS
2
NEWS
@@ -21,6 +21,8 @@ Post-v2.11.0
|
|||||||
* New "ovs-appctl dpctl/ipf-get-status" command for userspace datapath
|
* New "ovs-appctl dpctl/ipf-get-status" command for userspace datapath
|
||||||
conntrack fragmentation support.
|
conntrack fragmentation support.
|
||||||
* New action "check_pkt_len".
|
* New action "check_pkt_len".
|
||||||
|
* Port configuration with "other-config:priority-tags" now has a mode
|
||||||
|
that retains the 802.1Q header even if VLAN and priority are both zero.
|
||||||
- OVSDB:
|
- OVSDB:
|
||||||
* OVSDB clients can now resynchronize with clustered servers much more
|
* OVSDB clients can now resynchronize with clustered servers much more
|
||||||
quickly after a brief disconnection, saving bandwidth and CPU time.
|
quickly after a brief disconnection, saving bandwidth and CPU time.
|
||||||
|
@@ -549,7 +549,8 @@ static void xvlan_copy(struct xvlan *dst, const struct xvlan *src);
|
|||||||
static void xvlan_pop(struct xvlan *src);
|
static void xvlan_pop(struct xvlan *src);
|
||||||
static void xvlan_push_uninit(struct xvlan *src);
|
static void xvlan_push_uninit(struct xvlan *src);
|
||||||
static void xvlan_extract(const struct flow *, struct xvlan *);
|
static void xvlan_extract(const struct flow *, struct xvlan *);
|
||||||
static void xvlan_put(struct flow *, const struct xvlan *);
|
static void xvlan_put(struct flow *, const struct xvlan *,
|
||||||
|
enum port_priority_tags_mode);
|
||||||
static void xvlan_input_translate(const struct xbundle *,
|
static void xvlan_input_translate(const struct xbundle *,
|
||||||
const struct xvlan *in,
|
const struct xvlan *in,
|
||||||
struct xvlan *xvlan);
|
struct xvlan *xvlan);
|
||||||
@@ -2270,13 +2271,15 @@ xvlan_extract(const struct flow *flow, struct xvlan *xvlan)
|
|||||||
|
|
||||||
/* Put VLAN information (headers) to flow */
|
/* Put VLAN information (headers) to flow */
|
||||||
static void
|
static void
|
||||||
xvlan_put(struct flow *flow, const struct xvlan *xvlan)
|
xvlan_put(struct flow *flow, const struct xvlan *xvlan,
|
||||||
|
enum port_priority_tags_mode use_priority_tags)
|
||||||
{
|
{
|
||||||
ovs_be16 tci;
|
ovs_be16 tci;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < FLOW_MAX_VLAN_HEADERS; i++) {
|
for (i = 0; i < FLOW_MAX_VLAN_HEADERS; i++) {
|
||||||
tci = htons(xvlan->v[i].vid | (xvlan->v[i].pcp & VLAN_PCP_MASK));
|
tci = htons(xvlan->v[i].vid | (xvlan->v[i].pcp & VLAN_PCP_MASK));
|
||||||
if (tci) {
|
if (tci || ((use_priority_tags == PORT_PRIORITY_TAGS_ALWAYS) &&
|
||||||
|
xvlan->v[i].tpid)) {
|
||||||
tci |= htons(VLAN_CFI);
|
tci |= htons(VLAN_CFI);
|
||||||
flow->vlans[i].tpid = xvlan->v[i].tpid ?
|
flow->vlans[i].tpid = xvlan->v[i].tpid ?
|
||||||
htons(xvlan->v[i].tpid) :
|
htons(xvlan->v[i].tpid) :
|
||||||
@@ -2450,7 +2453,7 @@ output_normal(struct xlate_ctx *ctx, const struct xbundle *out_xbundle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&old_vlans, &ctx->xin->flow.vlans, sizeof(old_vlans));
|
memcpy(&old_vlans, &ctx->xin->flow.vlans, sizeof(old_vlans));
|
||||||
xvlan_put(&ctx->xin->flow, &out_xvlan);
|
xvlan_put(&ctx->xin->flow, &out_xvlan, out_xbundle->use_priority_tags);
|
||||||
|
|
||||||
compose_output_action(ctx, xport->ofp_port, use_recirc ? &xr : NULL,
|
compose_output_action(ctx, xport->ofp_port, use_recirc ? &xr : NULL,
|
||||||
false, false);
|
false, false);
|
||||||
|
@@ -420,6 +420,7 @@ enum port_vlan_mode {
|
|||||||
enum port_priority_tags_mode {
|
enum port_priority_tags_mode {
|
||||||
PORT_PRIORITY_TAGS_NEVER = 0,
|
PORT_PRIORITY_TAGS_NEVER = 0,
|
||||||
PORT_PRIORITY_TAGS_IF_NONZERO,
|
PORT_PRIORITY_TAGS_IF_NONZERO,
|
||||||
|
PORT_PRIORITY_TAGS_ALWAYS,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The behaviour of the port regarding priority tags */
|
/* The behaviour of the port regarding priority tags */
|
||||||
|
@@ -1026,6 +1026,8 @@ port_configure(struct port *port)
|
|||||||
const char *pt = smap_get_def(&cfg->other_config, "priority-tags", "");
|
const char *pt = smap_get_def(&cfg->other_config, "priority-tags", "");
|
||||||
if (!strcmp(pt, "if-nonzero") || !strcmp(pt, "true")) {
|
if (!strcmp(pt, "if-nonzero") || !strcmp(pt, "true")) {
|
||||||
s.use_priority_tags = PORT_PRIORITY_TAGS_IF_NONZERO;
|
s.use_priority_tags = PORT_PRIORITY_TAGS_IF_NONZERO;
|
||||||
|
} else if (!strcmp(pt, "always")) {
|
||||||
|
s.use_priority_tags = PORT_PRIORITY_TAGS_ALWAYS;
|
||||||
} else {
|
} else {
|
||||||
s.use_priority_tags = PORT_PRIORITY_TAGS_NEVER;
|
s.use_priority_tags = PORT_PRIORITY_TAGS_NEVER;
|
||||||
}
|
}
|
||||||
|
@@ -1877,7 +1877,7 @@
|
|||||||
|
|
||||||
<column name="other_config" key="priority-tags"
|
<column name="other_config" key="priority-tags"
|
||||||
type='{"type": "string",
|
type='{"type": "string",
|
||||||
"enum": ["set", ["never", "if-nonzero"]]}'>
|
"enum": ["set", ["never", "if-nonzero", "always"]]}'>
|
||||||
<p>
|
<p>
|
||||||
An 802.1Q header contains two important pieces of information: a VLAN
|
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
|
ID and a priority. A frame with a zero VLAN ID, called a
|
||||||
@@ -1894,8 +1894,10 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Regardless of this setting, Open vSwitch omits the 802.1Q header on
|
For <code>if-nonzero</code> Open vSwitch omits the 802.1Q header on
|
||||||
output if both the VLAN ID and priority would be zero.
|
output if both the VLAN ID and priority would be zero. Set to
|
||||||
|
<code>always</code> to retain the 802.1Q header in such frames as
|
||||||
|
well.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
Reference in New Issue
Block a user