27 Mar, 2020

40 commits

  • This patch adds a new MACsec offloading option, MACSEC_OFFLOAD_MAC,
    allowing a user to select a MAC as a provider for MACsec offloading
    operations.

    Signed-off-by: Antoine Tenart
    Signed-off-by: Mark Starovoytov
    Signed-off-by: Igor Russkikh
    Signed-off-by: David S. Miller

    Antoine Tenart
     
  • This patch allows to reference a net_device from a MACsec context. This
    is needed to allow implementing MACsec operations in net device drivers.

    Signed-off-by: Antoine Tenart
    Signed-off-by: Mark Starovoytov
    Signed-off-by: Igor Russkikh
    Signed-off-by: David S. Miller

    Antoine Tenart
     
  • This patch adds a reference to MACsec ops to the net_device structure,
    allowing net device drivers to implement offloading operations for
    MACsec.

    Signed-off-by: Antoine Tenart
    Signed-off-by: Mark Starovoytov
    Signed-off-by: Igor Russkikh
    Signed-off-by: David S. Miller

    Antoine Tenart
     
  • This patch introduce a new netdev feature, which will be used by drivers
    to state they can perform MACsec transformations in hardware.

    The patchset was gathered by Mark, macsec functinality itself
    was implemented by Dmitry, Mark and Pavel Belous.

    Signed-off-by: Antoine Tenart
    Signed-off-by: Mark Starovoytov
    Signed-off-by: Igor Russkikh
    Signed-off-by: David S. Miller

    Antoine Tenart
     
  • BIT() macro definition is internal to the Linux kernel and is not
    to be used in UAPI headers; replace its usage with the _BITUL() macro
    that is already used elsewhere in the header.

    Fixes: 9c66d1564676 ("taprio: Add support for hardware offloading")
    Signed-off-by: Eugene Syromiatnikov
    Acked-by: Vladimir Oltean
    Signed-off-by: David S. Miller

    Eugene Syromiatnikov
     
  • This is trivial since we already have support for the entirely
    identical (from the kernel's point of view) RDNSS, DNSSL, etc. that
    also contain opaque data that needs to be passed down to userspace
    for further processing.

    As specified in draft-ietf-6man-ra-pref64-09 (while it is still a draft,
    it is purely waiting on the RFC Editor for cleanups and publishing):
    PREF64 option contains lifetime and a (up to) 96-bit IPv6 prefix.

    The 8-bit identifier of the option type as assigned by the IANA is 38.

    Since we lack DNS64/NAT64/CLAT support in kernel at the moment,
    thus this option should also be passed on to userland.

    See:
    https://tools.ietf.org/html/draft-ietf-6man-ra-pref64-09
    https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5

    Cc: Erik Kline
    Cc: Jen Linkova
    Cc: Lorenzo Colitti
    Cc: Michael Haro
    Signed-off-by: Maciej Żenczykowski
    Acked-By: Lorenzo Colitti
    Signed-off-by: David S. Miller

    Maciej Żenczykowski
     
  • Grygorii Strashko says:

    ====================
    net: ethernet: ti: add networking support for k3 am65x/j721e soc

    This v6 series adds basic networking support support TI K3 AM654x/J721E SoC which
    have integrated Gigabit Ethernet MAC (Media Access Controller) into device MCU
    domain and named MCU_CPSW0 (CPSW2G NUSS).

    Formally TRMs refer CPSW2G NUSS as two-port Gigabit Ethernet Switch subsystem
    with port 0 being the CPPI DMA host port and port 1 being the external Ethernet
    port, but for 1 external port device it's just Port 0 ALE Port 1 and it's
    rather device with HW filtering capabilities then actually switching device.
    It's expected to have similar devices, but with more external ports.

    The new Host port 0 Communications Port Programming Interface (CPPI5) is
    operating by TI AM654x/J721E NAVSS Unified DMA Peripheral Root Complex (UDMA-P)
    controller [1].

    The CPSW2G contains below modules for which existing code is re-used:
    - MAC SL: cpsw_sl.c
    - Address Lookup Engine (ALE): cpsw_ale.c, basically compatible with K2 66AK2E/G
    - Management Data Input/Output interface (MDIO): davinci_mdio.c, fully
    compatible with TI AM3/4/5 devices

    Basic features supported by CPSW2G NUSS driver:
    - VLAN support, 802.1Q compliant, Auto add port VLAN for untagged frames on
    ingress, Auto VLAN removal on egress and auto pad to minimum frame size.
    - multicast filtering
    - promisc mode
    - TX multiq support in Round Robin or Fixed priority modes
    - RX checksum offload for non-fragmented IPv4/IPv6 TCP/UDP packets
    - TX checksum offload support for IPv4/IPv6 TCP/UDP packets (J721E only).

    Features under development:
    - Support for IEEE 1588 Clock Synchronization. The CPSW2G NUSS includes new
    version of Common Platform Time Sync (CPTS)
    - tc-mqprio: priority level Quality Of Service (QOS) support (802.1p)
    - tc-cbs: Support for Audio/Video Bridging (P802.1Qav/D6.0) HW shapers
    - tc-taprio: IEEE 802.1Qbv/D2.2 Enhancements for Scheduled Traffic
    - frame preemption: IEEE P902.3br/D2.0 Interspersing Express Traffic, 802.1Qbu
    - extended ALE features: classifier/policers, auto-aging

    Patches 1-6 are intended for netdev, Patches 7-11 are intended for K3 Platform
    tree and provided here for testing purposes.

    Changes in v6:
    - fixed comments from Rob Herring and added his Reviewed-by.
    - added Tested-by: Peter Ujfalusi

    Changes in v5:
    - renamed files k3-udma-desc-pool.* k3-udma-desc-pool to k3-cppi-desc-pool.*,
    and API to k3_cppi_desc_pool_* as requested by Peter Ujfalusi
    - fixed copy-paste err in am65_cpsw_nuss_ndo_slave_set_rx_mode() which blocked
    recieving of mcast frames.
    - added Tested-by: Murali Karicheri

    Changes in v4:
    - fixed minor comments from Jakub Kicinski
    - dependencies resolved: required phy-rmii-sel changes [2] queued for merge
    except one [3] which is included in this series with Kishon's ask.

    Changes in v3:
    - add ARM64 defconfig changes for testing purposes
    - fixed DT yaml definition
    - fixed comments from Jakub Kicinski

    Changes in v2:
    - fixed DT yaml definition
    - fixed comments from David Miller

    v5: https://patchwork.ozlabs.org/cover/1258295/
    v4: https://patchwork.ozlabs.org/cover/1256092/
    v3: https://patchwork.ozlabs.org/cover/1254568/
    v2: https://patchwork.ozlabs.org/cover/1250674/
    v1: https://lwn.net/Articles/813087/

    TRMs:
    AM654: http://www.ti.com/lit/ug/spruid7e/spruid7e.pdf
    J721E: http://www.ti.com/lit/ug/spruil1a/spruil1a.pdf

    Preliminary documentation can be found at:
    http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/K3_CPSW2g.html

    [1] https://lwn.net/Articles/808030/
    [2] https://lkml.org/lkml/2020/2/22/100
    [3] https://lkml.org/lkml/2020/3/3/724
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Enable TI K3 AM654x/J721E DMA and networking options.

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • The TI J721E EVM base board has TI DP83867 PHY connected to external CPSW
    NUSS Port 1 in rgmii-rxid mode.

    Hence, add pinmux and Ethernet PHY configuration for TI j721e SoC MCU
    Gigabit Ethernet two ports Switch subsystem (CPSW NUSS).

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • Add DT node for The TI J721E MCU SoC Gigabit Ethernet
    subsystem (MCU CPSW NUSS).

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • AM654 EVM base board has TI DP83867 PHY connected to external CPSW NUSS
    Port 1 in rgmii-rxid mode.

    Hence, add pinmux and Ethernet PHY configuration for TI am654 SoC Gigabit
    Ethernet two ports Switch subsystem (CPSW NUSS).

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • Add DT node for the TI AM65x SoC Gigabit Ethernet two ports Switch
    subsystem (CPSW NUSS).

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • The TI AM65x/J721E SoCs Gigabit Ethernet Switch subsystem (CPSW2G NUSS) has
    two ports - One Ethernet port (port 1) with selectable RGMII and RMII
    interfaces and an internal Communications Port Programming Interface (CPPI)
    port (Host port 0) and with ALE in between. It also contains
    - Management Data Input/Output (MDIO) interface for physical layer device
    (PHY) management;
    - Updated Address Lookup Engine (ALE) module;
    - (TBD) New version of Common platform time sync (CPTS) module.

    On the TI am65x/J721E SoCs CPSW NUSS Ethernet subsystem into device MCU
    domain named MCU_CPSW0.

    Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX
    channels and one RX channels operating by TI am654 NAVSS Unified DMA
    Peripheral Root Complex (UDMA-P) controller.

    Introduced driver provides standard Linux net_device to user space and supports:
    - ifconfig up/down
    - MAC address configuration
    - ethtool operation:
    --driver
    --change
    --register-dump
    --negotiate phy
    --statistics
    --set-eee phy
    --show-ring
    --show-channels
    --set-channels
    - net_device ioctl mii-control
    - promisc mode

    - rx checksum offload for non-fragmented IPv4/IPv6 TCP/UDP packets.
    The CPSW NUSS can verify IPv4/IPv6 TCP/UDP packets checksum and fills
    csum information for each packet in psdata[2] word:
    - BIT(16) CHECKSUM_ERROR - indicates csum error
    - BIT(17) FRAGMENT - indicates fragmented packet
    - BIT(18) TCP_UDP_N - Indicates TCP packet was detected
    - BIT(19) IPV6_VALID, BIT(20) IPV4_VALID - indicates IPv6/IPv4 packet
    - BIT(15, 0) CHECKSUM_ADD - This is the value that was summed
    during the checksum computation. This value is FFFFh for non fragmented
    IPV4/6 UDP/TCP packets with no checksum error.

    RX csum offload can be disabled:
    ethtool -K rx-checksum on|off

    - tx checksum offload support for IPv4/IPv6 TCP/UDP packets (J721E only).
    TX csum HW offload can be enabled/disabled:
    ethtool -K tx-checksum-ip-generic on|off

    - multiq and switch between round robin/prio modes for cppi tx queues by
    using Netdev private flag "p0-rx-ptype-rrobin" to switch between
    Round Robin and Fixed priority modes:
    # ethtool --show-priv-flags eth0
    Private flags for eth0:
    p0-rx-ptype-rrobin: on
    # ethtool --set-priv-flags eth0 p0-rx-ptype-rrobin off

    Number of TX DMA channels can be changed using "ethtool -L eth0 tx ".

    - GRO support: the napi_gro_receive() and napi_complete_done() are used.

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • Document device tree bindings for The TI AM654x/J721E SoC Gigabit Ethernet MAC
    (Media Access Controller - CPSW2G NUSS). The CPSW NUSS provides Ethernet packet
    communication for the device.

    Signed-off-by: Grygorii Strashko
    Reviewed-by: Rob Herring
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • Add support for default thread configuration for AM65x CPSW NUSS ALE to
    allow route all ingress packets to one default RX UDMA flow.

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • The new CPSW ALE version, available on TI K3 AM654/J721E SoCs family,
    allows to switch any external port to MAC only mode. When MAC only mode
    enabled this port be treated like a MAC port for the host. All traffic
    received is only sent to the host. The host must direct traffic to this
    port as the lookup engine will not send traffic to the ports with the
    p0_maconly bit set and the p0_no_learn also set. If p0_maconly bit is set
    and the p0_no_learn is not set, the host can send non-directed packets that
    can be sent to the destination of a MacOnly port. It is also possible that
    The host can broadcast to all ports including MacOnly ports in this mode.

    This patch add ALE supprt for MAC only mode.

    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • On AM65xx MCU CPSW2G NUSS and 66AK2E/L NUSS the unregistered multicast
    packets are still can be received with promisc and allmulti disabled.

    This happens, because ALE VLAN entries on these SoCs do not contain port
    masks for reg/unreg mcast packets, but instead store indexes of
    ALE_VLAN_MASK_MUXx_REG registers which intended for store port masks for
    reg/unreg mcast packets.

    ALE VLAN entry:UNREG_MCAST_FLOOD_INDEX -> ALE_VLAN_MASK_MUXx
    ALE VLAN entry:REG_MCAST_FLOOD_INDEX -> ALE_VLAN_MASK_MUXy

    The commit b361da837392 ("net: netcp: ale: add proper ale entry mask bits
    for netcp switch ALE") update ALE code to support such ALE entries, it is
    always used ALE_VLAN_MASK_MUX0_REG index in ALE VLAN entry for unreg mcast
    packets mask configuration, which is read-only, at least for AM65xx MCU
    CPSW2G NUSS and 66AK2E/L NUSS. As result unreg mcast packets are allowed
    always.

    Hence, update ALE code to use ALE_VLAN_MASK_MUX1_REG index for ALE VLAN
    entries to configure unreg mcast port mask.

    Fixes: b361da837392 ("net: netcp: ale: add proper ale entry mask bits for netcp switch ALE")
    Signed-off-by: Grygorii Strashko
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • The phy-gmii-sel can be only auto selected in Kconfig and now the pretty
    complex Kconfig dependencies are defined for phy-gmii-sel driver, which
    also need to be updated every time phy-gmii-sel is re-used for any new
    networking driver.

    Simplify Kconfig definition for phy-gmii-sel PHY driver - drop all
    dependencies and from networking drivers and rely on using 'imply
    PHY_TI_GMII_SEL' in Kconfig definitions for networking drivers instead.

    Signed-off-by: Grygorii Strashko
    Acked-by: Kishon Vijay Abraham I
    Tested-by: Murali Karicheri
    Tested-by: Peter Ujfalusi
    Signed-off-by: David S. Miller

    Grygorii Strashko
     
  • Guillaume Nault says:

    ====================
    cls_flower: Use extack in fl_set_key()

    Add missing extack messages in fl_set_key(), so that users can get more
    meaningfull error messages when netlink attributes are rejected.

    Patch 1 also extends extack in tcf_change_indev() (in pkt_cls.h) since
    this function is used by fl_set_key().
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Pass extack down to fl_set_key_flags() and set message on error.

    Signed-off-by: Guillaume Nault
    Signed-off-by: David S. Miller

    Guillaume Nault
     
  • Pass extack down to fl_set_key_port_range() and set message on error.

    Both the min and max ports would qualify as invalid attributes here.
    Report the min one as invalid, as it's probably what makes the most
    sense from a user point of view.

    Signed-off-by: Guillaume Nault
    Signed-off-by: David S. Miller

    Guillaume Nault
     
  • Pass extack down to fl_set_key_mpls() and set message on error.

    Signed-off-by: Guillaume Nault
    Signed-off-by: David S. Miller

    Guillaume Nault
     
  • Add an error message when device wasn't found.
    While there, also set the bad attribute's offset in extack.

    Signed-off-by: Guillaume Nault
    Signed-off-by: David S. Miller

    Guillaume Nault
     
  • Tobias Waldekranz says:

    ====================
    net: phy: marvell usb to mdio controller

    Support for an MDIO controller present on development boards for
    Marvell switches from the Link Street (88E6xxx) family.

    v3->v4:
    - Remove unnecessary dependency on OF_MDIO.

    v2->v3:
    - Rename driver smi2usb -> mvusb.
    - Clean up unused USB references.

    v1->v2:
    - Reverse christmas tree ordering of local variables.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • An MDIO controller present on development boards for Marvell switches
    from the Link Street (88E6xxx) family.

    Using this module, you can use the following setup as a development
    platform for switchdev and DSA related work.

    .-------. .-----------------.
    | USB----USB |
    | SoC | | 88E6390X-DB ETH1-10
    | ETH----ETH0 |
    '-------' '-----------------'

    Signed-off-by: Tobias Waldekranz
    Reviewed-by: Greg Kroah-Hartman
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Tobias Waldekranz
     
  • Describe how the USB to MDIO controller can optionally use device tree
    bindings to reference attached devices such as switches.

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

    Tobias Waldekranz
     
  • If we have scenarios like

    mdiobus_register()
    -> loads PHY driver module(s)
    -> registers PHY driver(s)
    -> may schedule async probe
    phydev = mdiobus_get_phy()

    or

    phydev = phy_device_create()
    -> loads PHY driver module
    -> registers PHY driver
    -> may schedule async probe

    then we expect the PHY driver to be bound to the phydev when triggering
    the action. This may not be the case in case of asynchronous probing.
    Therefore ensure that PHY drivers are probed synchronously.

    Default still is sync probing, except async probing is explicitly
    requested. I saw some comments that the intention is to promote
    async probing for more parallelism in boot process and want to be
    prepared for the case that the default is changed to async probing.

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

    Heiner Kallweit
     
  • Jacob Keller says:

    ====================
    implement DEVLINK_CMD_REGION_NEW

    This series adds support for the DEVLINK_CMD_REGION_NEW operation, used to
    enable userspace requesting a snapshot of a region on demand.

    This can be useful to enable adding regions for a driver for which there is
    no trigger to create snapshots. By making this a core part of devlink, there
    is no need for the drivers to use a separate channel such as debugfs.

    The primary intent for this kind of region is to expose device information
    that might be useful for diagnostics and information gathering.

    The first few patches refactor regions to support a new ops structure for
    extending the available operations that regions can perform. This includes
    converting the destructor into an op from a function argument.

    Next, patches refactor the snapshot id allocation to use an xarray which
    tracks the number of current snapshots using a given id. This is done so
    that id lifetime can be determined, and ids can be released when no longer
    in use.

    Without this change, snapshot ids remain used forever, until the snapshot_id
    count rolled over UINT_MAX.

    Finally, code to enable the previously unused DEVLINK_CMD_REGION_NEW is
    added. This code enforces that the snapshot id is always provided, unlike
    previous revisions of this series.

    Finally, a patch is added to enable using this new command via the .snapshot
    callback in both netdevsim and the ice driver.

    For the ice driver, a new "nvm-flash" region is added, which will enable
    read access to the NVM flash contents. The intention for this is to allow
    diagnostics tools to gather information about the device. By using a
    snapshot and gathering the NVM contents all at once, the contents can be
    atomic.

    Links to previous discussions:
    1st RFC - https://lore.kernel.org/netdev/20200130225913.1671982-1-jacob.e.keller@intel.com/
    2nd RFC - https://lore.kernel.org/netdev/20200214232223.3442651-1-jacob.e.keller@intel.com/
    v1 - https://lore.kernel.org/netdev/20200324223445.2077900-1-jacob.e.keller@intel.com/
    v2 - https://lore.kernel.org/netdev/20200326035157.2211090-1-jacob.e.keller@intel.com/

    Major changes since RFC:
    * use an xarray for tracking snapshot ids, rather than an IDR
    * remove support for auto-generated snapshot ids in DEVLINK_CMD_REGION_NEW

    See each patch for an individual changelog per-patch
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Add a devlink region for exposing the device's Non Volatime Memory flash
    contents.

    Support the recently added .snapshot operation, enabling userspace to
    request a snapshot of the NVM contents via DEVLINK_CMD_REGION_NEW.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • Implement the .snapshot region operation for the dummy data region. This
    enables a region snapshot to be taken upon request via the new
    DEVLINK_CMD_REGION_SNAPSHOT command.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • Implement support for the DEVLINK_CMD_REGION_NEW command for creating
    snapshots. This new command parallels the existing
    DEVLINK_CMD_REGION_DEL.

    In order for DEVLINK_CMD_REGION_NEW to work for a region, the new
    ".snapshot" operation must be implemented in the region's ops structure.

    The desired snapshot id must be provided. This helps avoid confusion on
    the purpose of DEVLINK_CMD_REGION_NEW, and keeps the API simpler.

    The requested id will be inserted into the xarray tracking the number of
    snapshots using each id. If this id is already used by another snapshot
    on any region, an error will be returned.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • Each snapshot created for a devlink region must have an id. These ids
    are supposed to be unique per "event" that caused the snapshot to be
    created. Drivers call devlink_region_snapshot_id_get to obtain a new id
    to use for a new event trigger. The id values are tracked per devlink,
    so that the same id number can be used if a triggering event creates
    multiple snapshots on different regions.

    There is no mechanism for snapshot ids to ever be reused. Introduce an
    xarray to store the count of how many snapshots are using a given id,
    replacing the snapshot_id field previously used for picking the next id.

    The devlink_region_snapshot_id_get() function will use xa_alloc to
    insert an initial value of 1 value at an available slot between 0 and
    U32_MAX.

    The new __devlink_snapshot_id_increment() and
    __devlink_snapshot_id_decrement() functions will be used to track how
    many snapshots currently use an id.

    Drivers must now call devlink_snapshot_id_put() in order to release
    their reference of the snapshot id after adding region snapshots.

    By tracking the total number of snapshots using a given id, it is
    possible for the decrement() function to erase the id from the xarray
    when it is not in use.

    With this method, a snapshot id can become reused again once all
    snapshots that referred to it have been deleted via
    DEVLINK_CMD_REGION_DEL, and the driver has finished adding snapshots.

    This work also paves the way to introduce a mechanism for userspace to
    request a snapshot.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • The devlink_snapshot_id_get() function returns a snapshot id. The
    snapshot id is a u32, so there is no way to indicate an error code.

    A future change is going to possibly add additional cases where this
    function could fail. Refactor the function to return the snapshot id in
    an argument, so that it can return zero or an error value.

    This ensures that snapshot ids cannot be confused with error values, and
    aids in the future refactor of snapshot id allocation management.

    Because there is no current way to release previously used snapshot ids,
    add a simple check ensuring that an error is reported in case the
    snapshot_id would over flow.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • A future change is going to implement a new devlink command to request
    a snapshot on demand. As part of this, the logic for handling the
    snapshot ids will be refactored. To simplify the snapshot id allocation
    function, move it to a separate function prefixed by `__`. This helper
    function will assume the lock is held.

    While no other callers will exist, it simplifies refactoring the logic
    because there is no need to complicate the function with gotos to handle
    unlocking on failure.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • The devlink_region_snapshot_create function returns -ENOMEM when the
    maximum number of snapshots has been reached. This is confusing because
    it is not an issue of being out of memory. Change this to use -ENOSPC
    instead.

    Reported-by: Jiri Pirko
    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • A future change is going to add a new devlink command to request
    a snapshot on demand. This function will want to call the
    devlink_region_snapshot_create function while already holding the
    devlink instance lock.

    Extract the logic of this function into a static function prefixed by
    `__` to indicate that it is an internal helper function. Modify the
    original function to be implemented in terms of the new locked
    function.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Reviewed-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • The function documentation comment for devlink_region_snapshot_create
    included a literal tab character between 'future analyses' that was
    difficult to spot as it happened to only display as one space wide.

    Fix the comment to use a space here instead of a stray tab appearing in
    the middle of a sentence.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • It does not makes sense that two snapshots for a given region would use
    different destructors. Simplify snapshot creation by adding
    a .destructor op for regions.

    This operation will replace the data_destructor for the snapshot
    creation, and makes snapshot creation easier.

    Noticed-by: Jakub Kicinski
    Signed-off-by: Jacob Keller
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • Modify the devlink region code in preparation for adding new operations
    on regions.

    Create a devlink_region_ops structure, and move the name pointer from
    within the devlink_region structure into the ops structure (similar to
    the devlink_health_reporter_ops).

    This prepares the regions to enable support of additional operations in
    the future such as requesting snapshots, or accessing the region
    directly without a snapshot.

    In order to re-use the constant strings in the mlx4 driver their
    declaration must be changed to 'const char * const' to ensure the
    compiler realizes that both the data and the pointer cannot change.

    Signed-off-by: Jacob Keller
    Reviewed-by: Jakub Kicinski
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jacob Keller
     
  • Lorenzo Bianconi says:

    ====================
    veth: move ndo_xdp_xmit stats to peer veth_rq

    Move ndo_xdp_xmit ethtool stats accounting to peer veth_rq.
    Move XDP_TX accounting to veth_xdp_flush_bq routine.

    Changes since v1:
    - rename xdp_xmit[_err] counters to peer_tq_xdp_xmit[_err]
    ====================

    Signed-off-by: David S. Miller

    David S. Miller