Skip to contentSkip to conversation

net: bcmasp: Switch to page pool for RX path

PATCH Applied Florian Fainelli 4 participants 4 messages Apr 8 – Apr 9

Subsystems (3)
lore
Share & tools
lore

Florian Fainelli

author maintainer
#0 lore raw

PATCH v2 1/1 net: bcmasp: Switch to page pool for RX path

This shows an improvement of 1.9% in reducing the CPU cycles and data cache misses.

---
Changes in v2:

- addressed Nicolai's comments by setting the .netdev and .napi members and dropped the useless comment and .dma_dir initialization

 drivers/net/ethernet/broadcom/Kconfig         |   1 +
 drivers/net/ethernet/broadcom/asp2/bcmasp.h   |   8 +-
 .../net/ethernet/broadcom/asp2/bcmasp_intf.c  | 125 +++++++++++++++---
 .../ethernet/broadcom/asp2/bcmasp_intf_defs.h |   4 +
 4 files changed, 115 insertions(+), 23 deletions(-)
drivers/net/ethernet/broadcom/Kconfig +1 -0
index dd164acafd01..4287edc7ddd6 100644
@@ -272,6 +272,7 @@ config BCMASP
 	depends on OF
 	select PHYLIB
 	select MDIO_BCM_UNIMAC
+	select PAGE_POOL
 	help
 	  This configuration enables the Broadcom ASP 2.0 Ethernet controller
 	  driver which is present in Broadcom STB SoCs such as 72165.
drivers/net/ethernet/broadcom/asp2/bcmasp.h +6 -2
index 29cd87335ec8..8c8ffaeadc79 100644
@@ -6,6 +6,7 @@
 #include <linux/phy.h>
 #include <linux/io-64-nonatomic-hi-lo.h>
 #include <uapi/linux/ethtool.h>
+#include <net/page_pool/helpers.h>
 
 #define ASP_INTR2_OFFSET			0x1000
 #define  ASP_INTR2_STATUS			0x0
@@ -298,16 +299,19 @@ struct bcmasp_intf {
 	void __iomem			*rx_edpkt_cfg;
 	void __iomem			*rx_edpkt_dma;
 	int				rx_edpkt_index;
-	int				rx_buf_order;
 	struct bcmasp_desc		*rx_edpkt_cpu;
 	dma_addr_t			rx_edpkt_dma_addr;
 	dma_addr_t			rx_edpkt_dma_read;
 	dma_addr_t			rx_edpkt_dma_valid;
 
-	/* RX buffer prefetcher ring*/
+	/* Streaming RX data ring (RBUF_4K mode) */
 	void				*rx_ring_cpu;
 	dma_addr_t			rx_ring_dma;
 	dma_addr_t			rx_ring_dma_valid;
+	int				rx_buf_order;
+
+	/* Page pool for recycling RX SKB data pages */
+	struct page_pool		*rx_page_pool;
 	struct napi_struct		rx_napi;
 
 	struct bcmasp_res		res;
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +104 -21

216 lines not on this page · raw message

drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h +4 -0
index af7418348e81..0318f257452a 100644
@@ -246,6 +246,10 @@
 	((((intf)->channel - 6) * 0x14) + 0xa2000)
 #define  RX_SPB_TOP_BLKOUT		0x00
 
+/*
+ * Number of 4 KB pages that make up the contiguous RBUF_4K streaming ring
+ * and the page pool used as copy-target SKB data areas.
+ */
 #define NUM_4K_BUFFERS			32
 #define RING_BUFFER_SIZE		(PAGE_SIZE * NUM_4K_BUFFERS)
 
Signature · 1 line
2.34.1
#3 lore raw
In reply to Florian Fainelli
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 7 Apr 2026 17:18:13 -0700 you wrote:

This shows an improvement of 1.9% in reducing the CPU cycles and data cache misses.

---
Changes in v2:

[...]

Here is the summary with links:
- [net-next,v2] net: bcmasp: Switch to page pool for RX path

    https://git.kernel.org/netdev/net-next/c/686a7587bd0b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html