Skip to content

Commit

Permalink
drivers: net: cpsw: disable coalesce when rx_coalesce_usecs is zero
Browse files Browse the repository at this point in the history
instead of return error on zero rx_coalesce_usecs, disable coalesce

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mugunthan V N authored and David S. Miller committed Jul 16, 2014
1 parent ff11d8b commit a84bc2a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/net/ethernet/ti/cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,14 +884,16 @@ static int cpsw_set_coalesce(struct net_device *ndev,
u32 addnl_dvdr = 1;
u32 coal_intvl = 0;

if (!coal->rx_coalesce_usecs)
return -EINVAL;

coal_intvl = coal->rx_coalesce_usecs;

int_ctrl = readl(&priv->wr_regs->int_control);
prescale = priv->bus_freq_mhz * 4;

if (!coal->rx_coalesce_usecs) {
int_ctrl &= ~(CPSW_INTPRESCALE_MASK | CPSW_INTPACEEN);
goto update_return;
}

if (coal_intvl < CPSW_CMINTMIN_INTVL)
coal_intvl = CPSW_CMINTMIN_INTVL;

Expand Down Expand Up @@ -919,6 +921,8 @@ static int cpsw_set_coalesce(struct net_device *ndev,
int_ctrl |= CPSW_INTPACEEN;
int_ctrl &= (~CPSW_INTPRESCALE_MASK);
int_ctrl |= (prescale & CPSW_INTPRESCALE_MASK);

update_return:
writel(int_ctrl, &priv->wr_regs->int_control);

cpsw_notice(priv, timer, "Set coalesce to %d usecs.\n", coal_intvl);
Expand Down

0 comments on commit a84bc2a

Please sign in to comment.