Commit 62a22bcb authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: mscc: ocelot: add a type definition for REW_TAG_CFG_TAG_CFG

This is a cosmetic patch which clarifies what are the port tagging
options for Ocelot switches.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dfcb63ce
...@@ -166,7 +166,7 @@ static void ocelot_port_set_native_vlan(struct ocelot *ocelot, int port, ...@@ -166,7 +166,7 @@ static void ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
struct ocelot_vlan native_vlan) struct ocelot_vlan native_vlan)
{ {
struct ocelot_port *ocelot_port = ocelot->ports[port]; struct ocelot_port *ocelot_port = ocelot->ports[port];
u32 val = 0; enum ocelot_port_tag_config tag_cfg;
ocelot_port->native_vlan = native_vlan; ocelot_port->native_vlan = native_vlan;
...@@ -176,16 +176,13 @@ static void ocelot_port_set_native_vlan(struct ocelot *ocelot, int port, ...@@ -176,16 +176,13 @@ static void ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
if (ocelot_port->vlan_aware) { if (ocelot_port->vlan_aware) {
if (native_vlan.valid) if (native_vlan.valid)
/* Tag all frames except when VID == DEFAULT_VLAN */ tag_cfg = OCELOT_PORT_TAG_NATIVE;
val = REW_TAG_CFG_TAG_CFG(1);
else else
/* Tag all frames */ tag_cfg = OCELOT_PORT_TAG_TRUNK;
val = REW_TAG_CFG_TAG_CFG(3);
} else { } else {
/* Port tagging disabled. */ tag_cfg = OCELOT_PORT_TAG_DISABLED;
val = REW_TAG_CFG_TAG_CFG(0);
} }
ocelot_rmw_gix(ocelot, val, ocelot_rmw_gix(ocelot, REW_TAG_CFG_TAG_CFG(tag_cfg),
REW_TAG_CFG_TAG_CFG_M, REW_TAG_CFG_TAG_CFG_M,
REW_TAG_CFG, port); REW_TAG_CFG, port);
} }
......
...@@ -568,6 +568,17 @@ struct ocelot_vlan { ...@@ -568,6 +568,17 @@ struct ocelot_vlan {
u16 vid; u16 vid;
}; };
enum ocelot_port_tag_config {
/* all VLANs are egress-untagged */
OCELOT_PORT_TAG_DISABLED = 0,
/* all VLANs except the native VLAN and VID 0 are egress-tagged */
OCELOT_PORT_TAG_NATIVE = 1,
/* all VLANs except VID 0 are egress-tagged */
OCELOT_PORT_TAG_TRUNK_NO_VID0 = 2,
/* all VLANs are egress-tagged */
OCELOT_PORT_TAG_TRUNK = 3,
};
enum ocelot_sb { enum ocelot_sb {
OCELOT_SB_BUF, OCELOT_SB_BUF,
OCELOT_SB_REF, OCELOT_SB_REF,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment