diff options
Diffstat (limited to 'drivers/net/gianfar_ethtool.c')
-rw-r--r-- | drivers/net/gianfar_ethtool.c | 58 |
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 | |||
352 | static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals) | 352 | static 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(®s->rxic, 0); | 421 | gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs)); |
415 | if (rx_queue->rxcoalescing) | 422 | } |
416 | gfar_write(®s->rxic, rx_queue->rxic); | ||
417 | 423 | ||
418 | gfar_write(®s->txic, 0); | 424 | gfar_configure_coalescing(priv, 0xFF, 0xFF); |
419 | if (tx_queue->txcoalescing) | ||
420 | gfar_write(®s->txic, tx_queue->txic); | ||
421 | 425 | ||
422 | return 0; | 426 | return 0; |
423 | } | 427 | } |