• Vladimir Oltean's avatar
    net: dsa: sja1105: be stateless with FDB entries on SJA1105P/Q/R/S/SJA1110 too · 589918df
    Vladimir Oltean authored
    Similar but not quite the same with what was done in commit b11f0a4c
    ("net: dsa: sja1105: be stateless when installing FDB entries") for
    SJA1105E/T, it is desirable to drop the priv->vlan_aware check and
    simply go ahead and install FDB entries in the VLAN that was given by
    the bridge.
    
    As opposed to SJA1105E/T, in SJA1105P/Q/R/S and SJA1110, the FDB is a
    maskable TCAM, and we are installing VLAN-unaware FDB entries with the
    VLAN ID masked off. However, such FDB entries might completely obscure
    VLAN-aware entries where the VLAN ID is included in the search mask,
    because the switch looks up the FDB from left to right and picks the
    first entry which results in a masked match. So it depends on whether
    the bridge installs first the VLAN-unaware or the VLAN-aware FDB entries.
    
    Anyway, if we had a VLAN-unaware FDB entry towards one set of DESTPORTS
    and a VLAN-aware one towards other set of DESTPORTS, the result is that
    the packets in VLAN-aware mode will be forwarded towards the DESTPORTS
    specified by the VLAN-unaware entry.
    
    To solve this, simply do not use the masked matching ability of the FDB
    for VLAN ID, and always match precisely on it. In VLAN-unaware mode, we
    configure the switch for shared VLAN learning, so the VLAN ID will be
    ignored anyway during lookup, so it is redundant to mask it off in the
    TCAM.
    
    This patch conflicts with net-next commit 0fac6aa0 ("net: dsa: sja1105:
    delete the best_effort_vlan_filtering mode") which changed this line:
    	if (priv->vlan_state != SJA1105_VLAN_UNAWARE) {
    into:
    	if (priv->vlan_aware) {
    
    When merging with net-next, the lines added by this patch should take
    precedence in the conflict resolution (i.e. the "if" condition should be
    deleted in both cases).
    
    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>
    589918df
sja1105_main.c 109 KB