RE: [PATCH v6 net-next 1/6] net: fec: use a member variable for maximum buffer size

From: Wei Fang
Date: Mon Sep 08 2025 - 22:12:24 EST


> @@ -253,9 +253,7 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC
> address"); #if defined(CONFIG_M523x) || defined(CONFIG_M527x) ||
> defined(CONFIG_M528x) || \
> defined(CONFIG_M520x) || defined(CONFIG_M532x) ||
> defined(CONFIG_ARM) || \
> defined(CONFIG_ARM64)
> -#define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16)
> -#else
> -#define OPT_FRAME_SIZE 0
> +#define OPT_ARCH_HAS_MAX_FL

In the fec driver, I noticed that the expression "#if defined (CONFIG_M523x) ||
defined(CONFIG_M527x) || ..." is used in four different places. I think we could
add a separate patch to define a new macro to replace these occurrences. This
new macro should be more generic than OPT_ARCH_HAS_MAX_FL.

> #endif
>
> /* FEC MII MMFR bits definition */
> @@ -1083,7 +1081,7 @@ static void fec_enet_enable_ring(struct net_device
> *ndev)
> for (i = 0; i < fep->num_rx_queues; i++) {
> rxq = fep->rx_queue[i];
> writel(rxq->bd.dma, fep->hwp + FEC_R_DES_START(i));
> - writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_R_BUFF_SIZE(i));
> + writel(fep->max_buf_size, fep->hwp + FEC_R_BUFF_SIZE(i));
>
> /* enable DMA1/2 */
> if (i)
> @@ -1145,9 +1143,13 @@ static void
> fec_restart(struct net_device *ndev)
> {
> struct fec_enet_private *fep = netdev_priv(ndev);
> - u32 rcntl = OPT_FRAME_SIZE | FEC_RCR_MII;
> + u32 rcntl = FEC_RCR_MII;

Nit: please follow reverse xmas tree rule, move this line under ecntl.