aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/net/gianfar.c5
-rw-r--r--drivers/net/gianfar_ethtool.c23
2 files changed, 15 insertions, 13 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 5100f75238af..19fdf93e0ec2 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -892,6 +892,8 @@ void gfar_start(struct net_device *dev)
892 892
893 /* Unmask the interrupts we look for */ 893 /* Unmask the interrupts we look for */
894 gfar_write(&regs->imask, IMASK_DEFAULT); 894 gfar_write(&regs->imask, IMASK_DEFAULT);
895
896 dev->trans_start = jiffies;
895} 897}
896 898
897/* Bring the controller up and running */ 899/* Bring the controller up and running */
@@ -1233,8 +1235,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
1233 status = txbdp->status & TXBD_WRAP; 1235 status = txbdp->status & TXBD_WRAP;
1234 1236
1235 /* Set up checksumming */ 1237 /* Set up checksumming */
1236 if (likely((dev->features & NETIF_F_IP_CSUM) 1238 if (CHECKSUM_PARTIAL == skb->ip_summed) {
1237 && (CHECKSUM_PARTIAL == skb->ip_summed))) {
1238 fcb = gfar_add_fcb(skb, txbdp); 1239 fcb = gfar_add_fcb(skb, txbdp);
1239 status |= TXBD_TOE; 1240 status |= TXBD_TOE;
1240 gfar_tx_checksum(skb, fcb); 1241 gfar_tx_checksum(skb, fcb);
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}