aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pci-skeleton.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pci-skeleton.c')
-rw-r--r--drivers/net/pci-skeleton.c74
1 files changed, 23 insertions, 51 deletions
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index a4b16484a5f7..7dace63fb6e6 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -457,7 +457,6 @@ struct netdrv_private {
457 void *mmio_addr; 457 void *mmio_addr;
458 int drv_flags; 458 int drv_flags;
459 struct pci_dev *pci_dev; 459 struct pci_dev *pci_dev;
460 struct net_device_stats stats;
461 struct timer_list timer; /* Media selection timer. */ 460 struct timer_list timer; /* Media selection timer. */
462 unsigned char *rx_ring; 461 unsigned char *rx_ring;
463 unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */ 462 unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */
@@ -505,7 +504,6 @@ static int netdrv_start_xmit (struct sk_buff *skb,
505static irqreturn_t netdrv_interrupt (int irq, void *dev_instance); 504static irqreturn_t netdrv_interrupt (int irq, void *dev_instance);
506static int netdrv_close (struct net_device *dev); 505static int netdrv_close (struct net_device *dev);
507static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); 506static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
508static struct net_device_stats *netdrv_get_stats (struct net_device *dev);
509static void netdrv_set_rx_mode (struct net_device *dev); 507static void netdrv_set_rx_mode (struct net_device *dev);
510static void netdrv_hw_start (struct net_device *dev); 508static void netdrv_hw_start (struct net_device *dev);
511 509
@@ -775,7 +773,6 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
775 dev->open = netdrv_open; 773 dev->open = netdrv_open;
776 dev->hard_start_xmit = netdrv_start_xmit; 774 dev->hard_start_xmit = netdrv_start_xmit;
777 dev->stop = netdrv_close; 775 dev->stop = netdrv_close;
778 dev->get_stats = netdrv_get_stats;
779 dev->set_multicast_list = netdrv_set_rx_mode; 776 dev->set_multicast_list = netdrv_set_rx_mode;
780 dev->do_ioctl = netdrv_ioctl; 777 dev->do_ioctl = netdrv_ioctl;
781 dev->tx_timeout = netdrv_tx_timeout; 778 dev->tx_timeout = netdrv_tx_timeout;
@@ -1276,7 +1273,7 @@ static void netdrv_tx_clear (struct netdrv_private *tp)
1276 if (rp->skb) { 1273 if (rp->skb) {
1277 dev_kfree_skb (rp->skb); 1274 dev_kfree_skb (rp->skb);
1278 rp->skb = NULL; 1275 rp->skb = NULL;
1279 tp->stats.tx_dropped++; 1276 dev->stats.tx_dropped++;
1280 } 1277 }
1281 } 1278 }
1282} 1279}
@@ -1389,25 +1386,25 @@ static void netdrv_tx_interrupt (struct net_device *dev,
1389 /* There was an major error, log it. */ 1386 /* There was an major error, log it. */
1390 DPRINTK ("%s: Transmit error, Tx status %8.8x.\n", 1387 DPRINTK ("%s: Transmit error, Tx status %8.8x.\n",
1391 dev->name, txstatus); 1388 dev->name, txstatus);
1392 tp->stats.tx_errors++; 1389 dev->stats.tx_errors++;
1393 if (txstatus & TxAborted) { 1390 if (txstatus & TxAborted) {
1394 tp->stats.tx_aborted_errors++; 1391 dev->stats.tx_aborted_errors++;
1395 NETDRV_W32 (TxConfig, TxClearAbt | (TX_DMA_BURST << TxDMAShift)); 1392 NETDRV_W32 (TxConfig, TxClearAbt | (TX_DMA_BURST << TxDMAShift));
1396 } 1393 }
1397 if (txstatus & TxCarrierLost) 1394 if (txstatus & TxCarrierLost)
1398 tp->stats.tx_carrier_errors++; 1395 dev->stats.tx_carrier_errors++;
1399 if (txstatus & TxOutOfWindow) 1396 if (txstatus & TxOutOfWindow)
1400 tp->stats.tx_window_errors++; 1397 dev->stats.tx_window_errors++;
1401 } else { 1398 } else {
1402 if (txstatus & TxUnderrun) { 1399 if (txstatus & TxUnderrun) {
1403 /* Add 64 to the Tx FIFO threshold. */ 1400 /* Add 64 to the Tx FIFO threshold. */
1404 if (tp->tx_flag < 0x00300000) 1401 if (tp->tx_flag < 0x00300000)
1405 tp->tx_flag += 0x00020000; 1402 tp->tx_flag += 0x00020000;
1406 tp->stats.tx_fifo_errors++; 1403 dev->stats.tx_fifo_errors++;
1407 } 1404 }
1408 tp->stats.collisions += (txstatus >> 24) & 15; 1405 dev->stats.collisions += (txstatus >> 24) & 15;
1409 tp->stats.tx_bytes += txstatus & 0x7ff; 1406 dev->stats.tx_bytes += txstatus & 0x7ff;
1410 tp->stats.tx_packets++; 1407 dev->stats.tx_packets++;
1411 } 1408 }
1412 1409
1413 /* Free the original skb. */ 1410 /* Free the original skb. */
@@ -1460,13 +1457,13 @@ static void netdrv_rx_err (u32 rx_status, struct net_device *dev,
1460 dev->name, rx_status); 1457 dev->name, rx_status);
1461 /* A.C.: The chip hangs here. */ 1458 /* A.C.: The chip hangs here. */
1462 } 1459 }
1463 tp->stats.rx_errors++; 1460 dev->stats.rx_errors++;
1464 if (rx_status & (RxBadSymbol | RxBadAlign)) 1461 if (rx_status & (RxBadSymbol | RxBadAlign))
1465 tp->stats.rx_frame_errors++; 1462 dev->stats.rx_frame_errors++;
1466 if (rx_status & (RxRunt | RxTooLong)) 1463 if (rx_status & (RxRunt | RxTooLong))
1467 tp->stats.rx_length_errors++; 1464 dev->stats.rx_length_errors++;
1468 if (rx_status & RxCRCErr) 1465 if (rx_status & RxCRCErr)
1469 tp->stats.rx_crc_errors++; 1466 dev->stats.rx_crc_errors++;
1470 /* Reset the receiver, based on RealTek recommendation. (Bug?) */ 1467 /* Reset the receiver, based on RealTek recommendation. (Bug?) */
1471 tp->cur_rx = 0; 1468 tp->cur_rx = 0;
1472 1469
@@ -1572,13 +1569,13 @@ static void netdrv_rx_interrupt (struct net_device *dev,
1572 skb->protocol = eth_type_trans (skb, dev); 1569 skb->protocol = eth_type_trans (skb, dev);
1573 netif_rx (skb); 1570 netif_rx (skb);
1574 dev->last_rx = jiffies; 1571 dev->last_rx = jiffies;
1575 tp->stats.rx_bytes += pkt_size; 1572 dev->stats.rx_bytes += pkt_size;
1576 tp->stats.rx_packets++; 1573 dev->stats.rx_packets++;
1577 } else { 1574 } else {
1578 printk (KERN_WARNING 1575 printk (KERN_WARNING
1579 "%s: Memory squeeze, dropping packet.\n", 1576 "%s: Memory squeeze, dropping packet.\n",
1580 dev->name); 1577 dev->name);
1581 tp->stats.rx_dropped++; 1578 dev->stats.rx_dropped++;
1582 } 1579 }
1583 1580
1584 cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; 1581 cur_rx = (cur_rx + rx_size + 4 + 3) & ~3;
@@ -1607,7 +1604,7 @@ static void netdrv_weird_interrupt (struct net_device *dev,
1607 assert (ioaddr != NULL); 1604 assert (ioaddr != NULL);
1608 1605
1609 /* Update the error count. */ 1606 /* Update the error count. */
1610 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1607 dev->stats.rx_missed_errors += NETDRV_R32 (RxMissed);
1611 NETDRV_W32 (RxMissed, 0); 1608 NETDRV_W32 (RxMissed, 0);
1612 1609
1613 if ((status & RxUnderrun) && link_changed && 1610 if ((status & RxUnderrun) && link_changed &&
@@ -1628,14 +1625,14 @@ static void netdrv_weird_interrupt (struct net_device *dev,
1628 /* XXX along with netdrv_rx_err, are we double-counting errors? */ 1625 /* XXX along with netdrv_rx_err, are we double-counting errors? */
1629 if (status & 1626 if (status &
1630 (RxUnderrun | RxOverflow | RxErr | RxFIFOOver)) 1627 (RxUnderrun | RxOverflow | RxErr | RxFIFOOver))
1631 tp->stats.rx_errors++; 1628 dev->stats.rx_errors++;
1632 1629
1633 if (status & (PCSTimeout)) 1630 if (status & (PCSTimeout))
1634 tp->stats.rx_length_errors++; 1631 dev->stats.rx_length_errors++;
1635 if (status & (RxUnderrun | RxFIFOOver)) 1632 if (status & (RxUnderrun | RxFIFOOver))
1636 tp->stats.rx_fifo_errors++; 1633 dev->stats.rx_fifo_errors++;
1637 if (status & RxOverflow) { 1634 if (status & RxOverflow) {
1638 tp->stats.rx_over_errors++; 1635 dev->stats.rx_over_errors++;
1639 tp->cur_rx = NETDRV_R16 (RxBufAddr) % RX_BUF_LEN; 1636 tp->cur_rx = NETDRV_R16 (RxBufAddr) % RX_BUF_LEN;
1640 NETDRV_W16_F (RxBufPtr, tp->cur_rx - 16); 1637 NETDRV_W16_F (RxBufPtr, tp->cur_rx - 16);
1641 } 1638 }
@@ -1739,7 +1736,7 @@ static int netdrv_close (struct net_device *dev)
1739 NETDRV_W16 (IntrMask, 0x0000); 1736 NETDRV_W16 (IntrMask, 0x0000);
1740 1737
1741 /* Update the error counts. */ 1738 /* Update the error counts. */
1742 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1739 dev->stats.rx_missed_errors += NETDRV_R32 (RxMissed);
1743 NETDRV_W32 (RxMissed, 0); 1740 NETDRV_W32 (RxMissed, 0);
1744 1741
1745 spin_unlock_irqrestore (&tp->lock, flags); 1742 spin_unlock_irqrestore (&tp->lock, flags);
@@ -1806,31 +1803,6 @@ static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1806 return rc; 1803 return rc;
1807} 1804}
1808 1805
1809
1810static struct net_device_stats *netdrv_get_stats (struct net_device *dev)
1811{
1812 struct netdrv_private *tp = dev->priv;
1813 void *ioaddr = tp->mmio_addr;
1814
1815 DPRINTK ("ENTER\n");
1816
1817 assert (tp != NULL);
1818
1819 if (netif_running(dev)) {
1820 unsigned long flags;
1821
1822 spin_lock_irqsave (&tp->lock, flags);
1823
1824 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed);
1825 NETDRV_W32 (RxMissed, 0);
1826
1827 spin_unlock_irqrestore (&tp->lock, flags);
1828 }
1829
1830 DPRINTK ("EXIT\n");
1831 return &tp->stats;
1832}
1833
1834/* Set or clear the multicast filter for this adaptor. 1806/* Set or clear the multicast filter for this adaptor.
1835 This routine is not state sensitive and need not be SMP locked. */ 1807 This routine is not state sensitive and need not be SMP locked. */
1836 1808
@@ -1908,7 +1880,7 @@ static int netdrv_suspend (struct pci_dev *pdev, pm_message_t state)
1908 NETDRV_W8 (ChipCmd, (NETDRV_R8 (ChipCmd) & ChipCmdClear)); 1880 NETDRV_W8 (ChipCmd, (NETDRV_R8 (ChipCmd) & ChipCmdClear));
1909 1881
1910 /* Update the error counts. */ 1882 /* Update the error counts. */
1911 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1883 dev->stats.rx_missed_errors += NETDRV_R32 (RxMissed);
1912 NETDRV_W32 (RxMissed, 0); 1884 NETDRV_W32 (RxMissed, 0);
1913 1885
1914 spin_unlock_irqrestore (&tp->lock, flags); 1886 spin_unlock_irqrestore (&tp->lock, flags);