[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190329104847.GF16484@darkstar.musicnaut.iki.fi>
Date: Fri, 29 Mar 2019 12:48:47 +0200
From: Aaro Koskinen <aaro.koskinen@....fi>
To: Jose Abreu <jose.abreu@...opsys.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexandre Torgue <alexandre.torgue@...com>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Aaro Koskinen <aaro.koskinen@...ia.com>
Subject: Re: [PATCH 1/6] net: stmmac: use correct DMA buffer size in the RX
descriptor
Hi,
On Fri, Mar 29, 2019 at 10:02:20AM +0000, Jose Abreu wrote:
> On 3/27/2019 8:35 PM, Aaro Koskinen wrote:
> > From: Aaro Koskinen <aaro.koskinen@...ia.com>
> >
> > We always program the maximum DMA buffer size into the receive descriptor,
> > although the allocated size may be less. E.g. with the default MTU size
> > we allocate only 1536 bytes. If somebody sends us a bigger frame, then
> > memory may get corrupted.
> >
> > Fix by using exact buffer sizes.
> >
> > Signed-off-by: Aaro Koskinen <aaro.koskinen@...ia.com>
>
> So, I'm seeing that the maximum allowed buffer size that can be
> put in the descriptor changes between enhanced descriptors to
> normal descriptors (8KB vs. 2KB right ?).
There are two size fields, so it's 16KB vs 4 KB.
> Shouldn't stmmac_main know about this limit before trying to init
> descriptors ?
Yes, and that is not a problem.
> We do limit the MTU according to HW version but I would rather
> prefer not having to need to calculate min() values in the
> descriptor code and just use the value as is ...
I don't think the calculation can be avoided, as the passed value can
be bigger than a single field can hold, or less than the maximum.
A.
Powered by blists - more mailing lists