24 Nov, 2019

1 commit

  • Rename the mac_link_state() method to mac_pcs_get_state() to make it
    clear that it should be returning the MACs PCS current state, which
    is used for inband negotiation rather than just reading back what the
    MAC has been configured for. Update the documentation to explicitly
    mention that this is for inband.

    We drop the return value as well; most of phylink doesn't check the
    return value and it is not clear what it should do on error - instead
    arrange for state->link to be false.

    Signed-off-by: Russell King
    Signed-off-by: Jakub Kicinski

    Russell King
     

23 Oct, 2019

1 commit

  • Use the new ports list instead of iterating over switches and their
    ports when looking for a slave device from a given master interface.

    Signed-off-by: Vivien Didelot
    Reviewed-by: Florian Fainelli
    Reviewed-by: Andrew Lunn
    Signed-off-by: Jakub Kicinski

    Vivien Didelot
     

10 Jul, 2019

1 commit

  • This patch adds support for enabling or disabling the flooding of
    unknown multicast traffic on the CPU ports, depending on the value
    of the switchdev SWITCHDEV_ATTR_ID_BRIDGE_MROUTER attribute.

    The current behavior is kept unchanged but a user can now prevent
    the CPU conduit to be flooded with a lot of unregistered traffic that
    the network stack needs to filter in software with e.g.:

    echo 0 > /sys/class/net/br0/multicast_router

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

    Vivien Didelot
     

08 Jun, 2019

1 commit


31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

30 May, 2019

1 commit

  • 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: Ioana Ciornei
    Suggested-by: Vladimir Oltean
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Ioana Ciornei
     

06 May, 2019

1 commit

  • Some hardware needs to take work to get convinced to receive frames on
    the CPU port (such as the sja1105 which takes temporary L2 forwarding
    rules over SPI that last for a single frame). Such work needs a
    sleepable context, and because the regular .ndo_start_xmit is atomic,
    this cannot be done in the tagger. So introduce a generic DSA mechanism
    that sets up a transmit skb queue and a workqueue for deferred
    transmission.

    The new driver callback (.port_deferred_xmit) is in dsa_switch and not
    in the tagger because the operations that require sleeping typically
    also involve interacting with the hardware, and not simply skb
    manipulations. Therefore having it there simplifies the structure a bit
    and makes it unnecessary to export functions from the driver to the
    tagger.

    The driver is responsible of calling dsa_enqueue_skb which transfers it
    to the master netdevice. This is so that it has a chance of performing
    some more work afterwards, such as cleanup or TX timestamping.

    To tell DSA that skb xmit deferral is required, I have thought about
    changing the return type of the tagger .xmit from struct sk_buff * into
    a enum dsa_tx_t that could potentially encode a DSA_XMIT_DEFER value.

    But the trailer tagger is reallocating every skb on xmit and therefore
    making a valid use of the pointer return value. So instead of reworking
    the API in complicated ways, right now a boolean property in the newly
    introduced DSA_SKB_CB is set.

    Signed-off-by: Vladimir Oltean
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vladimir Oltean
     

01 May, 2019

2 commits

  • Now that all drivers can be probed using more traditional methods,
    remove the legacy probe code.

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

    Andrew Lunn
     
  • This hides the need to perform a two-phase transaction and construct a
    switchdev_obj_port_vlan struct.

    Call graph (including a function that will be introduced in a follow-up
    patch) looks like this now (same for the *_vlan_del function):

    dsa_slave_vlan_rx_add_vid dsa_port_setup_8021q_tagging
    | |
    | |
    | +-------------+
    | |
    v v
    dsa_port_vid_add dsa_slave_port_obj_add
    | |
    +-------+ +-------+
    | |
    v v
    dsa_port_vlan_add

    Signed-off-by: Vladimir Oltean
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vladimir Oltean
     

29 Apr, 2019

3 commits

  • Now that tag drivers dynamically register, we don't need the static
    table. Remove it. This also means the tag driver structures can be
    made static.

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

    Andrew Lunn
     
  • When a DSA switch driver is unloaded, the lock on the tag driver
    should be released so the module can be unloaded. Add the needed calls,
    but leave the actual release code as a stub.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli

    v2

    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • dsa_resolve_tag_protocol() is used to find the tagging driver needed
    by a switch driver. When the tagging drivers become modules, it will
    be necassary to take a reference on the module to prevent it being
    unloaded. So rename this function to _get() to indicate it has some
    locking properties.

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

    Andrew Lunn
     

04 Mar, 2019

1 commit

  • KSZ9893 switch is similar to KSZ9477 switch except the ingress tail tag
    has 1 byte instead of 2 bytes. The size of the portmap is smaller and
    so the override and lookup bits are also moved.

    Signed-off-by: Tristram Ha
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Tristram Ha
     

25 Feb, 2019

1 commit


22 Feb, 2019

2 commits

  • In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
    add support for a function that processes the
    SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS and
    SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attributes and returns not
    supported for any flag set, since DSA does not currently support
    toggling those bridge port attributes (yet).

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

    Florian Fainelli
     
  • The Linux bridge implementation allows various properties of the bridge
    to be controlled, such as flooding unknown unicast and multicast frames.
    This patch adds the necessary DSA infrastructure to allow the Linux
    bridge support to control these properties for DSA switches.

    Reviewed-by: Vivien Didelot
    Signed-off-by: Russell King
    [florian: Add missing dp and ds variables declaration to fix build]
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Russell King
     

18 Jan, 2019

1 commit

  • Drivers may not be able to support certain FDB entries, and an error
    code is insufficient to give clear hints as to the reasons of rejection.

    In order to make it possible to communicate the rejection reason, extend
    ndo_fdb_add() with an extack argument. Adapt the existing
    implementations of ndo_fdb_add() to take the parameter (and ignore it).
    Pass the extack parameter when invoking ndo_fdb_add() from rtnl_fdb_add().

    Signed-off-by: Petr Machata
    Signed-off-by: David S. Miller

    Petr Machata
     

17 Dec, 2018

1 commit

  • Rename the tag Kconfig option and related macros in preparation for
    addition of new KSZ family switches with different tag formats.

    Signed-off-by: Tristram Ha
    Signed-off-by: Marek Vasut
    Cc: Vivien Didelot
    Cc: Woojung Huh
    Cc: David S. Miller
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Tristram Ha
     

13 Sep, 2018

1 commit

  • This handles the tag added by the PMAC on the VRX200 SoC line.

    The GSWIP uses internally a GSWIP special tag which is located after the
    Ethernet header. The PMAC which connects the GSWIP to the CPU converts
    this special tag used by the GSWIP into the PMAC special tag which is
    added in front of the Ethernet header.

    This was tested with GSWIP 2.1 found in the VRX200 SoCs, other GSWIP
    versions use slightly different PMAC special tags.

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

    Hauke Mehrtens
     

08 Sep, 2018

1 commit

  • There is no way for user-space to know what a given DSA network device's
    tagging protocol is. Expose this information through a dsa/tagging
    attribute which reflects the tagging protocol currently in use.

    This is helpful for configuration (e.g: none behaves dramatically
    different wrt. bridges) as well as for packet capture tools when there
    is not a proper Ethernet type available.

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

    Florian Fainelli
     

12 May, 2018

1 commit

  • Add support for PHYLINK within the DSA subsystem in order to support more
    complex devices such as pluggable (SFP) and non-pluggable (SFF) modules, 10G
    PHYs, and traditional PHYs. Using PHYLINK allows us to drop some amount of
    complexity we had while probing fixed and non-fixed PHYs using Device Tree.

    Because PHYLINK separates the Ethernet MAC/port configuration into different
    stages, we let switch drivers implement those, and for now, we maintain
    functionality by calling dsa_slave_adjust_link() during
    phylink_mac_link_{up,down} which provides semantically equivalent steps.

    Drivers willing to take advantage of PHYLINK should implement the phylink_mac_*
    operations that DSA wraps.

    We cannot quite remove the adjust_link() callback just yet, because a number of
    drivers rely on that for configuring their "CPU" and "DSA" ports, this is done
    dsa_port_setup_phy_of() and dsa_port_fixed_link_register_of() still.

    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.

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

    Florian Fainelli
     

08 Apr, 2018

1 commit

  • The Marvell switches under some conditions will pass a frame to the
    host with the port being the CPU port. Such frames are invalid, and
    should be dropped. Not dropping them can result in a crash when
    incrementing the receive statistics for an invalid port.

    Reported-by: Chris Healy
    Fixes: 91da11f870f0 ("net: Distributed Switch Architecture protocol support")
    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     

24 Jan, 2018

1 commit

  • This adds support for enabling the internal PHY for a 'cpu' port.
    It has been tested on GE B850v3, B650v3 and B450v3, which have a
    built-in MV88E6240 switch hardwired to a PCIe based network card.
    On these machines the internal PHY of the i210 network card and
    the Marvell switch are connected to each other and must be enabled
    for properly using the switch. While the i210 PHY will be enabled
    when the network interface is enabled, the switch's port is not
    exposed as network interface. Additionally the mv88e6xxx driver
    resets the chip during probe, so the PHY is disabled without this
    patch.

    Signed-off-by: Sebastian Reichel
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Sebastian Reichel
     

03 Jan, 2018

1 commit

  • We need to make the dsa_legacy_register() stub return 0 in order for
    dsa_init_module() to successfully register and continue registering the
    ETH_P_XDSA packet handler.

    Fixes: 2a93c1a3651f ("net: dsa: Allow compiling out legacy support")
    Reported-by: Egil Hjelmeland
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

08 Dec, 2017

1 commit

  • Introduce a configuration option: CONFIG_NET_DSA_LEGACY allowing to compile out
    support for the old platform device and Device Tree binding registration.
    Support for these configurations is scheduled to be removed in 4.17.

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

    Florian Fainelli
     

13 Nov, 2017

1 commit

  • Add a new type: DSA_TAG_PROTO_PREPEND which allows us to support for the
    4-bytes Broadcom tag that we already support, but in a format where it
    is pre-pended to the packet instead of located between the MAC SA and
    the Ethertyper (DSA_TAG_PROTO_BRCM).

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

    Florian Fainelli
     

10 Nov, 2017

1 commit


09 Nov, 2017

1 commit


01 Nov, 2017

1 commit


28 Oct, 2017

1 commit

  • The new bindings (dsa2.c) and the old bindings (legacy.c) share two
    helpers dsa_cpu_dsa_setup and dsa_cpu_dsa_destroy, used to register or
    deregister a fixed PHY if a given port has a corresponding device node.

    Unclutter the code by moving them into two new port.c helpers,
    dsa_port_fixed_link_register_of and dsa_port_fixed_link_(un)register_of.

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

    Vivien Didelot
     

18 Oct, 2017

4 commits

  • The dsa_port structure has a "netdev" member, which can be used for
    either the master device, or the slave device, depending on its type.

    It is true that today, CPU port are not exposed to userspace, thus the
    port's netdev member can be used to point to its master interface.

    But it is still slightly confusing, so split it into more explicit
    "master" and "slave" members inside an anonymous union.

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

    Vivien Didelot
     
  • The dsa_master_get_slave is slightly confusing since the idiomatic "get"
    term often suggests reference counting, in symmetry to "put".

    Rename it to dsa_master_find_slave to make the look up operation clear.

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

    Vivien Didelot
     
  • Many part of the DSA slave code require to get the master device
    assigned to a slave device. Remove dsa_master_netdev() in favor of a
    dsa_slave_to_master() helper which does that.

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

    Vivien Didelot
     
  • Many portions of DSA core code require to get the dsa_port structure
    corresponding to a slave net_device. For this purpose, introduce a
    dsa_slave_to_port() helper.

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

    Vivien Didelot
     

01 Oct, 2017

3 commits

  • With DSA, a master net device (CPU facing interface) has a dsa_ptr
    pointer to which hangs a dsa_switch_tree. This is not correct because a
    master interface is wired to a dedicated switch port, and because we can
    theoretically have several master interfaces pointing to several CPU
    ports of the same switch fabric.

    Change the master interface's dsa_ptr for the CPU dsa_port pointer.
    This is a step towards supporting multiple CPU ports.

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

    Vivien Didelot
     
  • The DSA tagging protocol operations are specific to each CPU port,
    thus the dsa_device_ops pointer belongs to the dsa_port structure.

    >From now on assign a slave's xmit copy from its CPU port tagging
    operations. This will ease the future support for multiple CPU ports.

    Also keep the tag_ops at the beginning of the dsa_port structure so that
    we ensure copies for hot path are in cacheline 1.

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

    Vivien Didelot
     
  • The DSA tagging code does not need to know about the DSA architecture,
    it only needs to return the slave device corresponding to the source
    port index (and eventually the source device index for cascade-capable
    switches) parsed from the frame received on the master device.

    For this purpose, provide an inline dsa_master_get_slave helper which
    validates the device and port indexes and look up the slave device.

    This makes the tagging rcv functions more concise and robust, and also
    makes dsa_get_cpu_port obsolete.

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

    Vivien Didelot
     

27 Sep, 2017

1 commit

  • There is no need to store a phy_device in dsa_slave_priv since
    net_device already provides one. Simply s/p->phy/dev->phydev/.

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

    Vivien Didelot
     

26 Sep, 2017

1 commit

  • Provide dsa_port_enable and dsa_port_disable helpers to respectively
    enable and disable a switch port. This makes the dsa_port_set_state_now
    helper static.

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

    Vivien Didelot
     

22 Sep, 2017

1 commit

  • Dumping a DSA port's FDB entries is not specific to a DSA slave, so add
    a dsa_port_fdb_dump function, similarly to dsa_port_fdb_add and
    dsa_port_fdb_del.

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

    Vivien Didelot