netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: netdev@vger.kernel.org, "Rafał Miłecki" <rafal@milecki.pl>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Murali Krishna Policharla" <murali.policharla@broadcom.com>,
	"Ray Jui" <ray.jui@broadcom.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Arun Parameswaran" <arun.parameswaran@broadcom.com>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] bgmac: reduce max frame size to support just MTU 1500
Date: Mon, 27 Jan 2025 17:22:05 +0000	[thread overview]
Message-ID: <20250127172205.GF5024@kernel.org> (raw)
In-Reply-To: <20250124191404.3721128-1-florian.fainelli@broadcom.com>

On Fri, Jan 24, 2025 at 11:14:04AM -0800, Florian Fainelli wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> bgmac allocates new replacement buffer before handling each received
> frame. Allocating & DMA-preparing 9724 B each time consumes a lot of CPU
> time. Ideally bgmac should just respect currently set MTU but it isn't
> the case right now. For now just revert back to the old limited frame
> size.
> 
> This change bumps NAT masquerade speed by ~95%.
> 
> Since commit 8218f62c9c9b ("mm: page_frag: use initial zero offset for
> page_frag_alloc_align()"), the bgmac driver fails to open its network
> interface successfully and runs out of memory in the following call
> stack:
> 
> bgmac_open
>   -> bgmac_dma_init
>     -> bgmac_dma_rx_skb_for_slot
>       -> netdev_alloc_frag
> 
> BGMAC_RX_ALLOC_SIZE = 10048 and PAGE_FRAG_CACHE_MAX_SIZE = 32768.
> 
> Eventually we land into __page_frag_alloc_align() with the following
> parameters across multiple successive calls:
> 
> __page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=0
> __page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=10048
> __page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=20096
> __page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=30144
> 
> So in that case we do indeed have offset + fragsz (40192) > size (32768)
> and so we would eventually return NULL. Reverting to the older 1500
> bytes MTU allows the network driver to be usable again.
> 
> Fixes: 8c7da63978f1 ("bgmac: configure MTU and add support for frames beyond 8192 byte size")
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> [florian: expand commit message about recent commits]
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> Change-Id: Ie70d714cb4f00e45a34e9a015d0eb4bff60fac6e

Hi Florian,

I think the Change-Id line needs to be dropped,
but otherwise this looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

      reply	other threads:[~2025-01-27 17:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24 19:14 [PATCH net] bgmac: reduce max frame size to support just MTU 1500 Florian Fainelli
2025-01-27 17:22 ` Simon Horman [this message]

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=20250127172205.GF5024@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=arun.parameswaran@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=murali.policharla@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rafal@milecki.pl \
    --cc=ray.jui@broadcom.com \
    --cc=vladimir.oltean@nxp.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;
as well as URLs for NNTP newsgroup(s).