Re: [PATCH net v4 5/7] net: stmmac: dwmac4: Use the correct bufzise when the len is exactly 8K

From: Nicolai Buchwitz

Date: Fri Sep 18 2026 - 10:45:19 EST




On September 18, 2026 2:45:10 PM GMT+02:00, Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx> wrote:
>
>
>On 9/18/26 14:25, Nicolai Buchwitz wrote:
>> Hi Maxime
>>
>> On 17.9.2026 23:53, Maxime Chevallier wrote:
>>> DMA bufsize selection isn't made on the MTU but the actual frame length,
>>> so including the L2 header. On DWMAC4, if the len is exactly BUF_SIZE_8KiB,
>>> the next larger size is incorrectly selected.
>>>
>>> Lets fix the comparison and while at it, rename the parameter from len
>>> to mtu.
>>
>> Isn't it "[...] from mtu to len"?
>
>:(
>
>Bah, if respin is required I'll fix this
>
>>>
>>> Fixes: c3efed5ad1b0 ("net: stmmac: Enable dwmac4 jumbo frame more than 8KiB").
>>> Signed-off-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
>>> ---
>>>  drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 4 ++--
>>>  drivers/net/ethernet/stmicro/stmmac/hwif.h         | 2 +-
>>>  drivers/net/ethernet/stmicro/stmmac/ring_mode.c    | 4 ++--
>>>  3 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>> index 2994df41ec2c..c6a8f8d73501 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>> @@ -474,11 +474,11 @@ static void dwmac4_set_sarc(struct dma_desc *p, u32 sarc_type)
>>>                        sarc_type));
>>>  }
>>>
>>> -static int set_16kib_bfsize(int mtu)
>>> +static int set_16kib_bfsize(int len)
>>>  {
>>>      int ret = 0;
>>>
>>> -    if (unlikely(mtu >= BUF_SIZE_8KiB))
>>> +    if (unlikely(len > BUF_SIZE_8KiB))
>>
>> Should we drop set_16kib_bfsize() instead?
>>
>> After 6/7 it looks to me like the same test as the first branch of
>> stmmac_set_bfsize(). The caller ends up there anyway when it returns 0
>> and chain_mode_ops doesn't have it at all.
>
>True yeah :) however maybe we can wait for this to be merged and have the
>cleanup in net-next ?
>
>Sashiko is getting crazy with the "pre-existing issues" everytime we touch
>stmmac, cleanups are long overdue and this could be included in there :(
>

Totally fine with me. Maybe the commit message can be fixed up on merge?

>Maxime
>
>
FWIW

Reviewed-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>