1. 25 Feb, 2015 3 commits
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: add HW bridging support · 12f460f2
      Florian Fainelli authored
      Implement the bridge join, leave and set_stp callbacks by making that
      we do the following:
      
      - when a port joins the bridge, all existing ports in the bridge get
        their VLAN control register updated with that joining port
      - the joining port is including all existing bridge ports in its own
        VLAN control register
      
      The leave operation is fairly similar, special care must be taken to
      make sure that port leaving the bridging is not removing itself from its
      own VLAN control register.
      
      Since the various BR_* states apply directly to our HW semantics, we
      just need to translate these constants into their corresponding HW
      settings, and voila!
      
      We make sure to trigger a fast-ageing process for ports that are
      joining/leaving the bridge and transition from incompatible states, this
      is equivalent to triggering an ARL flush for that port.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      12f460f2
    • Florian Fainelli's avatar
      net: dsa: integrate with SWITCHDEV for HW bridging · b73adef6
      Florian Fainelli authored
      In order to support bridging offloads in DSA switch drivers, select
      NET_SWITCHDEV to get access to the port_stp_update and parent_get_id
      NDOs that we are required to implement.
      
      To facilitate the integratation at the DSA driver level, we implement 3
      types of operations:
      
      - port_join_bridge
      - port_leave_bridge
      - port_stp_update
      
      DSA will resolve which switch ports that are currently bridge port
      members as some Switch hardware/drivers need to know about that to limit
      the register programming to just the relevant registers (especially for
      slow MDIO buses).
      
      We also take care of setting the correct STP state when slave network
      devices are brought up/down while being bridge members.
      
      Finally, when a port is leaving the bridge, we make sure we set in
      BR_STATE_FORWARDING state, otherwise the bridge layer would leave it
      disabled as a result of having left the bridge.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b73adef6
    • Guenter Roeck's avatar
      net: dsa: Ensure that port array elements are initialized before being used · d87d6f44
      Guenter Roeck authored
      A network device notifier can be called for one or more of the created
      slave devices before all slave devices have been registered. This can
      result in a mismatch between ds->phys_port_mask and the registered devices
      by the time the call is made, and it can result in a slave device being
      added to a bridge before its entry in ds->ports[] has been initialized.
      
      Rework the initialization code to initialize entries in ds->ports[] in
      dsa_slave_create. With this change, dsa_slave_create no longer needs
      to return slave_dev but can return an error code instead.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d87d6f44
  2. 24 Feb, 2015 37 commits