From: Stanislav Fomichev <sdf@google.com>
To: bpf@vger.kernel.org
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,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"David Ahern" <dsahern@gmail.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Willem de Bruijn" <willemb@google.com>,
"Jesper Dangaard Brouer" <brouer@redhat.com>,
"Anatoly Burakov" <anatoly.burakov@intel.com>,
"Alexander Lobakin" <alexandr.lobakin@intel.com>,
"Magnus Karlsson" <magnus.karlsson@gmail.com>,
"Maryam Tahhan" <mtahhan@redhat.com>,
xdp-hints@xdp-project.net, netdev@vger.kernel.org
Subject: [xdp-hints] [PATCH bpf-next v3 08/11] xsk: Add cb area to struct xdp_buff_xsk
Date: Tue, 29 Nov 2022 11:34:49 -0800 [thread overview]
Message-ID: <20221129193452.3448944-9-sdf@google.com> (raw)
In-Reply-To: <20221129193452.3448944-1-sdf@google.com>
From: Toke Høiland-Jørgensen <toke@redhat.com>
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 <john.fastabend@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>
Cc: Magnus Karlsson <magnus.karlsson@gmail.com>
Cc: Maryam Tahhan <mtahhan@redhat.com>
Cc: xdp-hints@xdp-project.net
Cc: netdev@vger.kernel.org
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
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;
+#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;
};
+#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;
--
2.38.1.584.g0f3c55d4c2-goog
next prev parent reply other threads:[~2022-11-29 19:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 19:34 [xdp-hints] [PATCH bpf-next v3 00/11] xdp: hints via kfuncs Stanislav Fomichev
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 01/11] bpf: Document XDP RX metadata Stanislav Fomichev
2022-12-02 20:58 ` [xdp-hints] " kernel test robot
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 02/11] bpf: XDP metadata RX kfuncs Stanislav Fomichev
2022-11-30 17:56 ` [xdp-hints] " kernel test robot
2022-11-30 22:49 ` kernel test robot
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 03/11] veth: Introduce veth_xdp_buff wrapper for xdp_buff Stanislav Fomichev
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 04/11] veth: Support RX XDP metadata Stanislav Fomichev
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 05/11] selftests/bpf: Verify xdp_metadata xdp->af_xdp path Stanislav Fomichev
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 06/11] mlx4: Introduce mlx4_xdp_buff wrapper for xdp_buff Stanislav Fomichev
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 07/11] mxl4: Support RX XDP metadata Stanislav Fomichev
2022-11-29 19:34 ` Stanislav Fomichev [this message]
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 09/11] mlx5: Introduce mlx5_xdp_buff wrapper for xdp_buff Stanislav Fomichev
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 10/11] mlx5: Support RX XDP metadata Stanislav Fomichev
2022-11-30 5:48 ` [xdp-hints] " kernel test robot
2022-11-30 22:29 ` kernel test robot
2022-12-01 2:42 ` kernel test robot
2022-12-01 13:08 ` kernel test robot
2022-11-29 19:34 ` [xdp-hints] [PATCH bpf-next v3 11/11] selftests/bpf: Simple program to dump XDP RX metadata Stanislav Fomichev
2022-11-29 20:50 ` [xdp-hints] Re: [PATCH bpf-next v3 00/11] xdp: hints via kfuncs Toke Høiland-Jørgensen
2022-11-29 23:41 ` Stanislav Fomichev
2022-11-30 23:01 ` Toke Høiland-Jørgensen
2022-12-01 0:16 ` Martin KaFai Lau
2022-12-01 0:32 ` Stanislav Fomichev
2022-12-01 3:56 ` Jakub Kicinski
2022-12-01 0:32 ` Stanislav Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.xdp-project.net/postorius/lists/xdp-hints.xdp-project.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221129193452.3448944-9-sdf@google.com \
--to=sdf@google.com \
--cc=alexandr.lobakin@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@gmail.com \
--cc=martin.lau@linux.dev \
--cc=mtahhan@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=song@kernel.org \
--cc=toke@redhat.com \
--cc=willemb@google.com \
--cc=xdp-hints@xdp-project.net \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox