[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ8uoz1qa-XgntqSUtwjU_vCajDAbZqYgEVSajZxidmpG0cOFQ@mail.gmail.com>
Date: Wed, 31 May 2023 12:16:13 +0200
From: Magnus Karlsson <magnus.karlsson@...il.com>
To: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, netdev@...r.kernel.org, magnus.karlsson@...el.com,
bjorn@...nel.org, tirthendu.sarkar@...el.com
Subject: Re: [PATCH v2 bpf-next 13/22] xsk: report ZC multi-buffer capability
via xdp_features
On Mon, 29 May 2023 at 17:57, Maciej Fijalkowski
<maciej.fijalkowski@...el.com> wrote:
>
> Introduce new xdp_feature NETDEV_XDP_ACT_NDO_ZC_SG that will be used to
> find out if user space that wants to do ZC multi-buffer will be able to
> do so against underlying ZC driver.
>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> ---
> include/uapi/linux/netdev.h | 4 ++--
> net/xdp/xsk_buff_pool.c | 6 ++++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> index 639524b59930..bfca07224f7b 100644
> --- a/include/uapi/linux/netdev.h
> +++ b/include/uapi/linux/netdev.h
> @@ -33,8 +33,8 @@ enum netdev_xdp_act {
> NETDEV_XDP_ACT_HW_OFFLOAD = 16,
> NETDEV_XDP_ACT_RX_SG = 32,
> NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
> -
> - NETDEV_XDP_ACT_MASK = 127,
> + NETDEV_XDP_ACT_NDO_ZC_SG = 128,
Since this flag has nothing to do with an NDO, I would prefer the
simpler NETDEV_XDP_ACT_ZC_SG. What do you think?
> + NETDEV_XDP_ACT_MASK = 255,
> };
>
> enum {
> diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> index 0a9f8ea68de3..43cca5fa90cf 100644
> --- a/net/xdp/xsk_buff_pool.c
> +++ b/net/xdp/xsk_buff_pool.c
> @@ -189,6 +189,12 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
> goto err_unreg_pool;
> }
>
> + if (!(netdev->xdp_features & NETDEV_XDP_ACT_NDO_ZC_SG) &&
> + flags & XDP_USE_SG) {
> + err = -EOPNOTSUPP;
> + goto err_unreg_pool;
> + }
> +
> bpf.command = XDP_SETUP_XSK_POOL;
> bpf.xsk.pool = pool;
> bpf.xsk.queue_id = queue_id;
> --
> 2.35.3
>
>
Powered by blists - more mailing lists