[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZXheMJYnuxG2ZZZ4@boxer>
Date: Tue, 12 Dec 2023 14:20:48 +0100
From: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
To: Larysa Zaremba <larysa.zaremba@...el.com>
CC: <bpf@...r.kernel.org>, <ast@...nel.org>, <daniel@...earbox.net>,
<andrii@...nel.org>, <martin.lau@...ux.dev>, <song@...nel.org>, <yhs@...com>,
<john.fastabend@...il.com>, <kpsingh@...nel.org>, <sdf@...gle.com>,
<haoluo@...gle.com>, <jolsa@...nel.org>, David Ahern <dsahern@...il.com>,
Jakub Kicinski <kuba@...nel.org>, Willem de Bruijn <willemb@...gle.com>,
Jesper Dangaard Brouer <hawk@...nel.org>, Anatoly Burakov
<anatoly.burakov@...el.com>, Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>, Maryam Tahhan
<mtahhan@...hat.com>, <xdp-hints@...-project.net>, <netdev@...r.kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>, Alexei Starovoitov
<alexei.starovoitov@...il.com>, Tariq Toukan <tariqt@...lanox.com>, "Saeed
Mahameed" <saeedm@...lanox.com>
Subject: Re: [PATCH bpf-next v8 08/18] ice: Support XDP hints in AF_XDP ZC
mode
On Tue, Dec 05, 2023 at 10:08:37PM +0100, Larysa Zaremba wrote:
> In AF_XDP ZC, xdp_buff is not stored on ring,
> instead it is provided by xsk_buff_pool.
> Space for metadata sources right after such buffers was already reserved
> in commit 94ecc5ca4dbf ("xsk: Add cb area to struct xdp_buff_xsk").
>
> Some things (such as pointer to packet context) do not change on a
> per-packet basis, so they can be set at the same time as RX queue info.
> On the other hand, RX descriptor is unique for each packet, but is already
> known when setting DMA addresses. This minimizes performance impact of
> hints on regular packet processing.
>
> Update AF_XDP ZC packet processing to support XDP hints.
>
> Co-developed-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@...el.com>
Not sure if I am supposed/allowed to provide review here, but:
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
LGTM
> ---
> drivers/net/ethernet/intel/ice/ice_base.c | 14 ++++++++++++++
> drivers/net/ethernet/intel/ice/ice_xsk.c | 5 +++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
> index 2d83f3c029e7..a040f02a342e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_base.c
> +++ b/drivers/net/ethernet/intel/ice/ice_base.c
> @@ -519,6 +519,19 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
> return 0;
> }
>
> +static void ice_xsk_pool_fill_cb(struct ice_rx_ring *ring)
> +{
> + void *ctx_ptr = &ring->pkt_ctx;
> + struct xsk_cb_desc desc = {};
> +
> + XSK_CHECK_PRIV_TYPE(struct ice_xdp_buff);
> + desc.src = &ctx_ptr;
> + desc.off = offsetof(struct ice_xdp_buff, pkt_ctx) -
> + sizeof(struct xdp_buff);
> + desc.bytes = sizeof(ctx_ptr);
> + xsk_pool_fill_cb(ring->xsk_pool, &desc);
> +}
> +
> /**
> * ice_vsi_cfg_rxq - Configure an Rx queue
> * @ring: the ring being configured
> @@ -553,6 +566,7 @@ int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
> if (err)
> return err;
> xsk_pool_set_rxq_info(ring->xsk_pool, &ring->xdp_rxq);
> + ice_xsk_pool_fill_cb(ring);
>
> dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n",
> ring->q_index);
> diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
> index 906e383e864a..11b6114ab83d 100644
> --- a/drivers/net/ethernet/intel/ice/ice_xsk.c
> +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
> @@ -458,6 +458,11 @@ static u16 ice_fill_rx_descs(struct xsk_buff_pool *pool, struct xdp_buff **xdp,
> rx_desc->read.pkt_addr = cpu_to_le64(dma);
> rx_desc->wb.status_error0 = 0;
>
> + /* Put private info that changes on a per-packet basis
> + * into xdp_buff_xsk->cb.
> + */
> + ice_xdp_meta_set_desc(*xdp, rx_desc);
> +
> rx_desc++;
> xdp++;
> }
> --
> 2.41.0
>
Powered by blists - more mailing lists