[Intel-wired-lan] [PATCH iwl-next 1/3] libeth: add __libeth_rx_sync_for_cpu
Matt Vollrath
tactii at gmail.com
Fri Jul 31 12:41:07 UTC 2026
Deriving a netmem's page pool from the ref requires loading a pointer
from the netmem_desc, which may not be cached. The driver may already
have a cached reference to the correct page pool, so add a bypass.
No functional change for existing callers.
Signed-off-by: Matt Vollrath <tactii at gmail.com>
Assisted-by: Claude:claude-5-fable
---
include/net/libeth/rx.h | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/include/net/libeth/rx.h b/include/net/libeth/rx.h
index 5d991404845e..fddac084e001 100644
--- a/include/net/libeth/rx.h
+++ b/include/net/libeth/rx.h
@@ -118,36 +118,51 @@ static inline dma_addr_t libeth_rx_alloc(const struct libeth_fq_fp *fq, u32 i)
void libeth_rx_recycle_slow(netmem_ref netmem);
/**
- * libeth_rx_sync_for_cpu - synchronize or recycle buffer post DMA
+ * __libeth_rx_sync_for_cpu - synchronize or recycle buffer post DMA
+ * @pool: &page_pool the buffer was allocated from
* @fqe: buffer to process
* @len: frame length from the descriptor
*
- * Process the buffer after it's written by HW. The regular path is to
- * synchronize DMA for CPU, but in case of no data it will be immediately
- * recycled back to its PP.
+ * Variant for callers which already know the buffer's pool, typically
+ * their Rx queue's fill queue pool.
*
* Return: true when there's data to process, false otherwise.
*/
-static inline bool libeth_rx_sync_for_cpu(const struct libeth_fqe *fqe,
- u32 len)
+static inline bool __libeth_rx_sync_for_cpu(const struct page_pool *pool,
+ const struct libeth_fqe *fqe,
+ u32 len)
{
- netmem_ref netmem = fqe->netmem;
-
/* Very rare, but possible case. The most common reason:
* the last fragment contained FCS only, which was then
* stripped by the HW.
*/
if (unlikely(!len)) {
- libeth_rx_recycle_slow(netmem);
+ libeth_rx_recycle_slow(fqe->netmem);
return false;
}
- page_pool_dma_sync_netmem_for_cpu(netmem_get_pp(netmem), netmem,
- fqe->offset, len);
+ page_pool_dma_sync_netmem_for_cpu(pool, fqe->netmem, fqe->offset, len);
return true;
}
+/**
+ * libeth_rx_sync_for_cpu - synchronize or recycle buffer post DMA
+ * @fqe: buffer to process
+ * @len: frame length from the descriptor
+ *
+ * Process the buffer after it's written by HW. The regular path is to
+ * synchronize DMA for CPU, but in case of no data it will be immediately
+ * recycled back to its PP.
+ *
+ * Return: true when there's data to process, false otherwise.
+ */
+static inline bool libeth_rx_sync_for_cpu(const struct libeth_fqe *fqe,
+ u32 len)
+{
+ return __libeth_rx_sync_for_cpu(netmem_get_pp(fqe->netmem), fqe, len);
+}
+
/* Converting abstract packet type numbers into a software structure with
* the packet parameters to do O(1) lookup on Rx.
*/
--
2.43.0
More information about the Intel-wired-lan
mailing list