11 Feb, 2017

1 commit


10 Feb, 2017

1 commit

  • While adding switch.o to the list of DSA object files, we essentially
    duplicated the previous obj-y line and just added switch.o, remove the
    duplicate.

    Fixes: f515f192ab4f ("net: dsa: add switch notifier")
    Signed-off-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Florian Fainelli
     

09 Feb, 2017

1 commit

  • dsa_slave_create() can fail, and dsa_user_port_unapply() will properly check
    for the network device not being NULL before attempting to destroy it. We were
    not setting the slave network device as NULL if dsa_slave_create() failed, so
    we would later on be calling dsa_slave_destroy() on a now free'd and
    unitialized network device, causing crashes in dsa_slave_destroy().

    Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

08 Feb, 2017

1 commit

  • Calling phy_read_status() means that we may call into
    genphy_read_status() which in turn will use genphy_update_link() which
    can make changes to phydev->link outside of the state machine's state
    transitions. This is an invalid behavior that is now caught as of
    811a919135b9 ("phy state machine: failsafe leave invalid RUNNING state")

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

    Florian Fainelli
     

07 Feb, 2017

8 commits

  • Allow drivers to use the new DSA API with platform data. Most of the
    code in net/dsa/dsa2.c does not rely so much on device_nodes and can get
    the same information from platform_data instead.

    We purposely do not support distributed configurations with platform
    data, so drivers should be providing a pointer to a 'struct
    dsa_chip_data' structure if they wish to communicate per-port layout.

    Multiple CPUs port could potentially be supported and dsa_chip_data is
    extended to receive up to one reference to an upstream network device
    per port described by a dsa_chip_data structure.

    dsa_dev_to_net_device() increments the network device's reference count,
    so we intentionally call dev_put() to be consistent with the DT-enabled
    path, until we have a generic notifier based solution.

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

    Florian Fainelli
     
  • In preparation for using this function in net/dsa/dsa2.c, rename the function
    to make its scope DSA specific, and export it.

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

    Florian Fainelli
     
  • A slave device will now notify the switch fabric once its port is
    bridged or unbridged, instead of calling directly its switch operations.

    This code allows propagating cross-chip bridging events in the fabric.

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

    Vivien Didelot
     
  • Add a notifier block per DSA switch, registered against a notifier head
    in the switch fabric they belong to.

    This infrastructure will allow to propagate fabric-wide events such as
    port bridging, VLAN configuration, etc. If a DSA switch driver cares
    about cross-chip configuration, such events can be caught.

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

    Vivien Didelot
     
  • The scope of the functions inside net/dsa/slave.c must be the slave
    net_device pointer. Change to state setter helper accordingly to
    simplify callers.

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

    Vivien Didelot
     
  • When an error is returned during the bridging of a port in a
    NETDEV_CHANGEUPPER event, net/core/dev.c rolls back the operation.

    Be consistent and unassign dp->bridge_dev when this happens.

    In the meantime, add comments to document this behavior.

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

    Vivien Didelot
     
  • Simplify the code handling the slave netdevice notifier call by
    providing a dsa_slave_changeupper helper for NETDEV_CHANGEUPPER, and so
    on (only this event is supported at the moment.)

    Return NOTIFY_DONE when we did not care about an event, and NOTIFY_OK
    when we were concerned but no error occurred, as the API suggests.

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

    Vivien Didelot
     
  • Move the netdevice notifier block register code in slave.c and provide
    helpers for dsa.c to register and unregister it.

    At the same time, check for errors since (un)register_netdevice_notifier
    may fail.

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

    Vivien Didelot
     

31 Jan, 2017

2 commits

  • Add necessary plumbing at the slave network device level to have switch
    drivers implement ndo_setup_tc() and most particularly the cls_matchall
    classifier. We add support for two switch operations:

    port_add_mirror and port_del_mirror() which configure, on a per-port
    basis the mirror parameters requested from the cls_matchall classifier.

    Code is largely borrowed from the Mellanox Spectrum switch driver.

    Reviewed-by: Jiri Pirko
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     
  • In preparation for adding support for CFP/TCAMP in the bcm_sf2 driver add the
    plumbing to call into driver specific {get,set}_rxnfc operations.

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

    Florian Fainelli
     

30 Jan, 2017

6 commits

  • Upon reception of the NETDEV_CHANGEUPPER, a leaving port is already
    unbridged, so reflect this by assigning the port's bridge_dev pointer to
    NULL before calling the port_bridge_leave DSA driver operation.

    Now that the bridge_dev pointer is exposed to the drivers, reflecting
    the current state of the DSA switch fabric is necessary for the drivers
    to adjust their port based VLANs correctly.

    Pass the bridge device pointer to the port_bridge_leave operation so
    that drivers have all information to re-program their chips properly,
    and do not need to cache it anymore.

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

    Vivien Didelot
     
  • Move the bridge_dev pointer from dsa_slave_priv to dsa_port so that DSA
    drivers can access this information and remove the need to cache it.

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

    Vivien Didelot
     
  • Store a pointer to the dsa_port structure in the dsa_slave_priv
    structure, instead of the switch/port index.

    This will allow to store more information such as the bridge device,
    needed in DSA drivers for multi-chip configuration.

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

    Vivien Didelot
     
  • Add the physical switch instance and port index a DSA port belongs to to
    the dsa_port structure.

    That can be used later to retrieve information about a physical port
    when configuring a switch fabric, or lighten up struct dsa_slave_priv.

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

    Vivien Didelot
     
  • The dsa_switch structure contains the number of ports. Use it where the
    structure is valid instead of the DSA_MAX_PORTS value.

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

    Vivien Didelot
     
  • Change the ports[DSA_MAX_PORTS] array of the dsa_switch structure for a
    zero-length array, allocated at the same time as the dsa_switch
    structure itself. A dsa_switch_alloc() helper is provided for that.

    This commit brings no functional change yet since we pass DSA_MAX_PORTS
    as the number of ports for the moment. Future patches can update the DSA
    drivers separately to support dynamic number of ports.

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

    Vivien Didelot
     

28 Jan, 2017

1 commit


27 Jan, 2017

4 commits


26 Jan, 2017

1 commit

  • 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

    Florian Fainelli
     

25 Jan, 2017

2 commits


24 Jan, 2017

1 commit

  • We need to check the return value of phy_connect_direct() in
    dsa_slave_phy_connect() otherwise we may be continuing the
    initialization of a slave network device with a PHY that already
    attached somewhere else and which will soon be in error because the PHY
    device is in error.

    The conditions for such an error to occur are that we have a port of our
    switch that is not disabled, and has the same port number as a PHY
    address (say both 5) that can be probed using the DSA slave MII bus. We
    end-up having this slave network device find a PHY at the same address
    as our port number, and we try to attach to it.

    A slave network (e.g: port 0) has already attached to our PHY device,
    and we try to re-attach it with a different network device, but since we
    ignore the error we would end-up initializating incorrect device
    references by the time the slave network interface is opened.

    The code has been (re)organized several times, making it hard to provide
    an exact Fixes tag, this is a bugfix nonetheless.

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

    Florian Fainelli
     

21 Jan, 2017

1 commit

  • Only the Marvell mv88e6xxx DSA driver made use of the HWMON support in
    DSA. The temperature sensor registers are actually in the embedded
    PHYs, and the PHY driver now supports it. So remove all HWMON support
    from DSA and drivers.

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

    Andrew Lunn
     

19 Jan, 2017

2 commits

  • Now that the DSA Ethernet switches are true Linux devices, the CPU
    switch is not necessarily the first one. If its address is higher than
    the second switch on the same MDIO bus, its index will be 1, not 0.

    Avoid any confusion by using dst->cpu_switch instead of dst->ds[0].

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

    Vivien Didelot
     
  • Store a dsa_switch pointer to the CPU switch in the tree instead of only
    its index. This avoids the need to initialize it to -1.

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

    Vivien Didelot
     

12 Jan, 2017

1 commit


11 Jan, 2017

4 commits

  • This reverts commit 3a543ef479868e36c95935de320608a7e41466ca ("net: dsa:
    Implement ndo_get_phys_port_id") since it misuses the purpose of
    ndo_get_phys_port_id(). We have ndo_get_phys_port_name() to do the
    correct thing for us now.

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

    Florian Fainelli
     
  • Return the physical port number of a DSA created network device using
    ndo_get_phys_port_name().

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

    Florian Fainelli
     
  • In the new DTS bindings for DSA (dsa2), the "ethernet" and "link"
    phandles are respectively mandatory and exclusive to CPU port and DSA
    link device tree nodes.

    Simplify dsa2.c a bit by checking the presence of such phandle instead
    of checking the redundant "label" property.

    Then the Linux philosophy for Ethernet switch ports is to expose them to
    userspace as standard NICs by default. Thus use the standard enumerated
    "eth%d" device name if no "label" property is provided for a user port.
    This allows to save DTS files from subjective net device names.

    If one wants to rename an interface, udev rules can be used as usual.

    Of course the current behavior is unchanged, and the optional "label"
    property for user ports has precedence over the enumerated name.

    Signed-off-by: Vivien Didelot
    Acked-by: Uwe Kleine-König
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • It is perfectly possible to have non zero indexed switches being present
    in a DSA switch tree, in such a case, we will be deferencing a NULL
    pointer while dsa_cpu_port_ethtool_{setup,restore}. Be more defensive
    and ensure that dst->ds[0] is valid before doing anything with it.

    Fixes: 0c73c523cf73 ("net: dsa: Initialize CPU port ethtool ops per tree")
    Signed-off-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Florian Fainelli
     

10 Jan, 2017

3 commits

  • The support for DSA Ethernet switch chips depends on TCP/IP networking,
    thus explicit that HAVE_NET_DSA depends on INET.

    DSA uses SWITCHDEV, thus select it instead of depending on it.

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

    Vivien Didelot
     
  • Now that we have properly encapsulated and made drivers utilize exported
    functions, we can switch dsa_switch_ops to be a annotated with const.

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

    Florian Fainelli
     
  • In preparation for making struct dsa_switch_ops const, encapsulate it
    within a dsa_switch_driver which has a list pointer and a pointer to
    dsa_switch_ops. This allows us to take the list_head pointer out of
    dsa_switch_ops, which is written to by {un,}register_switch_driver.

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

    Florian Fainelli