aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_ethtool.c
diff options
context:
space:
mode:
authorDai Haruki <dai.haruki@freescale.com>2008-12-16 18:29:52 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-16 18:29:52 -0500
commitb46a8454cd304b5376ba00d3457a612720e47269 (patch)
treecf6a119d3903b519b9540585684ba1eb2ef130d6 /drivers/net/gianfar_ethtool.c
parentb31a1d8b41513b96e9c7ec2f68c5734cef0b26a4 (diff)
gianfar: Optimize interrupt coalescing configuration
Store the interrupt coalescing values in the form in which they will be written to the interrupt coalescing registers. This puts a little overhead into the ethtool configuration, and takes it out of the interrupt handler Signed-off-by: Dai Haruki <dai.haruki@freescale.com> Acked-by: Andy Fleming <afleming@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar_ethtool.c')
-rw-r--r--drivers/net/gianfar_ethtool.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 53944b120a3d..c111c532f7b3 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -201,8 +201,8 @@ static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd)
201 if (NULL == phydev) 201 if (NULL == phydev)
202 return -ENODEV; 202 return -ENODEV;
203 203
204 cmd->maxtxpkt = priv->txcount; 204 cmd->maxtxpkt = get_icft_value(priv->txic);
205 cmd->maxrxpkt = priv->rxcount; 205 cmd->maxrxpkt = get_icft_value(priv->rxic);
206 206
207 return phy_ethtool_gset(phydev, cmd); 207 return phy_ethtool_gset(phydev, cmd);
208} 208}
@@ -279,6 +279,10 @@ static unsigned int gfar_ticks2usecs(struct gfar_private *priv, unsigned int tic
279static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals) 279static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
280{ 280{
281 struct gfar_private *priv = netdev_priv(dev); 281 struct gfar_private *priv = netdev_priv(dev);
282 unsigned long rxtime;
283 unsigned long rxcount;
284 unsigned long txtime;
285 unsigned long txcount;
282 286
283 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) 287 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE))
284 return -EOPNOTSUPP; 288 return -EOPNOTSUPP;
@@ -286,11 +290,15 @@ static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
286 if (NULL == priv->phydev) 290 if (NULL == priv->phydev)
287 return -ENODEV; 291 return -ENODEV;
288 292
289 cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime); 293 rxtime = get_ictt_value(priv->rxic);
290 cvals->rx_max_coalesced_frames = priv->rxcount; 294 rxcount = get_icft_value(priv->rxic);
295 txtime = get_ictt_value(priv->txic);
296 txcount = get_icft_value(priv->txic);;
297 cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, rxtime);
298 cvals->rx_max_coalesced_frames = rxcount;
291 299
292 cvals->tx_coalesce_usecs = gfar_ticks2usecs(priv, priv->txtime); 300 cvals->tx_coalesce_usecs = gfar_ticks2usecs(priv, txtime);
293 cvals->tx_max_coalesced_frames = priv->txcount; 301 cvals->tx_max_coalesced_frames = txcount;
294 302
295 cvals->use_adaptive_rx_coalesce = 0; 303 cvals->use_adaptive_rx_coalesce = 0;
296 cvals->use_adaptive_tx_coalesce = 0; 304 cvals->use_adaptive_tx_coalesce = 0;
@@ -358,8 +366,9 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
358 return -EINVAL; 366 return -EINVAL;
359 } 367 }
360 368
361 priv->rxtime = gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs); 369 priv->rxic = mk_ic_value(
362 priv->rxcount = cvals->rx_max_coalesced_frames; 370 gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs),
371 cvals->rx_max_coalesced_frames);
363 372
364 /* Set up tx coalescing */ 373 /* Set up tx coalescing */
365 if ((cvals->tx_coalesce_usecs == 0) || 374 if ((cvals->tx_coalesce_usecs == 0) ||
@@ -381,20 +390,17 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
381 return -EINVAL; 390 return -EINVAL;
382 } 391 }
383 392
384 priv->txtime = gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs); 393 priv->txic = mk_ic_value(
385 priv->txcount = cvals->tx_max_coalesced_frames; 394 gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs),
395 cvals->tx_max_coalesced_frames);
386 396
397 gfar_write(&priv->regs->rxic, 0);
387 if (priv->rxcoalescing) 398 if (priv->rxcoalescing)
388 gfar_write(&priv->regs->rxic, 399 gfar_write(&priv->regs->rxic, priv->rxic);
389 mk_ic_value(priv->rxcount, priv->rxtime));
390 else
391 gfar_write(&priv->regs->rxic, 0);
392 400
401 gfar_write(&priv->regs->txic, 0);
393 if (priv->txcoalescing) 402 if (priv->txcoalescing)
394 gfar_write(&priv->regs->txic, 403 gfar_write(&priv->regs->txic, priv->txic);
395 mk_ic_value(priv->txcount, priv->txtime));
396 else
397 gfar_write(&priv->regs->txic, 0);
398 404
399 return 0; 405 return 0;
400} 406}