Skip to content
  1. Jan 25, 2022
  2. Jan 22, 2022
    • Alexei Starovoitov's avatar
      Merge branch 'mvneta: introduce XDP multi-buffer support' · a9921ce1
      Alexei Starovoitov authored
      
      
      Lorenzo Bianconi says:
      
      ====================
      
      This series introduces XDP frags support. The mvneta driver is
      the first to support these new "non-linear" xdp_{buff,frame}. Reviewers
      please focus on how these new types of xdp_{buff,frame} packets
      traverse the different layers and the layout design. It is on purpose
      that BPF-helpers are kept simple, as we don't want to expose the
      internal layout to allow later changes.
      
      The main idea for the new XDP frags layout is to reuse the same
      structure used for non-linear SKB. This rely on the "skb_shared_info"
      struct at the end of the first buffer to link together subsequent
      buffers. Keeping the layout compatible with SKBs is also done to ease
      and speedup creating a SKB from an xdp_{buff,frame}.
      Converting xdp_frame to SKB and deliver it to the network stack is shown
      in patch 05/18 (e.g. cpumaps).
      
      A frags bit (XDP_FLAGS_HAS_FRAGS) has been introduced in the flags
      field of xdp_{buff,frame} structure to notify the bpf/network layer if
      this is a non-linear xdp frame (XDP_FLAGS_HAS_FRAGS set) or not
      (XDP_FLAGS_HAS_FRAGS not set).
      The frags bit will be set by a xdp frags capable driver only
      for non-linear frames maintaining the capability to receive linear frames
      without any extra cost since the skb_shared_info structure at the end
      of the first buffer will be initialized only if XDP_FLAGS_HAS_FRAGS bit
      is set. Moreover the flags field in xdp_{buff,frame} will be reused even for
      xdp rx csum offloading in future series.
      
      Typical use cases for this series are:
      - Jumbo-frames
      - Packet header split (please see Google’s use-case @ NetDevConf 0x14, [0])
      - TSO/GRO for XDP_REDIRECT
      
      The three following ebpf helpers (and related selftests) has been introduced:
      - bpf_xdp_load_bytes:
        This helper is provided as an easy way to load data from a xdp buffer. It
        can be used to load len bytes from offset from the frame associated to
        xdp_md, into the buffer pointed by buf.
      - bpf_xdp_store_bytes:
        Store len bytes from buffer buf into the frame associated to xdp_md, at
        offset.
      - bpf_xdp_get_buff_len:
        Return the total frame size (linear + paged parts)
      
      bpf_xdp_adjust_tail and bpf_xdp_copy helpers have been modified to take into
      account non-linear xdp frames.
      Moreover, similar to skb_header_pointer, we introduced bpf_xdp_pointer utility
      routine to return a pointer to a given position in the xdp_buff if the
      requested area (offset + len) is contained in a contiguous memory area
      otherwise it must be copied in a bounce buffer provided by the caller running
      bpf_xdp_copy_buf().
      
      BPF_F_XDP_HAS_FRAGS flag has been introduced to notify the kernel the
      eBPF program fully support xdp frags.
      SEC("xdp.frags"), SEC_DEF("xdp.frags/devmap") and SEC_DEF("xdp.frags/cpumap")
      have been introduced to declare xdp frags support.
      The NIC driver is expected to reject an eBPF program if it is running in
      XDP frags mode and the program does not support XDP frags.
      In the same way it is not possible to mix XDP frags and XDP legacy
      programs in a CPUMAP/DEVMAP or tailcall a XDP frags/legacy program from
      a legacy/frags one.
      
      More info about the main idea behind this approach can be found here [1][2].
      
      Changes since v22:
      - remove leftover CHECK macro usage
      - reintroduce SEC_XDP_FRAGS flag in sec_def_flags
      - rename xdp multi_frags in xdp frags
      - do not report xdp_frags support in fdinfo
      
      Changes since v21:
      - rename *_mb in *_frags: e.g:
        s/xdp_buff_is_mb/xdp_buff_has_frags
      - rely on ASSERT_* and not on CHECK in
        bpf_xdp_load_bytes/bpf_xdp_store_bytes self-tests
      - change new multi.frags SEC definitions to use the following schema:
        prog_type.prog_flags/attach_place
      - get rid of unnecessary properties in new multi.frags SEC definitions
      - rebase on top of bpf-next
      
      Changes since v20:
      - rebase to current bpf-next
      
      Changes since v19:
      - do not run deprecated bpf_prog_load()
      - rely on skb_frag_size_add/skb_frag_size_sub in
        bpf_xdp_mb_increase_tail/bpf_xdp_mb_shrink_tail
      - rely on sinfo->nr_frags in bpf_xdp_mb_shrink_tail to check if the frame has
        been shrunk to a single-buffer one
      - allow XDP_REDIRECT of a xdp-mb frame into a CPUMAP
      
      Changes since v18:
      - fix bpf_xdp_copy_buf utility routine when we want to load/store data
        contained in frag<n>
      - add a selftest for bpf_xdp_load_bytes/bpf_xdp_store_bytes when the caller
        accesses data contained in frag<n> and frag<n+1>
      
      Changes since v17:
      - rework bpf_xdp_copy to squash base and frag management
      - remove unused variable in bpf_xdp_mb_shrink_tail()
      - move bpf_xdp_copy_buf() out of bpf_xdp_pointer()
      - add sanity check for len in bpf_xdp_pointer()
      - remove EXPORT_SYMBOL for __xdp_return()
      - introduce frag_size field in xdp_rxq_info to let the driver specify max value
        for xdp fragments. frag_size set to 0 means the tail increase of last the
        fragment is not supported.
      
      Changes since v16:
      - do not allow tailcalling a xdp multi-buffer/legacy program from a
        legacy/multi-buff one.
      - do not allow mixing xdp multi-buffer and xdp legacy programs in a
        CPUMAP/DEVMAP
      - add selftests for CPUMAP/DEVMAP xdp mb compatibility
      - disable XDP_REDIRECT for xdp multi-buff for the moment
      - set max offset value to 0xffff in bpf_xdp_pointer
      - use ARG_PTR_TO_UNINIT_MEM and ARG_CONST_SIZE for arg3_type and arg4_type
        of bpf_xdp_store_bytes/bpf_xdp_load_bytes
      
      Changes since v15:
      - let the verifier check buf is not NULL in
        bpf_xdp_load_bytes/bpf_xdp_store_bytes helpers
      - return an error if offset + length is over frame boundaries in
        bpf_xdp_pointer routine
      - introduce BPF_F_XDP_MB flag for bpf_attr to notify the kernel the eBPF
        program fully supports xdp multi-buffer.
      - reject a non XDP multi-buffer program if the driver is running in
        XDP multi-buffer mode.
      
      Changes since v14:
      - intrudce bpf_xdp_pointer utility routine and
        bpf_xdp_load_bytes/bpf_xdp_store_bytes helpers
      - drop bpf_xdp_adjust_data helper
      - drop xdp_frags_truesize in skb_shared_info
      - explode bpf_xdp_mb_adjust_tail in bpf_xdp_mb_increase_tail and
        bpf_xdp_mb_shrink_tail
      
      Changes since v13:
      - use u32 for xdp_buff/xdp_frame flags field
      - rename xdp_frags_tsize in xdp_frags_truesize
      - fixed comments
      
      Changes since v12:
      - fix bpf_xdp_adjust_data helper for single-buffer use case
      - return -EFAULT in bpf_xdp_adjust_{head,tail} in case the data pointers are not
        properly reset
      - collect ACKs from John
      
      Changes since v11:
      - add missing static to bpf_xdp_get_buff_len_proto structure
      - fix bpf_xdp_adjust_data helper when offset is smaller than linear area length.
      
      Changes since v10:
      - move xdp->data to the requested payload offset instead of to the beginning of
        the fragment in bpf_xdp_adjust_data()
      
      Changes since v9:
      - introduce bpf_xdp_adjust_data helper and related selftest
      - add xdp_frags_size and xdp_frags_tsize fields in skb_shared_info
      - introduce xdp_update_skb_shared_info utility routine in ordere to not reset
        frags array in skb_shared_info converting from a xdp_buff/xdp_frame to a skb
      - simplify bpf_xdp_copy routine
      
      Changes since v8:
      - add proper dma unmapping if XDP_TX fails on mvneta for a xdp multi-buff
      - switch back to skb_shared_info implementation from previous xdp_shared_info
        one
      - avoid using a bietfield in xdp_buff/xdp_frame since it introduces performance
        regressions. Tested now on 10G NIC (ixgbe) to verify there are no performance
        penalties for regular codebase
      - add bpf_xdp_get_buff_len helper and remove frame_length field in xdp ctx
      - add data_len field in skb_shared_info struct
      - introduce XDP_FLAGS_FRAGS_PF_MEMALLOC flag
      
      Changes since v7:
      - rebase on top of bpf-next
      - fix sparse warnings
      - improve comments for frame_length in include/net/xdp.h
      
      Changes since v6:
      - the main difference respect to previous versions is the new approach proposed
        by Eelco to pass full length of the packet to eBPF layer in XDP context
      - reintroduce multi-buff support to eBPF kself-tests
      - reintroduce multi-buff support to bpf_xdp_adjust_tail helper
      - introduce multi-buffer support to bpf_xdp_copy helper
      - rebase on top of bpf-next
      
      Changes since v5:
      - rebase on top of bpf-next
      - initialize mb bit in xdp_init_buff() and drop per-driver initialization
      - drop xdp->mb initialization in xdp_convert_zc_to_xdp_frame()
      - postpone introduction of frame_length field in XDP ctx to another series
      - minor changes
      
      Changes since v4:
      - rebase ontop of bpf-next
      - introduce xdp_shared_info to build xdp multi-buff instead of using the
        skb_shared_info struct
      - introduce frame_length in xdp ctx
      - drop previous bpf helpers
      - fix bpf_xdp_adjust_tail for xdp multi-buff
      - introduce xdp multi-buff self-tests for bpf_xdp_adjust_tail
      - fix xdp_return_frame_bulk for xdp multi-buff
      
      Changes since v3:
      - rebase ontop of bpf-next
      - add patch 10/13 to copy back paged data from a xdp multi-buff frame to
        userspace buffer for xdp multi-buff selftests
      
      Changes since v2:
      - add throughput measurements
      - drop bpf_xdp_adjust_mb_header bpf helper
      - introduce selftest for xdp multibuffer
      - addressed comments on bpf_xdp_get_frags_count
      - introduce xdp multi-buff support to cpumaps
      
      Changes since v1:
      - Fix use-after-free in xdp_return_{buff/frame}
      - Introduce bpf helpers
      - Introduce xdp_mb sample program
      - access skb_shared_info->nr_frags only on the last fragment
      
      Changes since RFC:
      - squash multi-buffer bit initialization in a single patch
      - add mvneta non-linear XDP buff support for tx side
      
      [0] https://netdevconf.info/0x14/session.html?talk-the-path-to-tcp-4k-mtu-and-rx-zerocopy
      [1] https://github.com/xdp-project/xdp-project/blob/master/areas/core/xdp-multi-buffer01-design.org
      [2] https://netdevconf.info/0x14/session.html?tutorial-add-XDP-support-to-a-NIC-driver (XDPmulti-buffers section)
      
      Eelco Chaudron (3):
        bpf: add frags support to the bpf_xdp_adjust_tail() API
        bpf: add frags support to xdp copy helpers
        bpf: selftests: update xdp_adjust_tail selftest to include xdp frags
      
      Lorenzo Bianconi (19):
        net: skbuff: add size metadata to skb_shared_info for xdp
        xdp: introduce flags field in xdp_buff/xdp_frame
        net: mvneta: update frags bit before passing the xdp buffer to eBPF
          layer
        net: mvneta: simplify mvneta_swbm_add_rx_fragment management
        net: xdp: add xdp_update_skb_shared_info utility routine
        net: marvell: rely on xdp_update_skb_shared_info utility routine
        xdp: add frags support to xdp_return_{buff/frame}
        net: mvneta: add frags support to XDP_TX
        bpf: introduce BPF_F_XDP_HAS_FRAGS flag in prog_flags loading the ebpf
          program
        net: mvneta: enable jumbo frames if the loaded XDP program support
          frags
        bpf: introduce bpf_xdp_get_buff_len helper
        bpf: move user_size out of bpf_test_init
        bpf: introduce frags support to bpf_prog_test_run_xdp()
        bpf: test_run: add xdp_shared_info pointer in bpf_test_finish
          signature
        libbpf: Add SEC name for xdp frags programs
        net: xdp: introduce bpf_xdp_pointer utility routine
        bpf: selftests: introduce bpf_xdp_{load,store}_bytes selftest
        bpf: selftests: add CPUMAP/DEVMAP selftests for xdp frags
        xdp: disable XDP_REDIRECT for xdp frags
      ====================
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      a9921ce1
    • Lorenzo Bianconi's avatar
      xdp: disable XDP_REDIRECT for xdp frags · ab0db463
      Lorenzo Bianconi authored
      
      
      XDP_REDIRECT is not fully supported yet for xdp frags since not
      all XDP capable drivers can map non-linear xdp_frame in ndo_xdp_xmit
      so disable it for the moment.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/0da25e117d0e2673f5d0ce6503393c55c6fb1be9.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      ab0db463
    • Lorenzo Bianconi's avatar
      bpf: selftests: add CPUMAP/DEVMAP selftests for xdp frags · 0c5e118c
      Lorenzo Bianconi authored
      
      
      Verify compatibility checks attaching a XDP frags program to a
      CPUMAP/DEVMAP
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/d94b4d35adc1e42c9ca5004e6b2cdfd75992304d.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      0c5e118c
    • Lorenzo Bianconi's avatar
      bpf: selftests: introduce bpf_xdp_{load,store}_bytes selftest · 6db28e24
      Lorenzo Bianconi authored
      
      
      Introduce kernel selftest for new bpf_xdp_{load,store}_bytes helpers.
      and bpf_xdp_pointer/bpf_xdp_copy_buf utility routines.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/2c99ae663a5dcfbd9240b1d0489ad55dea4f4601.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      6db28e24
    • Lorenzo Bianconi's avatar
      net: xdp: introduce bpf_xdp_pointer utility routine · 3f364222
      Lorenzo Bianconi authored
      
      
      Similar to skb_header_pointer, introduce bpf_xdp_pointer utility routine
      to return a pointer to a given position in the xdp_buff if the requested
      area (offset + len) is contained in a contiguous memory area otherwise it
      will be copied in a bounce buffer provided by the caller.
      Similar to the tc counterpart, introduce the two following xdp helpers:
      - bpf_xdp_load_bytes
      - bpf_xdp_store_bytes
      
      Reviewed-by: default avatarEelco Chaudron <echaudro@redhat.com>
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/ab285c1efdd5b7a9d361348b1e7d3ef49f6382b3.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      3f364222
    • Toke Hoiland-Jorgensen's avatar
      bpf: generalise tail call map compatibility check · f45d5b6c
      Toke Hoiland-Jorgensen authored
      
      
      The check for tail call map compatibility ensures that tail calls only
      happen between maps of the same type. To ensure backwards compatibility for
      XDP frags we need a similar type of check for cpumap and devmap
      programs, so move the state from bpf_array_aux into bpf_map, add
      xdp_has_frags to the check, and apply the same check to cpumap and devmap.
      
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Co-developed-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Link: https://lore.kernel.org/r/f19fd97c0328a39927f3ad03e1ca6b43fd53cdfd.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      f45d5b6c
    • Lorenzo Bianconi's avatar
      libbpf: Add SEC name for xdp frags programs · 082c4bfb
      Lorenzo Bianconi authored
      
      
      Introduce support for the following SEC entries for XDP frags
      property:
      - SEC("xdp.frags")
      - SEC("xdp.frags/devmap")
      - SEC("xdp.frags/cpumap")
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/af23b6e4841c171ad1af01917839b77847a4bc27.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      082c4bfb
    • Eelco Chaudron's avatar
      bpf: selftests: update xdp_adjust_tail selftest to include xdp frags · 11022108
      Eelco Chaudron authored
      
      
      This change adds test cases for the xdp frags scenarios when shrinking
      and growing.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Co-developed-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarEelco Chaudron <echaudro@redhat.com>
      Link: https://lore.kernel.org/r/d2e6a0ebc52db6f89e62b9befe045032e5e0a5fe.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      11022108
    • Lorenzo Bianconi's avatar
      bpf: test_run: add xdp_shared_info pointer in bpf_test_finish signature · 7855e0db
      Lorenzo Bianconi authored
      
      
      introduce xdp_shared_info pointer in bpf_test_finish signature in order
      to copy back paged data from a xdp frags frame to userspace buffer
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/c803673798c786f915bcdd6c9338edaa9740d3d6.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      7855e0db
    • Lorenzo Bianconi's avatar
      bpf: introduce frags support to bpf_prog_test_run_xdp() · 1c194998
      Lorenzo Bianconi authored
      
      
      Introduce the capability to allocate a xdp frags in
      bpf_prog_test_run_xdp routine. This is a preliminary patch to
      introduce the selftests for new xdp frags ebpf helpers
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/b7c0e425a9287f00f601c4fc0de54738ec6ceeea.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      1c194998
    • Lorenzo Bianconi's avatar
      bpf: move user_size out of bpf_test_init · be3d72a2
      Lorenzo Bianconi authored
      
      
      Rely on data_size_in in bpf_test_init routine signature. This is a
      preliminary patch to introduce xdp frags selftest
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/6b48d38ed3d60240d7d6bb15e6fa7fabfac8dfb2.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      be3d72a2
    • Eelco Chaudron's avatar
      bpf: add frags support to xdp copy helpers · d9917302
      Eelco Chaudron authored
      
      
      This patch adds support for frags for the following helpers:
        - bpf_xdp_output()
        - bpf_perf_event_output()
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarEelco Chaudron <echaudro@redhat.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/340b4a99cdc24337b40eaf8bb597f9f9e7b0373e.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      d9917302
    • Eelco Chaudron's avatar
      bpf: add frags support to the bpf_xdp_adjust_tail() API · bf25146a
      Eelco Chaudron authored
      
      
      This change adds support for tail growing and shrinking for XDP frags.
      
      When called on a non-linear packet with a grow request, it will work
      on the last fragment of the packet. So the maximum grow size is the
      last fragments tailroom, i.e. no new buffer will be allocated.
      A XDP frags capable driver is expected to set frag_size in xdp_rxq_info
      data structure to notify the XDP core the fragment size.
      frag_size set to 0 is interpreted by the XDP core as tail growing is
      not allowed.
      Introduce __xdp_rxq_info_reg utility routine to initialize frag_size field.
      
      When shrinking, it will work from the last fragment, all the way down to
      the base buffer depending on the shrinking size. It's important to mention
      that once you shrink down the fragment(s) are freed, so you can not grow
      again to the original size.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
      Co-developed-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarEelco Chaudron <echaudro@redhat.com>
      Link: https://lore.kernel.org/r/eabda3485dda4f2f158b477729337327e609461d.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      bf25146a
    • Lorenzo Bianconi's avatar
      bpf: introduce bpf_xdp_get_buff_len helper · 0165cc81
      Lorenzo Bianconi authored
      
      
      Introduce bpf_xdp_get_buff_len helper in order to return the xdp buffer
      total size (linear and paged area)
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/aac9ac3504c84026cf66a3c71b7c5ae89bc991be.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      0165cc81
    • Lorenzo Bianconi's avatar
      net: mvneta: enable jumbo frames if the loaded XDP program support frags · e121d270
      Lorenzo Bianconi authored
      
      
      Enable the capability to receive jumbo frames even if the interface is
      running in XDP mode if the loaded program declare to properly support
      xdp frags. At same time reject a xdp program not supporting xdp frags
      if the driver is running in xdp frags mode.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/6909f81a3cbb8fb6b88e914752c26395771b882a.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      e121d270
    • Lorenzo Bianconi's avatar
      bpf: introduce BPF_F_XDP_HAS_FRAGS flag in prog_flags loading the ebpf program · c2f2cdbe
      Lorenzo Bianconi authored
      
      
      Introduce BPF_F_XDP_HAS_FRAGS and the related field in bpf_prog_aux
      in order to notify the driver the loaded program support xdp frags.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/db2e8075b7032a356003f407d1b0deb99adaa0ed.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      c2f2cdbe
    • Lorenzo Bianconi's avatar
      net: mvneta: add frags support to XDP_TX · c41ced02
      Lorenzo Bianconi authored
      
      
      Introduce the capability to map non-linear xdp buffer running
      mvneta_xdp_submit_frame() for XDP_TX and XDP_REDIRECT
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/5d46ab63870ffe96fb95e6075a7ff0c81ef6424d.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      c41ced02
    • Lorenzo Bianconi's avatar
      xdp: add frags support to xdp_return_{buff/frame} · 7c48cb01
      Lorenzo Bianconi authored
      
      
      Take into account if the received xdp_buff/xdp_frame is non-linear
      recycling/returning the frame memory to the allocator or into
      xdp_frame_bulk.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/a961069febc868508ce1bdf5e53a343eb4e57cb2.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      7c48cb01
    • Lorenzo Bianconi's avatar
      net: marvell: rely on xdp_update_skb_shared_info utility routine · ed7a58cb
      Lorenzo Bianconi authored
      
      
      Rely on xdp_update_skb_shared_info routine in order to avoid
      resetting frags array in skb_shared_info structure building
      the skb in mvneta_swbm_build_skb(). Frags array is expected to
      be initialized by the receiving driver building the xdp_buff
      and here we just need to update memory metadata.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/e0dad97f5d02b13f189f99f1e5bc8e61bef73412.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      ed7a58cb
    • Lorenzo Bianconi's avatar
      net: xdp: add xdp_update_skb_shared_info utility routine · d65a1906
      Lorenzo Bianconi authored
      
      
      Introduce xdp_update_skb_shared_info routine to update frags array
      metadata in skb_shared_info data structure converting to a skb from
      a xdp_buff or xdp_frame.
      According to the current skb_shared_info architecture in
      xdp_frame/xdp_buff and to the xdp frags support, there is
      no need to run skb_add_rx_frag() and reset frags array converting the buffer
      to a skb since the frag array will be in the same position for xdp_buff/xdp_frame
      and for the skb, we just need to update memory metadata.
      Introduce XDP_FLAGS_PF_MEMALLOC flag in xdp_buff_flags in order to mark
      the xdp_buff or xdp_frame as under memory-pressure if pages of the frags array
      are under memory pressure. Doing so we can avoid looping over all fragments in
      xdp_update_skb_shared_info routine. The driver is expected to set the
      flag constructing the xdp_buffer using xdp_buff_set_frag_pfmemalloc
      utility routine.
      Rely on xdp_update_skb_shared_info in __xdp_build_skb_from_frame routine
      converting the non-linear xdp_frame to a skb after performing a XDP_REDIRECT.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/bfd23fb8a8d7438724f7819c567cdf99ffd6226f.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      d65a1906
    • Lorenzo Bianconi's avatar
      net: mvneta: simplify mvneta_swbm_add_rx_fragment management · d094c985
      Lorenzo Bianconi authored
      
      
      Relying on xdp frags bit, remove skb_shared_info structure
      allocated on the stack in mvneta_rx_swbm routine and simplify
      mvneta_swbm_add_rx_fragment accessing skb_shared_info in the
      xdp_buff structure directly. There is no performance penalty in
      this approach since mvneta_swbm_add_rx_fragment is run just
      for xdp frags use-case.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/45f050c094ccffce49d6bc5112939ed35250ba90.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      d094c985
    • Lorenzo Bianconi's avatar
      net: mvneta: update frags bit before passing the xdp buffer to eBPF layer · 76a67694
      Lorenzo Bianconi authored
      
      
      Update frags bit (XDP_FLAGS_HAS_FRAGS) in xdp_buff to notify
      XDP/eBPF layer and XDP remote drivers if this is a "non-linear"
      XDP buffer. Access skb_shared_info only if XDP_FLAGS_HAS_FRAGS flag
      is set in order to avoid possible cache-misses.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/c00a73097f8a35860d50dae4a36e6cc9ef7e172f.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      76a67694
    • Lorenzo Bianconi's avatar
      xdp: introduce flags field in xdp_buff/xdp_frame · 2e88d4ff
      Lorenzo Bianconi authored
      
      
      Introduce flags field in xdp_frame and xdp_buffer data structures
      to define additional buffer features. At the moment the only
      supported buffer feature is frags bit (XDP_FLAGS_HAS_FRAGS).
      frags bit is used to specify if this is a linear buffer
      (XDP_FLAGS_HAS_FRAGS not set) or a frags frame (XDP_FLAGS_HAS_FRAGS
      set). In the latter case the driver is expected to initialize the
      skb_shared_info structure at the end of the first buffer to link together
      subsequent buffers belonging to the same frame.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/e389f14f3a162c0a5bc6a2e1aa8dd01a90be117d.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      2e88d4ff
    • Lorenzo Bianconi's avatar
      net: skbuff: add size metadata to skb_shared_info for xdp · d16697cb
      Lorenzo Bianconi authored
      
      
      Introduce xdp_frags_size field in skb_shared_info data structure
      to store xdp_buff/xdp_frame frame paged size (xdp_frags_size will
      be used in xdp frags support). In order to not increase
      skb_shared_info size we will use a hole due to skb_shared_info
      alignment.
      
      Acked-by: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/8a849819a3e0a143d540f78a3a5add76e17e980d.1642758637.git.lorenzo@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      d16697cb
  3. Jan 21, 2022
    • Di Zhu's avatar
      selftests: bpf: test BPF_PROG_QUERY for progs attached to sockmap · 820e6e22
      Di Zhu authored
      
      
      Add test for querying progs attached to sockmap. we use an existing
      libbpf query interface to query prog cnt before and after progs
      attaching to sockmap and check whether the queried prog id is right.
      
      Signed-off-by: default avatarDi Zhu <zhudi2@huawei.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Reviewed-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/r/20220119014005.1209-2-zhudi2@huawei.com
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      820e6e22
    • Di Zhu's avatar
      bpf: support BPF_PROG_QUERY for progs attached to sockmap · 748cd572
      Di Zhu authored
      
      
      Right now there is no way to query whether BPF programs are
      attached to a sockmap or not.
      
      we can use the standard interface in libbpf to query, such as:
      bpf_prog_query(mapFd, BPF_SK_SKB_STREAM_PARSER, 0, NULL, ...);
      the mapFd is the fd of sockmap.
      
      Signed-off-by: default avatarDi Zhu <zhudi2@huawei.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Reviewed-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/r/20220119014005.1209-1-zhudi2@huawei.com
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      748cd572
    • Alexei Starovoitov's avatar
      Merge branch 'libbpf: streamline netlink-based XDP APIs' · 3f712d46
      Alexei Starovoitov authored
      
      
      Andrii Nakryiko says:
      
      ====================
      
      Revamp existing low-level XDP APIs provided by libbpf to follow more
      consistent naming (new APIs follow bpf_tc_xxx() approach where it makes
      sense) and be extensible without ABI breakages (OPTS-based). See patch #1 for
      details, remaining patches switch bpftool, selftests/bpf and samples/bpf to
      new APIs.
      ====================
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      3f712d46
    • Andrii Nakryiko's avatar
      samples/bpf: adapt samples/bpf to bpf_xdp_xxx() APIs · d4e34bfc
      Andrii Nakryiko authored
      
      
      Use new bpf_xdp_*() APIs across all XDP-related BPF samples.
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220120061422.2710637-5-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      d4e34bfc
    • Andrii Nakryiko's avatar
      selftests/bpf: switch to new libbpf XDP APIs · 54435652
      Andrii Nakryiko authored
      
      
      Switch to using new bpf_xdp_*() APIs across all selftests. Take
      advantage of a more straightforward and user-friendly semantics of
      old_prog_fd (0 means "don't care") in few places.
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220120061422.2710637-4-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      54435652
    • Andrii Nakryiko's avatar
      bpftool: use new API for attaching XDP program · c86575ec
      Andrii Nakryiko authored
      
      
      Switch to new bpf_xdp_attach() API to avoid deprecation warnings.
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220120061422.2710637-3-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      c86575ec
    • Andrii Nakryiko's avatar
      libbpf: streamline low-level XDP APIs · c359821a
      Andrii Nakryiko authored
      
      
      Introduce 4 new netlink-based XDP APIs for attaching, detaching, and
      querying XDP programs:
        - bpf_xdp_attach;
        - bpf_xdp_detach;
        - bpf_xdp_query;
        - bpf_xdp_query_id.
      
      These APIs replace bpf_set_link_xdp_fd, bpf_set_link_xdp_fd_opts,
      bpf_get_link_xdp_id, and bpf_get_link_xdp_info APIs ([0]). The latter
      don't follow a consistent naming pattern and some of them use
      non-extensible approaches (e.g., struct xdp_link_info which can't be
      modified without breaking libbpf ABI).
      
      The approach I took with these low-level XDP APIs is similar to what we
      did with low-level TC APIs. There is a nice duality of bpf_tc_attach vs
      bpf_xdp_attach, and so on. I left bpf_xdp_attach() to support detaching
      when -1 is specified for prog_fd for generality and convenience, but
      bpf_xdp_detach() is preferred due to clearer naming and associated
      semantics. Both bpf_xdp_attach() and bpf_xdp_detach() accept the same
      opts struct allowing to specify expected old_prog_fd.
      
      While doing the refactoring, I noticed that old APIs require users to
      specify opts with old_fd == -1 to declare "don't care about already
      attached XDP prog fd" condition. Otherwise, FD 0 is assumed, which is
      essentially never an intended behavior. So I made this behavior
      consistent with other kernel and libbpf APIs, in which zero FD means "no
      FD". This seems to be more in line with the latest thinking in BPF land
      and should cause less user confusion, hopefully.
      
      For querying, I left two APIs, both more generic bpf_xdp_query()
      allowing to query multiple IDs and attach mode, but also
      a specialization of it, bpf_xdp_query_id(), which returns only requested
      prog_id. Uses of prog_id returning bpf_get_link_xdp_id() were so
      prevalent across selftests and samples, that it seemed a very common use
      case and using bpf_xdp_query() for doing it felt very cumbersome with
      a highly branches if/else chain based on flags and attach mode.
      
      Old APIs are scheduled for deprecation in libbpf 0.8 release.
      
        [0] Closes: https://github.com/libbpf/libbpf/issues/309
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Link: https://lore.kernel.org/r/20220120061422.2710637-2-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      c359821a
    • Alexei Starovoitov's avatar
      Merge branch 'libbpf: deprecate legacy BPF map definitions' · 1713e33b
      Alexei Starovoitov authored
      
      
      Andrii Nakryiko says:
      
      ====================
      
      Officially deprecate legacy BPF map definitions in libbpf. They've been slated
      for deprecation for a while in favor of more powerful BTF-defined map
      definitions and this patch set adds warnings and a way to enforce this in
      libbpf through LIBBPF_STRICT_MAP_DEFINITIONS strict mode flag.
      
      Selftests are fixed up and updated, BPF documentation is updated, bpftool's
      strict mode usage is adjusted to avoid breaking users unnecessarily.
      
      v1->v2:
        - replace missed bpf_map_def case in Documentation/bpf/btf.rst (Alexei).
      ====================
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      1713e33b
    • Andrii Nakryiko's avatar
      docs/bpf: update BPF map definition example · 96c85308
      Andrii Nakryiko authored
      
      
      Use BTF-defined map definition in the documentation example.
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220120060529.1890907-5-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      96c85308
    • Andrii Nakryiko's avatar
      libbpf: deprecate legacy BPF map definitions · 93b8952d
      Andrii Nakryiko authored
      
      
      Enact deprecation of legacy BPF map definition in SEC("maps") ([0]). For
      the definitions themselves introduce LIBBPF_STRICT_MAP_DEFINITIONS flag
      for libbpf strict mode. If it is set, error out on any struct
      bpf_map_def-based map definition. If not set, libbpf will print out
      a warning for each legacy BPF map to raise awareness that it goes away.
      
      For any use of BPF_ANNOTATE_KV_PAIR() macro providing a legacy way to
      associate BTF key/value type information with legacy BPF map definition,
      warn through libbpf's pr_warn() error message (but don't fail BPF object
      open).
      
      BPF-side struct bpf_map_def is marked as deprecated. User-space struct
      bpf_map_def has to be used internally in libbpf, so it is left
      untouched. It should be enough for bpf_map__def() to be marked
      deprecated to raise awareness that it goes away.
      
      bpftool is an interesting case that utilizes libbpf to open BPF ELF
      object to generate skeleton. As such, even though bpftool itself uses
      full on strict libbpf mode (LIBBPF_STRICT_ALL), it has to relax it a bit
      for BPF map definition handling to minimize unnecessary disruptions. So
      opt-out of LIBBPF_STRICT_MAP_DEFINITIONS for bpftool. User's code that
      will later use generated skeleton will make its own decision whether to
      enforce LIBBPF_STRICT_MAP_DEFINITIONS or not.
      
      There are few tests in selftests/bpf that are consciously using legacy
      BPF map definitions to test libbpf functionality. For those, temporary
      opt out of LIBBPF_STRICT_MAP_DEFINITIONS mode for the duration of those
      tests.
      
        [0] Closes: https://github.com/libbpf/libbpf/issues/272
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220120060529.1890907-4-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      93b8952d
    • Andrii Nakryiko's avatar
      selftests/bpf: convert remaining legacy map definitions · ccc3f569
      Andrii Nakryiko authored
      
      
      Converted few remaining legacy BPF map definition to BTF-defined ones.
      For the remaining two bpf_map_def-based legacy definitions that we want
      to keep for testing purposes until libbpf 1.0 release, guard them in
      pragma to suppres deprecation warnings which will be added in libbpf in
      the next commit.
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220120060529.1890907-3-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      ccc3f569
    • Andrii Nakryiko's avatar
      selftests/bpf: fail build on compilation warning · 32b34294
      Andrii Nakryiko authored
      
      
      It's very easy to miss compilation warnings without -Werror, which is
      not set for selftests. libbpf and bpftool are already strict about this,
      so make selftests/bpf also treat compilation warnings as errors to catch
      such regressions early.
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220120060529.1890907-2-andrii@kernel.org
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      32b34294
    • Kumar Kartikeya Dwivedi's avatar
      selftests/bpf: Do not fail build if CONFIG_NF_CONNTRACK=m/n · 1058b6a7
      Kumar Kartikeya Dwivedi authored
      
      
      Some users have complained that selftests fail to build when
      CONFIG_NF_CONNTRACK=m. It would be useful to allow building as long as
      it is set to module or built-in, even though in case of building as
      module, user would need to load it before running the selftest. Note
      that this also allows building selftest when CONFIG_NF_CONNTRACK is
      disabled.
      
      Signed-off-by: default avatarKumar Kartikeya Dwivedi <memxor@gmail.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220120164932.2798544-1-memxor@gmail.com
      1058b6a7
    • Felix Maurer's avatar
      selftests: bpf: Fix bind on used port · 8c0be063
      Felix Maurer authored
      The bind_perm BPF selftest failed when port 111/tcp was already in use
      during the test. To fix this, the test now runs in its own network name
      space.
      
      To use unshare, it is necessary to reorder the includes. The style of
      the includes is adapted to be consistent with the other prog_tests.
      
      v2: Replace deprecated CHECK macro with ASSERT_OK
      
      Fixes: 8259fdeb
      
       ("selftests/bpf: Verify that rebinding to port < 1024 from BPF works")
      Signed-off-by: default avatarFelix Maurer <fmaurer@redhat.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Reviewed-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/bpf/551ee65533bb987a43f93d88eaf2368b416ccd32.1642518457.git.fmaurer@redhat.com
      8c0be063
    • Andrii Nakryiko's avatar
      Merge branch 'rely on ASSERT marcos in xdp_bpf2bpf.c/xdp_adjust_tail.c' · 38f033a1
      Andrii Nakryiko authored
      
      
      Lorenzo Bianconi says:
      
      ====================
      
      Rely on ASSERT* macros and get rid of deprecated CHECK ones in xdp_bpf2bpf and
      xdp_adjust_tail bpf selftests.
      This is a preliminary series for XDP multi-frags support.
      
      Changes since v1:
      - run each ASSERT test separately
      - drop unnecessary return statements
      - drop unnecessary if condition in test_xdp_bpf2bpf()
      ====================
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      38f033a1