]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net: mscc: ocelot: add a type definition for REW_TAG_CFG_TAG_CFG
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 20 Oct 2021 17:58:48 +0000 (20:58 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Oct 2021 11:14:29 +0000 (12:14 +0100)
This is a cosmetic patch which clarifies what are the port tagging
options for Ocelot switches.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mscc/ocelot.c
include/soc/mscc/ocelot.h

index 520a75b578662a1b72c8b92d8e022dca0524c1a0..b099299702734111a96f710998f0ae3140a60b96 100644 (file)
@@ -166,7 +166,7 @@ static void ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
                                        struct ocelot_vlan native_vlan)
 {
        struct ocelot_port *ocelot_port = ocelot->ports[port];
-       u32 val = 0;
+       enum ocelot_port_tag_config tag_cfg;
 
        ocelot_port->native_vlan = native_vlan;
 
@@ -176,16 +176,13 @@ static void ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
 
        if (ocelot_port->vlan_aware) {
                if (native_vlan.valid)
-                       /* Tag all frames except when VID == DEFAULT_VLAN */
-                       val = REW_TAG_CFG_TAG_CFG(1);
+                       tag_cfg = OCELOT_PORT_TAG_NATIVE;
                else
-                       /* Tag all frames */
-                       val = REW_TAG_CFG_TAG_CFG(3);
+                       tag_cfg = OCELOT_PORT_TAG_TRUNK;
        } else {
-               /* Port tagging disabled. */
-               val = REW_TAG_CFG_TAG_CFG(0);
+               tag_cfg = OCELOT_PORT_TAG_DISABLED;
        }
-       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, port);
 }
index d7055b41982dfaa7f99189728c14b1cd0316dbc9..0568b25c8659b0228db0e037374e0c94879d4b6f 100644 (file)
@@ -568,6 +568,17 @@ struct ocelot_vlan {
        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 {
        OCELOT_SB_BUF,
        OCELOT_SB_REF,