aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_ethtool.c
diff options
context:
space:
mode:
authorSandeep Gopalpet <Sandeep.Kumar@freescale.com>2009-11-02 02:03:34 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-03 02:40:59 -0500
commit46ceb60ca80fa07703bc6eb8f4651f900dff5a82 (patch)
tree9bd694c3b1559cbd0fa72bff1f521ce4bcc95aa6 /drivers/net/gianfar_ethtool.c
parent2e0246c72fa2e2b61865a2d5aaff1cc9155b9447 (diff)
gianfar: Add Multiple group Support
This patch introduces multiple group support for etsec2.0 devices. Multiple group support is provided by mapping the set of enabled queues to different groups and then programming the per group regsiters imask, ievent, rstat, tstat. The queues corresponding to a group are indicated by programming isrg (interrupt steering) registers. Signed-off-by: Sandeep Gopalpet <Sandeep.Kumar@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.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index d3d26234f190..562f6c20f591 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -137,7 +137,7 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
137{ 137{
138 int i; 138 int i;
139 struct gfar_private *priv = netdev_priv(dev); 139 struct gfar_private *priv = netdev_priv(dev);
140 struct gfar __iomem *regs = priv->gfargrp.regs; 140 struct gfar __iomem *regs = priv->gfargrp[0].regs;
141 u64 *extra = (u64 *) & priv->extra_stats; 141 u64 *extra = (u64 *) & priv->extra_stats;
142 142
143 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { 143 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
@@ -226,7 +226,7 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi
226{ 226{
227 int i; 227 int i;
228 struct gfar_private *priv = netdev_priv(dev); 228 struct gfar_private *priv = netdev_priv(dev);
229 u32 __iomem *theregs = (u32 __iomem *) priv->gfargrp.regs; 229 u32 __iomem *theregs = (u32 __iomem *) priv->gfargrp[0].regs;
230 u32 *buf = (u32 *) regbuf; 230 u32 *buf = (u32 *) regbuf;
231 231
232 for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++) 232 for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
@@ -352,22 +352,23 @@ static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
352static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals) 352static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
353{ 353{
354 struct gfar_private *priv = netdev_priv(dev); 354 struct gfar_private *priv = netdev_priv(dev);
355 struct gfar __iomem *regs = priv->gfargrp.regs; 355 int i = 0;
356 struct gfar_priv_tx_q *tx_queue = NULL;
357 struct gfar_priv_rx_q *rx_queue = NULL;
358 356
359 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) 357 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE))
360 return -EOPNOTSUPP; 358 return -EOPNOTSUPP;
361 359
362 tx_queue = priv->tx_queue[0];
363 rx_queue = priv->rx_queue[0];
364
365 /* Set up rx coalescing */ 360 /* Set up rx coalescing */
361 /* As of now, we will enable/disable coalescing for all
362 * queues together in case of eTSEC2, this will be modified
363 * along with the ethtool interface */
366 if ((cvals->rx_coalesce_usecs == 0) || 364 if ((cvals->rx_coalesce_usecs == 0) ||
367 (cvals->rx_max_coalesced_frames == 0)) 365 (cvals->rx_max_coalesced_frames == 0)) {
368 rx_queue->rxcoalescing = 0; 366 for (i = 0; i < priv->num_rx_queues; i++)
369 else 367 priv->rx_queue[i]->rxcoalescing = 0;
370 rx_queue->rxcoalescing = 1; 368 } else {
369 for (i = 0; i < priv->num_rx_queues; i++)
370 priv->rx_queue[i]->rxcoalescing = 1;
371 }
371 372
372 if (NULL == priv->phydev) 373 if (NULL == priv->phydev)
373 return -ENODEV; 374 return -ENODEV;
@@ -385,15 +386,21 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
385 return -EINVAL; 386 return -EINVAL;
386 } 387 }
387 388
388 rx_queue->rxic = mk_ic_value(cvals->rx_max_coalesced_frames, 389 for (i = 0; i < priv->num_rx_queues; i++) {
389 gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs)); 390 priv->rx_queue[i]->rxic = mk_ic_value(
391 cvals->rx_max_coalesced_frames,
392 gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs));
393 }
390 394
391 /* Set up tx coalescing */ 395 /* Set up tx coalescing */
392 if ((cvals->tx_coalesce_usecs == 0) || 396 if ((cvals->tx_coalesce_usecs == 0) ||
393 (cvals->tx_max_coalesced_frames == 0)) 397 (cvals->tx_max_coalesced_frames == 0)) {
394 tx_queue->txcoalescing = 0; 398 for (i = 0; i < priv->num_tx_queues; i++)
395 else 399 priv->tx_queue[i]->txcoalescing = 0;
396 tx_queue->txcoalescing = 1; 400 } else {
401 for (i = 0; i < priv->num_tx_queues; i++)
402 priv->tx_queue[i]->txcoalescing = 1;
403 }
397 404
398 /* Check the bounds of the values */ 405 /* Check the bounds of the values */
399 if (cvals->tx_coalesce_usecs > GFAR_MAX_COAL_USECS) { 406 if (cvals->tx_coalesce_usecs > GFAR_MAX_COAL_USECS) {
@@ -408,16 +415,13 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
408 return -EINVAL; 415 return -EINVAL;
409 } 416 }
410 417
411 tx_queue->txic = mk_ic_value(cvals->tx_max_coalesced_frames, 418 for (i = 0; i < priv->num_tx_queues; i++) {
412 gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs)); 419 priv->tx_queue[i]->txic = mk_ic_value(
413 420 cvals->tx_max_coalesced_frames,
414 gfar_write(&regs->rxic, 0); 421 gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs));
415 if (rx_queue->rxcoalescing) 422 }
416 gfar_write(&regs->rxic, rx_queue->rxic);
417 423
418 gfar_write(&regs->txic, 0); 424 gfar_configure_coalescing(priv, 0xFF, 0xFF);
419 if (tx_queue->txcoalescing)
420 gfar_write(&regs->txic, tx_queue->txic);
421 425
422 return 0; 426 return 0;
423} 427}