From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by mail.toke.dk (Postfix) with ESMTPS id 81BD29E05C8 for ; Thu, 19 Jan 2023 23:16:02 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=W4fB6P6l Received: by mail-pl1-x64a.google.com with SMTP id j16-20020a170902da9000b00194c056109eso2053041plx.18 for ; Thu, 19 Jan 2023 14:16:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=5PUb7Bdy4BSrYUAvE8+8Zaz9Ehc/dbC7IUiLA9SLDnE=; b=W4fB6P6lN1r3lPzei+yCuB62E3KrdiijlYkvb4L9JN6SyNkYDMgrGeynrzRZqO8Te9 BMBP8jLTHiysg4wSKQnx0GJdOJMHh0RZjqlXX5lC8osu9nMMm1bl+xBZ0aKvd4oZ41Fi IQasLfiHoiw6QKzaz1o0yJCbg3US/U+gG9529yIpr8LolfisMP2UXRLHyUNlbndwAmk9 svNxkr+QPpUlBtshsZQhqMSkHFhYt91Lb9FQIjCa+7yCbBTWxj0HQRpgynlYSGr3yfuh CYB/slRlGtROXA36BIsDanh+QJ3u9m3UK37IcbdtN2XaUYlkcH4+2k3n+qLY/p/omMiJ zFWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=5PUb7Bdy4BSrYUAvE8+8Zaz9Ehc/dbC7IUiLA9SLDnE=; b=sAZI7nhaY7sz3ks2NwSC5s+VrOZ60fWy+vIpThbIiTKboGG0GL88Z6SRKSaLuJ6X0V Cd8zQJarxYBX/1QGZqucOH4oTh3miOO5IIdgiGosJ0iD6atU5To6ezr0/uImUEyfqJ59 aGb+64D39X0DbihU48hvcbC4X5Nsi0YQw3jQfJ1OV52M9eYz3T844PDW+Nta3vyTAGyy gX6OY3D6NKcwKzr2T7gQ1qfrgsmXONXaowL08xAqp3sQl6gZLJKKcO3tdlmWlbLIrgXj XFvQfVlQrhlDX02RIniLiggTWymFTcimIpo+lCwgUUQPsPxpnjOsrwm7l2htNGxu2SbW 7fqQ== X-Gm-Message-State: AFqh2kqswp8wIetAwRUeE8U4njqfNqWvEhLcLmuJ0sSamzgt7TjjyDhE T5CNYwNiXLd53FaUSgfrC7JN3R8= X-Google-Smtp-Source: AMrXdXtqqFlIs8RhTd2XTMrIxTA9lU1ZrKN8mQajhbBRloIC00jTX+bF1n85HCoMwM+umw6U2ODcQgA= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:902:ce8f:b0:194:8938:c2a6 with SMTP id f15-20020a170902ce8f00b001948938c2a6mr1309816plg.7.1674166561994; Thu, 19 Jan 2023 14:16:01 -0800 (PST) Date: Thu, 19 Jan 2023 14:15:33 -0800 In-Reply-To: <20230119221536.3349901-1-sdf@google.com> Mime-Version: 1.0 References: <20230119221536.3349901-1-sdf@google.com> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog Message-ID: <20230119221536.3349901-15-sdf@google.com> From: Stanislav Fomichev To: bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CXANGKEHVYYRXYIW742OJ47L7K6FV5VW X-Message-ID-Hash: CXANGKEHVYYRXYIW742OJ47L7K6FV5VW X-MailFrom: 3IcHJYwMKCe4iTVWeeWbU.SecnTf-XYdjinTf-fheZUSj.dUj@flex--sdf.bounces.google.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] [PATCH bpf-next v8 14/17] xsk: Add cb area to struct xdp_buff_xsk List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Toke H=C3=B8iland-J=C3=B8rgensen Add an area after the xdp_buff in struct xdp_buff_xsk that drivers can use to stash extra information to use in metadata kfuncs. The maximum size of 24 bytes means the full xdp_buff_xsk structure will take up exactly two cache lines (with the cb field spanning both). Also add a macro drivers can use to check their own wrapping structs against the available size. Cc: John Fastabend Cc: David Ahern Cc: Martin KaFai Lau Cc: Jakub Kicinski Cc: Willem de Bruijn Cc: Jesper Dangaard Brouer Cc: Anatoly Burakov Cc: Alexander Lobakin Cc: Magnus Karlsson Cc: Maryam Tahhan Cc: xdp-hints@xdp-project.net Cc: netdev@vger.kernel.org Suggested-by: Jakub Kicinski Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Signed-off-by: Stanislav Fomichev --- include/net/xsk_buff_pool.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h index f787c3f524b0..3e952e569418 100644 --- a/include/net/xsk_buff_pool.h +++ b/include/net/xsk_buff_pool.h @@ -19,8 +19,11 @@ struct xdp_sock; struct device; struct page; =20 +#define XSK_PRIV_MAX 24 + struct xdp_buff_xsk { struct xdp_buff xdp; + u8 cb[XSK_PRIV_MAX]; dma_addr_t dma; dma_addr_t frame_dma; struct xsk_buff_pool *pool; @@ -28,6 +31,8 @@ struct xdp_buff_xsk { struct list_head free_list_node; }; =20 +#define XSK_CHECK_PRIV_TYPE(t) BUILD_BUG_ON(sizeof(t) > offsetofend(struct= xdp_buff_xsk, cb)) + struct xsk_dma_map { dma_addr_t *dma_pages; struct device *dev; --=20 2.39.0.246.g2a6d74b583-goog