Re: [PATCH] xsk: Fix offset calculation in unaligned mode
From: Maciej Fijalkowski
Date: Thu Apr 10 2025 - 08:54:09 EST
On Wed, Apr 09, 2025 at 03:19:13PM +0200, e.kubanski wrote:
> Offset calculation in unaligned mode didn't
> match previous behaviour.
>
> Unaligned mode should pass offset only in
> upper 16 bits, lower 48 bits should pass
> only specific chunk location in umem.
>
> pool->headroom was duplicated into offset
> and address of the umem chunk.
Thanks! Same what Magnus commented, you need to target the patch to bpf
tree and provide a fixes tag. Here's the format that we expect:
Fixes: bea14124bacb ("xsk: Get rid of xdp_buff_xsk::orig_addr")
and it actually is the blamed commit for this fix, so just paste it to
commit message.
Also, we prefer to use imperative mood in commit descriptions. Go through
https://docs.kernel.org/process/submitting-patches.html.
>
> Signed-off-by: Eryk Kubanski <e.kubanski@xxxxxxxxxxxxxxxxxxx>
> ---
> include/net/xsk_buff_pool.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
> index 7f0a75d6563d..b3699a848844 100644
> --- a/include/net/xsk_buff_pool.h
> +++ b/include/net/xsk_buff_pool.h
> @@ -232,8 +232,8 @@ static inline u64 xp_get_handle(struct xdp_buff_xsk *xskb,
> return orig_addr;
>
> offset = xskb->xdp.data - xskb->xdp.data_hard_start;
> - orig_addr -= offset;
> offset += pool->headroom;
> + orig_addr -= offset;
> return orig_addr + (offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT);
> }
>
> --
> 2.34.1
>