From: Paolo Abeni <pabeni@redhat.com>
To: Paolo Valerio <pvalerio@redhat.com>, netdev@vger.kernel.org
Cc: "Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Lorenzo Bianconi" <lorenzo@kernel.org>,
"Théo Lebrun" <theo.lebrun@bootlin.com>
Subject: Re: [PATCH net-next v3 3/8] net: macb: Add page pool support handle multi-descriptor frame rx
Date: Thu, 5 Mar 2026 11:53:19 +0100 [thread overview]
Message-ID: <4a7c8f45-abe3-4673-9b7c-abc1040b0bdc@redhat.com> (raw)
In-Reply-To: <20260302115232.1430640-4-pvalerio@redhat.com>
On 3/2/26 12:52 PM, Paolo Valerio wrote:
> Use the page pool allocator for the data buffers and enable skb
> recycling support, instead of relying on netdev_alloc_skb
> allocating the entire skb during the refill.
>
> The patch also add support for receiving network frames that span
> multiple DMA descriptors in the Cadence MACB/GEM Ethernet driver.
>
> The patch removes the requirement that limited frame reception to
> a single descriptor (RX_SOF && RX_EOF), also avoiding potential
> contiguous multi-page allocation for large frames.
>
> Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
> ---
> drivers/net/ethernet/cadence/Kconfig | 1 +
> drivers/net/ethernet/cadence/macb.h | 5 +
> drivers/net/ethernet/cadence/macb_main.c | 401 ++++++++++++++++-------
> 3 files changed, 283 insertions(+), 124 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
> index 5b2a461dfd28..ae500f717433 100644
> --- a/drivers/net/ethernet/cadence/Kconfig
> +++ b/drivers/net/ethernet/cadence/Kconfig
> @@ -25,6 +25,7 @@ config MACB
> depends on PTP_1588_CLOCK_OPTIONAL
> select PHYLINK
> select CRC32
> + select PAGE_POOL
> help
> The Cadence MACB ethernet interface is found on many Atmel AT32 and
> AT91 parts. This driver also supports the Cadence GEM (Gigabit
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 3b184e9ac771..a78ad00f53b1 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -14,6 +14,7 @@
> #include <linux/interrupt.h>
> #include <linux/phy/phy.h>
> #include <linux/workqueue.h>
> +#include <net/page_pool/helpers.h>
>
> #define MACB_GREGS_NBR 16
> #define MACB_GREGS_VERSION 2
> @@ -1266,6 +1267,8 @@ struct macb_queue {
> void *rx_buffers;
> struct napi_struct napi_rx;
> struct queue_stats stats;
> + struct page_pool *page_pool;
> + struct sk_buff *skb;
> };
>
> struct ethtool_rx_fs_item {
> @@ -1289,6 +1292,8 @@ struct macb {
> struct macb_dma_desc *rx_ring_tieoff;
> dma_addr_t rx_ring_tieoff_dma;
> size_t rx_buffer_size;
> + size_t rx_headroom;
> + unsigned int rx_ip_align;
>
> unsigned int rx_ring_size;
> unsigned int tx_ring_size;
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index fbd4872901c2..621bca2e1844 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -1263,14 +1263,54 @@ static int macb_tx_complete(struct macb_queue *queue, int budget)
> return packets;
> }
>
> -static int gem_rx_refill(struct macb_queue *queue)
> +static inline int gem_rx_data_len(struct macb *bp, struct macb_queue *queue,
> + u32 desc_ctrl, bool rx_sof, bool rx_eof)
Please no static inline in c files.
> +{
> + int len;
> +
> + if (unlikely(!rx_sof && !queue->skb)) {
> + netdev_err(bp->dev,
> + "Received non-starting frame while expecting a starting one\n");
The existing code already had a few of them, but this
netdev_err()/netdev_warn() messages on per packet events could DoS the
host should they ever trigger.
Please switch to _once() or _ratelimited() variant when the
warning/error could be triggered by an incoming packet.
/P
next prev parent reply other threads:[~2026-03-05 10:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 11:52 [PATCH net-next v3 0/8] net: macb: Add XDP support and page pool integration Paolo Valerio
2026-03-02 11:52 ` [PATCH net-next v3 1/8] net: macb: move Rx buffers alloc from link up to open Paolo Valerio
2026-03-02 11:52 ` [PATCH net-next v3 2/8] net: macb: rename rx_skbuff into rx_buff Paolo Valerio
2026-03-02 11:52 ` [PATCH net-next v3 3/8] net: macb: Add page pool support handle multi-descriptor frame rx Paolo Valerio
2026-03-05 10:53 ` Paolo Abeni [this message]
2026-03-02 11:52 ` [PATCH net-next v3 4/8] net: macb: use the current queue number for stats Paolo Valerio
2026-03-02 11:52 ` [PATCH net-next v3 5/8] net: macb: make macb_tx_skb generic Paolo Valerio
2026-03-02 11:52 ` [PATCH net-next v3 6/8] net: macb: generalize tx buffer handling Paolo Valerio
2026-03-02 11:52 ` [PATCH net-next v3 7/8] net: macb: add XDP support for gem Paolo Valerio
2026-03-05 11:01 ` [net-next,v3,7/8] " Paolo Abeni
2026-03-02 11:52 ` [PATCH net-next v3 8/8] net: macb: introduce ndo_xdp_xmit support Paolo Valerio
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=4a7c8f45-abe3-4673-9b7c-abc1040b0bdc@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.beznea@tuxon.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pvalerio@redhat.com \
--cc=theo.lebrun@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox