1. 19 5月, 2020 6 次提交
  2. 17 5月, 2020 10 次提交
  3. 16 5月, 2020 19 次提交
  4. 15 5月, 2020 5 次提交
    • J
      mlx5: Rx queue setup time determine frame_sz for XDP · d628ee4f
      Jesper Dangaard Brouer 提交于
      The mlx5 driver have multiple memory models, which are also changed
      according to whether a XDP bpf_prog is attached.
      
      The 'rx_striding_rq' setting is adjusted via ethtool priv-flags e.g.:
       # ethtool --set-priv-flags mlx5p2 rx_striding_rq off
      
      On the general case with 4K page_size and regular MTU packet, then
      the frame_sz is 2048 and 4096 when XDP is enabled, in both modes.
      
      The info on the given frame size is stored differently depending on the
      RQ-mode and encoded in a union in struct mlx5e_rq union wqe/mpwqe.
      In rx striding mode rq->mpwqe.log_stride_sz is either 11 or 12, which
      corresponds to 2048 or 4096 (MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ).
      In non-striding mode (MLX5_WQ_TYPE_CYCLIC) the frag_stride is stored
      in rq->wqe.info.arr[0].frag_stride, for the first fragment, which is
      what the XDP case cares about.
      
      To reduce effect on fast-path, this patch determine the frame_sz at
      setup time, to avoid determining the memory model runtime. Variable
      is named frame0_sz to make it clear that this is only the frame
      size of the first fragment.
      
      This mlx5 driver does a DMA-sync on XDP_TX action, but grow is safe
      as it have done a DMA-map on the entire PAGE_SIZE. The driver also
      already does a XDP length check against sq->hw_mtu on the possible
      XDP xmit paths mlx5e_xmit_xdp_frame() + mlx5e_xmit_xdp_frame_mpwqe().
      
      V3+4: Change variable name first_frame_sz to frame0_sz
      
      V2: Fix that frag_size need to be recalc before creating SKB.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NTariq Toukan <tariqt@mellanox.com>
      Cc: Saeed Mahameed <saeedm@mellanox.com>
      Link: https://lore.kernel.org/bpf/158945348021.97035.12295039384250022883.stgit@firesoul
      d628ee4f
    • J
      xdp: For Intel AF_XDP drivers add XDP frame_sz · 2a637c5b
      Jesper Dangaard Brouer 提交于
      Intel drivers implement native AF_XDP zerocopy in separate C-files,
      that have its own invocation of bpf_prog_run_xdp(). The setup of
      xdp_buff is also handled in separately from normal code path.
      
      This patch update XDP frame_sz for AF_XDP zerocopy drivers i40e, ice
      and ixgbe, as the code changes needed are very similar.  Introduce a
      helper function xsk_umem_xdp_frame_sz() for calculating frame size.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NBjörn Töpel <bjorn.topel@intel.com>
      Cc: intel-wired-lan@lists.osuosl.org
      Cc: Magnus Karlsson <magnus.karlsson@intel.com>
      Link: https://lore.kernel.org/bpf/158945347511.97035.8536753731329475655.stgit@firesoul
      2a637c5b
    • J
      ice: Add XDP frame size to driver · d4ecdbf7
      Jesper Dangaard Brouer 提交于
      This driver uses different memory models depending on PAGE_SIZE at
      compile time. For PAGE_SIZE 4K it uses page splitting, meaning for
      normal MTU frame size is 2048 bytes (and headroom 192 bytes). For
      larger MTUs the driver still use page splitting, by allocating
      order-1 pages (8192 bytes) for RX frames. For PAGE_SIZE larger than
      4K, driver instead advance its rx_buffer->page_offset with the frame
      size "truesize".
      
      For XDP frame size calculations, this mean that in PAGE_SIZE larger
      than 4K mode the frame_sz change on a per packet basis. For the page
      split 4K PAGE_SIZE mode, xdp.frame_sz is more constant and can be
      updated once outside the main NAPI loop.
      
      The default setting in the driver uses build_skb(), which provides
      the necessary headroom and tailroom for XDP-redirect in RX-frame
      (in both modes).
      
      There is one complication, which is legacy-rx mode (configurable via
      ethtool priv-flags). There are zero headroom in this mode, which is a
      requirement for XDP-redirect to work. The conversion to xdp_frame
      (convert_to_xdp_frame) will detect this insufficient space, and
      xdp_do_redirect() call will fail. This is deemed acceptable, as it
      allows other XDP actions to still work in legacy-mode. In
      legacy-mode + larger PAGE_SIZE due to lacking tailroom, we also
      accept that xdp_adjust_tail shrink doesn't work.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Cc: intel-wired-lan@lists.osuosl.org
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Link: https://lore.kernel.org/bpf/158945347002.97035.328088795813704587.stgit@firesoul
      d4ecdbf7
    • J
      i40e: Add XDP frame size to driver · 24104024
      Jesper Dangaard Brouer 提交于
      This driver uses different memory models depending on PAGE_SIZE at
      compile time. For PAGE_SIZE 4K it uses page splitting, meaning for
      normal MTU frame size is 2048 bytes (and headroom 192 bytes). For
      larger MTUs the driver still use page splitting, by allocating
      order-1 pages (8192 bytes) for RX frames. For PAGE_SIZE larger than
      4K, driver instead advance its rx_buffer->page_offset with the frame
      size "truesize".
      
      For XDP frame size calculations, this mean that in PAGE_SIZE larger
      than 4K mode the frame_sz change on a per packet basis. For the page
      split 4K PAGE_SIZE mode, xdp.frame_sz is more constant and can be
      updated once outside the main NAPI loop.
      
      The default setting in the driver uses build_skb(), which provides
      the necessary headroom and tailroom for XDP-redirect in RX-frame
      (in both modes).
      
      There is one complication, which is legacy-rx mode (configurable via
      ethtool priv-flags). There are zero headroom in this mode, which is a
      requirement for XDP-redirect to work. The conversion to xdp_frame
      (convert_to_xdp_frame) will detect this insufficient space, and
      xdp_do_redirect() call will fail. This is deemed acceptable, as it
      allows other XDP actions to still work in legacy-mode. In
      legacy-mode + larger PAGE_SIZE due to lacking tailroom, we also
      accept that xdp_adjust_tail shrink doesn't work.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Cc: intel-wired-lan@lists.osuosl.org
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Link: https://lore.kernel.org/bpf/158945346494.97035.12809400414566061815.stgit@firesoul
      24104024
    • J
      ixgbevf: Add XDP frame size to VF driver · 81f3c628
      Jesper Dangaard Brouer 提交于
      This patch mirrors the changes to ixgbe in previous patch.
      
      This VF driver doesn't support XDP_REDIRECT, but correct tailroom is
      still necessary for BPF-helper xdp_adjust_tail.  In legacy-mode +
      larger PAGE_SIZE, due to lacking tailroom, we accept that
      xdp_adjust_tail shrink doesn't work.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Cc: intel-wired-lan@lists.osuosl.org
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Link: https://lore.kernel.org/bpf/158945345984.97035.13518286183248025173.stgit@firesoul
      81f3c628