diff options
-rw-r--r-- | drivers/net/sundance.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index fba64d39ba19..02679e688c4c 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1642,6 +1642,14 @@ static int netdev_close(struct net_device *dev) | |||
1642 | struct sk_buff *skb; | 1642 | struct sk_buff *skb; |
1643 | int i; | 1643 | int i; |
1644 | 1644 | ||
1645 | /* Wait and kill tasklet */ | ||
1646 | tasklet_kill(&np->rx_tasklet); | ||
1647 | tasklet_kill(&np->tx_tasklet); | ||
1648 | np->cur_tx = 0; | ||
1649 | np->dirty_tx = 0; | ||
1650 | np->cur_task = 0; | ||
1651 | np->last_tx = 0; | ||
1652 | |||
1645 | netif_stop_queue(dev); | 1653 | netif_stop_queue(dev); |
1646 | 1654 | ||
1647 | if (netif_msg_ifdown(np)) { | 1655 | if (netif_msg_ifdown(np)) { |
@@ -1662,9 +1670,20 @@ static int netdev_close(struct net_device *dev) | |||
1662 | /* Stop the chip's Tx and Rx processes. */ | 1670 | /* Stop the chip's Tx and Rx processes. */ |
1663 | iowrite16(TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl1); | 1671 | iowrite16(TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl1); |
1664 | 1672 | ||
1665 | /* Wait and kill tasklet */ | 1673 | for (i = 2000; i > 0; i--) { |
1666 | tasklet_kill(&np->rx_tasklet); | 1674 | if ((ioread32(ioaddr + DMACtrl) & 0xc000) == 0) |
1667 | tasklet_kill(&np->tx_tasklet); | 1675 | break; |
1676 | mdelay(1); | ||
1677 | } | ||
1678 | |||
1679 | iowrite16(GlobalReset | DMAReset | FIFOReset | NetworkReset, | ||
1680 | ioaddr +ASICCtrl + 2); | ||
1681 | |||
1682 | for (i = 2000; i > 0; i--) { | ||
1683 | if ((ioread16(ioaddr + ASICCtrl +2) & ResetBusy) == 0) | ||
1684 | break; | ||
1685 | mdelay(1); | ||
1686 | } | ||
1668 | 1687 | ||
1669 | #ifdef __i386__ | 1688 | #ifdef __i386__ |
1670 | if (netif_msg_hw(np)) { | 1689 | if (netif_msg_hw(np)) { |
@@ -1702,6 +1721,7 @@ static int netdev_close(struct net_device *dev) | |||
1702 | } | 1721 | } |
1703 | } | 1722 | } |
1704 | for (i = 0; i < TX_RING_SIZE; i++) { | 1723 | for (i = 0; i < TX_RING_SIZE; i++) { |
1724 | np->tx_ring[i].next_desc = 0; | ||
1705 | skb = np->tx_skbuff[i]; | 1725 | skb = np->tx_skbuff[i]; |
1706 | if (skb) { | 1726 | if (skb) { |
1707 | pci_unmap_single(np->pci_dev, | 1727 | pci_unmap_single(np->pci_dev, |