]> git.infradead.org Git - nvme.git/commitdiff
xdp: reflect tail increase for MEM_TYPE_XSK_BUFF_POOL
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Wed, 24 Jan 2024 19:16:00 +0000 (20:16 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 25 Jan 2024 00:24:07 +0000 (16:24 -0800)
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>
net/core/filter.c

index 36fb5ae8af699be6f0f6b3e70a4d8c9eb8f0fab6..ef3e78b6a39c45b9487931e0b7fa438e722aac2e 100644 (file)
@@ -4093,6 +4093,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;
 }