Commit bf20af07 authored by e.kubanski's avatar e.kubanski Committed by Jakub Kicinski
Browse files

xsk: Fix offset calculation in unaligned mode



Bring back previous offset calculation behaviour
in AF_XDP unaligned umem mode.

In unaligned mode, upper 16 bits should contain
data offset, lower 48 bits should contain
only specific chunk location without offset.

Remove pool->headroom duplication into 48bit address.

Signed-off-by: default avatarEryk Kubanski <e.kubanski@partner.samsung.com>
Fixes: bea14124 ("xsk: Get rid of xdp_buff_xsk::orig_addr")
Acked-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
Link: https://patch.msgid.link/20250416112925.7501-1-e.kubanski@partner.samsung.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a1356ac7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -240,8 +240,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);
}