netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "e.kubanski" <e.kubanski@partner.samsung.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: bjorn@kernel.org, magnus.karlsson@intel.com,
	maciej.fijalkowski@intel.com, jonathan.lemon@gmail.com,
	"e.kubanski" <e.kubanski@partner.samsung.com>
Subject: [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode
Date: Wed, 16 Apr 2025 13:29:25 +0200	[thread overview]
Message-ID: <20250416112925.7501-1-e.kubanski@partner.samsung.com> (raw)
In-Reply-To: CGME20250416112956eucas1p1977ffda6af7fa81c3e46cadc93c30de3@eucas1p1.samsung.com

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


       reply	other threads:[~2025-04-16 11:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250416112956eucas1p1977ffda6af7fa81c3e46cadc93c30de3@eucas1p1.samsung.com>
2025-04-16 11:29 ` e.kubanski [this message]
2025-04-22  9:53   ` [PATCH v2 bpf] xsk: Fix offset calculation in unaligned mode Magnus Karlsson
2025-04-25  0:20   ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250416112925.7501-1-e.kubanski@partner.samsung.com \
    --to=e.kubanski@partner.samsung.com \
    --cc=bjorn@kernel.org \
    --cc=jonathan.lemon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).