diff options
Diffstat (limited to 'drivers/net/8139cp.c')
-rw-r--r-- | drivers/net/8139cp.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 72cdf19e1be1..7b293f01c9ed 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/etherdevice.h> | 61 | #include <linux/etherdevice.h> |
62 | #include <linux/init.h> | 62 | #include <linux/init.h> |
63 | #include <linux/pci.h> | 63 | #include <linux/pci.h> |
64 | #include <linux/dma-mapping.h> | ||
64 | #include <linux/delay.h> | 65 | #include <linux/delay.h> |
65 | #include <linux/ethtool.h> | 66 | #include <linux/ethtool.h> |
66 | #include <linux/mii.h> | 67 | #include <linux/mii.h> |
@@ -595,7 +596,7 @@ rx_status_loop: | |||
595 | 596 | ||
596 | mapping = | 597 | mapping = |
597 | cp->rx_skb[rx_tail].mapping = | 598 | cp->rx_skb[rx_tail].mapping = |
598 | pci_map_single(cp->pdev, new_skb->tail, | 599 | pci_map_single(cp->pdev, new_skb->data, |
599 | buflen, PCI_DMA_FROMDEVICE); | 600 | buflen, PCI_DMA_FROMDEVICE); |
600 | cp->rx_skb[rx_tail].skb = new_skb; | 601 | cp->rx_skb[rx_tail].skb = new_skb; |
601 | 602 | ||
@@ -1100,7 +1101,7 @@ static int cp_refill_rx (struct cp_private *cp) | |||
1100 | skb_reserve(skb, RX_OFFSET); | 1101 | skb_reserve(skb, RX_OFFSET); |
1101 | 1102 | ||
1102 | cp->rx_skb[i].mapping = pci_map_single(cp->pdev, | 1103 | cp->rx_skb[i].mapping = pci_map_single(cp->pdev, |
1103 | skb->tail, cp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1104 | skb->data, cp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1104 | cp->rx_skb[i].skb = skb; | 1105 | cp->rx_skb[i].skb = skb; |
1105 | 1106 | ||
1106 | cp->rx_ring[i].opts2 = 0; | 1107 | cp->rx_ring[i].opts2 = 0; |
@@ -1515,22 +1516,22 @@ static void cp_get_ethtool_stats (struct net_device *dev, | |||
1515 | struct ethtool_stats *estats, u64 *tmp_stats) | 1516 | struct ethtool_stats *estats, u64 *tmp_stats) |
1516 | { | 1517 | { |
1517 | struct cp_private *cp = netdev_priv(dev); | 1518 | struct cp_private *cp = netdev_priv(dev); |
1518 | unsigned int work = 100; | ||
1519 | int i; | 1519 | int i; |
1520 | 1520 | ||
1521 | memset(cp->nic_stats, 0, sizeof(struct cp_dma_stats)); | ||
1522 | |||
1521 | /* begin NIC statistics dump */ | 1523 | /* begin NIC statistics dump */ |
1522 | cpw32(StatsAddr + 4, (cp->nic_stats_dma >> 16) >> 16); | 1524 | cpw32(StatsAddr + 4, (cp->nic_stats_dma >> 16) >> 16); |
1523 | cpw32(StatsAddr, (cp->nic_stats_dma & 0xffffffff) | DumpStats); | 1525 | cpw32(StatsAddr, (cp->nic_stats_dma & 0xffffffff) | DumpStats); |
1524 | cpr32(StatsAddr); | 1526 | cpr32(StatsAddr); |
1525 | 1527 | ||
1526 | while (work-- > 0) { | 1528 | for (i = 0; i < 1000; i++) { |
1527 | if ((cpr32(StatsAddr) & DumpStats) == 0) | 1529 | if ((cpr32(StatsAddr) & DumpStats) == 0) |
1528 | break; | 1530 | break; |
1529 | cpu_relax(); | 1531 | udelay(10); |
1530 | } | 1532 | } |
1531 | 1533 | cpw32(StatsAddr, 0); | |
1532 | if (cpr32(StatsAddr) & DumpStats) | 1534 | cpw32(StatsAddr + 4, 0); |
1533 | return /* -EIO */; | ||
1534 | 1535 | ||
1535 | i = 0; | 1536 | i = 0; |
1536 | tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok); | 1537 | tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok); |
@@ -1732,19 +1733,19 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1732 | 1733 | ||
1733 | /* Configure DMA attributes. */ | 1734 | /* Configure DMA attributes. */ |
1734 | if ((sizeof(dma_addr_t) > 4) && | 1735 | if ((sizeof(dma_addr_t) > 4) && |
1735 | !pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL) && | 1736 | !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK) && |
1736 | !pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { | 1737 | !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { |
1737 | pci_using_dac = 1; | 1738 | pci_using_dac = 1; |
1738 | } else { | 1739 | } else { |
1739 | pci_using_dac = 0; | 1740 | pci_using_dac = 0; |
1740 | 1741 | ||
1741 | rc = pci_set_dma_mask(pdev, 0xffffffffULL); | 1742 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
1742 | if (rc) { | 1743 | if (rc) { |
1743 | printk(KERN_ERR PFX "No usable DMA configuration, " | 1744 | printk(KERN_ERR PFX "No usable DMA configuration, " |
1744 | "aborting.\n"); | 1745 | "aborting.\n"); |
1745 | goto err_out_res; | 1746 | goto err_out_res; |
1746 | } | 1747 | } |
1747 | rc = pci_set_consistent_dma_mask(pdev, 0xffffffffULL); | 1748 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
1748 | if (rc) { | 1749 | if (rc) { |
1749 | printk(KERN_ERR PFX "No usable consistent DMA configuration, " | 1750 | printk(KERN_ERR PFX "No usable consistent DMA configuration, " |
1750 | "aborting.\n"); | 1751 | "aborting.\n"); |