netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode
       [not found] <CGME20250416112956eucas1p1977ffda6af7fa81c3e46cadc93c30de3@eucas1p1.samsung.com>
@ 2025-04-16 11:29 ` e.kubanski
  2025-04-22  9:53   ` Magnus Karlsson
  2025-04-25  0:20   ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: e.kubanski @ 2025-04-16 11:29 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: bjorn, magnus.karlsson, maciej.fijalkowski, jonathan.lemon,
	e.kubanski

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: Eryk Kubanski <e.kubanski@partner.samsung.com>
Fixes: bea14124bacb ("xsk: Get rid of xdp_buff_xsk::orig_addr")
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode
  2025-04-16 11:29 ` [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode e.kubanski
@ 2025-04-22  9:53   ` Magnus Karlsson
  2025-04-25  0:20   ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Magnus Karlsson @ 2025-04-22  9:53 UTC (permalink / raw)
  To: e.kubanski
  Cc: linux-kernel, netdev, bjorn, magnus.karlsson, maciej.fijalkowski,
	jonathan.lemon

On Wed, 16 Apr 2025 at 13:30, e.kubanski <e.kubanski@partner.samsung.com> wrote:
>
> 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.

Thanks Eryk.

Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>

> Signed-off-by: Eryk Kubanski <e.kubanski@partner.samsung.com>
> Fixes: bea14124bacb ("xsk: Get rid of xdp_buff_xsk::orig_addr")
> ---
>  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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode
  2025-04-16 11:29 ` [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode e.kubanski
  2025-04-22  9:53   ` Magnus Karlsson
@ 2025-04-25  0:20   ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-25  0:20 UTC (permalink / raw)
  To: e.kubanski
  Cc: linux-kernel, netdev, bjorn, magnus.karlsson, maciej.fijalkowski,
	jonathan.lemon

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 16 Apr 2025 13:29:25 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [v2,bpf] xsk: Fix offset calculation in unaligned mode
    https://git.kernel.org/netdev/net/c/bf20af079099

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-25  0:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250416112956eucas1p1977ffda6af7fa81c3e46cadc93c30de3@eucas1p1.samsung.com>
2025-04-16 11:29 ` [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode e.kubanski
2025-04-22  9:53   ` Magnus Karlsson
2025-04-25  0:20   ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).