🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11862

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

#11862
From: Simon Horman
Date: Thu, 05 Nov 2026 20:13
55 lines
9407 bytes
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@gmail.com>

...

> @@ -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

...
Technical Details
Message-ID: <20261105201302.GY865646@horms.kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357568-linux-kernel-netdev=dewy.ru
References: <20261102034806.190498-1-rosenp@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357568-linux-kernel-netdev=dewy.ru
From: horms@kernel.org (Simon Horman)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net: ibm: emac: use page_pool for RX buffers
Date: Thu, 5 Nov 2026 20:13:02 +0000
Organization: Usenet Network
Message-ID: <20261105201302.GY865646@horms.kernel.org>
References: <20261102034806.190498-1-rosenp@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3723079"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gbKGpph+mnLC3rKU8KPGO6Rfg5A= sha256:Tnu5Egbcw8sZ9oVb8peO8w9G+cIMblnBSNEKlq2LRXA=
	sha1:JOofGMqNxi57WFiVbiniRFunuM8= sha256:UKmvcdldNikfJeZnZl3kJgr6pPCHuWQJ4bMQM95EvCU=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 4DF51113093; Thu,  5 Nov 2026 23:40:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 9yhbXXn2Fe4c;
	Thu,  5 Nov 2026 23:40:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-357568-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 5815911302A; Thu,  5 Nov 2026 23:40:39 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id C56BC38034; Thu,  5 Nov 2026 20:13:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793909598;
	b=shnkAiMtFEnF0udKM0MC899nh6oJ8wS3NCk4GpIQgH2uo46dQVe+zNngtvdPKct3cVAw
	 sFWTpL55JCtU8tk1wztEfVRa689A8+JPFtTW+La0PkOifn/25ZpVsbYf48Zi1+pR5a8Y9
	 g4wOct1Epi6eC0R2ft1+2YB0zdo5dY+hFzW7XGyaQd+TP61soi+bXYYwVj3pmKhKKfj/g
	 73hmHPiYfrFM11319gmfjvENp/qiq0qC98p4dBM+FsEKPy9Dt64R8aZ5kMIjPO+g8sAyR
	 qP2lhxFp/hSeWcwLkArvubdaHNo4yTBYr+a3ae3ZVbEo6EZV1TxY+oSy6TUEXXpW5Jg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793909598;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=Y2Heru+krAQjJgkVwe3kW1L+yzEzbjyvlLhz+JHeGcU=;
	b=M85zj4AJCA8gR0J7DAoAch8LRA43ZU5UD0o/UwfRHxFLzUrNy71iMvWxpUvYqSSmZ77T
	 +N9fpKGx+nMgihZzrV7mCVV80YR0lpI06FnWGMEOofzh4o1A1FFGxRvxPY0wfXJCGH9Sn
	 FQEytBB5BkK1jU+DlStVfyVJKMOfpa5wJztqoOCCI46kwtYk6OoPJnOwdGIkhFkw/K7Gu
	 Vez0fS6SYgEsHfZmmRGyP2cqO29H9TMZKiTLDxH2XdJgsL2ryPvETMnHgf9dSuo8VLFSk
	 QFG5++XjXBn/N8r0F6BhKu9H/Awx4c9d1BY01Z09BBXp9GXnI+Gj798UcocUd9Hk93Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T4czUsrp;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 215D0606A328;
	Thu,  5 Nov 2026 20:13:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T4czUsrp
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793909587;
	b=Z65WX1WJ1kdIpH1ibPXW5ug9mgiKKRV6iUjbLEH7nSIkFuRqseALHml1SeH+XmMgSpFQ
	 cXPEGqB1ShxfXs1Ae0x+8ZItf4uB3IRVHj9mZUbjCM8yA/ElaNmCA1b5igkkYldDaGCOc
	 5N8fkQsA7YFyY2FThDBKMKSFq/kBmpxyKckXb8S1FXOvhTrTKNrY8QTnzzChY09O8HXsb
	 qw+oNoZ4JyCyoFyKVsM6yOHYQ4jiPVk9Q38adBlEJdlvATpyn8xc43VyNFgh9wbVMBVV5
	 jmTtmYl9uylZADjyULUOQ4EuORboXkLrYtTWPR6h74QF70bRd4EhoYrs5uT1Oe0Hopw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793909587;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=Y2Heru+krAQjJgkVwe3kW1L+yzEzbjyvlLhz+JHeGcU=;
	b=cG21UZGnfY1PuVhLE/yU1n7bcTCx128nJB6r3dtUZNtLvvVIAMe8U+y4wfnKF2mVxxoX
	 hnhggbxJ5IZatIKLy3XkF9aiuLVnCCspcmQVCEXiP5fphYqTidNcF7B/yv8dBuw5Jv1iv
	 Y3nJop5Z8NGdXOv8hNkKb2LYFfZ5Jq+iY1k2kL9q+f9SRnAr/P3O88YAKcNBG0r3cwBL9
	 vYsd3HVq3j1cPgakfPYwJRgWtlovMOa0TUrrciceJ9m+g8kPjyw2MkP9us2I6rrkJ0Mi8
	 RBSJsrXJyzij+YpNteupZvTgJkEcGkbOzMn1f+umX/LwjcpHXBNlOi+1KsO/wSGKZ6A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T4czUsrp;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1940606A31B;
	Thu,  5 Nov 2026 20:13:06 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14CB91F0089F;
	Thu,  5 Nov 2026 20:13:04 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793909586;
	bh=Y2Heru+krAQjJgkVwe3kW1L+yzEzbjyvlLhz+JHeGcU=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=T4czUsrpmFYecGSDy2nnUGHgt1y0+xQdOH+e5ezZUSYPGXYkQjUKBmS96pw9V3ofH
	 p5rZgvFeqoiZnJ6LOqQEEpxw7nKJoUOiZ67rm4WxivavU8DAnpjGeuHpWUWj69DaYS
	 91kPXhZaxFvw6VkFLVkVjDHua1oPPuWaJgVQAz2vJDxBRmfhFmkdvHKLrjbyAZCosF
	 w32yCOC51P1OW7etuuPZ1W2ng/id33DHCknSXq4LZ6sXZNK23QUZ26RjMhmqjsyaW9
	 +3UagrnkT/UmP4wskp7J89AK7nD2Gqi7gCA8vlL9ripSWnv4FM1gKMtlJaZhgj8o9d
	 5VPA2faytQyJg==
X-Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	open list <linux-kernel@vger.kernel.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261102034806.190498-1-rosenp@gmail.com>