Skip to content
  1. May 31, 2019
  2. May 30, 2019
    • Marek Vasut's avatar
      net: phy: tja11xx: Switch to HWMON_CHANNEL_INFO() · 517f4c49
      Marek Vasut authored
      
      
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: linux-hwmon@vger.kernel.org
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      517f4c49
    • Ivan Khoronzhuk's avatar
      net: ethernet: ti: cpsw: correct .ndo_open error path · 02cacede
      Ivan Khoronzhuk authored
      
      
      It's found while review and probably never happens, but real number
      of queues is set per device, and error path should be per device.
      So split error path based on usage_count.
      
      Signed-off-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      02cacede
    • David S. Miller's avatar
      Merge branch 'Decoupling-PHYLINK-from-struct-net_device' · 6faaffb3
      David S. Miller authored
      
      
      Ioana Ciornei says:
      
      ====================
      Decoupling PHYLINK from struct net_device
      
      Following two separate discussion threads in:
        https://www.spinics.net/lists/netdev/msg569087.html
      and:
        https://www.spinics.net/lists/netdev/msg570450.html
      
      Previous RFC patch set: https://www.spinics.net/lists/netdev/msg571995.html
      
      PHYLINK was reworked in order to accept multiple operation types,
      PHYLINK_NETDEV and PHYLINK_DEV, passed through a phylink_config
      structure alongside the corresponding struct device.
      
      One of the main concerns expressed in the RFC was that using notifiers
      to signal the corresponding phylink_mac_ops would break PHYLINK's API
      unity and that it would become harder to grep for its users.
      Using the current approach, we maintain a common API for all users.
      Also, printing useful information in PHYLINK, when decoupled from a
      net_device, is achieved using dev_err&co on the struct device received
      (in DSA's case is the device corresponding to the dsa_switch).
      
      PHYLIB (which PHYLINK uses) was reworked to the extent that it does not
      crash when connecting to a PHY and the net_device pointer is NULL.
      
      Lastly, DSA has been reworked in its way that it handles PHYs for ports
      that lack a net_device (CPU and DSA ports).  For these, it was
      previously using PHYLIB and is now using the PHYLINK_DEV operation type.
      Previously, a driver that wanted to support PHY operations on CPU/DSA
      ports has to implement .adjust_link(). This patch set not only gives
      drivers the options to use PHYLINK uniformly but also urges them to
      convert to it. For compatibility, the old code is kept but it will be
      removed once all drivers switch over.
      
      The patchset was tested on the NXP LS1021A-TSN board having the
      following Ethernet layout:
        https://lkml.org/lkml/2019/5/5/279
      The CPU port was moved from the internal RGMII fixed-link (enet2 ->
      switch port 4) to an external loopback Cat5 cable between the enet1 port
      and the front-facing swp2 SJA1105 port. In this mode, both the master
      and the CPU port have an attached PHY which detects link change events:
      
      [   49.105426] fsl-gianfar soc:ethernet@2d50000 eth1: Link is Down
      [   50.305486] sja1105 spi0.1: Link is Down
      [   53.265596] fsl-gianfar soc:ethernet@2d50000 eth1: Link is Up - 1Gbps/Full - flow control off
      [   54.466304] sja1105 spi0.1: Link is Up - 1Gbps/Full - flow control off
      
      Changes in v2:
        - fixed sparse warnings
        - updated 'Documentation/ABI/testing/sysfs-class-net-phydev'
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6faaffb3
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Fix broken fixed-link interfaces on user ports · af7cd036
      Vladimir Oltean authored
      PHYLIB and PHYLINK handle fixed-link interfaces differently. PHYLIB
      wraps them in a software PHY ("pseudo fixed link") phydev construct such
      that .adjust_link driver callbacks see an unified API. Whereas PHYLINK
      simply creates a phylink_link_state structure and passes it to
      .mac_config.
      
      At the time the driver was introduced, DSA was using PHYLIB for the
      CPU/cascade ports (the ones with no net devices) and PHYLINK for
      everything else.
      
      As explained below:
      
      commit aab9c406
      
      
      Author: Florian Fainelli <f.fainelli@gmail.com>
      Date:   Thu May 10 13:17:36 2018 -0700
      
        net: dsa: Plug in PHYLINK support
      
        Drivers that utilize fixed links for user-facing ports (e.g: bcm_sf2)
        will need to implement phylink_mac_ops from now on to preserve
        functionality, since PHYLINK *does not* create a phy_device instance
        for fixed links.
      
      In the above patch, DSA guards the .phylink_mac_config callback against
      a NULL phydev pointer.  Therefore, .adjust_link is not called in case of
      a fixed-link user port.
      
      This patch fixes the situation by converting the driver from using
      .adjust_link to .phylink_mac_config.  This can be done now in a unified
      fashion for both slave and CPU/cascade ports because DSA now uses
      PHYLINK for all ports.
      
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      af7cd036
    • Ioana Ciornei's avatar
      net: dsa: Use PHYLINK for the CPU/DSA ports · 0e279218
      Ioana Ciornei authored
      
      
      For DSA switches that do not have an .adjust_link callback, aka those
      who transitioned totally to the PHYLINK-compliant API, use PHYLINK to
      drive the CPU/DSA ports.
      
      The PHYLIB usage and .adjust_link are kept but deprecated, and users are
      asked to transition from it.  The reason why we can't do anything for
      them is because PHYLINK does not wrap the fixed-link state behind a
      phydev object, so we cannot wrap .phylink_mac_config into .adjust_link
      unless we fabricate a phy_device structure.
      
      For these ports, the newly introduced PHYLINK_DEV operation type is
      used and the dsa_switch device structure is passed to PHYLINK for
      printing purposes.  The handling of the PHYLINK_NETDEV and PHYLINK_DEV
      PHYLINK instances is common from the perspective of the driver.
      
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e279218
    • Ioana Ciornei's avatar
      net: dsa: Move the phylink driver calls into port.c · 77373d49
      Ioana Ciornei authored
      
      
      In order to have a common handling of PHYLINK for the slave and non-user
      ports, the DSA core glue logic (between PHYLINK and the driver) must use
      an API that does not rely on a struct net_device.
      
      These will also be called by the CPU-port-handling code in a further
      patch.
      
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Suggested-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      77373d49
    • Ioana Ciornei's avatar
      net: phylink: Add phylink_{printk, err, warn, info, dbg} macros · 17091180
      Ioana Ciornei authored
      
      
      With the latest addition to the PHYLINK infrastructure, we are faced
      with a decision on when to print necessary info using the struct
      net_device and when with the struct device.
      
      Add a series of macros that encapsulate this decision and replace all
      uses of netdev_err&co with phylink_err.
      
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      17091180
    • Ioana Ciornei's avatar
      net: phylink: Add PHYLINK_DEV operation type · 43de6195
      Ioana Ciornei authored
      
      
      In the PHYLINK_DEV operation type, the PHYLINK infrastructure can work
      without an attached net_device. For printing usecases, instead, a struct
      device * should be passed to PHYLINK using the phylink_config structure.
      
      Also, netif_carrier_* calls ar guarded by the presence of a valid
      net_device. When using the PHYLINK_DEV operation type, we cannot check
      link status using the netif_carrier_ok() API so instead, keep an
      internal state of the MAC and call mac_link_{down,up} only when the link
      changed.
      
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      43de6195
    • Ioana Ciornei's avatar
      net: phylink: Add struct phylink_config to PHYLINK API · 44cc27e4
      Ioana Ciornei authored
      
      
      The phylink_config structure will encapsulate a pointer to a struct
      device and the operation type requested for this instance of PHYLINK.
      This patch does not make any functional changes, it just transitions the
      PHYLINK internals and all its users to the new API.
      
      A pointer to a phylink_config structure will be passed to
      phylink_create() instead of the net_device directly. Also, the same
      phylink_config pointer will be passed back to all phylink_mac_ops
      callbacks instead of the net_device. Using this mechanism, a PHYLINK
      user can get the original net_device using a structure such as
      'to_net_dev(config->dev)' or directly the structure containing the
      phylink_config using a container_of call.
      
      At the moment, only the PHYLINK_NETDEV is defined as a valid operation
      type for PHYLINK. In this mode, a valid reference to a struct device
      linked to the original net_device should be passed to PHYLINK through
      the phylink_config structure.
      
      This API changes is mainly driven by the necessity of adding a new
      operation type in PHYLINK that disconnects the phy_device from the
      net_device and also works when the net_device is lacking.
      
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
      Tested-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44cc27e4