aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/8139cp.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-21 22:34:08 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-21 22:34:08 -0400
commita3536c839f04682ed06c84a7f75968c27c6108c8 (patch)
tree92c26ea74c0ffb9b83a2285ad2539cc271b09856 /drivers/net/8139cp.c
parenta33a1982012e9070736e3717231714dc9892303b (diff)
parentefb0372bbaf5b829ff8c39db372779928af542a7 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/net/8139cp.c')
-rw-r--r--drivers/net/8139cp.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index bd99c268e2da..f822cd3025ff 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -353,8 +353,6 @@ struct cp_private {
353 353
354 struct net_device_stats net_stats; 354 struct net_device_stats net_stats;
355 struct cp_extra_stats cp_stats; 355 struct cp_extra_stats cp_stats;
356 struct cp_dma_stats *nic_stats;
357 dma_addr_t nic_stats_dma;
358 356
359 unsigned rx_tail ____cacheline_aligned; 357 unsigned rx_tail ____cacheline_aligned;
360 struct cp_desc *rx_ring; 358 struct cp_desc *rx_ring;
@@ -1142,10 +1140,6 @@ static int cp_alloc_rings (struct cp_private *cp)
1142 cp->rx_ring = mem; 1140 cp->rx_ring = mem;
1143 cp->tx_ring = &cp->rx_ring[CP_RX_RING_SIZE]; 1141 cp->tx_ring = &cp->rx_ring[CP_RX_RING_SIZE];
1144 1142
1145 mem += (CP_RING_BYTES - CP_STATS_SIZE);
1146 cp->nic_stats = mem;
1147 cp->nic_stats_dma = cp->ring_dma + (CP_RING_BYTES - CP_STATS_SIZE);
1148
1149 return cp_init_rings(cp); 1143 return cp_init_rings(cp);
1150} 1144}
1151 1145
@@ -1186,7 +1180,6 @@ static void cp_free_rings (struct cp_private *cp)
1186 pci_free_consistent(cp->pdev, CP_RING_BYTES, cp->rx_ring, cp->ring_dma); 1180 pci_free_consistent(cp->pdev, CP_RING_BYTES, cp->rx_ring, cp->ring_dma);
1187 cp->rx_ring = NULL; 1181 cp->rx_ring = NULL;
1188 cp->tx_ring = NULL; 1182 cp->tx_ring = NULL;
1189 cp->nic_stats = NULL;
1190} 1183}
1191 1184
1192static int cp_open (struct net_device *dev) 1185static int cp_open (struct net_device *dev)
@@ -1515,13 +1508,17 @@ static void cp_get_ethtool_stats (struct net_device *dev,
1515 struct ethtool_stats *estats, u64 *tmp_stats) 1508 struct ethtool_stats *estats, u64 *tmp_stats)
1516{ 1509{
1517 struct cp_private *cp = netdev_priv(dev); 1510 struct cp_private *cp = netdev_priv(dev);
1511 struct cp_dma_stats *nic_stats;
1512 dma_addr_t dma;
1518 int i; 1513 int i;
1519 1514
1520 memset(cp->nic_stats, 0, sizeof(struct cp_dma_stats)); 1515 nic_stats = pci_alloc_consistent(cp->pdev, sizeof(*nic_stats), &dma);
1516 if (!nic_stats)
1517 return;
1521 1518
1522 /* begin NIC statistics dump */ 1519 /* begin NIC statistics dump */
1523 cpw32(StatsAddr + 4, (cp->nic_stats_dma >> 16) >> 16); 1520 cpw32(StatsAddr + 4, (u64)dma >> 32);
1524 cpw32(StatsAddr, (cp->nic_stats_dma & 0xffffffff) | DumpStats); 1521 cpw32(StatsAddr, ((u64)dma & DMA_32BIT_MASK) | DumpStats);
1525 cpr32(StatsAddr); 1522 cpr32(StatsAddr);
1526 1523
1527 for (i = 0; i < 1000; i++) { 1524 for (i = 0; i < 1000; i++) {
@@ -1531,24 +1528,27 @@ static void cp_get_ethtool_stats (struct net_device *dev,
1531 } 1528 }
1532 cpw32(StatsAddr, 0); 1529 cpw32(StatsAddr, 0);
1533 cpw32(StatsAddr + 4, 0); 1530 cpw32(StatsAddr + 4, 0);
1531 cpr32(StatsAddr);
1534 1532
1535 i = 0; 1533 i = 0;
1536 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok); 1534 tmp_stats[i++] = le64_to_cpu(nic_stats->tx_ok);
1537 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok); 1535 tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok);
1538 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_err); 1536 tmp_stats[i++] = le64_to_cpu(nic_stats->tx_err);
1539 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_err); 1537 tmp_stats[i++] = le32_to_cpu(nic_stats->rx_err);
1540 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->rx_fifo); 1538 tmp_stats[i++] = le16_to_cpu(nic_stats->rx_fifo);
1541 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->frame_align); 1539 tmp_stats[i++] = le16_to_cpu(nic_stats->frame_align);
1542 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_1col); 1540 tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_1col);
1543 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_mcol); 1541 tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_mcol);
1544 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_phys); 1542 tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_phys);
1545 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_bcast); 1543 tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_bcast);
1546 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_ok_mcast); 1544 tmp_stats[i++] = le32_to_cpu(nic_stats->rx_ok_mcast);
1547 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_abort); 1545 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
1548 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_underrun); 1546 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
1549 tmp_stats[i++] = cp->cp_stats.rx_frags; 1547 tmp_stats[i++] = cp->cp_stats.rx_frags;
1550 if (i != CP_NUM_STATS) 1548 if (i != CP_NUM_STATS)
1551 BUG(); 1549 BUG();
1550
1551 pci_free_consistent(cp->pdev, sizeof(*nic_stats), nic_stats, dma);
1552} 1552}
1553 1553
1554static struct ethtool_ops cp_ethtool_ops = { 1554static struct ethtool_ops cp_ethtool_ops = {