]> Git Repo - J-linux.git/commitdiff
net: davinci_emac: Fix interrupt pacing disable
authorMaxim Kiselev <[email protected]>
Mon, 1 Nov 2021 15:23:41 +0000 (18:23 +0300)
committerJakub Kicinski <[email protected]>
Wed, 3 Nov 2021 00:28:46 +0000 (17:28 -0700)
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.")
Signed-off-by: Maxim Kiselev <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
drivers/net/ethernet/ti/davinci_emac.c

index 2d2dcf70563f3219d3c875a56796a720534f39ea..d55f06120ce7b65612403a4c3c3b260d3706e39b 100644 (file)
@@ -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;
 
This page took 0.058653 seconds and 4 git commands to generate.