aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_ethtool.c
diff options
context:
space:
mode:
authorDai Haruki <dai.haruki@freescale.com>2008-12-16 18:30:20 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-16 18:30:20 -0500
commit12dea57be552a291e93827baeffbb91e33f587a6 (patch)
treedba9874cf9a930a729aac0f30f7fe50824b9e76a /drivers/net/gianfar_ethtool.c
parentb46a8454cd304b5376ba00d3457a612720e47269 (diff)
gianfar: Fix eTSEC configuration procedure
Fix some bugs in the ethtool configuration functions: * gfar_clean_rx_ring should not be called with interrupts disabled. * Update last transmission time to avoid tx timeout. * Delete redundant NETIF_F_IP_CSUM check in gfar_start_xmit * Use netif_tx_lock_bh when reconfiguring the tx csum Signed-off-by: Dai Haruki <dai.haruki@freescale.com> Signed-off-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.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index c111c532f7b3..3021057d54ae 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -462,11 +462,12 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
462 spin_lock(&priv->rxlock); 462 spin_lock(&priv->rxlock);
463 463
464 gfar_halt(dev); 464 gfar_halt(dev);
465 gfar_clean_rx_ring(dev, priv->rx_ring_size);
466 465
467 spin_unlock(&priv->rxlock); 466 spin_unlock(&priv->rxlock);
468 spin_unlock_irqrestore(&priv->txlock, flags); 467 spin_unlock_irqrestore(&priv->txlock, flags);
469 468
469 gfar_clean_rx_ring(dev, priv->rx_ring_size);
470
470 /* Now we take down the rings to rebuild them */ 471 /* Now we take down the rings to rebuild them */
471 stop_gfar(dev); 472 stop_gfar(dev);
472 } 473 }
@@ -476,9 +477,10 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
476 priv->tx_ring_size = rvals->tx_pending; 477 priv->tx_ring_size = rvals->tx_pending;
477 478
478 /* Rebuild the rings with the new size */ 479 /* Rebuild the rings with the new size */
479 if (dev->flags & IFF_UP) 480 if (dev->flags & IFF_UP) {
480 err = startup_gfar(dev); 481 err = startup_gfar(dev);
481 482 netif_wake_queue(dev);
483 }
482 return err; 484 return err;
483} 485}
484 486
@@ -498,11 +500,12 @@ static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
498 spin_lock(&priv->rxlock); 500 spin_lock(&priv->rxlock);
499 501
500 gfar_halt(dev); 502 gfar_halt(dev);
501 gfar_clean_rx_ring(dev, priv->rx_ring_size);
502 503
503 spin_unlock(&priv->rxlock); 504 spin_unlock(&priv->rxlock);
504 spin_unlock_irqrestore(&priv->txlock, flags); 505 spin_unlock_irqrestore(&priv->txlock, flags);
505 506
507 gfar_clean_rx_ring(dev, priv->rx_ring_size);
508
506 /* Now we take down the rings to rebuild them */ 509 /* Now we take down the rings to rebuild them */
507 stop_gfar(dev); 510 stop_gfar(dev);
508 } 511 }
@@ -511,9 +514,10 @@ static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
511 priv->rx_csum_enable = data; 514 priv->rx_csum_enable = data;
512 spin_unlock_irqrestore(&priv->bflock, flags); 515 spin_unlock_irqrestore(&priv->bflock, flags);
513 516
514 if (dev->flags & IFF_UP) 517 if (dev->flags & IFF_UP) {
515 err = startup_gfar(dev); 518 err = startup_gfar(dev);
516 519 netif_wake_queue(dev);
520 }
517 return err; 521 return err;
518} 522}
519 523
@@ -529,22 +533,19 @@ static uint32_t gfar_get_rx_csum(struct net_device *dev)
529 533
530static int gfar_set_tx_csum(struct net_device *dev, uint32_t data) 534static int gfar_set_tx_csum(struct net_device *dev, uint32_t data)
531{ 535{
532 unsigned long flags;
533 struct gfar_private *priv = netdev_priv(dev); 536 struct gfar_private *priv = netdev_priv(dev);
534 537
535 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM)) 538 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
536 return -EOPNOTSUPP; 539 return -EOPNOTSUPP;
537 540
538 spin_lock_irqsave(&priv->txlock, flags); 541 netif_tx_lock_bh(dev);
539 gfar_halt(dev);
540 542
541 if (data) 543 if (data)
542 dev->features |= NETIF_F_IP_CSUM; 544 dev->features |= NETIF_F_IP_CSUM;
543 else 545 else
544 dev->features &= ~NETIF_F_IP_CSUM; 546 dev->features &= ~NETIF_F_IP_CSUM;
545 547
546 gfar_start(dev); 548 netif_tx_unlock_bh(dev);
547 spin_unlock_irqrestore(&priv->txlock, flags);
548 549
549 return 0; 550 return 0;
550} 551}