Re: [PATCH net-next] stmmac: align RX buffers

From: Eric Dumazet
Date: Thu Aug 12 2021 - 04:48:16 EST




On 8/11/21 4:16 PM, Marc Zyngier wrote:
> On Wed, 11 Aug 2021 13:53:59 +0100,
> Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:
>
>> Are you sure you do not need to adjust stmmac_set_bfsize(),
>> stmmac_rx_buf1_len() and stmmac_rx_buf2_len() ?
>>
>> Presumably DEFAULT_BUFSIZE also want to be increased by NET_SKB_PAD
>>
>> Patch for stmmac_rx_buf1_len() :
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 7b8404a21544cf29668e8a14240c3971e6bce0c3..041a74e7efca3436bfe3e17f972dd156173957a9 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -4508,12 +4508,12 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv,
>>
>> /* First descriptor, not last descriptor and not split header */
>> if (status & rx_not_ls)
>> - return priv->dma_buf_sz;
>> + return priv->dma_buf_sz - NET_SKB_PAD - NET_IP_ALIGN;
>>
>> plen = stmmac_get_rx_frame_len(priv, p, coe);
>>
>> /* First descriptor and last descriptor and not split header */
>> - return min_t(unsigned int, priv->dma_buf_sz, plen);
>> + return min_t(unsigned int, priv->dma_buf_sz - NET_SKB_PAD - NET_IP_ALIGN, plen);
>> }
>>
>> static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
>
> Feels like a major deficiency of the original patch. Happy to test a
> more complete patch if/when you have one.

I wont have time in the immediate future.

Matteo, if you do not work on a fix, I suggest we revert
a955318fe67ec0d962760b5ee58e74bffaf649b8 stmmac: align RX buffers

before a more polished version can be submitted.