public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xsk: Fix offset calculation in unaligned mode
       [not found] <CGME20250409131930eucas1p22b304bf5924a9b3bc43a442d738ebef3@eucas1p2.samsung.com>
@ 2025-04-09 13:19 ` e.kubanski
  2025-04-10 12:50   ` Maciej Fijalkowski
  0 siblings, 1 reply; 2+ messages in thread
From: e.kubanski @ 2025-04-09 13:19 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: bjorn, magnus.karlsson, maciej.fijalkowski, jonathan.lemon,
	e.kubanski

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.

Signed-off-by: Eryk Kubanski <e.kubanski@partner.samsung.com>
---
 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] 2+ messages in thread

* Re: [PATCH] xsk: Fix offset calculation in unaligned mode
  2025-04-09 13:19 ` [PATCH] xsk: Fix offset calculation in unaligned mode e.kubanski
@ 2025-04-10 12:50   ` Maciej Fijalkowski
  0 siblings, 0 replies; 2+ messages in thread
From: Maciej Fijalkowski @ 2025-04-10 12:50 UTC (permalink / raw)
  To: e.kubanski; +Cc: linux-kernel, netdev, bjorn, magnus.karlsson, jonathan.lemon

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@partner.samsung.com>
> ---
>  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] 2+ messages in thread

end of thread, other threads:[~2025-04-10 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250409131930eucas1p22b304bf5924a9b3bc43a442d738ebef3@eucas1p2.samsung.com>
2025-04-09 13:19 ` [PATCH] xsk: Fix offset calculation in unaligned mode e.kubanski
2025-04-10 12:50   ` Maciej Fijalkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox