[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB8510C17E1980D456FD9F094F887AA@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Thu, 26 Jun 2025 02:36:37 +0000
From: Wei Fang <wei.fang@....com>
To: Jonas Rebmann <jre@...gutronix.de>
CC: "imx@...ts.linux.dev" <imx@...ts.linux.dev>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "kernel@...gutronix.de"
<kernel@...gutronix.de>, Shenwei Wang <shenwei.wang@....com>, Clark Wang
<xiaoning.wang@....com>, Andrew Lunn <andrew+netdev@...n.ch>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Subject: RE: [PATCH] net: fec: allow disable coalescing
> 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
Powered by blists - more mailing lists