Commit d52bcb47 authored by Maxim Kiselev's avatar Maxim Kiselev Committed by Jakub Kicinski

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: 84da2658 ("TI DaVinci EMAC : Implement interrupt pacing functionality.")
Signed-off-by: default avatarMaxim Kiselev <bigunclemax@gmail.com>
Reviewed-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Link: https://lore.kernel.org/r/20211101152343.4193233-1-bigunclemax@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 26499499
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment