aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_ethtool.c
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2006-04-20 17:44:29 -0400
committerJeff Garzik <jeff@garzik.org>2006-04-20 17:55:06 -0400
commitfef6108d4556917c45cd9ba397c1c7597f3990e1 (patch)
treef35566dd3ddbda7cc84fc8a03aa3aebeea7dc746 /drivers/net/gianfar_ethtool.c
parentf18b95c3e2ab0f75b23a5aabab0bc8f99bd6bbf3 (diff)
[PATCH] Fix locking in gianfar
This patch fixes several bugs in the gianfar driver, including a major one where spinlocks were horribly broken: * Split gianfar locks into two types: TX and RX * Made it so gfar_start() now clears RHALT * Fixed a bug where calling gfar_start_xmit() with interrupts off would corrupt the interrupt state * Fixed a bug where a frame could potentially arrive, and never be handled (if no more frames arrived * Fixed a bug where the rx_work_limit would never be observed by the rx completion code * Fixed a bug where the interrupt handlers were not actually protected by their spinlocks Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/gianfar_ethtool.c')
-rw-r--r--drivers/net/gianfar_ethtool.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 5de7b2e259dc..d69698c695ef 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -455,10 +455,14 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
455 455
456 /* Halt TX and RX, and process the frames which 456 /* Halt TX and RX, and process the frames which
457 * have already been received */ 457 * have already been received */
458 spin_lock_irqsave(&priv->lock, flags); 458 spin_lock_irqsave(&priv->txlock, flags);
459 spin_lock(&priv->rxlock);
460
459 gfar_halt(dev); 461 gfar_halt(dev);
460 gfar_clean_rx_ring(dev, priv->rx_ring_size); 462 gfar_clean_rx_ring(dev, priv->rx_ring_size);
461 spin_unlock_irqrestore(&priv->lock, flags); 463
464 spin_unlock(&priv->rxlock);
465 spin_unlock_irqrestore(&priv->txlock, flags);
462 466
463 /* Now we take down the rings to rebuild them */ 467 /* Now we take down the rings to rebuild them */
464 stop_gfar(dev); 468 stop_gfar(dev);
@@ -488,10 +492,14 @@ static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
488 492
489 /* Halt TX and RX, and process the frames which 493 /* Halt TX and RX, and process the frames which
490 * have already been received */ 494 * have already been received */
491 spin_lock_irqsave(&priv->lock, flags); 495 spin_lock_irqsave(&priv->txlock, flags);
496 spin_lock(&priv->rxlock);
497
492 gfar_halt(dev); 498 gfar_halt(dev);
493 gfar_clean_rx_ring(dev, priv->rx_ring_size); 499 gfar_clean_rx_ring(dev, priv->rx_ring_size);
494 spin_unlock_irqrestore(&priv->lock, flags); 500
501 spin_unlock(&priv->rxlock);
502 spin_unlock_irqrestore(&priv->txlock, flags);
495 503
496 /* Now we take down the rings to rebuild them */ 504 /* Now we take down the rings to rebuild them */
497 stop_gfar(dev); 505 stop_gfar(dev);
@@ -523,7 +531,7 @@ static int gfar_set_tx_csum(struct net_device *dev, uint32_t data)
523 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM)) 531 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
524 return -EOPNOTSUPP; 532 return -EOPNOTSUPP;
525 533
526 spin_lock_irqsave(&priv->lock, flags); 534 spin_lock_irqsave(&priv->txlock, flags);
527 gfar_halt(dev); 535 gfar_halt(dev);
528 536
529 if (data) 537 if (data)
@@ -532,7 +540,7 @@ static int gfar_set_tx_csum(struct net_device *dev, uint32_t data)
532 dev->features &= ~NETIF_F_IP_CSUM; 540 dev->features &= ~NETIF_F_IP_CSUM;
533 541
534 gfar_start(dev); 542 gfar_start(dev);
535 spin_unlock_irqrestore(&priv->lock, flags); 543 spin_unlock_irqrestore(&priv->txlock, flags);
536 544
537 return 0; 545 return 0;
538} 546}