Re: [PATCH net-next] net: ibm: emac: use page_pool for RX buffers

From: Simon Horman

Date: Thu Nov 05 2026 - 15:28:58 EST


On Sun, Nov 01, 2026 at 07:48:06PM -0800, Rosen Penev wrote:
> The RX ring held skbs that were allocated and DMA mapped when a slot was
> refilled. By the time a frame arrived in that slot the skb was cold, and
> every refill paid for a full skb allocation and a dma_map_single().
>
> Take the RX buffers from a page_pool instead and build the skb with
> napi_build_skb() once a frame has arrived. Frames spanning several BDs
> get the following buffers attached as page fragments instead of being
> copied into one large skb. The BD size is capped so that a buffer always
> fits into a page. The driver now syncs the received data for the CPU
> before reading it.
>
> The pool recycles directly into the MAL NAPI instance, so it is
> destroyed while that instance is disabled.
>
> Routing a single TCP stream through the qca8k switch of a Meraki MX60
> (iperf3 median of 3):
>
> LAN->WAN WAN->LAN (Mbit/s)
> before 588 508
> after 614 528
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>

...

> @@ -1661,17 +1667,23 @@ static void emac_poll_tx(void *param)
> netif_tx_unlock_bh(dev->ndev);
> }
>
> +static inline void emac_rx_sync_for_cpu(struct emac_instance *dev, int slot,
> + int len)
> +{
> + dma_sync_single_for_cpu(&dev->ofdev->dev, dev->rx_dma[slot],
> + SKB_DATA_ALIGN(len + NET_IP_ALIGN),
> + DMA_FROM_DEVICE);
> +}
> +

Hi Rosen,

I realise this is pattern already pervasive in this file.
But please do not add new instances of the inline keyword
in C files unless there is a demonstrable reason to do so -
usually performance.

Instead, please let the compiler do it's thing.

Otherwise this patch looks good to me.

--
pw-bot: changes-requested

...