• Vladimir Oltean's avatar
    net: dsa: sja1105: match FDB entries regardless of inner/outer VLAN tag · 47c2c0c2
    Vladimir Oltean authored
    On SJA1105P/Q/R/S and SJA1110, the L2 Lookup Table entries contain a
    maskable "inner/outer tag" bit which means:
    - when set to 1: match single-outer and double tagged frames
    - when set to 0: match untagged and single-inner tagged frames
    - when masked off: match all frames regardless of the type of tag
    
    This driver does not make any meaningful distinction between inner tags
    (matches on TPID) and outer tags (matches on TPID2). In fact, all VLAN
    table entries are installed as SJA1110_VLAN_D_TAG, which means that they
    match on both inner and outer tags.
    
    So it does not make sense that we install FDB entries with the IOTAG bit
    set to 1.
    
    In VLAN-unaware mode, we set both TPID and TPID2 to 0xdadb, so the
    switch will see frames as outer-tagged or double-tagged (never inner).
    So the FDB entries will match if IOTAG is set to 1.
    
    In VLAN-aware mode, we set TPID to 0x8100 and TPID2 to 0x88a8. So the
    switch will see untagged and 802.1Q-tagged packets as inner-tagged, and
    802.1ad-tagged packets as outer-tagged. So untagged and 802.1Q-tagged
    packets will not match FDB entries if IOTAG is set to 1, but 802.1ad
    tagged packets will. Strange.
    
    To fix this, simply mask off the IOTAG bit from FDB entries, and make
    them match regardless of whether the VLAN tag is inner or outer.
    
    Fixes: 1da73821 ("net: dsa: sja1105: Add FDB operations for P/Q/R/S series")
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    47c2c0c2
sja1105_main.c 109 KB