Skip to contentSkip to conversation

net: davinci_emac: Fix interrupt pacing disable

PATCH Applied Maxim Kiselev 2 participants 2 messages Nov 1, 2021 – Nov 3, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: davinci_emac: Fix interrupt pacing disable

This patch allows to use 0 for coal->rx_coalesce_usecs param to disable rx irq coalescing.

Previously we could enable rx irq coalescing via ethtool (For ex: ethtool -C eth0 rx-usecs 2000) but we couldn't disable it because this part rejects 0 value:

       if (!coal->rx_coalesce_usecs)
               return -EINVAL;
Fixes 84da2658a619 ("TI DaVinci EMAC : Implement interrupt pacing

functionality.")

---
Changes v1 -> v2 (after review of Grygorii Strashko):

- Simplify !coal->rx_coalesce_usecs handler

---
 drivers/net/ethernet/ti/davinci_emac.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +14 -2
index e8291d8488391..d243ca5dfde00 100644
@@ -420,8 +420,20 @@ static int emac_set_coalesce(struct net_device *ndev,
 	u32 int_ctrl, num_interrupts = 0;
 	u32 prescale = 0, addnl_dvdr = 1, coal_intvl = 0;
 
-	if (!coal->rx_coalesce_usecs)
-		return -EINVAL;
+	if (!coal->rx_coalesce_usecs) {
+		priv->coal_intvl = 0;
+
+		switch (priv->version) {
+		case EMAC_VERSION_2:
+			emac_ctrl_write(EMAC_DM646X_CMINTCTRL, 0);
+			break;
+		default:
+			emac_ctrl_write(EMAC_CTRL_EWINTTCNT, 0);
+			break;
+		}
+
+		return 0;
+	}
 
 	coal_intvl = coal->rx_coalesce_usecs;
 
Signature · 1 line
2.30.2
#1 lore raw
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 1 Nov 2021 18:23:41 +0300 you wrote:

This patch allows to use 0 for coal->rx_coalesce_usecs param to disable rx irq coalescing.

Previously we could enable rx irq coalescing via ethtool (For ex: ethtool -C eth0 rx-usecs 2000) but we couldn't disable it because this part rejects 0 value:

[...]

Here is the summary with links:
- [v2] net: davinci_emac: Fix interrupt pacing disable

    https://git.kernel.org/netdev/net/c/d52bcb47bdf9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html