aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcnet32.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcnet32.c')
-rw-r--r--drivers/net/pcnet32.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 5f994b5beda1..ff92aca0a7b3 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -282,7 +282,6 @@ struct pcnet32_private {
282 282
283 struct net_device *dev; 283 struct net_device *dev;
284 struct napi_struct napi; 284 struct napi_struct napi;
285 struct net_device_stats stats;
286 char tx_full; 285 char tx_full;
287 char phycount; /* number of phys found */ 286 char phycount; /* number of phys found */
288 int options; 287 int options;
@@ -442,7 +441,9 @@ static struct pcnet32_access pcnet32_dwio = {
442 441
443static void pcnet32_netif_stop(struct net_device *dev) 442static void pcnet32_netif_stop(struct net_device *dev)
444{ 443{
444#ifdef CONFIG_PCNET32_NAPI
445 struct pcnet32_private *lp = netdev_priv(dev); 445 struct pcnet32_private *lp = netdev_priv(dev);
446#endif
446 dev->trans_start = jiffies; 447 dev->trans_start = jiffies;
447#ifdef CONFIG_PCNET32_NAPI 448#ifdef CONFIG_PCNET32_NAPI
448 napi_disable(&lp->napi); 449 napi_disable(&lp->napi);
@@ -452,7 +453,9 @@ static void pcnet32_netif_stop(struct net_device *dev)
452 453
453static void pcnet32_netif_start(struct net_device *dev) 454static void pcnet32_netif_start(struct net_device *dev)
454{ 455{
456#ifdef CONFIG_PCNET32_NAPI
455 struct pcnet32_private *lp = netdev_priv(dev); 457 struct pcnet32_private *lp = netdev_priv(dev);
458#endif
456 netif_wake_queue(dev); 459 netif_wake_queue(dev);
457#ifdef CONFIG_PCNET32_NAPI 460#ifdef CONFIG_PCNET32_NAPI
458 napi_enable(&lp->napi); 461 napi_enable(&lp->napi);
@@ -1178,15 +1181,15 @@ static void pcnet32_rx_entry(struct net_device *dev,
1178 * buffers, with only the last correctly noting the error. 1181 * buffers, with only the last correctly noting the error.
1179 */ 1182 */
1180 if (status & 0x01) /* Only count a general error at the */ 1183 if (status & 0x01) /* Only count a general error at the */
1181 lp->stats.rx_errors++; /* end of a packet. */ 1184 dev->stats.rx_errors++; /* end of a packet. */
1182 if (status & 0x20) 1185 if (status & 0x20)
1183 lp->stats.rx_frame_errors++; 1186 dev->stats.rx_frame_errors++;
1184 if (status & 0x10) 1187 if (status & 0x10)
1185 lp->stats.rx_over_errors++; 1188 dev->stats.rx_over_errors++;
1186 if (status & 0x08) 1189 if (status & 0x08)
1187 lp->stats.rx_crc_errors++; 1190 dev->stats.rx_crc_errors++;
1188 if (status & 0x04) 1191 if (status & 0x04)
1189 lp->stats.rx_fifo_errors++; 1192 dev->stats.rx_fifo_errors++;
1190 return; 1193 return;
1191 } 1194 }
1192 1195
@@ -1197,13 +1200,13 @@ static void pcnet32_rx_entry(struct net_device *dev,
1197 if (netif_msg_drv(lp)) 1200 if (netif_msg_drv(lp))
1198 printk(KERN_ERR "%s: Impossible packet size %d!\n", 1201 printk(KERN_ERR "%s: Impossible packet size %d!\n",
1199 dev->name, pkt_len); 1202 dev->name, pkt_len);
1200 lp->stats.rx_errors++; 1203 dev->stats.rx_errors++;
1201 return; 1204 return;
1202 } 1205 }
1203 if (pkt_len < 60) { 1206 if (pkt_len < 60) {
1204 if (netif_msg_rx_err(lp)) 1207 if (netif_msg_rx_err(lp))
1205 printk(KERN_ERR "%s: Runt packet!\n", dev->name); 1208 printk(KERN_ERR "%s: Runt packet!\n", dev->name);
1206 lp->stats.rx_errors++; 1209 dev->stats.rx_errors++;
1207 return; 1210 return;
1208 } 1211 }
1209 1212
@@ -1237,7 +1240,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
1237 printk(KERN_ERR 1240 printk(KERN_ERR
1238 "%s: Memory squeeze, dropping packet.\n", 1241 "%s: Memory squeeze, dropping packet.\n",
1239 dev->name); 1242 dev->name);
1240 lp->stats.rx_dropped++; 1243 dev->stats.rx_dropped++;
1241 return; 1244 return;
1242 } 1245 }
1243 skb->dev = dev; 1246 skb->dev = dev;
@@ -1256,7 +1259,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
1256 pkt_len, 1259 pkt_len,
1257 PCI_DMA_FROMDEVICE); 1260 PCI_DMA_FROMDEVICE);
1258 } 1261 }
1259 lp->stats.rx_bytes += skb->len; 1262 dev->stats.rx_bytes += skb->len;
1260 skb->protocol = eth_type_trans(skb, dev); 1263 skb->protocol = eth_type_trans(skb, dev);
1261#ifdef CONFIG_PCNET32_NAPI 1264#ifdef CONFIG_PCNET32_NAPI
1262 netif_receive_skb(skb); 1265 netif_receive_skb(skb);
@@ -1264,7 +1267,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
1264 netif_rx(skb); 1267 netif_rx(skb);
1265#endif 1268#endif
1266 dev->last_rx = jiffies; 1269 dev->last_rx = jiffies;
1267 lp->stats.rx_packets++; 1270 dev->stats.rx_packets++;
1268 return; 1271 return;
1269} 1272}
1270 1273
@@ -1312,21 +1315,21 @@ static int pcnet32_tx(struct net_device *dev)
1312 if (status & 0x4000) { 1315 if (status & 0x4000) {
1313 /* There was a major error, log it. */ 1316 /* There was a major error, log it. */
1314 int err_status = le32_to_cpu(lp->tx_ring[entry].misc); 1317 int err_status = le32_to_cpu(lp->tx_ring[entry].misc);
1315 lp->stats.tx_errors++; 1318 dev->stats.tx_errors++;
1316 if (netif_msg_tx_err(lp)) 1319 if (netif_msg_tx_err(lp))
1317 printk(KERN_ERR 1320 printk(KERN_ERR
1318 "%s: Tx error status=%04x err_status=%08x\n", 1321 "%s: Tx error status=%04x err_status=%08x\n",
1319 dev->name, status, 1322 dev->name, status,
1320 err_status); 1323 err_status);
1321 if (err_status & 0x04000000) 1324 if (err_status & 0x04000000)
1322 lp->stats.tx_aborted_errors++; 1325 dev->stats.tx_aborted_errors++;
1323 if (err_status & 0x08000000) 1326 if (err_status & 0x08000000)
1324 lp->stats.tx_carrier_errors++; 1327 dev->stats.tx_carrier_errors++;
1325 if (err_status & 0x10000000) 1328 if (err_status & 0x10000000)
1326 lp->stats.tx_window_errors++; 1329 dev->stats.tx_window_errors++;
1327#ifndef DO_DXSUFLO 1330#ifndef DO_DXSUFLO
1328 if (err_status & 0x40000000) { 1331 if (err_status & 0x40000000) {
1329 lp->stats.tx_fifo_errors++; 1332 dev->stats.tx_fifo_errors++;
1330 /* Ackk! On FIFO errors the Tx unit is turned off! */ 1333 /* Ackk! On FIFO errors the Tx unit is turned off! */
1331 /* Remove this verbosity later! */ 1334 /* Remove this verbosity later! */
1332 if (netif_msg_tx_err(lp)) 1335 if (netif_msg_tx_err(lp))
@@ -1337,7 +1340,7 @@ static int pcnet32_tx(struct net_device *dev)
1337 } 1340 }
1338#else 1341#else
1339 if (err_status & 0x40000000) { 1342 if (err_status & 0x40000000) {
1340 lp->stats.tx_fifo_errors++; 1343 dev->stats.tx_fifo_errors++;
1341 if (!lp->dxsuflo) { /* If controller doesn't recover ... */ 1344 if (!lp->dxsuflo) { /* If controller doesn't recover ... */
1342 /* Ackk! On FIFO errors the Tx unit is turned off! */ 1345 /* Ackk! On FIFO errors the Tx unit is turned off! */
1343 /* Remove this verbosity later! */ 1346 /* Remove this verbosity later! */
@@ -1351,8 +1354,8 @@ static int pcnet32_tx(struct net_device *dev)
1351#endif 1354#endif
1352 } else { 1355 } else {
1353 if (status & 0x1800) 1356 if (status & 0x1800)
1354 lp->stats.collisions++; 1357 dev->stats.collisions++;
1355 lp->stats.tx_packets++; 1358 dev->stats.tx_packets++;
1356 } 1359 }
1357 1360
1358 /* We must free the original skb */ 1361 /* We must free the original skb */
@@ -1849,6 +1852,9 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1849 lp->mii_if.mdio_read = mdio_read; 1852 lp->mii_if.mdio_read = mdio_read;
1850 lp->mii_if.mdio_write = mdio_write; 1853 lp->mii_if.mdio_write = mdio_write;
1851 1854
1855 /* napi.weight is used in both the napi and non-napi cases */
1856 lp->napi.weight = lp->rx_ring_size / 2;
1857
1852#ifdef CONFIG_PCNET32_NAPI 1858#ifdef CONFIG_PCNET32_NAPI
1853 netif_napi_add(dev, &lp->napi, pcnet32_poll, lp->rx_ring_size / 2); 1859 netif_napi_add(dev, &lp->napi, pcnet32_poll, lp->rx_ring_size / 2);
1854#endif 1860#endif
@@ -2471,7 +2477,7 @@ static void pcnet32_tx_timeout(struct net_device *dev)
2471 "%s: transmit timed out, status %4.4x, resetting.\n", 2477 "%s: transmit timed out, status %4.4x, resetting.\n",
2472 dev->name, lp->a.read_csr(ioaddr, CSR0)); 2478 dev->name, lp->a.read_csr(ioaddr, CSR0));
2473 lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); 2479 lp->a.write_csr(ioaddr, CSR0, CSR0_STOP);
2474 lp->stats.tx_errors++; 2480 dev->stats.tx_errors++;
2475 if (netif_msg_tx_err(lp)) { 2481 if (netif_msg_tx_err(lp)) {
2476 int i; 2482 int i;
2477 printk(KERN_DEBUG 2483 printk(KERN_DEBUG
@@ -2541,7 +2547,7 @@ static int pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev)
2541 lp->tx_ring[entry].status = cpu_to_le16(status); 2547 lp->tx_ring[entry].status = cpu_to_le16(status);
2542 2548
2543 lp->cur_tx++; 2549 lp->cur_tx++;
2544 lp->stats.tx_bytes += skb->len; 2550 dev->stats.tx_bytes += skb->len;
2545 2551
2546 /* Trigger an immediate send poll. */ 2552 /* Trigger an immediate send poll. */
2547 lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL); 2553 lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL);
@@ -2586,7 +2592,7 @@ pcnet32_interrupt(int irq, void *dev_id)
2586 2592
2587 /* Log misc errors. */ 2593 /* Log misc errors. */
2588 if (csr0 & 0x4000) 2594 if (csr0 & 0x4000)
2589 lp->stats.tx_errors++; /* Tx babble. */ 2595 dev->stats.tx_errors++; /* Tx babble. */
2590 if (csr0 & 0x1000) { 2596 if (csr0 & 0x1000) {
2591 /* 2597 /*
2592 * This happens when our receive ring is full. This 2598 * This happens when our receive ring is full. This
@@ -2599,7 +2605,7 @@ pcnet32_interrupt(int irq, void *dev_id)
2599 * don't get a rx interrupt, but a missed frame 2605 * don't get a rx interrupt, but a missed frame
2600 * interrupt sooner or later. 2606 * interrupt sooner or later.
2601 */ 2607 */
2602 lp->stats.rx_errors++; /* Missed a Rx frame. */ 2608 dev->stats.rx_errors++; /* Missed a Rx frame. */
2603 } 2609 }
2604 if (csr0 & 0x0800) { 2610 if (csr0 & 0x0800) {
2605 if (netif_msg_drv(lp)) 2611 if (netif_msg_drv(lp))
@@ -2661,7 +2667,7 @@ static int pcnet32_close(struct net_device *dev)
2661 2667
2662 spin_lock_irqsave(&lp->lock, flags); 2668 spin_lock_irqsave(&lp->lock, flags);
2663 2669
2664 lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); 2670 dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
2665 2671
2666 if (netif_msg_ifdown(lp)) 2672 if (netif_msg_ifdown(lp))
2667 printk(KERN_DEBUG 2673 printk(KERN_DEBUG
@@ -2698,10 +2704,10 @@ static struct net_device_stats *pcnet32_get_stats(struct net_device *dev)
2698 unsigned long flags; 2704 unsigned long flags;
2699 2705
2700 spin_lock_irqsave(&lp->lock, flags); 2706 spin_lock_irqsave(&lp->lock, flags);
2701 lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); 2707 dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
2702 spin_unlock_irqrestore(&lp->lock, flags); 2708 spin_unlock_irqrestore(&lp->lock, flags);
2703 2709
2704 return &lp->stats; 2710 return &dev->stats;
2705} 2711}
2706 2712
2707/* taken from the sunlance driver, which it took from the depca driver */ 2713/* taken from the sunlance driver, which it took from the depca driver */