Re: [PATCH 1/6] net: stmmac: use correct DMA buffer size in the RX descriptor
From: Jose Abreu
Date: Fri Mar 29 2019 - 06:02:27 EST
On 3/27/2019 8:35 PM, Aaro Koskinen wrote:
> From: Aaro Koskinen <aaro.koskinen@xxxxxxxxx>
>
> 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@xxxxxxxxx>
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 ?).
Shouldn't stmmac_main know about this limit before trying to init
descriptors ?
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 ...
Thanks,
Jose Miguel Abreu