RE: [PATCH] net: fec: allow disable coalescing

From: Wei Fang
Date: Wed Jun 25 2025 - 22:36:56 EST


> static void fec_enet_itr_coal_set(struct net_device *ndev)
> {
> struct fec_enet_private *fep = netdev_priv(ndev);
> - int rx_itr, tx_itr;
> + int rx_itr = 0, tx_itr = 0;

Since you modified this line, it would be a good idea to change
the type to u32.

>
> - /* Must be greater than zero to avoid unpredictable behavior */
> - if (!fep->rx_time_itr || !fep->rx_pkts_itr ||
> - !fep->tx_time_itr || !fep->tx_pkts_itr)
> - return;
> -
> - /* Select enet system clock as Interrupt Coalescing
> - * timer Clock Source
> - */
> - rx_itr = FEC_ITR_CLK_SEL;
> - tx_itr = FEC_ITR_CLK_SEL;
> -
> - /* set ICFT and ICTT */
> - rx_itr |= FEC_ITR_ICFT(fep->rx_pkts_itr);
> - rx_itr |= FEC_ITR_ICTT(fec_enet_us_to_itr_clock(ndev,
> fep->rx_time_itr));
> - tx_itr |= FEC_ITR_ICFT(fep->tx_pkts_itr);
> - tx_itr |= FEC_ITR_ICTT(fec_enet_us_to_itr_clock(ndev,
> fep->tx_time_itr));
> + if (fep->rx_time_itr > 0 && fep->rx_pkts_itr > 1) {
> + /* Select enet system clock as Interrupt Coalescing timer
> Clock Source */
> + rx_itr = FEC_ITR_CLK_SEL;
> + rx_itr |= FEC_ITR_EN;

nitpicking: the above two lines can be simplified to one line as below,
but the comment needs to be changed appropriately.

rx_itr = FEC_ITR_CLK_SEL | FEC_ITR_EN;

> + rx_itr |= FEC_ITR_ICFT(fep->rx_pkts_itr);
> + rx_itr |= FEC_ITR_ICTT(fec_enet_us_to_itr_clock(ndev,
> fep->rx_time_itr));
> + }
>
> - rx_itr |= FEC_ITR_EN;
> - tx_itr |= FEC_ITR_EN;
> + if (fep->tx_time_itr > 0 && fep->tx_pkts_itr > 1) {
> + /* Select enet system clock as Interrupt Coalescing timer
> Clock Source */
> + tx_itr = FEC_ITR_CLK_SEL;
> + tx_itr |= FEC_ITR_EN;

Same as above