13 May, 2019

1 commit

  • The sk_buff control block can have any contents on xmit put there by the
    stack, so initialization is mandatory, since we are checking its value
    after the actual DSA xmit (the tagger may have changed it).

    The DSA_SKB_ZERO() macro could have been used for this purpose, but:
    - Zeroizing a 48-byte memory region in the hotpath is best avoided.
    - It would have triggered a warning with newer compilers since
    __dsa_skb_cb contains a structure within a structure, and the {0}
    initializer was incorrect for that purpose.

    So simply remove the DSA_SKB_ZERO() macro and initialize the
    deferred_xmit variable by hand (which should be done for all further
    dsa_skb_cb variables which need initialization - currently none - to
    avoid the performance penalty).

    Fixes: 97a69a0dea9a ("net: dsa: Add support for deferred xmit")
    Signed-off-by: Vladimir Oltean
    Signed-off-by: David S. Miller

    Vladimir Oltean
     

08 May, 2019

1 commit

  • There was NVMEM support added to of_get_mac_address, so it could now
    return ERR_PTR encoded error values, so we need to adjust all current
    users of of_get_mac_address to this new fact.

    While at it, remove superfluous is_valid_ether_addr as the MAC address
    returned from of_get_mac_address is always valid and checked by
    is_valid_ether_addr anyway.

    Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
    Signed-off-by: Petr Štetiar
    Tested-by: Vladimir Oltean
    Signed-off-by: David S. Miller

    Petr Štetiar
     

06 May, 2019

2 commits

  • 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
     
  • Updates dsa hardware switch handling infrastructure to use the newer
    intermediate representation for flow actions in matchall offloads.

    Signed-off-by: Pieter Jansen van Vuuren
    Reviewed-by: Jakub Kicinski
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Pieter Jansen van Vuuren
     

01 May, 2019

1 commit

  • 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
     

05 Apr, 2019

1 commit


02 Apr, 2019

1 commit


29 Mar, 2019

2 commits


27 Mar, 2019

1 commit

  • When phylink_of_phy_connect fails, dsa_slave_phy_setup tries to save the
    day by connecting to an alternative PHY, none other than a PHY on the
    switch's internal MDIO bus, at an address equal to the port's index.

    However this does not take into consideration the scenario when the
    switch that failed to probe an external PHY does not have an internal
    MDIO bus at all.

    Fixes: aab9c4067d23 ("net: dsa: Plug in PHYLINK support")
    Signed-off-by: Vladimir Oltean
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vladimir Oltean
     

04 Mar, 2019

1 commit

  • We were skipping the prepare phase which causes some problems with at
    least a couple of drivers:

    - mv88e6xxx chooses to skip programming VID = 0 with -EOPNOTSUPP in
    the prepare phase, but we would still try to force this VID since we
    would only call the commit phase and so we would get the driver to
    return -EINVAL instead

    - qca8k does not currently have a port_vlan_add() callback implemented,
    yet we would try to call that unconditionally leading to a NPD

    Fix both issues by conforming to the current model doing a
    prepare/commit phase, this makes us consistent throughout the code and
    assumptions.

    Reported-by: Heiner Kallweit
    Reported-by: Michal Vokáč
    Fixes: 061f6a505ac3 ("net: dsa: Add ndo_vlan_rx_{add, kill}_vid implementation")
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

28 Feb, 2019

2 commits

  • Now that we have converted all possible callers to using a switchdev
    notifier for attributes we do not have a need for implementing
    switchdev_ops anymore, and this can be removed from all drivers the
    net_device structure.

    Signed-off-by: Florian Fainelli
    Reviewed-by: Ido Schimmel
    Signed-off-by: David S. Miller

    Florian Fainelli
     
  • Following patches will change the way we communicate setting a port's
    attribute and use notifiers towards that goal.

    Prepare DSA to support receiving notifier events targeting
    SWITCHDEV_PORT_ATTR_SET from both atomic and process context and use a
    small helper to translate the event notifier into something that
    dsa_slave_port_attr_set() can process.

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

    Florian Fainelli
     

25 Feb, 2019

1 commit


23 Feb, 2019

2 commits

  • In order to properly support VLAN filtering being enabled/disabled on a
    bridge, while having other ports being non bridge port members, we need
    to support the ndo_vlan_rx_{add,kill}_vid callbacks in order to make
    sure the non-bridge ports can continue receiving VLAN tags, even when
    the switch is globally configured to do ingress/egress VID checking.

    Since we can call dsa_port_vlan_{add,del} with a bridge_dev pointer
    NULL, we now need to check that in these two functions.

    We specifically deal with two possibly problematic cases:

    - creating a bridge VLAN entry while there is an existing VLAN device
    claiming that same VID

    - creating a VLAN device while there is an existing bridge VLAN entry
    with that VID

    Those are both resolved with returning -EBUSY back to user-space.

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

    Florian Fainelli
     
  • VLAN devices on top of a DSA network device which is already part of a
    bridge and with said bridge being VLAN aware should not be allowed to be
    enslaved into that bridge. For one, this duplicates functionality
    offered by the VLAN aware bridge which supports tagged and untagged VLAN
    frames processing and it would make things needlessly complex to e.g.:
    propagate FDB/MDB accordingly.

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

    Florian Fainelli
     

22 Feb, 2019

4 commits

  • With the bridge no longer calling switchdev_port_attr_get() to obtain
    the supported bridge port flags from a driver but instead trying to set
    the bridge port flags directly and relying on driver to reject
    unsupported configurations, we can effectively get rid of
    switchdev_port_attr_get() entirely since this was the only place where
    it was called.

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

    Florian Fainelli
     
  • Now that we have converted the bridge code and the drivers to check for
    bridge port(s) flags at the time we try to set them, there is no need
    for a get() -> set() sequence anymore and
    SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT therefore becomes unused.

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

    Florian Fainelli
     
  • 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
     

09 Feb, 2019

1 commit


07 Feb, 2019

2 commits

  • DSA implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
    of switchdev_ops eventually, ease that migration by implementing a
    ndo_get_port_parent_id() function which returns what
    switchdev_port_attr_get() would do.

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

    Florian Fainelli
     
  • This function can't succeed if dp->pl is NULL. It will Oops inside the
    call to return phylink_ethtool_get_eee(dp->pl, e);

    Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
    Signed-off-by: Dan Carpenter
    Reviewed-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Dan Carpenter
     

05 Feb, 2019

1 commit

  • The unbalance of master's promiscuity or allmulti will happen after ifdown
    and ifup a slave interface which is in a bridge.

    When we ifdown a slave interface , both the 'dsa_slave_close' and
    'dsa_slave_change_rx_flags' will clear the master's flags. The flags
    of master will be decrease twice.
    In the other hand, if we ifup the slave interface again, since the
    slave's flags were cleared the 'dsa_slave_open' won't set the master's
    flag, only 'dsa_slave_change_rx_flags' that triggered by 'br_add_if'
    will set the master's flags. The flags of master is increase once.

    Only propagating flag changes when a slave interface is up makes
    sure this does not happen. The 'vlan_dev_change_rx_flags' had the
    same problem and was fixed, and changes here follows that fix.

    Fixes: 91da11f870f0 ("net: Distributed Switch Architecture protocol support")
    Signed-off-by: Rundong Ge
    Signed-off-by: David S. Miller

    Rundong Ge
     

18 Jan, 2019

2 commits

  • A follow-up patch will enable vetoing of FDB entries. Make it possible
    to communicate details of why an FDB entry is not acceptable back to the
    user.

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

    Petr Machata
     
  • 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
     

10 Dec, 2018

1 commit

  • Several conflicts, seemingly all over the place.

    I used Stephen Rothwell's sample resolutions for many of these, if not
    just to double check my own work, so definitely the credit largely
    goes to him.

    The NFP conflict consisted of a bug fix (moving operations
    past the rhashtable operation) while chaning the initial
    argument in the function call in the moved code.

    The net/dsa/master.c conflict had to do with a bug fix intermixing of
    making dsa_master_set_mtu() static with the fixing of the tagging
    attribute location.

    cls_flower had a conflict because the dup reject fix from Or
    overlapped with the addition of port range classifiction.

    __set_phy_supported()'s conflict was relatively easy to resolve
    because Andrew fixed it in both trees, so it was just a matter
    of taking the net-next copy. Or at least I think it was :-)

    Joe Stringer's fix to the handling of netns id 0 in bpf_sk_lookup()
    intermixed with changes on how the sdif and caller_net are calculated
    in these code paths in net-next.

    The remaining BPF conflicts were largely about the addition of the
    __bpf_md_ptr stuff in 'net' overlapping with adjustments and additions
    to the relevant data structure where the MD pointer macros are used.

    Signed-off-by: David S. Miller

    David S. Miller
     

01 Dec, 2018

1 commit

  • While introducing the DSA tagging protocol attribute, it was added to the DSA
    slave network devices, but those actually see untagged traffic (that is their
    whole purpose). Correct this mistake by putting the tagging sysfs attribute
    under the DSA master network device where this is the information that we need.

    While at it, also correct the sysfs documentation mistake that missed the
    "dsa/" directory component of the attribute.

    Fixes: 98cdb4807123 ("net: dsa: Expose tagging protocol to user-space")
    Signed-off-by: Florian Fainelli
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Florian Fainelli
     

24 Nov, 2018

2 commits

  • Drop switchdev_ops.switchdev_port_obj_add and _del. Drop the uses of
    this field from all clients, which were migrated to use switchdev
    notification in the previous patches.

    Add a new function switchdev_port_obj_notify() that sends the switchdev
    notifications SWITCHDEV_PORT_OBJ_ADD and _DEL.

    Update switchdev_port_obj_del_now() to dispatch to this new function.
    Drop __switchdev_port_obj_add() and update switchdev_port_obj_add()
    likewise.

    Signed-off-by: Petr Machata
    Reviewed-by: Ido Schimmel
    Signed-off-by: David S. Miller

    Petr Machata
     
  • Following patches will change the way of distributing port object
    changes from a switchdev operation to a switchdev notifier. The
    switchdev code currently recursively descends through layers of lower
    devices, eventually calling the op on a front-panel port device. The
    notifier will instead be sent referencing the bridge port device, which
    may be a stacking device that's one of front-panel ports uppers, or a
    completely unrelated device.

    DSA currently doesn't support any other uppers than bridge.
    SWITCHDEV_OBJ_ID_HOST_MDB and _PORT_MDB objects are always notified on
    the bridge port device. Thus the only case that a stacked device could
    be validly referenced by port object notifications are bridge
    notifications for VLAN objects added to the bridge itself. But the
    driver explicitly rejects such notifications in dsa_port_vlan_add(). It
    is therefore safe to assume that the only interesting case is that the
    notification is on a front-panel port netdevice. Therefore keep the
    filtering by dsa_slave_dev_check() in place.

    To handle SWITCHDEV_PORT_OBJ_ADD and _DEL, subscribe to the blocking
    notifier chain. Dispatch to rocker_port_obj_add() resp. _del() to
    maintain the behavior that the switchdev operation based code currently
    has.

    Signed-off-by: Petr Machata
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Petr Machata
     

20 Oct, 2018

1 commit

  • This fixes a problem introduced by:
    commit 2cde6acd49da ("netpoll: Fix __netpoll_rcu_free so that it can hold the rtnl lock")

    When using netconsole on a bond, __netpoll_cleanup can asynchronously
    recurse multiple times, each __netpoll_free_async call can result in
    more __netpoll_free_async's. This means there is now a race between
    cleanup_work queues on multiple netpoll_info's on multiple devices and
    the configuration of a new netpoll. For example if a netconsole is set
    to enable 0, reconfigured, and enable 1 immediately, this netconsole
    will likely not work.

    Given the reason for __netpoll_free_async is it can be called when rtnl
    is not locked, if it is locked, we should be able to execute
    synchronously. It appears to be locked everywhere it's called from.

    Generalize the design pattern from the teaming driver for current
    callers of __netpoll_free_async.

    CC: Neil Horman
    CC: "David S. Miller"
    Signed-off-by: Debabrata Banerjee
    Signed-off-by: David S. Miller

    Debabrata Banerjee
     

18 Oct, 2018

1 commit

  • Currently, an FDB entry only ceases being offloaded when it is deleted.
    This changes with VxLAN encapsulation.

    Devices capable of performing VxLAN encapsulation usually have only one
    FDB table, unlike the software data path which has two - one in the
    bridge driver and another in the VxLAN driver.

    Therefore, bridge FDB entries pointing to a VxLAN device are only
    offloaded if there is a corresponding entry in the VxLAN FDB.

    Allow clearing the offload indication in case the corresponding entry
    was deleted from the VxLAN FDB.

    Signed-off-by: Ido Schimmel
    Reviewed-by: Petr Machata
    Signed-off-by: David S. Miller

    Ido Schimmel
     

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
     

22 Aug, 2018

1 commit

  • After commit 90b73b77d08e, list_head is no longer needed.
    Now we just need to convert the list iteration to array
    iteration for drivers.

    Fixes: 90b73b77d08e ("net: sched: change action API to use array of pointers to actions")
    Cc: Jiri Pirko
    Cc: Vlad Buslov
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

10 Aug, 2018

1 commit


09 Aug, 2018

1 commit

  • For a port to be able to use EEE, both the MAC and the PHY must
    support EEE. A phy can be provided by both a phydev or phylink. Verify
    at least one of these exist, not just phydev.

    Fixes: aab9c4067d23 ("net: dsa: Plug in PHYLINK support")
    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     

03 Aug, 2018

1 commit


02 Aug, 2018

1 commit


26 Jun, 2018

1 commit

  • Pass the extact struct from a tc qdisc add to the block bind function and,
    in turn, to the setup_tc ndo of binding device via the tc_block_offload
    struct. Pass this back to any block callback registrations to allow
    netlink logging of fails in the bind process.

    Signed-off-by: John Hurley
    Signed-off-by: Jakub Kicinski
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    John Hurley
     

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