02 Oct, 2020

13 commits

  • Realtek single-chip Ethernet PHY solutions can be separated as below:
    10M/100Mbps: RTL8201X
    1Gbps: RTL8211X
    2.5Gbps: RTL8226/RTL8221X
    RTL8226 is the first version for realtek that compatible 2.5Gbps single PHY.
    Since RTL8226 is single port only, realtek changes its name to RTL8221B from
    the second version.
    PHY ID for RTL8226 is 0x001cc800 and RTL8226B/RTL8221B is 0x001cc840.

    RTL8125 is not a single PHY solution, it integrates PHY/MAC/PCIE bus
    controller and embedded memory.

    Signed-off-by: Willy Liu
    Signed-off-by: David S. Miller

    Willy Liu
     
  • After commit a8c7687bf216 ("caif_virtio: Check that vringh_config is not
    null"), the variable err is being initialized with '-EINVAL' that is
    meaningless. So remove it.

    Signed-off-by: Jing Xiangfeng
    Signed-off-by: David S. Miller

    Jing Xiangfeng
     
  • Fix follow warnings:
    [net/core/net-sysfs.c:1161]: (warning) %u in format string (no. 1)
    requires 'unsigned int' but the argument type is 'int'.
    [net/core/net-sysfs.c:1162]: (warning) %u in format string (no. 1)
    requires 'unsigned int' but the argument type is 'int'.

    Reported-by: Hulk Robot
    Signed-off-by: Ye Bin
    Signed-off-by: David S. Miller

    Ye Bin
     
  • Fix follow warnings:
    [net/core/pktgen.c:925]: (warning) %u in format string (no. 1)
    requires 'unsigned int' but the argument type is 'signed int'.
    [net/core/pktgen.c:942]: (warning) %u in format string (no. 1)
    requires 'unsigned int' but the argument type is 'signed int'.
    [net/core/pktgen.c:962]: (warning) %u in format string (no. 1)
    requires 'unsigned int' but the argument type is 'signed int'.
    [net/core/pktgen.c:984]: (warning) %u in format string (no. 1)
    requires 'unsigned int' but the argument type is 'signed int'.
    [net/core/pktgen.c:1149]: (warning) %d in format string (no. 1)
    requires 'int' but the argument type is 'unsigned int'.

    Reported-by: Hulk Robot
    Signed-off-by: Ye Bin
    Signed-off-by: David S. Miller

    Ye Bin
     
  • The fr_hard_header function is used to prepend the header to skbs before
    transmission. It is used in 3 situations:
    1) When a control packet is generated internally in this driver;
    2) When a user sends an skb on an Ethernet-emulating PVC device;
    3) When a user sends an skb on a normal PVC device.

    These 3 situations need to be handled differently by fr_hard_header.
    Different headers should be prepended to the skb in different situations.

    Currently fr_hard_header distinguishes these 3 situations using
    skb->protocol. For situation 1 and 2, a special skb->protocol value
    will be assigned before calling fr_hard_header, so that it can recognize
    these 2 situations. All skb->protocol values other than these special ones
    are treated by fr_hard_header as situation 3.

    However, it is possible that in situation 3, the user sends an skb with
    one of the special skb->protocol values. In this case, fr_hard_header
    would incorrectly treat it as situation 1 or 2.

    This patch tries to solve this issue by using skb->dev instead of
    skb->protocol to distinguish between these 3 situations. For situation
    1, skb->dev would be NULL; for situation 2, skb->dev->type would be
    ARPHRD_ETHER; and for situation 3, skb->dev->type would be ARPHRD_DLCI.

    This way fr_hard_header would be able to distinguish these 3 situations
    correctly regardless what skb->protocol value the user tries to use in
    situation 3.

    Cc: Krzysztof Halasa
    Signed-off-by: Xie He
    Signed-off-by: David S. Miller

    Xie He
     
  • Daniel Borkmann says:

    ====================
    pull-request: bpf-next 2020-10-01

    The following pull-request contains BPF updates for your *net-next* tree.

    We've added 90 non-merge commits during the last 8 day(s) which contain
    a total of 103 files changed, 7662 insertions(+), 1894 deletions(-).

    Note that once bpf(/net) tree gets merged into net-next, there will be a small
    merge conflict in tools/lib/bpf/btf.c between commit 1245008122d7 ("libbpf: Fix
    native endian assumption when parsing BTF") from the bpf tree and the commit
    3289959b97ca ("libbpf: Support BTF loading and raw data output in both endianness")
    from the bpf-next tree. Correct resolution would be to stick with bpf-next, it
    should look like:

    [...]
    /* check BTF magic */
    if (fread(&magic, 1, sizeof(magic), f) < sizeof(magic)) {
    err = -EIO;
    goto err_out;
    }
    if (magic != BTF_MAGIC && magic != bswap_16(BTF_MAGIC)) {
    /* definitely not a raw BTF */
    err = -EPROTO;
    goto err_out;
    }

    /* get file size */
    [...]

    The main changes are:

    1) Add bpf_snprintf_btf() and bpf_seq_printf_btf() helpers to support displaying
    BTF-based kernel data structures out of BPF programs, from Alan Maguire.

    2) Speed up RCU tasks trace grace periods by a factor of 50 & fix a few race
    conditions exposed by it. It was discussed to take these via BPF and
    networking tree to get better testing exposure, from Paul E. McKenney.

    3) Support multi-attach for freplace programs, needed for incremental attachment
    of multiple XDP progs using libxdp dispatcher model, from Toke Høiland-Jørgensen.

    4) libbpf support for appending new BTF types at the end of BTF object, allowing
    intrusive changes of prog's BTF (useful for future linking), from Andrii Nakryiko.

    5) Several BPF helper improvements e.g. avoid atomic op in cookie generator and add
    a redirect helper into neighboring subsys, from Daniel Borkmann.

    6) Allow map updates on sockmaps from bpf_iter context in order to migrate sockmaps
    from one to another, from Lorenz Bauer.

    7) Fix 32 bit to 64 bit assignment from latest alu32 bounds tracking which caused
    a verifier issue due to type downgrade to scalar, from John Fastabend.

    8) Follow-up on tail-call support in BPF subprogs which optimizes x64 JIT prologue
    and epilogue sections, from Maciej Fijalkowski.

    9) Add an option to perf RB map to improve sharing of event entries by avoiding remove-
    on-close behavior. Also, add BPF_PROG_TEST_RUN for raw_tracepoint, from Song Liu.

    10) Fix a crash in AF_XDP's socket_release when memory allocation for UMEMs fails,
    from Magnus Karlsson.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • onfiguration'

    Geert Uytterhoeven says:

    ====================
    net/ravb: Add support for explicit internal clock delay configuration

    Some Renesas EtherAVB variants support internal clock delay
    configuration, which can add larger delays than the delays that are
    typically supported by the PHY (using an "rgmii-*id" PHY mode, and/or
    "[rt]xc-skew-ps" properties).

    Historically, the EtherAVB driver configured these delays based on the
    "rgmii-*id" PHY mode. This caused issues with PHY drivers that
    implement PHY internal delays properly[1]. Hence a backwards-compatible
    workaround was added by masking the PHY mode[2].

    This patch series implements the next step of the plan outlined in [3],
    and adds proper support for explicit configuration of the MAC internal
    clock delays using new "[rt]x-internal-delay-ps" properties. If none of
    these properties is present, the driver falls back to the old handling.

    This can be considered the MAC counterpart of commit 9150069bf5fc0e86
    ("dt-bindings: net: Add tx and rx internal delays"), which applies to
    the PHY. Note that unlike commit 92252eec913b2dd5 ("net: phy: Add a
    helper to return the index for of the internal delay"), no helpers are
    provided to parse the DT properties, as so far there is a single user
    only, which supports only zero or a single fixed value. Of course such
    helpers can be added later, when the need arises, or when deemed useful
    otherwise.

    This series consists of 3 parts:
    1. DT binding updates documenting the new properties, for both the
    generic ethernet-controller and the EtherAVB-specific bindings,
    2. Conversion to json-schema of the Renesas EtherAVB DT bindings.
    Technically, the conversion is independent of all of the above.
    I included it in this series, as it shows how all sanity checks on
    "[rt]x-internal-delay-ps" values are implemented as DT binding
    checks,
    3. EtherAVB driver update implementing support for the new properties.

    Given Rob has provided his acks for the DT binding updates, all of this
    can be merged through net-next.

    Changes compared to v3[4]:
    - Add Reviewed-by,
    - Drop the DT updates, as they will be merged through renesas-devel and
    arm-soc, and have a hard dependency on this series.

    Changes compared to v2[5]:
    - Update recently added board DTS files,
    - Add Reviewed-by.

    Changes compared to v1[6]:
    - Added "[PATCH 1/7] dt-bindings: net: ethernet-controller: Add
    internal delay properties",
    - Replace "renesas,[rt]xc-delay-ps" by "[rt]x-internal-delay-ps",
    - Incorporated EtherAVB DT binding conversion to json-schema,
    - Add Reviewed-by.

    Impacted, tested:
    - Salvator-X(S) with R-Car H3 ES1.0 and ES2.0, M3-W, and M3-N.

    Not impacted, tested:
    - Ebisu with R-Car E3.

    Impacted, not tested:
    - Salvator-X(S) with other SoC variants,
    - ULCB with R-Car H3/M3-W/M3-N variants,
    - V3MSK and Eagle with R-Car V3M,
    - Draak with R-Car V3H,
    - HiHope RZ/G2[MN] with RZ/G2M or RZ/G2N,
    - Beacon EmbeddedWorks RZ/G2M Development Kit.

    To ease testing, I have pushed this series and the DT updates to the
    topic/ravb-internal-clock-delays-v4 branch of my renesas-drivers
    repository at
    git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git.

    Thanks for applying!

    References:
    [1] Commit bcf3440c6dd78bfe ("net: phy: micrel: add phy-mode support
    for the KSZ9031 PHY")
    [2] Commit 9b23203c32ee02cd ("ravb: Mask PHY mode to avoid inserting
    delays twice").
    https://lore.kernel.org/r/20200529122540.31368-1-geert+renesas@glider.be/
    [3] https://lore.kernel.org/r/CAMuHMdU+MR-2tr3-pH55G0GqPG9HwH3XUd=8HZxprFDMGQeWUw@mail.gmail.com/
    [4] https://lore.kernel.org/linux-devicetree/20200819134344.27813-1-geert+renesas@glider.be/
    [5] https://lore.kernel.org/linux-devicetree/20200706143529.18306-1-geert+renesas@glider.be/
    [6] https://lore.kernel.org/linux-devicetree/20200619191554.24942-1-geert+renesas@glider.be/
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Some EtherAVB variants support internal clock delay configuration, which
    can add larger delays than the delays that are typically supported by
    the PHY (using an "rgmii-*id" PHY mode, and/or "[rt]xc-skew-ps"
    properties).

    Historically, the EtherAVB driver configured these delays based on the
    "rgmii-*id" PHY mode. This caused issues with PHY drivers that
    implement PHY internal delays properly[1]. Hence a backwards-compatible
    workaround was added by masking the PHY mode[2].

    Add proper support for explicit configuration of the MAC internal clock
    delays using the new "[rt]x-internal-delay-ps" properties.
    Fall back to the old handling if none of these properties is present.

    [1] Commit bcf3440c6dd78bfe ("net: phy: micrel: add phy-mode support for
    the KSZ9031 PHY")
    [2] Commit 9b23203c32ee02cd ("ravb: Mask PHY mode to avoid inserting
    delays twice").

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Sergei Shtylyov
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Geert Uytterhoeven
     
  • Currently, full delay handling is done in both the probe and resume
    paths. Split it in two parts, so the resume path doesn't have to redo
    the parsing part over and over again.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Sergei Shtylyov
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Geert Uytterhoeven
     
  • Convert the Renesas Ethernet AVB (EthernetAVB-IF) Device Tree binding
    documentation to json-schema.

    Add missing properties.
    Update the example to match reality.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Sergei Shtylyov
    Reviewed-by: Rob Herring
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Geert Uytterhoeven
     
  • Some EtherAVB variants support internal clock delay configuration, which
    can add larger delays than the delays that are typically supported by
    the PHY (using an "rgmii-*id" PHY mode, and/or "[rt]xc-skew-ps"
    properties).

    Add properties for configuring the internal MAC delays.
    These properties are mandatory, even when specified as zero, to
    distinguish between old and new DTBs.

    Update the (bogus) example accordingly.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Sergei Shtylyov
    Reviewed-by: Rob Herring
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Geert Uytterhoeven
     
  • Internal Receive and Transmit Clock Delays are a common setting for
    RGMII capable devices.

    While these delays are typically applied by the PHY, some MACs support
    configuring internal clock delay settings, too. Hence add standardized
    properties to configure this.

    This is the MAC counterpart of commit 9150069bf5fc0e86 ("dt-bindings:
    net: Add tx and rx internal delays"), which applies to the PHY.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Rob Herring
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Geert Uytterhoeven
     
  • Saeed Mahameed says:

    ====================
    mlx5-updates-2020-09-30

    Updates and cleanups for mlx5 driver:

    1) From Ariel, Dan Carpenter and Gostavo, Fixes to the previous
    mlx5 Connection track series.

    2) From Yevgeny, trivial cleanups for Software steering

    3) From Hamdan, Support for Flow source hint in software steering and
    E-Switch

    4) From Parav and Sunil, Small and trivial E-Switch updates and
    cleanups in preparation for mlx5 Sub-functions support
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

01 Oct, 2020

27 commits

  • Song Liu says:

    ====================
    This set introduces BPF_F_PRESERVE_ELEMS to perf event array for better
    sharing of perf event. By default, perf event array removes the perf event
    when the map fd used to add the event is closed. With BPF_F_PRESERVE_ELEMS
    set, however, the perf event will stay in the array until it is removed, or
    the map is closed.
    ---
    Changes v3 => v5:
    1. Clean up in selftest. (Alexei)

    Changes v2 => v3:
    1. Move perf_event_fd_array_map_free() to avoid unnecessary forward
    declaration. (Daniel)

    Changes v1 => v2:
    1. Rename the flag as BPF_F_PRESERVE_ELEMS. (Alexei, Daniel)
    2. Simplify the code and selftest. (Daniel, Alexei)
    ====================

    Signed-off-by: Alexei Starovoitov

    Alexei Starovoitov
     
  • Add tests for perf event array with and without BPF_F_PRESERVE_ELEMS.

    Add a perf event to array via fd mfd. Without BPF_F_PRESERVE_ELEMS, the
    perf event is removed when mfd is closed. With BPF_F_PRESERVE_ELEMS, the
    perf event is removed when the map is freed.

    Signed-off-by: Song Liu
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20200930224927.1936644-3-songliubraving@fb.com

    Song Liu
     
  • Currently, perf event in perf event array is removed from the array when
    the map fd used to add the event is closed. This behavior makes it
    difficult to the share perf events with perf event array.

    Introduce perf event map that keeps the perf event open with a new flag
    BPF_F_PRESERVE_ELEMS. With this flag set, perf events in the array are not
    removed when the original map fd is closed. Instead, the perf event will
    stay in the map until 1) it is explicitly removed from the array; or 2)
    the array is freed.

    Signed-off-by: Song Liu
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20200930224927.1936644-2-songliubraving@fb.com

    Song Liu
     
  • Calls to kzalloc() and kvzalloc() should be null-checked
    in order to avoid any potential failures. In this case,
    a potential null pointer dereference.

    Fix this by adding null checks for _parse_attr_ and _flow_
    right after allocation.

    Addresses-Coverity-ID: 1497154 ("Dereference before null check")
    Fixes: c620b772152b ("net/mlx5: Refactor tc flow attributes structure")
    Signed-off-by: Gustavo A. R. Silva
    Reviewed-by: Leon Romanovsky
    Signed-off-by: Saeed Mahameed

    Gustavo A. R. Silva
     
  • This code frees "shared_counter" and then dereferences on the next line
    to get the error code.

    Fixes: 1edae2335adf ("net/mlx5e: CT: Use the same counter for both directions")
    Signed-off-by: Dan Carpenter
    Reviewed-by: Leon Romanovsky
    Signed-off-by: Saeed Mahameed

    Dan Carpenter
     
  • When removing a flow from the slow path fdb, a flow attr struct is
    allocated for the rule removal process. If the allocation fails the
    code prints a warning message but continues with the removal flow
    which include dereferencing a pointer which could be null.
    Fix this by exiting the function in case the attr allocation failed.

    Fixes: c620b772152b ("net/mlx5: Refactor tc flow attributes structure")
    Reported-by: Dan Carpenter
    Signed-off-by: Ariel Levkovich
    Signed-off-by: Saeed Mahameed

    Ariel Levkovich
     
  • Use the PCI device directly for dma accesses as non PCI device unlikely
    support IOMMU and dma mappings.
    Introduce and use helper routine to access DMA device.

    Signed-off-by: Parav Pandit
    Reviewed-by: Vu Pham
    Signed-off-by: Saeed Mahameed

    Parav Pandit
     
  • Set flow source as hint for local vport.

    Signed-off-by: Hamdan Igbaria
    Reviewed-by: Oz Shlomo
    Signed-off-by: Saeed Mahameed

    Hamdan Igbaria
     
  • Currently devlink eswitch ports are registered and unregistered by the
    representor layer.
    However it is better to register them at eswitch layer so that in future
    user initiated command port add and delete commands can also
    register/unregister devlink ports without depending on representor layer.

    Signed-off-by: Parav Pandit
    Reviewed-by: Roi Dayan
    Reviewed-by: Vu Pham
    Signed-off-by: Saeed Mahameed

    Parav Pandit
     
  • To register and unregister devlink ports when loading/unload
    representors, refactor the code to helper functions.

    Signed-off-by: Parav Pandit
    Reviewed-by: Roi Dayan
    Reviewed-by: Vu Pham
    Signed-off-by: Saeed Mahameed

    Parav Pandit
     
  • Currently only VF vports need egress ACL table.
    Add a generic helper to check whether a vport need egress
    ACL table or not.

    Signed-off-by: Parav Pandit
    Reviewed-by: Roi Dayan
    Reviewed-by: Vu Pham
    Signed-off-by: Saeed Mahameed

    Parav Pandit
     
  • Currently only 256 vports can be supported as only 8 bits are
    reserved for them and 8 bits are reserved for vhca_ids in
    metadata reg c0. To support more than 256 vports, replace
    vhca_id with a unique shorter 4-bit PF number which covers
    upto 16 PF's. Use remaining 12 bits for vports ranging 1-4095.
    This will continue to generate unique metadata even if
    multiple PCI devices have same switch_id.

    Signed-off-by: sunils
    Reviewed-by: Parav Pandit
    Reviewed-by: Vu Pham
    Signed-off-by: Saeed Mahameed

    sunils
     
  • Skip the rule according to flow arrival source, in case of RX and the
    source is local port skip and in case of TX and the source is uplink
    skip, we get this info according to the flow source hint we get from
    upper layers when creating the rule.
    This is needed because for example in case of FDB table which has a TX
    and RX tables and we are inserting a rule with an encap action which
    is only a TX action, in this case rule will fail on RX, so we can rely
    on the flow source hint and skip RX in such case.
    Until now we relied on metadata regc_0 that upper layer mapped the
    port in the regc_0, but the problem is that upper layer did not always
    use regc_0 for port mapping, so now we added support to flow source
    hint which upper layers will pass to SW steering when creating a rule.

    Signed-off-by: Alex Vesker
    Signed-off-by: Hamdan Igbaria
    Signed-off-by: Saeed Mahameed

    Hamdan Igbaria
     
  • Instead of getting the tag in each function, call the builder
    directly with the tag. This will allow to use the same function
    for building the tag and the bitmask.

    Signed-off-by: Alex Vesker
    Signed-off-by: Yevgeny Kliteynik
    Signed-off-by: Saeed Mahameed

    Yevgeny Kliteynik
     
  • The misc3 variable is used only once and can be dropped.

    Signed-off-by: Alex Vesker
    Signed-off-by: Yevgeny Kliteynik
    Signed-off-by: Saeed Mahameed

    Yevgeny Kliteynik
     
  • When we create a matcher we check that all fields are consumed.
    There is no need for this specific check. This keeps the STE
    builder functions simple and clean.

    Signed-off-by: Alex Vesker
    Signed-off-by: Yevgeny Kliteynik
    Signed-off-by: Saeed Mahameed

    Yevgeny Kliteynik
     
  • Mask validity for ste builders is checked by mlx5dr_ste_build_pre_check
    during matcher creation.
    It already checks the mask value of source_vport, so removing
    this duplicated check.
    Also, moving there the check of source_eswitch_owner_vhca_id mask.

    Signed-off-by: Alex Vesker
    Signed-off-by: Yevgeny Kliteynik
    Signed-off-by: Saeed Mahameed

    Yevgeny Kliteynik
     
  • Validity check is done by reading the next lu_type from the STE,
    this check can be replaced by checking the refcount.
    This will make the check independent on internal STE structure.

    Signed-off-by: Alex Vesker
    Signed-off-by: Yevgeny Kliteynik
    Signed-off-by: Saeed Mahameed

    Yevgeny Kliteynik
     
  • Fix a build failure on arm64, due to missing alignment information for
    the .BTF_ids section:

    resolve_btfids.test.o: in function `test_resolve_btfids':
    tools/testing/selftests/bpf/prog_tests/resolve_btfids.c:140:(.text+0x29c): relocation truncated to fit: R_AARCH64_LDST32_ABS_LO12_NC against `.BTF_ids'
    ld: tools/testing/selftests/bpf/prog_tests/resolve_btfids.c:140: warning: one possible cause of this error is that the symbol is being referenced in the indicated code as if it had a larger alignment than was declared where it was defined

    In vmlinux, the .BTF_ids section is aligned to 4 bytes by vmlinux.lds.h.
    In test_progs however, .BTF_ids doesn't have alignment constraints. The
    arm64 linker expects the btf_id_set.cnt symbol, a u32, to be naturally
    aligned but finds it misaligned and cannot apply the relocation. Enforce
    alignment of .BTF_ids to 4 bytes.

    Fixes: cd04b04de119 ("selftests/bpf: Add set test to resolve_btfids")
    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Alexei Starovoitov
    Acked-by: Jiri Olsa
    Link: https://lore.kernel.org/bpf/20200930093559.2120126-1-jean-philippe@linaro.org

    Jean-Philippe Brucker
     
  • Ido Schimmel says:

    ====================
    drop_monitor: Convert to use devlink tracepoint

    Drop monitor is able to monitor both software and hardware originated
    drops. Software drops are monitored by having drop monitor register its
    probe on the 'kfree_skb' tracepoint. Hardware originated drops are
    monitored by having devlink call into drop monitor whenever it receives
    a dropped packet from the underlying hardware.

    This patch set converts drop monitor to monitor both software and
    hardware originated drops in the same way - by registering its probe on
    the relevant tracepoint.

    In addition to drop monitor being more consistent, it is now also
    possible to build drop monitor as module instead of as a builtin and
    still monitor hardware originated drops. Initially, CONFIG_NET_DEVLINK
    implied CONFIG_NET_DROP_MONITOR, but after commit def2fbffe62c
    ("kconfig: allow symbols implied by y to become m") we can have
    CONFIG_NET_DEVLINK=y and CONFIG_NET_DROP_MONITOR=m and hardware
    originated drops will not be monitored.

    Patch set overview:

    Patch #1 adds a tracepoint in devlink for trap reports.

    Patch #2 prepares probe functions in drop monitor for the new
    tracepoint.

    Patch #3 converts drop monitor to use the new tracepoint.

    Patches #4-#6 perform cleanups after the conversion.

    Patch #7 adds a test case for drop monitor. Both software originated
    drops and hardware originated drops (using netdevsim) are tested.

    Tested:

    | CONFIG_NET_DEVLINK | CONFIG_NET_DROP_MONITOR | Build | SW drops | HW drops |
    | -------------------|-------------------------|-------|----------|----------|
    | y | y | v | v | v |
    | y | m | v | v | v |
    | y | n | v | x | x |
    | n | y | v | v | x |
    | n | m | v | v | x |
    | n | n | v | x | x |
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Test that drop monitor correctly captures both software and hardware
    originated packet drops.

    # ./drop_monitor_tests.sh

    Software drops test
    TEST: Capturing active software drops [ OK ]
    TEST: Capturing inactive software drops [ OK ]

    Hardware drops test
    TEST: Capturing active hardware drops [ OK ]
    TEST: Capturing inactive hardware drops [ OK ]

    Tests passed: 4
    Tests failed: 0

    Signed-off-by: Ido Schimmel
    Signed-off-by: David S. Miller

    Ido Schimmel
     
  • Previously, devlink called into drop monitor in order to report hardware
    originated drops / exceptions. devlink intentionally filtered control
    packets and did not pass them to drop monitor as they were not dropped
    by the underlying hardware.

    Now drop monitor registers its probe on a generic 'devlink_trap_report'
    tracepoint and should therefore perform this filtering itself instead of
    having devlink do that.

    Add the trap type as metadata and have drop monitor ignore control
    packets.

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

    Ido Schimmel
     
  • 'struct net_dm_hw_metadata' is a duplicate of 'struct
    devlink_trap_metadata'.

    Remove the former and simplify the code.

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

    Ido Schimmel
     
  • The old probe functions that were invoked by drop monitor code are no
    longer called and can thus be removed. They were replaced by actual
    probe functions that are registered on the recently introduced
    'devlink_trap_report' tracepoint.

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

    Ido Schimmel
     
  • Convert drop monitor to use the recently introduced
    'devlink_trap_report' tracepoint instead of having devlink call into
    drop monitor.

    This is both consistent with software originated drops ('kfree_skb'
    tracepoint) and also allows drop monitor to be built as a module and
    still report hardware originated drops.

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

    Ido Schimmel
     
  • Drop monitor supports two alerting modes: Summary and packet. Prepare a
    probe function for each, so that they could be later registered on the
    devlink tracepoint by calling register_trace_devlink_trap_report(),
    based on the configured alerting mode.

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

    Ido Schimmel
     
  • Add a tracepoint for trap reports so that drop monitor could register
    its probe on it. Use trace_devlink_trap_report_enabled() to avoid
    wasting cycles setting the trap metadata if the tracepoint is not
    enabled.

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

    Ido Schimmel