mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charles Perry <charles.perry@microchip.com>
To: Simon Horman <horms@kernel.org>
Cc: <netdev@vger.kernel.org>, 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>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<charles.perry@microchip.com>
Subject: Re: [PATCH net-next 3/4] net: macb: add safeguards for jumbo frame larger than 10240
Date: Fri, 6 Mar 2026 07:25:35 -0800	[thread overview]
Message-ID: <aarx70c8gbzGs/KS@bby-cbu-swbuild03.eng.microchip.com> (raw)
In-Reply-To: <20260306130426.GA461701@kernel.org>

On Fri, Mar 06, 2026 at 01:04:26PM +0000, Simon Horman wrote:
> On Thu, Mar 05, 2026 at 06:24:24AM -0800, Charles Perry wrote:
> > On Thu, Mar 05, 2026 at 11:40:10AM +0000, Simon Horman wrote:
> > > On Tue, Mar 03, 2026 at 10:03:17AM -0800, Charles Perry wrote:
> > > > The RX buffers for GEM can have a maximum size of 16320 bytes
> > > > (0xff in the RXBS field of the DMACFG register means 255*64 =
> > > > 16320 bytes).
> > > > 
> > > > The "jumbo_max_length" field (bits 0..13) of the DCFG2 register
> > > > can take a value of up to 16383 (0x3FFF). This field is not used
> > > > when determining the max MTU, instead an hardcoded value
> > > > (jumbo_max_len) is used for each platform. Right now the maximum
> > > > value for jumbo_max_len is 10240 (0x2800).
> > > > 
> > > > GEM uses one buffer per packet which means that one buffer must
> > > > allow room for the max MTU plus L2 encapsulation and alignment.
> > > > 
> > > > This commit adds a limit to max_mtu and rx_buffer_size so that
> > > > the RXBS field can never overflow when a large MTU is used.
> > > > 
> > > > With this commit, it is now possible to add new platforms that
> > > > have their gem_jumbo_max_length set to 16383.
> > > > 
> > > > Signed-off-by: Charles Perry <charles.perry@microchip.com>
> > > 
> > > Hi Charles,
> > > 
> > > I am sorry if this question is a bit naïve.
> > > 
> > > I understand the need to clamp the max_mtu to avoid overflowing RXBS.
> > > And that this hasn't been an issue up until now due to the maximum
> > > value of jumbo_max_len used in the driver.
> > > 
> > > But I'm unclear on the relationship between DCFG2 and the max_mtu.
> > > Why does it need to be set to a value larger than that corresponding to
> > > the maximum mtu and RX buf size?
> > > 
> > 
> > Hello Simon,
> > 
> > The DCFG2 register is the max_mtu value, there's some public documentation
> > for this for AMD versal [1]. "gem_jumbo_max_length" is a define in the RTL
> > code, the hardware designer probably makes a tradeoff between gate count
> > and the max_mtu. The maximum value for this is 0x3FFF (16383).
> > 
> > The maximum buffer size is 255 * 64 = 16320
> > 
> > The GEM driver, in its current state, uses one buffer per frame, so the MTU
> > needs to be clamped at the maximum buffer size.
> > 
> > We could just set 16320 instead of 16383 into the "jumbo_max_len" of
> > "struct macb_config" but it would mix information about what the hardware
> > supports vs what the software support. My approach is to put what the
> > hardware support in "struct macb_config" and clamp it later when
> > calculating max_mtu because we know we have a software limitation.
> 
> Hi Charles,
> 
> Thanks for the explanation. I agree that it is best not to conflate
> software and hardware support. And that the approach you have taken
> here makes sense.
> 
> I do think it would be nice to add a bit more detail to the commit message,
> along the lines of the text above. But I'll leave that call up to you.
> 

Ok, I'll clarify what is hardware specific vs software specific.

Thank you for the review,
Charles

> Overall, this looks good to me.
> 
> Reviewed-by: Simon Horman <horms@kernel.org>

  reply	other threads:[~2026-03-06 15:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 18:03 [PATCH net-next 0/4] Initial support for p64h GEM Charles Perry
2026-03-03 18:03 ` [PATCH net-next 1/4] dt-bindings: net: cdns,macb: add a compatible for Microchip p64h Charles Perry
2026-03-03 18:18   ` Conor Dooley
2026-03-03 18:54     ` Charles Perry
2026-03-03 19:32       ` Conor Dooley
2026-03-03 20:45         ` Charles Perry
2026-03-03 18:03 ` [PATCH net-next 2/4] dt-bindings: net: cdns,macb: forbid phy nodes " Charles Perry
2026-03-03 18:11   ` Conor Dooley
2026-03-03 18:57     ` Charles Perry
2026-03-03 18:03 ` [PATCH net-next 3/4] net: macb: add safeguards for jumbo frame larger than 10240 Charles Perry
2026-03-05 11:40   ` Simon Horman
2026-03-05 14:24     ` Charles Perry
2026-03-06 13:04       ` Simon Horman
2026-03-06 15:25         ` Charles Perry [this message]
2026-03-03 18:03 ` [PATCH net-next 4/4] net: macb: add support for Microchip p64h ethernet endpoint Charles Perry
2026-03-06 13:04   ` Simon Horman

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=aarx70c8gbzGs/KS@bby-cbu-swbuild03.eng.microchip.com \
    --to=charles.perry@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®