• Vladimir Oltean's avatar
    net: dsa: tag_sja1105: be dsa_loop-safe · 994d2cbb
    Vladimir Oltean authored
    Add support for tag_sja1105 running on non-sja1105 DSA ports, by making
    sure that every time we dereference dp->priv, we check the switch's
    dsa_switch_ops (otherwise we access a struct sja1105_port structure that
    is in fact something else).
    
    This adds an unconditional build-time dependency between sja1105 being
    built as module => tag_sja1105 must also be built as module. This was
    there only for PTP before.
    
    Some sane defaults must also take place when not running on sja1105
    hardware. These are:
    
    - sja1105_xmit_tpid: the sja1105 driver uses different VLAN protocols
      depending on VLAN awareness and switch revision (when an encapsulated
      VLAN must be sent). Default to 0x8100.
    
    - sja1105_rcv_meta_state_machine: this aggregates PTP frames with their
      metadata timestamp frames. When running on non-sja1105 hardware, don't
      do that and accept all frames unmodified.
    
    - sja1105_defer_xmit: calls sja1105_port_deferred_xmit in sja1105_main.c
      which writes a management route over SPI. When not running on sja1105
      hardware, bypass the SPI write and send the frame as-is.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    994d2cbb
Kconfig 5.44 KB