summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>2024-01-24 20:16:00 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-31 16:21:10 -0800
commit440fee8feb34a4e23d01cc17fd65a989917a8641 (patch)
treeaa89cc7951cd16d000bd89ec7ab80bf1d656a2d4 /net/core
parent8bd491e5dcb55269856db759a14ba796cf0b05c9 (diff)
downloadlinux-stable-440fee8feb34a4e23d01cc17fd65a989917a8641.tar.gz
linux-stable-440fee8feb34a4e23d01cc17fd65a989917a8641.tar.bz2
linux-stable-440fee8feb34a4e23d01cc17fd65a989917a8641.zip
xdp: reflect tail increase for MEM_TYPE_XSK_BUFF_POOL
[ Upstream commit fbadd83a612c3b7aad2987893faca6bd24aaebb3 ] XSK ZC Rx path calculates the size of data that will be posted to XSK Rx queue via subtracting xdp_buff::data_end from xdp_buff::data. In bpf_xdp_frags_increase_tail(), when underlying memory type of xdp_rxq_info is MEM_TYPE_XSK_BUFF_POOL, add offset to data_end in tail fragment, so that later on user space will be able to take into account the amount of bytes added by XDP program. Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX") Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://lore.kernel.org/r/20240124191602.566724-10-maciej.fijalkowski@intel.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 6575288b8580..cee53838310f 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4091,6 +4091,8 @@ static int bpf_xdp_frags_increase_tail(struct xdp_buff *xdp, int offset)
memset(skb_frag_address(frag) + skb_frag_size(frag), 0, offset);
skb_frag_size_add(frag, offset);
sinfo->xdp_frags_size += offset;
+ if (rxq->mem.type == MEM_TYPE_XSK_BUFF_POOL)
+ xsk_buff_get_tail(xdp)->data_end += offset;
return 0;
}