Re: [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak

From: Alexander Lobakin
Date: Wed Dec 18 2024 - 10:49:26 EST


From: Furong Xu <0x1207@xxxxxxxxx>
Date: Wed, 18 Dec 2024 16:34:07 +0800

> After commit 2af6106ae949 ("net: stmmac: Introducing support for Page
> Pool"), the driver always copies frames to get a better performance,
> zero-copy for RX frames is no more, then these code turned to be
> useless and users of ethtool may get confused about the unhandled
> rx-copybreak parameter.
>
> This patch mostly reverts
> commit 22ad38381547 ("stmmac: do not perform zero-copy for rx frames")
>
> Signed-off-by: Furong Xu <0x1207@xxxxxxxxx>

The patch itself is fine, *but*

> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 -
> .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 39 -------------------
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ---
> 3 files changed, 46 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index 1d86439b8a14..b8d631e559c0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -126,7 +126,6 @@ struct stmmac_rx_queue {
> unsigned int cur_rx;
> unsigned int dirty_rx;
> unsigned int buf_alloc_num;
> - u32 rx_zeroc_thresh;
> dma_addr_t dma_rx_phy;

If sizeof(dma_addr_t) == 8, you're clearly introducing a 4-byte hole
here. Perhaps you could reshuffle the struct a bit to avoid this.

It's always good to inspect the .kos with pahole after modifying
structures to make sure there are no regressions.

> u32 rx_tail_addr;
> unsigned int state_saved;

Thanks,
Olek