04 Feb, 2017

1 commit

  • [ Upstream commit f154be241d22298d2b63c9b613f619fa1086ea75 ]

    Commit 448b4482c671 ("net: dsa: Add lockdep class to tx queues to avoid
    lockdep splat") removed the netif_device_detach() call done in
    dsa_slave_suspend() which is necessary, and paired with a corresponding
    netif_device_attach(), bring it back.

    Fixes: 448b4482c671 ("net: dsa: Add lockdep class to tx queues to avoid lockdep splat")
    Signed-off-by: Florian Fainelli
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Florian Fainelli
     

30 Nov, 2016

2 commits

  • Make sure to deregister and free any fixed-link PHY registered using
    of_phy_register_fixed_link() on slave-setup errors and on slave destroy.

    Fixes: 0d8bcdd383b8 ("net: dsa: allow for more complex PHY setups")
    Signed-off-by: Johan Hovold
    Signed-off-by: David S. Miller

    Johan Hovold
     
  • Make sure to drop the reference taken by of_parse_phandle() before
    returning from dsa_slave_phy_setup().

    Note that this also modifies the PHY priority so that any fixed-link
    node is only parsed when no phy-handle is given, which is in accordance
    with the common scheme for this.

    Fixes: 0d8bcdd383b8 ("net: dsa: allow for more complex PHY setups")
    Signed-off-by: Johan Hovold
    Signed-off-by: David S. Miller

    Johan Hovold
     

23 Sep, 2016

2 commits

  • Today the DSA drivers are in charge of flushing the MAC addresses
    associated to a port when its STP state changes from Learning or
    Forwarding, to Disabled or Blocking or Listening.

    This makes the drivers more complex and hides the generic switch logic.
    Introduce a new optional port_fast_age operation to dsa_switch_ops, to
    move this logic to the DSA layer and keep drivers simple.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • Add a void helper to set the STP state of a port, checking first if the
    required routine is provided by the driver.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     

01 Sep, 2016

1 commit


25 Aug, 2016

1 commit

  • Now that the dsa_switch_driver structure contains only function pointers
    as it is supposed to, rename it to the more appropriate dsa_switch_ops,
    uniformly to any other operations structure in the kernel.

    No functional changes here, basically just the result of something like:
    s/dsa_switch_driver *drv/dsa_switch_ops *ops/g

    However keep the {un,}register_switch_driver functions and their
    dsa_switch_drivers list as is, since they represent the -- likely to be
    deprecated soon -- legacy DSA registration framework.

    In the meantime, also fix the following checks from checkpatch.pl to
    make it happy with this patch:

    CHECK: Comparison to NULL could be written "!ops"
    #403: FILE: net/dsa/dsa.c:470:
    + if (ops == NULL) {

    CHECK: Comparison to NULL could be written "ds->ops->get_strings"
    #773: FILE: net/dsa/slave.c:697:
    + if (ds->ops->get_strings != NULL)

    CHECK: Comparison to NULL could be written "ds->ops->get_ethtool_stats"
    #824: FILE: net/dsa/slave.c:785:
    + if (ds->ops->get_ethtool_stats != NULL)

    CHECK: Comparison to NULL could be written "ds->ops->get_sset_count"
    #835: FILE: net/dsa/slave.c:798:
    + if (ds->ops->get_sset_count != NULL)

    total: 0 errors, 0 warnings, 4 checks, 784 lines checked

    Signed-off-by: Vivien Didelot
    Acked-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vivien Didelot
     

20 Jul, 2016

1 commit

  • Add a new function for DSA drivers to handle the switchdev
    SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute.

    The ageing time is passed as milliseconds.

    Also because we can have multiple logical bridges on top of a physical
    switch and ageing time are switch-wide, call the driver function with
    the fastest ageing time in use on the chip instead of the requested one.

    Signed-off-by: Vivien Didelot
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Vivien Didelot
     

09 Jun, 2016

3 commits

  • Now that we can properly support multiple distinct trees in the system,
    using a global variable: dsa_cpu_port_ethtool_ops is getting clobbered
    as soon as the second switch tree gets probed, and we don't want that.

    We need to move this to be dynamically allocated, and since we can't
    really be comparing addresses anymore to determine first time
    initialization versus any other times, just move this to dsa.c and
    dsa2.c where the remainder of the dst/ds initialization happens.

    The operations teardown restores the master netdev's ethtool_ops to its
    original ethtool_ops pointer (typically within the Ethernet driver)

    Signed-off-by: Florian Fainelli
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Florian Fainelli
     
  • Add a helper function: dsa_cpu_port_ethtool_init() which initializes a
    custom ethtool_ops structure with custom DSA ethtool operations for CPU
    ports. This is a preliminary change to move the initialization outside
    of net/dsa/slave.c.

    Reviewed-by: Vivien Didelot
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     
  • In case we have multiples trees and switches with the same index, we
    need to add another discriminating id: the switch tree.

    Reviewed-by: Andrew Lunn
    Reviewed-by: Vivien Didelot
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

05 Jun, 2016

6 commits

  • The existing DSA binding has a number of limitations and problems. The
    main problem is that it cannot represent a switch as a linux device,
    hanging off some bus. It is limited to one CPU port. The DSA platform
    device is artificial, and does not really represent hardware.

    Implement a new binding which can be embedded into any type of node on
    a bus to represent one switch device, and its links to other switches.

    Signed-off-by: Andrew Lunn
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • Replace the two switch statements with an array lookup, and store the
    result in the dsa tree structure. The drivers no longer need to know
    the selected tag protocol, so remove it from the dsa switch structure.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • Move the port device node structure into the port structure, from the
    chip data. This information is needed in the next step of implementing
    the new binding.

    The chip data structure is used while parsing the whole old binding,
    before the individual switch structures exist. With the new bindings,
    this is reversed, the switches exist first, and the interconnections
    between the switches is derived from the individual switch
    bindings. Thus this chip data structure becomes unneeded.

    Signed-off-by: Andrew Lunn
    eviewed-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • There are going to be more per-port members added to the switch
    structure. So add a port structure and move the netdev into it.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • The DSA layer should no longer assume the switch is connected to an
    MDIO bus. As a result, we cannot use the address on the MDIO bus when
    forming the name of the switches internal MDIO bus for its builtin and
    possibly external PHYs. The switch index is sufficient to make the
    name unique, so drop the MDIO address.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • The new binding does not make use of dsa_chip_data, a.k.a cd. When
    retrieving the size of the EEPROM attached to a switch, don't assume
    there is a cd attached to the switch structure.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Andrew Lunn
     

12 May, 2016

2 commits

  • The dsa_switch structure contains a dsa_chip_data member called pd.
    However in the rest of the code, pd is used for dsa_platform_data.
    This is confusing. Rename it cd, which is already often used in dsa.c
    and slave.c for this data type.

    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • The switch drivers only use the master_dev member for dev_info()
    messages. Now that the device is passed to the old style probe, and
    new style drivers are probed as true linux drivers, this is no longer
    needed.

    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     

29 Apr, 2016

1 commit

  • This patch overloads the DSA master netdev, aka CPU Ethernet MAC to also
    include switch-side statistics, which is useful for debugging purposes,
    when the switch is not properly connected to the Ethernet MAC (duplex
    mismatch, (RG)MII electrical issues etc.).

    We accomplish this by retaining the original copy of the master netdev's
    ethtool_ops, and just overload the 3 operations we care about:
    get_sset_count, get_strings and get_ethtool_stats so as to intercept
    these calls and call into the original master_netdev ethtool_ops, plus
    our own.

    We take this approach as opposed to providing a set of DSA helper
    functions that would retrive the CPU port's statistics, because the
    entire purpose of DSA is to allow unmodified Ethernet MAC drivers to be
    used as CPU conduit interfaces, therefore, statistics overlay in such
    drivers would simply not scale.

    The new ethtool -S output would therefore look like this now:
    statistics
    p_

    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

20 Apr, 2016

1 commit


09 Apr, 2016

3 commits

  • The switchdev design implies that a software error should not happen in
    the commit phase since it must have been previously reported in the
    prepare phase. If an hardware error occurs during the commit phase,
    there is nothing switchdev can do about it.

    The DSA layer separates port_vlan_prepare and port_vlan_add for
    simplicity and convenience. If an hardware error occurs during the
    commit phase, there is no need to report it outside the driver itself.

    Make the DSA port_vlan_add routine return void for explicitness.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • The switchdev design implies that a software error should not happen in
    the commit phase since it must have been previously reported in the
    prepare phase. If an hardware error occurs during the commit phase,
    there is nothing switchdev can do about it.

    The DSA layer separates port_fdb_prepare and port_fdb_add for simplicity
    and convenience. If an hardware error occurs during the commit phase,
    there is no need to report it outside the DSA driver itself.

    Make the DSA port_fdb_add routine return void for explicitness.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • The DSA layer doesn't care about the return code of the port_stp_update
    routine, so make it void in the layer and the DSA drivers.

    Replace the useless dsa_slave_stp_update function with a
    dsa_slave_stp_state function used to reply to the switchdev
    SWITCHDEV_ATTR_ID_PORT_STP_STATE attribute.

    In the meantime, rename port_stp_update to port_stp_state_set to
    explicit the state change.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     

15 Mar, 2016

4 commits

  • Rework the netdev event handler, similar to what the Mellanox Spectrum
    driver does, to easily welcome more events later (for example
    NETDEV_PRECHANGEUPPER) and use netdev helpers (such as
    netif_is_bridge_master).

    Signed-off-by: Vivien Didelot
    Acked-by: Jiri Pirko
    Acked-by: Ido Schimmel
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • netdev_upper_dev_unlink() which notifies NETDEV_CHANGEUPPER, returns
    void, as well as del_nbp(). So there's no advantage to catch an eventual
    error from the port_bridge_leave routine at the DSA level.

    Make this routine void for the DSA layer and its existing drivers.

    Signed-off-by: Vivien Didelot
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • Rename DSA port_join_bridge and port_leave_bridge routines to
    respectively port_bridge_join and port_bridge_leave in order to respect
    an implicit Port::Bridge namespace.

    Signed-off-by: Vivien Didelot
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • When the phy is disconnected, the parent pointer to the netdev it was
    attached to is set to NULL. The code then tries to suspend the phy,
    but dsa_slave_fixed_link_update needs the parent pointer to determine
    which switch the phy is connected to. So it dereferenced a NULL
    pointer. Check for this condition.

    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     

02 Mar, 2016

1 commit

  • When a user explicitly requests VLAN filtering with something like:

    # echo 1 > /sys/class/net//bridge/vlan_filtering

    Switchdev propagates a SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING port
    attribute.

    Add support for it in the DSA layer with a new port_vlan_filtering
    function to let drivers toggle 802.1Q filtering on user demand.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     

26 Feb, 2016

2 commits

  • The VLAN GetNext operation is specific to some switches, and thus can be
    complicated to implement for some drivers.

    Remove the support for the vlan_getnext/port_pvid_get approach in favor
    of the generic and simpler port_vlan_dump function.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • Similar to port_fdb_dump, add a port_vlan_dump function to DSA drivers
    which gets passed the switchdev VLAN object and callback.

    This function, if implemented, takes precedence over the soon legacy
    vlan_getnext/port_pvid_get approach.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     

24 Feb, 2016

2 commits

  • DSA drivers may support multiple bridge groups with the same hardware
    VLAN. The mv88e6xxx driver which cannot yet, already has its own check
    for overlapping bridges. Thus remove the check from the DSA layer.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • Some DSA drivers may or may not support multiple software bridges on top
    of an hardware switch.

    It is more convenient for them to access the bridge's net_device for
    finer configuration.

    Removing the need to craft and access a bitmask also simplifies the
    code.

    This patch changes the signature of bridge related functions, update DSA
    drivers, and removes dsa_slave_br_port_mask.

    Signed-off-by: Vivien Didelot
    Tested-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vivien Didelot
     

18 Feb, 2016

1 commit

  • With commit 0071f56e46da ("dsa: Register netdev before phy"), we are now trying
    to free a network device that has been previously registered, and in case of
    errors, this will make us hit the BUG_ON(dev->reg_state != NETREG_UNREGISTERED)
    condition.

    Fix this by adding a missing unregister_netdev() before free_netdev().

    Fixes: 0071f56e46da ("dsa: Register netdev before phy")
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

17 Feb, 2016

1 commit


08 Jan, 2016

3 commits

  • When the phy is connected, an info message is printed. If the netdev
    it is attached to has not been registered yet, the name
    'uninitialised' in the output. By registering the netdev first, then
    connecting they phy, we can avoid this.

    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • Rather than have drivers directly manipulate the mii_bus structure,
    provide and API for registering and unregistering devices on an MDIO
    bus, and performing lookups.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • Many Ethernet drivers contain the same netdev_info() print statement
    about the attached phy. Move it into the phy device code. Additionally
    add a varargs function which can be used to append additional
    information.

    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     

08 Dec, 2015

1 commit

  • Move dsa slave dedicated code from dsa_switch_destroy to a new
    dsa_slave_destroy function in slave.c.
    Add the netif_carrier_off and phy_disconnect calls in order to
    correctly cleanup the netdev state and PHY state machine.

    Signed-off-by: Frode Isaksen
    Signed-off-by: Neil Armstrong
    Signed-off-by: David S. Miller

    Neil Armstrong
     

02 Nov, 2015

1 commit