1. 11 4月, 2022 32 次提交
  2. 09 4月, 2022 8 次提交
    • J
      netfilter: bitwise: improve error goto labels · 00bd4352
      Jeremy Sowden 提交于
      Replace two labels (`err1` and `err2`) with more informative ones.
      Signed-off-by: NJeremy Sowden <jeremy@azazel.net>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      00bd4352
    • J
      netfilter: bitwise: replace hard-coded size with `sizeof` expression · c70b921f
      Jeremy Sowden 提交于
      When calculating the length of an array, use the appropriate `sizeof`
      expression for its type, rather than an integer literal.
      Signed-off-by: NJeremy Sowden <jeremy@azazel.net>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      c70b921f
    • C
      net: mdio: mscc-miim: add local dev variable to cleanup probe function · 626a5aaa
      Colin Foster 提交于
      Create a local device *dev in order to not dereference the platform_device
      several times throughout the probe function.
      Signed-off-by: NColin Foster <colin.foster@in-advantage.com>
      Reviewed-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      626a5aaa
    • J
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 34ba23b4
      Jakub Kicinski 提交于
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2022-04-09
      
      We've added 63 non-merge commits during the last 9 day(s) which contain
      a total of 68 files changed, 4852 insertions(+), 619 deletions(-).
      
      The main changes are:
      
      1) Add libbpf support for USDT (User Statically-Defined Tracing) probes.
         USDTs are an abstraction built on top of uprobes, critical for tracing
         and BPF, and widely used in production applications, from Andrii Nakryiko.
      
      2) While Andrii was adding support for x86{-64}-specific logic of parsing
         USDT argument specification, Ilya followed-up with USDT support for s390
         architecture, from Ilya Leoshkevich.
      
      3) Support name-based attaching for uprobe BPF programs in libbpf. The format
         supported is `u[ret]probe/binary_path:[raw_offset|function[+offset]]`, e.g.
         attaching to libc malloc can be done in BPF via SEC("uprobe/libc.so.6:malloc")
         now, from Alan Maguire.
      
      4) Various load/store optimizations for the arm64 JIT to shrink the image
         size by using arm64 str/ldr immediate instructions. Also enable pointer
         authentication to verify return address for JITed code, from Xu Kuohai.
      
      5) BPF verifier fixes for write access checks to helper functions, e.g.
         rd-only memory from bpf_*_cpu_ptr() must not be passed to helpers that
         write into passed buffers, from Kumar Kartikeya Dwivedi.
      
      6) Fix overly excessive stack map allocation for its base map structure and
         buckets which slipped-in from cleanups during the rlimit accounting removal
         back then, from Yuntao Wang.
      
      7) Extend the unstable CT lookup helpers for XDP and tc/BPF to report netfilter
         connection tracking tuple direction, from Lorenzo Bianconi.
      
      8) Improve bpftool dump to show BPF program/link type names, Milan Landaverde.
      
      9) Minor cleanups all over the place from various others.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (63 commits)
        bpf: Fix excessive memory allocation in stack_map_alloc()
        selftests/bpf: Fix return value checks in perf_event_stackmap test
        selftests/bpf: Add CO-RE relos into linked_funcs selftests
        libbpf: Use weak hidden modifier for USDT BPF-side API functions
        libbpf: Don't error out on CO-RE relos for overriden weak subprogs
        samples, bpf: Move routes monitor in xdp_router_ipv4 in a dedicated thread
        libbpf: Allow WEAK and GLOBAL bindings during BTF fixup
        libbpf: Use strlcpy() in path resolution fallback logic
        libbpf: Add s390-specific USDT arg spec parsing logic
        libbpf: Make BPF-side of USDT support work on big-endian machines
        libbpf: Minor style improvements in USDT code
        libbpf: Fix use #ifdef instead of #if to avoid compiler warning
        libbpf: Potential NULL dereference in usdt_manager_attach_usdt()
        selftests/bpf: Uprobe tests should verify param/return values
        libbpf: Improve string parsing for uprobe auto-attach
        libbpf: Improve library identification for uprobe binary path resolution
        selftests/bpf: Test for writes to map key from BPF helpers
        selftests/bpf: Test passing rdonly mem to global func
        bpf: Reject writes for PTR_TO_MAP_KEY in check_helper_mem_access
        bpf: Check PTR_TO_MEM | MEM_RDONLY in check_helper_mem_access
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20220408231741.19116-1-daniel@iogearbox.netSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      34ba23b4
    • Y
      bpf: Fix excessive memory allocation in stack_map_alloc() · b4504319
      Yuntao Wang 提交于
      The 'n_buckets * (value_size + sizeof(struct stack_map_bucket))' part of the
      allocated memory for 'smap' is never used after the memlock accounting was
      removed, thus get rid of it.
      
      [ Note, Daniel:
      
      Commit b936ca64 ("bpf: rework memlock-based memory accounting for maps")
      moved `cost += n_buckets * (value_size + sizeof(struct stack_map_bucket))`
      up and therefore before the bpf_map_area_alloc() allocation, sigh. In a later
      step commit c85d6913 ("bpf: move memory size checks to bpf_map_charge_init()"),
      and the overflow checks of `cost >= U32_MAX - PAGE_SIZE` moved into
      bpf_map_charge_init(). And then 37086810 ("bpf: Eliminate rlimit-based
      memory accounting for stackmap maps") finally removed the bpf_map_charge_init().
      Anyway, the original code did the allocation same way as /after/ this fix. ]
      
      Fixes: b936ca64 ("bpf: rework memlock-based memory accounting for maps")
      Signed-off-by: NYuntao Wang <ytcoode@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20220407130423.798386-1-ytcoode@gmail.com
      b4504319
    • B
      sfc: use hardware tx timestamps for more than PTP · bd4a2697
      Bert Kenward 提交于
      The 8000 series and newer NICs all get hardware timestamps from the MAC
       and can provide timestamps on a normal TX queue, rather than via a slow
       path through the MC. As such we can use this path for any packet where a
       hardware timestamp is requested.
      This also enables support for PTP over transports other than IPv4+UDP.
      Signed-off-by: NBert Kenward <bkenward@solarflare.com>
      Signed-off-by: NEdward Cree <ecree@xilinx.com>
      Link: https://lore.kernel.org/r/510652dc-54b4-0e11-657e-e37ee3ca26a9@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      bd4a2697
    • M
      net: phy: micrel: ksz9031/ksz9131: add cabletest support · 58389c00
      Marek Vasut 提交于
      Add cable test support for Micrel KSZ9x31 PHYs.
      
      Tested on i.MX8M Mini with KSZ9131RNX in 100/Full mode with pairs shuffled
      before magnetics:
      (note: Cable test started/completed messages are omitted)
      
        mx8mm-ksz9131-a-d-connected$ ethtool --cable-test eth0
        Pair A code OK
        Pair B code Short within Pair
        Pair B, fault length: 0.80m
        Pair C code Short within Pair
        Pair C, fault length: 0.80m
        Pair D code OK
      
        mx8mm-ksz9131-a-b-connected$ ethtool --cable-test eth0
        Pair A code OK
        Pair B code OK
        Pair C code Short within Pair
        Pair C, fault length: 0.00m
        Pair D code Short within Pair
        Pair D, fault length: 0.00m
      
      Tested on R8A77951 Salvator-XS with KSZ9031RNX and all four pairs connected:
      (note: Cable test started/completed messages are omitted)
      
        r8a7795-ksz9031-all-connected$ ethtool --cable-test eth0
        Pair A code OK
        Pair B code OK
        Pair C code OK
        Pair D code OK
      
      The CTRL1000 CTL1000_ENABLE_MASTER and CTL1000_AS_MASTER bits are not
      restored by calling phy_init_hw(), they must be manually cached in
      ksz9x31_cable_test_start() and restored at the end of
      ksz9x31_cable_test_get_status().
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Cc: Oleksij Rempel <linux@rempel-privat.de>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Tested-by: NClaudiu Beznea <claudiu.beznea@microchip.com>
      Link: https://lore.kernel.org/r/20220407105534.85833-1-marex@denx.deSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      58389c00
    • Y
      selftests/bpf: Fix return value checks in perf_event_stackmap test · 658d8768
      Yuntao Wang 提交于
      The bpf_get_stackid() function may also return 0 on success as per UAPI BPF
      helper documentation. Therefore, correct checks from 'val > 0' to 'val >= 0'
      to ensure that they cover all possible success return values.
      Signed-off-by: NYuntao Wang <ytcoode@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20220408041452.933944-1-ytcoode@gmail.com
      658d8768