• Vladimir Oltean's avatar
    net: mscc: ocelot: offload VLAN mangle action to VCAP IS1 · 70edfae1
    Vladimir Oltean authored
    The VCAP_IS1_ACT_VID_REPLACE_ENA action, from the VCAP IS1 ingress TCAM,
    changes the classified VLAN.
    
    We are only exposing this ability for switch ports that are under VLAN
    aware bridges. This is because in standalone ports mode and under a
    bridge with vlan_filtering=0, the ocelot driver configures the switch to
    operate as VLAN-unaware, so the classified VLAN is not derived from the
    802.1Q header from the packet, but instead is always equal to the
    port-based VLAN ID of the ingress port. We _can_ still change the
    classified VLAN for packets when operating in this mode, but the end
    result will most likely be a drop, since both the ingress and the egress
    port need to be members of the modified VLAN. And even if we install the
    new classified VLAN into the VLAN table of the switch, the result would
    still not be as expected: we wouldn't see, on the output port, the
    modified VLAN tag, but the original one, even though the classified VLAN
    was indeed modified. This is because of how the hardware works: on
    egress, what is pushed to the frame is a "port tag", which gives us the
    following options:
    
    - Tag all frames with port tag (derived from the classified VLAN)
    - Tag all frames with port tag, except if the classified VLAN is 0 or
      equal to the native VLAN of the egress port
    - No port tag
    
    Needless to say, in VLAN-unaware mode we are disabling the port tag.
    Otherwise, the existing VLAN tag would be ignored, and a second VLAN
    tag (the port tag), holding the classified VLAN, would be pushed
    (instead of replacing the existing 802.1Q tag). This is definitely not
    what the user wanted when installing a "vlan modify" action.
    
    So it is simply not worth bothering with VLAN modify rules under other
    configurations except when the ports are fully VLAN-aware.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    70edfae1
ocelot_flower.c 20.8 KB