From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org
Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com,
bjorn@kernel.org, maciej.fijalkowski@intel.com
Subject: [PATCH bpf-next 4/6] xsk: carry a copy of xdp_zc_max_segs within xsk_buff_pool
Date: Wed, 2 Oct 2024 17:54:39 +0200 [thread overview]
Message-ID: <20241002155441.253956-5-maciej.fijalkowski@intel.com> (raw)
In-Reply-To: <20241002155441.253956-1-maciej.fijalkowski@intel.com>
This so we avoid dereferencing struct net_device within hot path.
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
include/net/xsk_buff_pool.h | 1 +
net/xdp/xsk_buff_pool.c | 1 +
net/xdp/xsk_queue.h | 2 +-
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
index 468a23b1b4c5..8223581d95f8 100644
--- a/include/net/xsk_buff_pool.h
+++ b/include/net/xsk_buff_pool.h
@@ -77,6 +77,7 @@ struct xsk_buff_pool {
u32 chunk_shift;
u32 frame_len;
u8 tx_metadata_len; /* inherited from umem */
+ u32 xdp_zc_max_segs;
u8 cached_need_wakeup;
bool uses_need_wakeup;
bool unaligned;
diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index 7ecd4ccd2473..e946ba4a5ccf 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -229,6 +229,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
goto err_unreg_xsk;
}
pool->umem->zc = true;
+ pool->xdp_zc_max_segs = netdev->xdp_zc_max_segs;
return 0;
err_unreg_xsk:
diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h
index 406b20dfee8d..46d87e961ad6 100644
--- a/net/xdp/xsk_queue.h
+++ b/net/xdp/xsk_queue.h
@@ -260,7 +260,7 @@ u32 xskq_cons_read_desc_batch(struct xsk_queue *q, struct xsk_buff_pool *pool,
nr_frags = 0;
} else {
nr_frags++;
- if (nr_frags == pool->netdev->xdp_zc_max_segs) {
+ if (nr_frags == pool->xdp_zc_max_segs) {
nr_frags = 0;
break;
}
--
2.34.1
next prev parent reply other threads:[~2024-10-02 15:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 15:54 [PATCH bpf-next 0/6] xsk: struct diet and cleanups Maciej Fijalkowski
2024-10-02 15:54 ` [PATCH bpf-next 1/6] xsk: get rid of xdp_buff_xsk::xskb_list_node Maciej Fijalkowski
2024-10-04 12:08 ` Daniel Borkmann
2024-10-07 12:16 ` Maciej Fijalkowski
2024-10-02 15:54 ` [PATCH bpf-next 2/6] xsk: s/free_list_node/list_node Maciej Fijalkowski
2024-10-02 15:54 ` [PATCH bpf-next 3/6] xsk: get rid of xdp_buff_xsk::orig_addr Maciej Fijalkowski
2024-10-02 15:54 ` Maciej Fijalkowski [this message]
2024-10-02 19:41 ` [PATCH bpf-next 4/6] xsk: carry a copy of xdp_zc_max_segs within xsk_buff_pool Vadim Fedorenko
2024-10-03 11:47 ` Maciej Fijalkowski
2024-10-02 15:54 ` [PATCH bpf-next 5/6] xsk: wrap duplicated code to function Maciej Fijalkowski
2024-10-02 15:54 ` [PATCH bpf-next 6/6] xsk: use xsk_buff_pool directly for cq functions Maciej Fijalkowski
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241002155441.253956-5-maciej.fijalkowski@intel.com \
--to=maciej.fijalkowski@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
/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