From: Matt Vollrath <tactii@gmail.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Matt Vollrath <tactii@gmail.com>
Subject: [Intel-wired-lan] [PATCH iwl-next 3/3] iavf: use cached page_pool ref in skb helpers
Date: Fri, 31 Jul 2026 08:41:09 -0400 [thread overview]
Message-ID: <20260731124109.99065-4-tactii@gmail.com> (raw)
In-Reply-To: <20260731124109.99065-1-tactii@gmail.com>
Deriving a reference to the page pool from netmem_desc requires loading
the struct. We already have a cached reference to the pool, so use that
instead.
Signed-off-by: Matt Vollrath <tactii@gmail.com>
Assisted-by: Claude:claude-5-fable
---
drivers/net/ethernet/intel/iavf/iavf_txrx.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index 3ae2f0a0ee4d..9dc5f0761d8b 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -1184,6 +1184,7 @@ static bool iavf_cleanup_headers(struct iavf_ring *rx_ring, struct sk_buff *skb)
/**
* iavf_add_rx_frag - Add contents of Rx buffer to sk_buff
+ * @pp: page pool the buffer was allocated from
* @skb: sk_buff to place the data into
* @rx_buffer: buffer containing page to add
* @size: packet length from rx_desc
@@ -1193,11 +1194,11 @@ static bool iavf_cleanup_headers(struct iavf_ring *rx_ring, struct sk_buff *skb)
*
* The function will then update the page offset.
**/
-static void iavf_add_rx_frag(struct sk_buff *skb,
+static void iavf_add_rx_frag(const struct page_pool *pp, struct sk_buff *skb,
const struct libeth_fqe *rx_buffer,
unsigned int size)
{
- u32 hr = netmem_get_pp(rx_buffer->netmem)->p.offset;
+ u32 hr = pp->p.offset;
skb_add_rx_frag_netmem(skb, skb_shinfo(skb)->nr_frags,
rx_buffer->netmem, rx_buffer->offset + hr,
@@ -1206,17 +1207,19 @@ static void iavf_add_rx_frag(struct sk_buff *skb,
/**
* iavf_build_skb - Build skb around an existing buffer
+ * @pp: page pool the buffer was allocated from
* @rx_buffer: Rx buffer to pull data from
* @size: size of buffer to add to skb
*
* This function builds an skb around an existing Rx buffer, taking care
* to set up the skb correctly and avoid any memcpy overhead.
*/
-static struct sk_buff *iavf_build_skb(const struct libeth_fqe *rx_buffer,
+static struct sk_buff *iavf_build_skb(const struct page_pool *pp,
+ const struct libeth_fqe *rx_buffer,
unsigned int size)
{
struct page *buf_page = __netmem_to_page(rx_buffer->netmem);
- u32 hr = pp_page_to_nmdesc(buf_page)->pp->p.offset;
+ u32 hr = pp->p.offset;
struct sk_buff *skb;
void *va;
@@ -1430,9 +1433,9 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, int budget)
/* retrieve a buffer from the ring */
if (skb)
- iavf_add_rx_frag(skb, rx_buffer, fields.len);
+ iavf_add_rx_frag(pp, skb, rx_buffer, fields.len);
else
- skb = iavf_build_skb(rx_buffer, fields.len);
+ skb = iavf_build_skb(pp, rx_buffer, fields.len);
/* exit if we failed to retrieve a buffer */
if (!skb) {
--
2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: Matt Vollrath <tactii@gmail.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Matt Vollrath <tactii@gmail.com>
Subject: [PATCH iwl-next 3/3] iavf: use cached page_pool ref in skb helpers
Date: Fri, 31 Jul 2026 08:41:09 -0400 [thread overview]
Message-ID: <20260731124109.99065-4-tactii@gmail.com> (raw)
In-Reply-To: <20260731124109.99065-1-tactii@gmail.com>
Deriving a reference to the page pool from netmem_desc requires loading
the struct. We already have a cached reference to the pool, so use that
instead.
Signed-off-by: Matt Vollrath <tactii@gmail.com>
Assisted-by: Claude:claude-5-fable
---
drivers/net/ethernet/intel/iavf/iavf_txrx.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index 3ae2f0a0ee4d..9dc5f0761d8b 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -1184,6 +1184,7 @@ static bool iavf_cleanup_headers(struct iavf_ring *rx_ring, struct sk_buff *skb)
/**
* iavf_add_rx_frag - Add contents of Rx buffer to sk_buff
+ * @pp: page pool the buffer was allocated from
* @skb: sk_buff to place the data into
* @rx_buffer: buffer containing page to add
* @size: packet length from rx_desc
@@ -1193,11 +1194,11 @@ static bool iavf_cleanup_headers(struct iavf_ring *rx_ring, struct sk_buff *skb)
*
* The function will then update the page offset.
**/
-static void iavf_add_rx_frag(struct sk_buff *skb,
+static void iavf_add_rx_frag(const struct page_pool *pp, struct sk_buff *skb,
const struct libeth_fqe *rx_buffer,
unsigned int size)
{
- u32 hr = netmem_get_pp(rx_buffer->netmem)->p.offset;
+ u32 hr = pp->p.offset;
skb_add_rx_frag_netmem(skb, skb_shinfo(skb)->nr_frags,
rx_buffer->netmem, rx_buffer->offset + hr,
@@ -1206,17 +1207,19 @@ static void iavf_add_rx_frag(struct sk_buff *skb,
/**
* iavf_build_skb - Build skb around an existing buffer
+ * @pp: page pool the buffer was allocated from
* @rx_buffer: Rx buffer to pull data from
* @size: size of buffer to add to skb
*
* This function builds an skb around an existing Rx buffer, taking care
* to set up the skb correctly and avoid any memcpy overhead.
*/
-static struct sk_buff *iavf_build_skb(const struct libeth_fqe *rx_buffer,
+static struct sk_buff *iavf_build_skb(const struct page_pool *pp,
+ const struct libeth_fqe *rx_buffer,
unsigned int size)
{
struct page *buf_page = __netmem_to_page(rx_buffer->netmem);
- u32 hr = pp_page_to_nmdesc(buf_page)->pp->p.offset;
+ u32 hr = pp->p.offset;
struct sk_buff *skb;
void *va;
@@ -1430,9 +1433,9 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, int budget)
/* retrieve a buffer from the ring */
if (skb)
- iavf_add_rx_frag(skb, rx_buffer, fields.len);
+ iavf_add_rx_frag(pp, skb, rx_buffer, fields.len);
else
- skb = iavf_build_skb(rx_buffer, fields.len);
+ skb = iavf_build_skb(pp, rx_buffer, fields.len);
/* exit if we failed to retrieve a buffer */
if (!skb) {
--
2.43.0
next prev parent reply other threads:[~2026-07-31 12:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 12:41 [PATCH iwl-next 0/3] iavf: defer loading netmem_desc Matt Vollrath
2026-07-31 12:41 ` [Intel-wired-lan] " Matt Vollrath
2026-07-31 12:41 ` [Intel-wired-lan] [PATCH iwl-next 1/3] libeth: add __libeth_rx_sync_for_cpu Matt Vollrath
2026-07-31 12:41 ` Matt Vollrath
2026-07-31 13:37 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-07-31 13:37 ` Loktionov, Aleksandr
2026-07-31 12:41 ` [Intel-wired-lan] [PATCH iwl-next 2/3] iavf: use __libeth_rx_sync_for_cpu Matt Vollrath
2026-07-31 12:41 ` Matt Vollrath
2026-07-31 13:38 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-07-31 13:38 ` Loktionov, Aleksandr
2026-07-31 12:41 ` Matt Vollrath [this message]
2026-07-31 12:41 ` [PATCH iwl-next 3/3] iavf: use cached page_pool ref in skb helpers Matt Vollrath
2026-07-31 13:38 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-07-31 13:38 ` Loktionov, Aleksandr
2026-07-31 15:13 ` [PATCH iwl-next 0/3] iavf: defer loading netmem_desc Alexander Lobakin
2026-07-31 15:13 ` [Intel-wired-lan] " Alexander Lobakin
2026-07-31 19:27 ` Matt Vollrath
2026-07-31 19:27 ` [Intel-wired-lan] " Matt Vollrath
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=20260731124109.99065-4-tactii@gmail.com \
--to=tactii@gmail.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.