Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code

We now have struct net_device_stats embedded in struct net_device,
and the default ->get_stats() hook does the obvious thing for us.

Run through drivers/net/* and remove the driver-local storage of
statistics, and driver-local ->get_stats() hook where applicable.

This was just the low-hanging fruit in drivers/net; plenty more drivers
remain to be updated.

[ Resolved conflicts with napi_struct changes and fix sunqe build
regression... -DaveM ]

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jeff Garzik and committed by
David S. Miller
09f75cd7 ff8ac609

+946 -1761
+11 -30
drivers/net/3c501.c
··· 315 315 dev->tx_timeout = &el_timeout; 316 316 dev->watchdog_timeo = HZ; 317 317 dev->stop = &el1_close; 318 - dev->get_stats = &el1_get_stats; 319 318 dev->set_multicast_list = &set_multicast_list; 320 319 dev->ethtool_ops = &netdev_ethtool_ops; 321 320 return 0; ··· 373 374 if (el_debug) 374 375 printk (KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n", 375 376 dev->name, inb(TX_STATUS), inb(AX_STATUS), inb(RX_STATUS)); 376 - lp->stats.tx_errors++; 377 + dev->stats.tx_errors++; 377 378 outb(TX_NORM, TX_CMD); 378 379 outb(RX_NORM, RX_CMD); 379 380 outb(AX_OFF, AX_CMD); /* Just trigger a false interrupt. */ ··· 440 441 lp->tx_pkt_start = gp_start; 441 442 lp->collisions = 0; 442 443 443 - lp->stats.tx_bytes += skb->len; 444 + dev->stats.tx_bytes += skb->len; 444 445 445 446 /* 446 447 * Command mode with status cleared should [in theory] ··· 587 588 printk (KERN_DEBUG "%s: Transmit failed 16 times, Ethernet jammed?\n",dev->name); 588 589 outb(AX_SYS, AX_CMD); 589 590 lp->txing = 0; 590 - lp->stats.tx_aborted_errors++; 591 + dev->stats.tx_aborted_errors++; 591 592 netif_wake_queue(dev); 592 593 } 593 594 else if (txsr & TX_COLLISION) ··· 605 606 outb(AX_SYS, AX_CMD); 606 607 outw(lp->tx_pkt_start, GP_LOW); 607 608 outb(AX_XMIT, AX_CMD); 608 - lp->stats.collisions++; 609 + dev->stats.collisions++; 609 610 spin_unlock(&lp->lock); 610 611 goto out; 611 612 } ··· 614 615 /* 615 616 * It worked.. we will now fall through and receive 616 617 */ 617 - lp->stats.tx_packets++; 618 + dev->stats.tx_packets++; 618 619 if (el_debug > 6) 619 620 printk(KERN_DEBUG " Tx succeeded %s\n", 620 621 (txsr & TX_RDY) ? "." : "but tx is busy!"); ··· 639 640 * Just reading rx_status fixes most errors. 640 641 */ 641 642 if (rxsr & RX_MISSED) 642 - lp->stats.rx_missed_errors++; 643 + dev->stats.rx_missed_errors++; 643 644 else if (rxsr & RX_RUNT) 644 645 { /* Handled to avoid board lock-up. */ 645 - lp->stats.rx_length_errors++; 646 + dev->stats.rx_length_errors++; 646 647 if (el_debug > 5) 647 648 printk(KERN_DEBUG " runt.\n"); 648 649 } ··· 693 694 694 695 static void el_receive(struct net_device *dev) 695 696 { 696 - struct net_local *lp = netdev_priv(dev); 697 697 int ioaddr = dev->base_addr; 698 698 int pkt_len; 699 699 struct sk_buff *skb; ··· 706 708 { 707 709 if (el_debug) 708 710 printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); 709 - lp->stats.rx_over_errors++; 711 + dev->stats.rx_over_errors++; 710 712 return; 711 713 } 712 714 ··· 725 727 if (skb == NULL) 726 728 { 727 729 printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); 728 - lp->stats.rx_dropped++; 730 + dev->stats.rx_dropped++; 729 731 return; 730 732 } 731 733 else ··· 740 742 skb->protocol=eth_type_trans(skb,dev); 741 743 netif_rx(skb); 742 744 dev->last_rx = jiffies; 743 - lp->stats.rx_packets++; 744 - lp->stats.rx_bytes+=pkt_len; 745 + dev->stats.rx_packets++; 746 + dev->stats.rx_bytes+=pkt_len; 745 747 } 746 748 return; 747 749 } ··· 806 808 outb(AX_RESET, AX_CMD); /* Reset the chip */ 807 809 808 810 return 0; 809 - } 810 - 811 - /** 812 - * el1_get_stats: 813 - * @dev: The card to get the statistics for 814 - * 815 - * In smarter devices this function is needed to pull statistics off the 816 - * board itself. The 3c501 has no hardware statistics. We maintain them all 817 - * so they are by definition always up to date. 818 - * 819 - * Returns the statistics for the card from the card private data 820 - */ 821 - 822 - static struct net_device_stats *el1_get_stats(struct net_device *dev) 823 - { 824 - struct net_local *lp = netdev_priv(dev); 825 - return &lp->stats; 826 811 } 827 812 828 813 /**
-2
drivers/net/3c501.h
··· 11 11 static void el_receive(struct net_device *dev); 12 12 static void el_reset(struct net_device *dev); 13 13 static int el1_close(struct net_device *dev); 14 - static struct net_device_stats *el1_get_stats(struct net_device *dev); 15 14 static void set_multicast_list(struct net_device *dev); 16 15 static const struct ethtool_ops netdev_ethtool_ops; 17 16 ··· 28 29 29 30 struct net_local 30 31 { 31 - struct net_device_stats stats; 32 32 int tx_pkt_start; /* The length of the current Tx packet. */ 33 33 int collisions; /* Tx collisions this packet */ 34 34 int loading; /* Spot buffer load collisions */
+19 -33
drivers/net/3c507.c
··· 118 118 119 119 /* Information that need to be kept for each board. */ 120 120 struct net_local { 121 - struct net_device_stats stats; 122 121 int last_restart; 123 122 ushort rx_head; 124 123 ushort rx_tail; ··· 288 289 static irqreturn_t el16_interrupt(int irq, void *dev_id); 289 290 static void el16_rx(struct net_device *dev); 290 291 static int el16_close(struct net_device *dev); 291 - static struct net_device_stats *el16_get_stats(struct net_device *dev); 292 292 static void el16_tx_timeout (struct net_device *dev); 293 293 294 294 static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad); ··· 453 455 dev->open = el16_open; 454 456 dev->stop = el16_close; 455 457 dev->hard_start_xmit = el16_send_packet; 456 - dev->get_stats = el16_get_stats; 457 458 dev->tx_timeout = el16_tx_timeout; 458 459 dev->watchdog_timeo = TX_TIMEOUT; 459 460 dev->ethtool_ops = &netdev_ethtool_ops; ··· 486 489 readw(shmem + iSCB_STATUS) & 0x8000 ? "IRQ conflict" : 487 490 "network cable problem"); 488 491 /* Try to restart the adaptor. */ 489 - if (lp->last_restart == lp->stats.tx_packets) { 492 + if (lp->last_restart == dev->stats.tx_packets) { 490 493 if (net_debug > 1) 491 494 printk ("Resetting board.\n"); 492 495 /* Completely reset the adaptor. */ ··· 498 501 printk ("Kicking board.\n"); 499 502 writew(0xf000 | CUC_START | RX_START, shmem + iSCB_CMD); 500 503 outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */ 501 - lp->last_restart = lp->stats.tx_packets; 504 + lp->last_restart = dev->stats.tx_packets; 502 505 } 503 506 dev->trans_start = jiffies; 504 507 netif_wake_queue (dev); ··· 517 520 518 521 spin_lock_irqsave (&lp->lock, flags); 519 522 520 - lp->stats.tx_bytes += length; 523 + dev->stats.tx_bytes += length; 521 524 /* Disable the 82586's input to the interrupt line. */ 522 525 outb (0x80, ioaddr + MISC_CTRL); 523 526 ··· 576 579 } 577 580 /* Tx unsuccessful or some interesting status bit set. */ 578 581 if (!(tx_status & 0x2000) || (tx_status & 0x0f3f)) { 579 - lp->stats.tx_errors++; 580 - if (tx_status & 0x0600) lp->stats.tx_carrier_errors++; 581 - if (tx_status & 0x0100) lp->stats.tx_fifo_errors++; 582 - if (!(tx_status & 0x0040)) lp->stats.tx_heartbeat_errors++; 583 - if (tx_status & 0x0020) lp->stats.tx_aborted_errors++; 584 - lp->stats.collisions += tx_status & 0xf; 582 + dev->stats.tx_errors++; 583 + if (tx_status & 0x0600) dev->stats.tx_carrier_errors++; 584 + if (tx_status & 0x0100) dev->stats.tx_fifo_errors++; 585 + if (!(tx_status & 0x0040)) dev->stats.tx_heartbeat_errors++; 586 + if (tx_status & 0x0020) dev->stats.tx_aborted_errors++; 587 + dev->stats.collisions += tx_status & 0xf; 585 588 } 586 - lp->stats.tx_packets++; 589 + dev->stats.tx_packets++; 587 590 if (net_debug > 5) 588 591 printk("Reaped %x, Tx status %04x.\n" , lp->tx_reap, tx_status); 589 592 lp->tx_reap += TX_BUF_SIZE; ··· 660 663 /* Update the statistics here. */ 661 664 662 665 return 0; 663 - } 664 - 665 - /* Get the current statistics. This may be called with the card open or 666 - closed. */ 667 - static struct net_device_stats *el16_get_stats(struct net_device *dev) 668 - { 669 - struct net_local *lp = netdev_priv(dev); 670 - 671 - /* ToDo: decide if there are any useful statistics from the SCB. */ 672 - 673 - return &lp->stats; 674 666 } 675 667 676 668 /* Initialize the Rx-block list. */ ··· 838 852 pkt_len); 839 853 } else if ((frame_status & 0x2000) == 0) { 840 854 /* Frame Rxed, but with error. */ 841 - lp->stats.rx_errors++; 842 - if (frame_status & 0x0800) lp->stats.rx_crc_errors++; 843 - if (frame_status & 0x0400) lp->stats.rx_frame_errors++; 844 - if (frame_status & 0x0200) lp->stats.rx_fifo_errors++; 845 - if (frame_status & 0x0100) lp->stats.rx_over_errors++; 846 - if (frame_status & 0x0080) lp->stats.rx_length_errors++; 855 + dev->stats.rx_errors++; 856 + if (frame_status & 0x0800) dev->stats.rx_crc_errors++; 857 + if (frame_status & 0x0400) dev->stats.rx_frame_errors++; 858 + if (frame_status & 0x0200) dev->stats.rx_fifo_errors++; 859 + if (frame_status & 0x0100) dev->stats.rx_over_errors++; 860 + if (frame_status & 0x0080) dev->stats.rx_length_errors++; 847 861 } else { 848 862 /* Malloc up new buffer. */ 849 863 struct sk_buff *skb; ··· 852 866 skb = dev_alloc_skb(pkt_len+2); 853 867 if (skb == NULL) { 854 868 printk("%s: Memory squeeze, dropping packet.\n", dev->name); 855 - lp->stats.rx_dropped++; 869 + dev->stats.rx_dropped++; 856 870 break; 857 871 } 858 872 ··· 864 878 skb->protocol=eth_type_trans(skb,dev); 865 879 netif_rx(skb); 866 880 dev->last_rx = jiffies; 867 - lp->stats.rx_packets++; 868 - lp->stats.rx_bytes += pkt_len; 881 + dev->stats.rx_packets++; 882 + dev->stats.rx_bytes += pkt_len; 869 883 } 870 884 871 885 /* Clear the status word and set End-of-List on the rx frame. */
+20 -27
drivers/net/7990.c
··· 305 305 306 306 /* We got an incomplete frame? */ 307 307 if ((bits & LE_R1_POK) != LE_R1_POK) { 308 - lp->stats.rx_over_errors++; 309 - lp->stats.rx_errors++; 308 + dev->stats.rx_over_errors++; 309 + dev->stats.rx_errors++; 310 310 continue; 311 311 } else if (bits & LE_R1_ERR) { 312 312 /* Count only the end frame as a rx error, 313 313 * not the beginning 314 314 */ 315 - if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++; 316 - if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++; 317 - if (bits & LE_R1_OFL) lp->stats.rx_over_errors++; 318 - if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++; 319 - if (bits & LE_R1_EOP) lp->stats.rx_errors++; 315 + if (bits & LE_R1_BUF) dev->stats.rx_fifo_errors++; 316 + if (bits & LE_R1_CRC) dev->stats.rx_crc_errors++; 317 + if (bits & LE_R1_OFL) dev->stats.rx_over_errors++; 318 + if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++; 319 + if (bits & LE_R1_EOP) dev->stats.rx_errors++; 320 320 } else { 321 321 len = (rd->mblength & 0xfff) - 4; 322 322 skb = dev_alloc_skb (len+2); ··· 324 324 if (skb == 0) { 325 325 printk ("%s: Memory squeeze, deferring packet.\n", 326 326 dev->name); 327 - lp->stats.rx_dropped++; 327 + dev->stats.rx_dropped++; 328 328 rd->mblength = 0; 329 329 rd->rmd1_bits = LE_R1_OWN; 330 330 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask; ··· 339 339 skb->protocol = eth_type_trans (skb, dev); 340 340 netif_rx (skb); 341 341 dev->last_rx = jiffies; 342 - lp->stats.rx_packets++; 343 - lp->stats.rx_bytes += len; 342 + dev->stats.rx_packets++; 343 + dev->stats.rx_bytes += len; 344 344 } 345 345 346 346 /* Return the packet to the pool */ ··· 377 377 if (td->tmd1_bits & LE_T1_ERR) { 378 378 status = td->misc; 379 379 380 - lp->stats.tx_errors++; 381 - if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++; 382 - if (status & LE_T3_LCOL) lp->stats.tx_window_errors++; 380 + dev->stats.tx_errors++; 381 + if (status & LE_T3_RTY) dev->stats.tx_aborted_errors++; 382 + if (status & LE_T3_LCOL) dev->stats.tx_window_errors++; 383 383 384 384 if (status & LE_T3_CLOS) { 385 - lp->stats.tx_carrier_errors++; 385 + dev->stats.tx_carrier_errors++; 386 386 if (lp->auto_select) { 387 387 lp->tpe = 1 - lp->tpe; 388 388 printk("%s: Carrier Lost, trying %s\n", ··· 400 400 /* buffer errors and underflows turn off the transmitter */ 401 401 /* Restart the adapter */ 402 402 if (status & (LE_T3_BUF|LE_T3_UFL)) { 403 - lp->stats.tx_fifo_errors++; 403 + dev->stats.tx_fifo_errors++; 404 404 405 405 printk ("%s: Tx: ERR_BUF|ERR_UFL, restarting\n", 406 406 dev->name); ··· 420 420 421 421 /* One collision before packet was sent. */ 422 422 if (td->tmd1_bits & LE_T1_EONE) 423 - lp->stats.collisions++; 423 + dev->stats.collisions++; 424 424 425 425 /* More than one collision, be optimistic. */ 426 426 if (td->tmd1_bits & LE_T1_EMORE) 427 - lp->stats.collisions += 2; 427 + dev->stats.collisions += 2; 428 428 429 - lp->stats.tx_packets++; 429 + dev->stats.tx_packets++; 430 430 } 431 431 432 432 j = (j + 1) & lp->tx_ring_mod_mask; ··· 471 471 472 472 /* Log misc errors. */ 473 473 if (csr0 & LE_C0_BABL) 474 - lp->stats.tx_errors++; /* Tx babble. */ 474 + dev->stats.tx_errors++; /* Tx babble. */ 475 475 if (csr0 & LE_C0_MISS) 476 - lp->stats.rx_errors++; /* Missed a Rx frame. */ 476 + dev->stats.rx_errors++; /* Missed a Rx frame. */ 477 477 if (csr0 & LE_C0_MERR) { 478 478 printk("%s: Bus master arbitration failure, status %4.4x.\n", 479 479 dev->name, csr0); ··· 587 587 spin_unlock_irqrestore (&lp->devlock, flags); 588 588 589 589 return 0; 590 - } 591 - 592 - struct net_device_stats *lance_get_stats (struct net_device *dev) 593 - { 594 - struct lance_private *lp = netdev_priv(dev); 595 - 596 - return &lp->stats; 597 590 } 598 591 599 592 /* taken from the depca driver via a2065.c */
-2
drivers/net/7990.h
··· 111 111 int lance_log_rx_bufs, lance_log_tx_bufs; 112 112 int rx_ring_mod_mask, tx_ring_mod_mask; 113 113 114 - struct net_device_stats stats; 115 114 int tpe; /* TPE is selected */ 116 115 int auto_select; /* cable-selection is by carrier */ 117 116 unsigned short busmaster_regval; ··· 245 246 extern int lance_open(struct net_device *dev); 246 247 extern int lance_close (struct net_device *dev); 247 248 extern int lance_start_xmit (struct sk_buff *skb, struct net_device *dev); 248 - extern struct net_device_stats *lance_get_stats (struct net_device *dev); 249 249 extern void lance_set_multicast (struct net_device *dev); 250 250 extern void lance_tx_timeout(struct net_device *dev); 251 251 #ifdef CONFIG_NET_POLL_CONTROLLER
+27 -38
drivers/net/82596.c
··· 326 326 struct i596_cmd *cmd_head; 327 327 int cmd_backlog; 328 328 unsigned long last_cmd; 329 - struct net_device_stats stats; 330 329 struct i596_rfd rfds[RX_RING_SIZE]; 331 330 struct i596_rbd rbds[RX_RING_SIZE]; 332 331 struct tx_cmd tx_cmds[TX_RING_SIZE]; ··· 359 360 static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); 360 361 static irqreturn_t i596_interrupt(int irq, void *dev_id); 361 362 static int i596_close(struct net_device *dev); 362 - static struct net_device_stats *i596_get_stats(struct net_device *dev); 363 363 static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd); 364 364 static void i596_tx_timeout (struct net_device *dev); 365 365 static void print_eth(unsigned char *buf, char *str); ··· 826 828 if (skb == NULL) { 827 829 /* XXX tulip.c can defer packets here!! */ 828 830 printk(KERN_WARNING "%s: i596_rx Memory squeeze, dropping packet.\n", dev->name); 829 - lp->stats.rx_dropped++; 831 + dev->stats.rx_dropped++; 830 832 } 831 833 else { 832 834 if (!rx_in_place) { ··· 842 844 #endif 843 845 netif_rx(skb); 844 846 dev->last_rx = jiffies; 845 - lp->stats.rx_packets++; 846 - lp->stats.rx_bytes+=pkt_len; 847 + dev->stats.rx_packets++; 848 + dev->stats.rx_bytes+=pkt_len; 847 849 } 848 850 } 849 851 else { 850 852 DEB(DEB_ERRORS, printk(KERN_DEBUG "%s: Error, rfd.stat = 0x%04x\n", 851 853 dev->name, rfd->stat)); 852 - lp->stats.rx_errors++; 854 + dev->stats.rx_errors++; 853 855 if ((rfd->stat) & 0x0001) 854 - lp->stats.collisions++; 856 + dev->stats.collisions++; 855 857 if ((rfd->stat) & 0x0080) 856 - lp->stats.rx_length_errors++; 858 + dev->stats.rx_length_errors++; 857 859 if ((rfd->stat) & 0x0100) 858 - lp->stats.rx_over_errors++; 860 + dev->stats.rx_over_errors++; 859 861 if ((rfd->stat) & 0x0200) 860 - lp->stats.rx_fifo_errors++; 862 + dev->stats.rx_fifo_errors++; 861 863 if ((rfd->stat) & 0x0400) 862 - lp->stats.rx_frame_errors++; 864 + dev->stats.rx_frame_errors++; 863 865 if ((rfd->stat) & 0x0800) 864 - lp->stats.rx_crc_errors++; 866 + dev->stats.rx_crc_errors++; 865 867 if ((rfd->stat) & 0x1000) 866 - lp->stats.rx_length_errors++; 868 + dev->stats.rx_length_errors++; 867 869 } 868 870 869 871 /* Clear the buffer descriptor count and EOF + F flags */ ··· 914 916 915 917 dev_kfree_skb(skb); 916 918 917 - lp->stats.tx_errors++; 918 - lp->stats.tx_aborted_errors++; 919 + dev->stats.tx_errors++; 920 + dev->stats.tx_aborted_errors++; 919 921 920 922 ptr->v_next = ptr->b_next = I596_NULL; 921 923 tx_cmd->cmd.command = 0; /* Mark as free */ ··· 1036 1038 DEB(DEB_ERRORS,printk(KERN_ERR "%s: transmit timed out, status resetting.\n", 1037 1039 dev->name)); 1038 1040 1039 - lp->stats.tx_errors++; 1041 + dev->stats.tx_errors++; 1040 1042 1041 1043 /* Try to restart the adaptor */ 1042 - if (lp->last_restart == lp->stats.tx_packets) { 1044 + if (lp->last_restart == dev->stats.tx_packets) { 1043 1045 DEB(DEB_ERRORS,printk(KERN_ERR "Resetting board.\n")); 1044 1046 /* Shutdown and restart */ 1045 1047 i596_reset (dev, lp, ioaddr); ··· 1048 1050 DEB(DEB_ERRORS,printk(KERN_ERR "Kicking board.\n")); 1049 1051 lp->scb.command = CUC_START | RX_START; 1050 1052 CA (dev); 1051 - lp->last_restart = lp->stats.tx_packets; 1053 + lp->last_restart = dev->stats.tx_packets; 1052 1054 } 1053 1055 1054 1056 dev->trans_start = jiffies; ··· 1080 1082 if (tx_cmd->cmd.command) { 1081 1083 printk(KERN_NOTICE "%s: xmit ring full, dropping packet.\n", 1082 1084 dev->name); 1083 - lp->stats.tx_dropped++; 1085 + dev->stats.tx_dropped++; 1084 1086 1085 1087 dev_kfree_skb(skb); 1086 1088 } else { ··· 1105 1107 DEB(DEB_TXADDR,print_eth(skb->data, "tx-queued")); 1106 1108 i596_add_cmd(dev, &tx_cmd->cmd); 1107 1109 1108 - lp->stats.tx_packets++; 1109 - lp->stats.tx_bytes += length; 1110 + dev->stats.tx_packets++; 1111 + dev->stats.tx_bytes += length; 1110 1112 } 1111 1113 1112 1114 netif_start_queue(dev); ··· 1235 1237 dev->open = i596_open; 1236 1238 dev->stop = i596_close; 1237 1239 dev->hard_start_xmit = i596_start_xmit; 1238 - dev->get_stats = i596_get_stats; 1239 1240 dev->set_multicast_list = set_multicast_list; 1240 1241 dev->tx_timeout = i596_tx_timeout; 1241 1242 dev->watchdog_timeo = TX_TIMEOUT; ··· 1340 1343 if ((ptr->status) & STAT_OK) { 1341 1344 DEB(DEB_TXADDR,print_eth(skb->data, "tx-done")); 1342 1345 } else { 1343 - lp->stats.tx_errors++; 1346 + dev->stats.tx_errors++; 1344 1347 if ((ptr->status) & 0x0020) 1345 - lp->stats.collisions++; 1348 + dev->stats.collisions++; 1346 1349 if (!((ptr->status) & 0x0040)) 1347 - lp->stats.tx_heartbeat_errors++; 1350 + dev->stats.tx_heartbeat_errors++; 1348 1351 if ((ptr->status) & 0x0400) 1349 - lp->stats.tx_carrier_errors++; 1352 + dev->stats.tx_carrier_errors++; 1350 1353 if ((ptr->status) & 0x0800) 1351 - lp->stats.collisions++; 1354 + dev->stats.collisions++; 1352 1355 if ((ptr->status) & 0x1000) 1353 - lp->stats.tx_aborted_errors++; 1356 + dev->stats.tx_aborted_errors++; 1354 1357 } 1355 1358 1356 1359 dev_kfree_skb_irq(skb); ··· 1405 1408 if (netif_running(dev)) { 1406 1409 DEB(DEB_ERRORS,printk(KERN_ERR "%s: i596 interrupt receive unit inactive, status 0x%x\n", dev->name, status)); 1407 1410 ack_cmd |= RX_START; 1408 - lp->stats.rx_errors++; 1409 - lp->stats.rx_fifo_errors++; 1411 + dev->stats.rx_errors++; 1412 + dev->stats.rx_fifo_errors++; 1410 1413 rebuild_rx_bufs(dev); 1411 1414 } 1412 1415 } ··· 1487 1490 remove_rx_bufs(dev); 1488 1491 1489 1492 return 0; 1490 - } 1491 - 1492 - static struct net_device_stats * 1493 - i596_get_stats(struct net_device *dev) 1494 - { 1495 - struct i596_private *lp = dev->priv; 1496 - 1497 - return &lp->stats; 1498 1493 } 1499 1494 1500 1495 /*
+21 -30
drivers/net/a2065.c
··· 119 119 int lance_log_rx_bufs, lance_log_tx_bufs; 120 120 int rx_ring_mod_mask, tx_ring_mod_mask; 121 121 122 - struct net_device_stats stats; 123 122 int tpe; /* cable-selection is TPE */ 124 123 int auto_select; /* cable-selection by carrier */ 125 124 unsigned short busmaster_regval; ··· 293 294 294 295 /* We got an incomplete frame? */ 295 296 if ((bits & LE_R1_POK) != LE_R1_POK) { 296 - lp->stats.rx_over_errors++; 297 - lp->stats.rx_errors++; 297 + dev->stats.rx_over_errors++; 298 + dev->stats.rx_errors++; 298 299 continue; 299 300 } else if (bits & LE_R1_ERR) { 300 301 /* Count only the end frame as a rx error, 301 302 * not the beginning 302 303 */ 303 - if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++; 304 - if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++; 305 - if (bits & LE_R1_OFL) lp->stats.rx_over_errors++; 306 - if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++; 307 - if (bits & LE_R1_EOP) lp->stats.rx_errors++; 304 + if (bits & LE_R1_BUF) dev->stats.rx_fifo_errors++; 305 + if (bits & LE_R1_CRC) dev->stats.rx_crc_errors++; 306 + if (bits & LE_R1_OFL) dev->stats.rx_over_errors++; 307 + if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++; 308 + if (bits & LE_R1_EOP) dev->stats.rx_errors++; 308 309 } else { 309 310 len = (rd->mblength & 0xfff) - 4; 310 311 skb = dev_alloc_skb (len+2); ··· 312 313 if (skb == 0) { 313 314 printk(KERN_WARNING "%s: Memory squeeze, " 314 315 "deferring packet.\n", dev->name); 315 - lp->stats.rx_dropped++; 316 + dev->stats.rx_dropped++; 316 317 rd->mblength = 0; 317 318 rd->rmd1_bits = LE_R1_OWN; 318 319 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask; ··· 327 328 skb->protocol = eth_type_trans (skb, dev); 328 329 netif_rx (skb); 329 330 dev->last_rx = jiffies; 330 - lp->stats.rx_packets++; 331 - lp->stats.rx_bytes += len; 331 + dev->stats.rx_packets++; 332 + dev->stats.rx_bytes += len; 332 333 } 333 334 334 335 /* Return the packet to the pool */ ··· 363 364 if (td->tmd1_bits & LE_T1_ERR) { 364 365 status = td->misc; 365 366 366 - lp->stats.tx_errors++; 367 - if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++; 368 - if (status & LE_T3_LCOL) lp->stats.tx_window_errors++; 367 + dev->stats.tx_errors++; 368 + if (status & LE_T3_RTY) dev->stats.tx_aborted_errors++; 369 + if (status & LE_T3_LCOL) dev->stats.tx_window_errors++; 369 370 370 371 if (status & LE_T3_CLOS) { 371 - lp->stats.tx_carrier_errors++; 372 + dev->stats.tx_carrier_errors++; 372 373 if (lp->auto_select) { 373 374 lp->tpe = 1 - lp->tpe; 374 375 printk(KERN_ERR "%s: Carrier Lost, " ··· 387 388 /* buffer errors and underflows turn off the transmitter */ 388 389 /* Restart the adapter */ 389 390 if (status & (LE_T3_BUF|LE_T3_UFL)) { 390 - lp->stats.tx_fifo_errors++; 391 + dev->stats.tx_fifo_errors++; 391 392 392 393 printk(KERN_ERR "%s: Tx: ERR_BUF|ERR_UFL, " 393 394 "restarting\n", dev->name); ··· 407 408 408 409 /* One collision before packet was sent. */ 409 410 if (td->tmd1_bits & LE_T1_EONE) 410 - lp->stats.collisions++; 411 + dev->stats.collisions++; 411 412 412 413 /* More than one collision, be optimistic. */ 413 414 if (td->tmd1_bits & LE_T1_EMORE) 414 - lp->stats.collisions += 2; 415 + dev->stats.collisions += 2; 415 416 416 - lp->stats.tx_packets++; 417 + dev->stats.tx_packets++; 417 418 } 418 419 419 420 j = (j + 1) & lp->tx_ring_mod_mask; ··· 458 459 459 460 /* Log misc errors. */ 460 461 if (csr0 & LE_C0_BABL) 461 - lp->stats.tx_errors++; /* Tx babble. */ 462 + dev->stats.tx_errors++; /* Tx babble. */ 462 463 if (csr0 & LE_C0_MISS) 463 - lp->stats.rx_errors++; /* Missed a Rx frame. */ 464 + dev->stats.rx_errors++; /* Missed a Rx frame. */ 464 465 if (csr0 & LE_C0_MERR) { 465 466 printk(KERN_ERR "%s: Bus master arbitration failure, status " 466 467 "%4.4x.\n", dev->name, csr0); ··· 605 606 /* Now, give the packet to the lance */ 606 607 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); 607 608 lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask; 608 - lp->stats.tx_bytes += skblen; 609 + dev->stats.tx_bytes += skblen; 609 610 610 611 if (TX_BUFFS_AVAIL <= 0) 611 612 netif_stop_queue(dev); ··· 618 619 local_irq_restore(flags); 619 620 620 621 return status; 621 - } 622 - 623 - static struct net_device_stats *lance_get_stats (struct net_device *dev) 624 - { 625 - struct lance_private *lp = netdev_priv(dev); 626 - 627 - return &lp->stats; 628 622 } 629 623 630 624 /* taken from the depca driver */ ··· 774 782 dev->hard_start_xmit = &lance_start_xmit; 775 783 dev->tx_timeout = &lance_tx_timeout; 776 784 dev->watchdog_timeo = 5*HZ; 777 - dev->get_stats = &lance_get_stats; 778 785 dev->set_multicast_list = &lance_set_multicast; 779 786 dev->dma = 0; 780 787
+12 -27
drivers/net/at1700.c
··· 109 109 110 110 /* Information that need to be kept for each board. */ 111 111 struct net_local { 112 - struct net_device_stats stats; 113 112 spinlock_t lock; 114 113 unsigned char mc_filter[8]; 115 114 uint jumpered:1; /* Set iff the board has jumper config. */ ··· 163 164 static irqreturn_t net_interrupt(int irq, void *dev_id); 164 165 static void net_rx(struct net_device *dev); 165 166 static int net_close(struct net_device *dev); 166 - static struct net_device_stats *net_get_stats(struct net_device *dev); 167 167 static void set_rx_mode(struct net_device *dev); 168 168 static void net_tx_timeout (struct net_device *dev); 169 169 ··· 454 456 dev->open = net_open; 455 457 dev->stop = net_close; 456 458 dev->hard_start_xmit = net_send_packet; 457 - dev->get_stats = net_get_stats; 458 459 dev->set_multicast_list = &set_rx_mode; 459 460 dev->tx_timeout = net_tx_timeout; 460 461 dev->watchdog_timeo = TX_TIMEOUT; ··· 568 571 dev->name, inw(ioaddr + TX_STATUS), inw(ioaddr + TX_INTR), inw(ioaddr + TX_MODE), 569 572 inw(ioaddr + CONFIG_0), inw(ioaddr + DATAPORT), inw(ioaddr + TX_START), 570 573 inw(ioaddr + MODE13 - 1), inw(ioaddr + RX_CTRL)); 571 - lp->stats.tx_errors++; 574 + dev->stats.tx_errors++; 572 575 /* ToDo: We should try to restart the adaptor... */ 573 576 outw(0xffff, ioaddr + MODE24); 574 577 outw (0xffff, ioaddr + TX_STATUS); ··· 688 691 printk("%s: 16 Collision occur during Txing.\n", dev->name); 689 692 /* Cancel sending a packet. */ 690 693 outb(0x03, ioaddr + COL16CNTL); 691 - lp->stats.collisions++; 694 + dev->stats.collisions++; 692 695 } 693 696 if (status & 0x82) { 694 - lp->stats.tx_packets++; 697 + dev->stats.tx_packets++; 695 698 /* The Tx queue has any packets and is not being 696 699 transferred a packet from the host, start 697 700 transmitting. */ ··· 716 719 static void 717 720 net_rx(struct net_device *dev) 718 721 { 719 - struct net_local *lp = netdev_priv(dev); 720 722 int ioaddr = dev->base_addr; 721 723 int boguscount = 5; 722 724 ··· 734 738 #endif 735 739 736 740 if ((status & 0xF0) != 0x20) { /* There was an error. */ 737 - lp->stats.rx_errors++; 738 - if (status & 0x08) lp->stats.rx_length_errors++; 739 - if (status & 0x04) lp->stats.rx_frame_errors++; 740 - if (status & 0x02) lp->stats.rx_crc_errors++; 741 - if (status & 0x01) lp->stats.rx_over_errors++; 741 + dev->stats.rx_errors++; 742 + if (status & 0x08) dev->stats.rx_length_errors++; 743 + if (status & 0x04) dev->stats.rx_frame_errors++; 744 + if (status & 0x02) dev->stats.rx_crc_errors++; 745 + if (status & 0x01) dev->stats.rx_over_errors++; 742 746 } else { 743 747 /* Malloc up new buffer. */ 744 748 struct sk_buff *skb; ··· 749 753 /* Prime the FIFO and then flush the packet. */ 750 754 inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT); 751 755 outb(0x05, ioaddr + RX_CTRL); 752 - lp->stats.rx_errors++; 756 + dev->stats.rx_errors++; 753 757 break; 754 758 } 755 759 skb = dev_alloc_skb(pkt_len+3); ··· 759 763 /* Prime the FIFO and then flush the packet. */ 760 764 inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT); 761 765 outb(0x05, ioaddr + RX_CTRL); 762 - lp->stats.rx_dropped++; 766 + dev->stats.rx_dropped++; 763 767 break; 764 768 } 765 769 skb_reserve(skb,2); ··· 768 772 skb->protocol=eth_type_trans(skb, dev); 769 773 netif_rx(skb); 770 774 dev->last_rx = jiffies; 771 - lp->stats.rx_packets++; 772 - lp->stats.rx_bytes += pkt_len; 775 + dev->stats.rx_packets++; 776 + dev->stats.rx_bytes += pkt_len; 773 777 } 774 778 if (--boguscount <= 0) 775 779 break; ··· 816 820 /* Power-down the chip. Green, green, green! */ 817 821 outb(0x00, ioaddr + CONFIG_1); 818 822 return 0; 819 - } 820 - 821 - /* Get the current statistics. 822 - This may be called with the card open or closed. 823 - There are no on-chip counters, so this function is trivial. 824 - */ 825 - static struct net_device_stats * 826 - net_get_stats(struct net_device *dev) 827 - { 828 - struct net_local *lp = netdev_priv(dev); 829 - return &lp->stats; 830 823 } 831 824 832 825 /*
+20 -38
drivers/net/atarilance.c
··· 224 224 int dirty_tx; /* Ring entries to be freed. */ 225 225 /* copy function */ 226 226 void *(*memcpy_f)( void *, const void *, size_t ); 227 - struct net_device_stats stats; 228 227 /* This must be long for set_bit() */ 229 228 long tx_full; 230 229 spinlock_t devlock; ··· 346 347 static irqreturn_t lance_interrupt( int irq, void *dev_id ); 347 348 static int lance_rx( struct net_device *dev ); 348 349 static int lance_close( struct net_device *dev ); 349 - static struct net_device_stats *lance_get_stats( struct net_device *dev ); 350 350 static void set_multicast_list( struct net_device *dev ); 351 351 static int lance_set_mac_address( struct net_device *dev, void *addr ); 352 352 static void lance_tx_timeout (struct net_device *dev); ··· 629 631 dev->open = &lance_open; 630 632 dev->hard_start_xmit = &lance_start_xmit; 631 633 dev->stop = &lance_close; 632 - dev->get_stats = &lance_get_stats; 633 634 dev->set_multicast_list = &set_multicast_list; 634 635 dev->set_mac_address = &lance_set_mac_address; 635 636 636 637 /* XXX MSch */ 637 638 dev->tx_timeout = lance_tx_timeout; 638 639 dev->watchdog_timeo = TX_TIMEOUT; 639 - 640 - 641 - #if 0 642 - dev->start = 0; 643 - #endif 644 - 645 - memset( &lp->stats, 0, sizeof(lp->stats) ); 646 640 647 641 return( 1 ); 648 642 } ··· 743 753 * little endian mode. 744 754 */ 745 755 REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0); 746 - lp->stats.tx_errors++; 756 + dev->stats.tx_errors++; 747 757 #ifndef final_version 748 758 { int i; 749 759 DPRINTK( 2, ( "Ring data: dirty_tx %d cur_tx %d%s cur_rx %d\n", ··· 831 841 head->misc = 0; 832 842 lp->memcpy_f( PKTBUF_ADDR(head), (void *)skb->data, skb->len ); 833 843 head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP; 834 - lp->stats.tx_bytes += skb->len; 844 + dev->stats.tx_bytes += skb->len; 835 845 dev_kfree_skb( skb ); 836 846 lp->cur_tx++; 837 847 while( lp->cur_tx >= TX_RING_SIZE && lp->dirty_tx >= TX_RING_SIZE ) { ··· 902 912 if (status & TMD1_ERR) { 903 913 /* There was an major error, log it. */ 904 914 int err_status = MEM->tx_head[entry].misc; 905 - lp->stats.tx_errors++; 906 - if (err_status & TMD3_RTRY) lp->stats.tx_aborted_errors++; 907 - if (err_status & TMD3_LCAR) lp->stats.tx_carrier_errors++; 908 - if (err_status & TMD3_LCOL) lp->stats.tx_window_errors++; 915 + dev->stats.tx_errors++; 916 + if (err_status & TMD3_RTRY) dev->stats.tx_aborted_errors++; 917 + if (err_status & TMD3_LCAR) dev->stats.tx_carrier_errors++; 918 + if (err_status & TMD3_LCOL) dev->stats.tx_window_errors++; 909 919 if (err_status & TMD3_UFLO) { 910 920 /* Ackk! On FIFO errors the Tx unit is turned off! */ 911 - lp->stats.tx_fifo_errors++; 921 + dev->stats.tx_fifo_errors++; 912 922 /* Remove this verbosity later! */ 913 923 DPRINTK( 1, ( "%s: Tx FIFO error! Status %04x\n", 914 924 dev->name, csr0 )); ··· 917 927 } 918 928 } else { 919 929 if (status & (TMD1_MORE | TMD1_ONE | TMD1_DEF)) 920 - lp->stats.collisions++; 921 - lp->stats.tx_packets++; 930 + dev->stats.collisions++; 931 + dev->stats.tx_packets++; 922 932 } 923 933 924 934 /* XXX MSch: free skb?? */ ··· 945 955 } 946 956 947 957 /* Log misc errors. */ 948 - if (csr0 & CSR0_BABL) lp->stats.tx_errors++; /* Tx babble. */ 949 - if (csr0 & CSR0_MISS) lp->stats.rx_errors++; /* Missed a Rx frame. */ 958 + if (csr0 & CSR0_BABL) dev->stats.tx_errors++; /* Tx babble. */ 959 + if (csr0 & CSR0_MISS) dev->stats.rx_errors++; /* Missed a Rx frame. */ 950 960 if (csr0 & CSR0_MERR) { 951 961 DPRINTK( 1, ( "%s: Bus master arbitration failure (?!?), " 952 962 "status %04x.\n", dev->name, csr0 )); ··· 987 997 buffers it's possible for a jabber packet to use two 988 998 buffers, with only the last correctly noting the error. */ 989 999 if (status & RMD1_ENP) /* Only count a general error at the */ 990 - lp->stats.rx_errors++; /* end of a packet.*/ 991 - if (status & RMD1_FRAM) lp->stats.rx_frame_errors++; 992 - if (status & RMD1_OFLO) lp->stats.rx_over_errors++; 993 - if (status & RMD1_CRC) lp->stats.rx_crc_errors++; 994 - if (status & RMD1_BUFF) lp->stats.rx_fifo_errors++; 1000 + dev->stats.rx_errors++; /* end of a packet.*/ 1001 + if (status & RMD1_FRAM) dev->stats.rx_frame_errors++; 1002 + if (status & RMD1_OFLO) dev->stats.rx_over_errors++; 1003 + if (status & RMD1_CRC) dev->stats.rx_crc_errors++; 1004 + if (status & RMD1_BUFF) dev->stats.rx_fifo_errors++; 995 1005 head->flag &= (RMD1_ENP|RMD1_STP); 996 1006 } else { 997 1007 /* Malloc up new buffer, compatible with net-3. */ ··· 1000 1010 1001 1011 if (pkt_len < 60) { 1002 1012 printk( "%s: Runt packet!\n", dev->name ); 1003 - lp->stats.rx_errors++; 1013 + dev->stats.rx_errors++; 1004 1014 } 1005 1015 else { 1006 1016 skb = dev_alloc_skb( pkt_len+2 ); ··· 1013 1023 break; 1014 1024 1015 1025 if (i > RX_RING_SIZE - 2) { 1016 - lp->stats.rx_dropped++; 1026 + dev->stats.rx_dropped++; 1017 1027 head->flag |= RMD1_OWN_CHIP; 1018 1028 lp->cur_rx++; 1019 1029 } ··· 1042 1052 skb->protocol = eth_type_trans( skb, dev ); 1043 1053 netif_rx( skb ); 1044 1054 dev->last_rx = jiffies; 1045 - lp->stats.rx_packets++; 1046 - lp->stats.rx_bytes += pkt_len; 1055 + dev->stats.rx_packets++; 1056 + dev->stats.rx_bytes += pkt_len; 1047 1057 } 1048 1058 } 1049 1059 ··· 1077 1087 DREG = CSR0_STOP; 1078 1088 1079 1089 return 0; 1080 - } 1081 - 1082 - 1083 - static struct net_device_stats *lance_get_stats( struct net_device *dev ) 1084 - 1085 - { struct lance_private *lp = (struct lance_private *)dev->priv; 1086 - 1087 - return &lp->stats; 1088 1090 } 1089 1091 1090 1092
+18 -31
drivers/net/atp.c
··· 171 171 struct net_local { 172 172 spinlock_t lock; 173 173 struct net_device *next_module; 174 - struct net_device_stats stats; 175 174 struct timer_list timer; /* Media selection timer. */ 176 175 long last_rx_time; /* Last Rx, in jiffies, to handle Rx hang. */ 177 176 int saved_tx_size; ··· 204 205 static void net_rx(struct net_device *dev); 205 206 static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode); 206 207 static int net_close(struct net_device *dev); 207 - static struct net_device_stats *net_get_stats(struct net_device *dev); 208 208 static void set_rx_mode_8002(struct net_device *dev); 209 209 static void set_rx_mode_8012(struct net_device *dev); 210 210 static void tx_timeout(struct net_device *dev); ··· 346 348 dev->open = net_open; 347 349 dev->stop = net_close; 348 350 dev->hard_start_xmit = atp_send_packet; 349 - dev->get_stats = net_get_stats; 350 351 dev->set_multicast_list = 351 352 lp->chip_type == RTL8002 ? &set_rx_mode_8002 : &set_rx_mode_8012; 352 353 dev->tx_timeout = tx_timeout; ··· 535 538 536 539 static void tx_timeout(struct net_device *dev) 537 540 { 538 - struct net_local *np = netdev_priv(dev); 539 541 long ioaddr = dev->base_addr; 540 542 541 543 printk(KERN_WARNING "%s: Transmit timed out, %s?\n", dev->name, 542 544 inb(ioaddr + PAR_CONTROL) & 0x10 ? "network cable problem" 543 545 : "IRQ conflict"); 544 - np->stats.tx_errors++; 546 + dev->stats.tx_errors++; 545 547 /* Try to restart the adapter. */ 546 548 hardware_init(dev); 547 549 dev->trans_start = jiffies; 548 550 netif_wake_queue(dev); 549 - np->stats.tx_errors++; 551 + dev->stats.tx_errors++; 550 552 } 551 553 552 554 static int atp_send_packet(struct sk_buff *skb, struct net_device *dev) ··· 625 629 /* We acknowledged the normal Rx interrupt, so if the interrupt 626 630 is still outstanding we must have a Rx error. */ 627 631 if (read_status & (CMR1_IRQ << 3)) { /* Overrun. */ 628 - lp->stats.rx_over_errors++; 632 + dev->stats.rx_over_errors++; 629 633 /* Set to no-accept mode long enough to remove a packet. */ 630 634 write_reg_high(ioaddr, CMR2, CMR2h_OFF); 631 635 net_rx(dev); ··· 645 649 and reinitialize the adapter. */ 646 650 write_reg(ioaddr, ISR, ISR_TxErr + ISR_TxOK); 647 651 if (status & (ISR_TxErr<<3)) { 648 - lp->stats.collisions++; 652 + dev->stats.collisions++; 649 653 if (++lp->re_tx > 15) { 650 - lp->stats.tx_aborted_errors++; 654 + dev->stats.tx_aborted_errors++; 651 655 hardware_init(dev); 652 656 break; 653 657 } ··· 656 660 write_reg(ioaddr, CMR1, CMR1_ReXmit + CMR1_Xmit); 657 661 } else { 658 662 /* Finish up the transmit. */ 659 - lp->stats.tx_packets++; 663 + dev->stats.tx_packets++; 660 664 lp->pac_cnt_in_tx_buf--; 661 665 if ( lp->saved_tx_size) { 662 666 trigger_send(ioaddr, lp->saved_tx_size); ··· 674 678 "%ld jiffies status %02x CMR1 %02x.\n", dev->name, 675 679 num_tx_since_rx, jiffies - dev->last_rx, status, 676 680 (read_nibble(ioaddr, CMR1) >> 3) & 15); 677 - lp->stats.rx_missed_errors++; 681 + dev->stats.rx_missed_errors++; 678 682 hardware_init(dev); 679 683 num_tx_since_rx = 0; 680 684 break; ··· 731 735 struct net_local *lp = netdev_priv(atp_timed_dev); 732 736 write_reg_byte(ioaddr, PAR0 + i, atp_timed_dev->dev_addr[i]); 733 737 if (i == 2) 734 - lp->stats.tx_errors++; 738 + dev->stats.tx_errors++; 735 739 else if (i == 3) 736 - lp->stats.tx_dropped++; 740 + dev->stats.tx_dropped++; 737 741 else if (i == 4) 738 - lp->stats.collisions++; 742 + dev->stats.collisions++; 739 743 else 740 - lp->stats.rx_errors++; 744 + dev->stats.rx_errors++; 741 745 } 742 746 #endif 743 747 } ··· 761 765 printk(KERN_DEBUG " rx_count %04x %04x %04x %04x..", rx_head.pad, 762 766 rx_head.rx_count, rx_head.rx_status, rx_head.cur_addr); 763 767 if ((rx_head.rx_status & 0x77) != 0x01) { 764 - lp->stats.rx_errors++; 765 - if (rx_head.rx_status & 0x0004) lp->stats.rx_frame_errors++; 766 - else if (rx_head.rx_status & 0x0002) lp->stats.rx_crc_errors++; 768 + dev->stats.rx_errors++; 769 + if (rx_head.rx_status & 0x0004) dev->stats.rx_frame_errors++; 770 + else if (rx_head.rx_status & 0x0002) dev->stats.rx_crc_errors++; 767 771 if (net_debug > 3) 768 772 printk(KERN_DEBUG "%s: Unknown ATP Rx error %04x.\n", 769 773 dev->name, rx_head.rx_status); 770 774 if (rx_head.rx_status & 0x0020) { 771 - lp->stats.rx_fifo_errors++; 775 + dev->stats.rx_fifo_errors++; 772 776 write_reg_high(ioaddr, CMR1, CMR1h_TxENABLE); 773 777 write_reg_high(ioaddr, CMR1, CMR1h_RxENABLE | CMR1h_TxENABLE); 774 778 } else if (rx_head.rx_status & 0x0050) ··· 783 787 if (skb == NULL) { 784 788 printk(KERN_ERR "%s: Memory squeeze, dropping packet.\n", 785 789 dev->name); 786 - lp->stats.rx_dropped++; 790 + dev->stats.rx_dropped++; 787 791 goto done; 788 792 } 789 793 ··· 792 796 skb->protocol = eth_type_trans(skb, dev); 793 797 netif_rx(skb); 794 798 dev->last_rx = jiffies; 795 - lp->stats.rx_packets++; 796 - lp->stats.rx_bytes += pkt_len; 799 + dev->stats.rx_packets++; 800 + dev->stats.rx_bytes += pkt_len; 797 801 } 798 802 done: 799 803 write_reg(ioaddr, CMR1, CMR1_NextPkt); ··· 843 847 /* Reset the ethernet hardware and activate the printer pass-through. */ 844 848 write_reg_high(ioaddr, CMR1, CMR1h_RESET | CMR1h_MUX); 845 849 return 0; 846 - } 847 - 848 - /* Get the current statistics. This may be called with the card open or 849 - closed. */ 850 - static struct net_device_stats * 851 - net_get_stats(struct net_device *dev) 852 - { 853 - struct net_local *lp = netdev_priv(dev); 854 - return &lp->stats; 855 850 } 856 851 857 852 /*
+4 -19
drivers/net/au1000_eth.c
··· 90 90 static irqreturn_t au1000_interrupt(int, void *); 91 91 static void au1000_tx_timeout(struct net_device *); 92 92 static void set_rx_mode(struct net_device *); 93 - static struct net_device_stats *au1000_get_stats(struct net_device *); 94 93 static int au1000_ioctl(struct net_device *, struct ifreq *, int); 95 94 static int mdio_read(struct net_device *, int, int); 96 95 static void mdio_write(struct net_device *, int, int, u16); ··· 771 772 dev->open = au1000_open; 772 773 dev->hard_start_xmit = au1000_tx; 773 774 dev->stop = au1000_close; 774 - dev->get_stats = au1000_get_stats; 775 775 dev->set_multicast_list = &set_rx_mode; 776 776 dev->do_ioctl = &au1000_ioctl; 777 777 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); ··· 1036 1038 static void update_tx_stats(struct net_device *dev, u32 status) 1037 1039 { 1038 1040 struct au1000_private *aup = (struct au1000_private *) dev->priv; 1039 - struct net_device_stats *ps = &aup->stats; 1041 + struct net_device_stats *ps = &dev->stats; 1040 1042 1041 1043 if (status & TX_FRAME_ABORTED) { 1042 1044 if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) { ··· 1092 1094 static int au1000_tx(struct sk_buff *skb, struct net_device *dev) 1093 1095 { 1094 1096 struct au1000_private *aup = (struct au1000_private *) dev->priv; 1095 - struct net_device_stats *ps = &aup->stats; 1097 + struct net_device_stats *ps = &dev->stats; 1096 1098 volatile tx_dma_t *ptxd; 1097 1099 u32 buff_stat; 1098 1100 db_dest_t *pDB; ··· 1146 1148 static inline void update_rx_stats(struct net_device *dev, u32 status) 1147 1149 { 1148 1150 struct au1000_private *aup = (struct au1000_private *) dev->priv; 1149 - struct net_device_stats *ps = &aup->stats; 1151 + struct net_device_stats *ps = &dev->stats; 1150 1152 1151 1153 ps->rx_packets++; 1152 1154 if (status & RX_MCAST_FRAME) ··· 1199 1201 printk(KERN_ERR 1200 1202 "%s: Memory squeeze, dropping packet.\n", 1201 1203 dev->name); 1202 - aup->stats.rx_dropped++; 1204 + dev->stats.rx_dropped++; 1203 1205 continue; 1204 1206 } 1205 1207 skb_reserve(skb, 2); /* 16 byte IP header align */ ··· 1320 1322 if (!aup->phy_dev) return -EINVAL; // PHY not controllable 1321 1323 1322 1324 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd); 1323 - } 1324 - 1325 - static struct net_device_stats *au1000_get_stats(struct net_device *dev) 1326 - { 1327 - struct au1000_private *aup = (struct au1000_private *) dev->priv; 1328 - 1329 - if (au1000_debug > 4) 1330 - printk("%s: au1000_get_stats: dev=%p\n", dev->name, dev); 1331 - 1332 - if (netif_device_present(dev)) { 1333 - return &aup->stats; 1334 - } 1335 - return 0; 1336 1325 } 1337 1326 1338 1327 module_init(au1000_init_module);
-1
drivers/net/au1000_eth.h
··· 115 115 u32 vaddr; /* virtual address of rx/tx buffers */ 116 116 dma_addr_t dma_addr; /* dma address of rx/tx buffers */ 117 117 118 - struct net_device_stats stats; 119 118 spinlock_t lock; /* Serialise access to device */ 120 119 };
+5 -20
drivers/net/bfin_mac.c
··· 579 579 adjust_tx_list(); 580 580 current_tx_ptr = current_tx_ptr->next; 581 581 dev->trans_start = jiffies; 582 - lp->stats.tx_packets++; 583 - lp->stats.tx_bytes += (skb->len); 582 + dev->stats.tx_packets++; 583 + dev->stats.tx_bytes += (skb->len); 584 584 return 0; 585 585 } 586 586 ··· 596 596 if (!new_skb) { 597 597 printk(KERN_NOTICE DRV_NAME 598 598 ": rx: low on mem - packet dropped\n"); 599 - lp->stats.rx_dropped++; 599 + dev->stats.rx_dropped++; 600 600 goto out; 601 601 } 602 602 /* reserve 2 bytes for RXDWA padding */ ··· 618 618 #endif 619 619 620 620 netif_rx(skb); 621 - lp->stats.rx_packets++; 622 - lp->stats.rx_bytes += len; 621 + dev->stats.rx_packets++; 622 + dev->stats.rx_bytes += len; 623 623 current_rx_ptr->status.status_word = 0x00000000; 624 624 current_rx_ptr = current_rx_ptr->next; 625 625 ··· 730 730 /* We can accept TX packets again */ 731 731 dev->trans_start = jiffies; 732 732 netif_wake_queue(dev); 733 - } 734 - 735 - /* 736 - * Get the current statistics. 737 - * This may be called with the card open or closed. 738 - */ 739 - static struct net_device_stats *bf537mac_query_statistics(struct net_device 740 - *dev) 741 - { 742 - struct bf537mac_local *lp = netdev_priv(dev); 743 - 744 - pr_debug("%s: %s\n", dev->name, __FUNCTION__); 745 - 746 - return &lp->stats; 747 733 } 748 734 749 735 /* ··· 877 891 dev->stop = bf537mac_close; 878 892 dev->hard_start_xmit = bf537mac_hard_start_xmit; 879 893 dev->tx_timeout = bf537mac_timeout; 880 - dev->get_stats = bf537mac_query_statistics; 881 894 dev->set_multicast_list = bf537mac_set_multicast_list; 882 895 #ifdef CONFIG_NET_POLL_CONTROLLER 883 896 dev->poll_controller = bf537mac_poll;
-2
drivers/net/bfin_mac.h
··· 104 104 * can find out semi-useless statistics of how well the card is 105 105 * performing 106 106 */ 107 - struct net_device_stats stats; 108 - 109 107 int version; 110 108 111 109 int FlowEnabled; /* record if data flow is active */
+18 -28
drivers/net/bmac.c
··· 75 75 int tx_fill; 76 76 int tx_empty; 77 77 unsigned char tx_fullup; 78 - struct net_device_stats stats; 79 78 struct timer_list tx_timeout; 80 79 int timeout_active; 81 80 int sleeping; ··· 144 145 static int bmac_open(struct net_device *dev); 145 146 static int bmac_close(struct net_device *dev); 146 147 static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev); 147 - static struct net_device_stats *bmac_stats(struct net_device *dev); 148 148 static void bmac_set_multicast(struct net_device *dev); 149 149 static void bmac_reset_and_enable(struct net_device *dev); 150 150 static void bmac_start_chip(struct net_device *dev); ··· 666 668 bp->tx_bufs[bp->tx_fill] = skb; 667 669 bp->tx_fill = i; 668 670 669 - bp->stats.tx_bytes += skb->len; 671 + dev->stats.tx_bytes += skb->len; 670 672 671 673 dbdma_continue(td); 672 674 ··· 705 707 nb = RX_BUFLEN - residual - 2; 706 708 if (nb < (ETHERMINPACKET - ETHERCRC)) { 707 709 skb = NULL; 708 - bp->stats.rx_length_errors++; 709 - bp->stats.rx_errors++; 710 + dev->stats.rx_length_errors++; 711 + dev->stats.rx_errors++; 710 712 } else { 711 713 skb = bp->rx_bufs[i]; 712 714 bp->rx_bufs[i] = NULL; ··· 717 719 skb->protocol = eth_type_trans(skb, dev); 718 720 netif_rx(skb); 719 721 dev->last_rx = jiffies; 720 - ++bp->stats.rx_packets; 721 - bp->stats.rx_bytes += nb; 722 + ++dev->stats.rx_packets; 723 + dev->stats.rx_bytes += nb; 722 724 } else { 723 - ++bp->stats.rx_dropped; 725 + ++dev->stats.rx_dropped; 724 726 } 725 727 dev->last_rx = jiffies; 726 728 if ((skb = bp->rx_bufs[i]) == NULL) { ··· 783 785 } 784 786 785 787 if (bp->tx_bufs[bp->tx_empty]) { 786 - ++bp->stats.tx_packets; 788 + ++dev->stats.tx_packets; 787 789 dev_kfree_skb_irq(bp->tx_bufs[bp->tx_empty]); 788 790 } 789 791 bp->tx_bufs[bp->tx_empty] = NULL; ··· 803 805 804 806 bmac_start(dev); 805 807 return IRQ_HANDLED; 806 - } 807 - 808 - static struct net_device_stats *bmac_stats(struct net_device *dev) 809 - { 810 - struct bmac_data *p = netdev_priv(dev); 811 - 812 - return &p->stats; 813 808 } 814 809 815 810 #ifndef SUNHME_MULTICAST ··· 1071 1080 } 1072 1081 /* XXDEBUG(("bmac_misc_intr, status=%#08x\n", status)); */ 1073 1082 /* bmac_txdma_intr_inner(irq, dev_id); */ 1074 - /* if (status & FrameReceived) bp->stats.rx_dropped++; */ 1075 - if (status & RxErrorMask) bp->stats.rx_errors++; 1076 - if (status & RxCRCCntExp) bp->stats.rx_crc_errors++; 1077 - if (status & RxLenCntExp) bp->stats.rx_length_errors++; 1078 - if (status & RxOverFlow) bp->stats.rx_over_errors++; 1079 - if (status & RxAlignCntExp) bp->stats.rx_frame_errors++; 1083 + /* if (status & FrameReceived) dev->stats.rx_dropped++; */ 1084 + if (status & RxErrorMask) dev->stats.rx_errors++; 1085 + if (status & RxCRCCntExp) dev->stats.rx_crc_errors++; 1086 + if (status & RxLenCntExp) dev->stats.rx_length_errors++; 1087 + if (status & RxOverFlow) dev->stats.rx_over_errors++; 1088 + if (status & RxAlignCntExp) dev->stats.rx_frame_errors++; 1080 1089 1081 - /* if (status & FrameSent) bp->stats.tx_dropped++; */ 1082 - if (status & TxErrorMask) bp->stats.tx_errors++; 1083 - if (status & TxUnderrun) bp->stats.tx_fifo_errors++; 1084 - if (status & TxNormalCollExp) bp->stats.collisions++; 1090 + /* if (status & FrameSent) dev->stats.tx_dropped++; */ 1091 + if (status & TxErrorMask) dev->stats.tx_errors++; 1092 + if (status & TxUnderrun) dev->stats.tx_fifo_errors++; 1093 + if (status & TxNormalCollExp) dev->stats.collisions++; 1085 1094 return IRQ_HANDLED; 1086 1095 } 1087 1096 ··· 1315 1324 dev->stop = bmac_close; 1316 1325 dev->ethtool_ops = &bmac_ethtool_ops; 1317 1326 dev->hard_start_xmit = bmac_output; 1318 - dev->get_stats = bmac_stats; 1319 1327 dev->set_multicast_list = bmac_set_multicast; 1320 1328 dev->set_mac_address = bmac_set_address; 1321 1329 ··· 1532 1542 XXDEBUG((KERN_DEBUG "bmac: tx empty=%d fill=%d fullup=%d\n", 1533 1543 bp->tx_empty, bp->tx_fill, bp->tx_fullup)); 1534 1544 i = bp->tx_empty; 1535 - ++bp->stats.tx_errors; 1545 + ++dev->stats.tx_errors; 1536 1546 if (i != bp->tx_fill) { 1537 1547 dev_kfree_skb(bp->tx_bufs[i]); 1538 1548 bp->tx_bufs[i] = NULL;
+4 -11
drivers/net/de600.c
··· 154 154 return 0; 155 155 } 156 156 157 - static struct net_device_stats *get_stats(struct net_device *dev) 158 - { 159 - return (struct net_device_stats *)(dev->priv); 160 - } 161 - 162 157 static inline void trigger_interrupt(struct net_device *dev) 163 158 { 164 159 de600_put_command(FLIP_IRQ); ··· 303 308 if (!(irq_status & TX_FAILED16)) { 304 309 tx_fifo_out = (tx_fifo_out + 1) % TX_PAGES; 305 310 ++free_tx_pages; 306 - ((struct net_device_stats *)(dev->priv))->tx_packets++; 311 + dev->stats.tx_packets++; 307 312 netif_wake_queue(dev); 308 313 } 309 314 ··· 370 375 371 376 /* update stats */ 372 377 dev->last_rx = jiffies; 373 - ((struct net_device_stats *)(dev->priv))->rx_packets++; /* count all receives */ 374 - ((struct net_device_stats *)(dev->priv))->rx_bytes += size; /* count all received bytes */ 378 + dev->stats.rx_packets++; /* count all receives */ 379 + dev->stats.rx_bytes += size; /* count all received bytes */ 375 380 376 381 /* 377 382 * If any worth-while packets have been received, netif_rx() ··· 385 390 struct net_device *dev; 386 391 int err; 387 392 388 - dev = alloc_etherdev(sizeof(struct net_device_stats)); 393 + dev = alloc_etherdev(0); 389 394 if (!dev) 390 395 return ERR_PTR(-ENOMEM); 391 396 ··· 442 447 for (i = 1; i < ETH_ALEN; i++) 443 448 printk(":%02X",dev->dev_addr[i]); 444 449 printk("\n"); 445 - 446 - dev->get_stats = get_stats; 447 450 448 451 dev->open = de600_open; 449 452 dev->stop = de600_close;
-1
drivers/net/de600.h
··· 121 121 /* Put in the device structure. */ 122 122 static int de600_open(struct net_device *dev); 123 123 static int de600_close(struct net_device *dev); 124 - static struct net_device_stats *get_stats(struct net_device *dev); 125 124 static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev); 126 125 127 126 /* Dispatch from interrupts. */
+7 -19
drivers/net/de620.c
··· 216 216 /* Put in the device structure. */ 217 217 static int de620_open(struct net_device *); 218 218 static int de620_close(struct net_device *); 219 - static struct net_device_stats *get_stats(struct net_device *); 220 219 static void de620_set_multicast_list(struct net_device *); 221 220 static int de620_start_xmit(struct sk_buff *, struct net_device *); 222 221 ··· 479 480 480 481 /********************************************* 481 482 * 482 - * Return current statistics 483 - * 484 - */ 485 - static struct net_device_stats *get_stats(struct net_device *dev) 486 - { 487 - return (struct net_device_stats *)(dev->priv); 488 - } 489 - 490 - /********************************************* 491 - * 492 483 * Set or clear the multicast filter for this adaptor. 493 484 * (no real multicast implemented for the DE-620, but she can be promiscuous...) 494 485 * ··· 568 579 if(!(using_txbuf == (TXBF0 | TXBF1))) 569 580 netif_wake_queue(dev); 570 581 571 - ((struct net_device_stats *)(dev->priv))->tx_packets++; 582 + dev->stats.tx_packets++; 572 583 spin_unlock_irqrestore(&de620_lock, flags); 573 584 dev_kfree_skb (skb); 574 585 return 0; ··· 649 660 /* You win some, you lose some. And sometimes plenty... */ 650 661 adapter_init(dev); 651 662 netif_wake_queue(dev); 652 - ((struct net_device_stats *)(dev->priv))->rx_over_errors++; 663 + dev->stats.rx_over_errors++; 653 664 return 0; 654 665 } 655 666 ··· 669 680 next_rx_page = header_buf.Rx_NextPage; /* at least a try... */ 670 681 de620_send_command(dev, W_DUMMY); 671 682 de620_set_register(dev, W_NPRF, next_rx_page); 672 - ((struct net_device_stats *)(dev->priv))->rx_over_errors++; 683 + dev->stats.rx_over_errors++; 673 684 return 0; 674 685 } 675 686 next_rx_page = pagelink; ··· 682 693 skb = dev_alloc_skb(size+2); 683 694 if (skb == NULL) { /* Yeah, but no place to put it... */ 684 695 printk(KERN_WARNING "%s: Couldn't allocate a sk_buff of size %d.\n", dev->name, size); 685 - ((struct net_device_stats *)(dev->priv))->rx_dropped++; 696 + dev->stats.rx_dropped++; 686 697 } 687 698 else { /* Yep! Go get it! */ 688 699 skb_reserve(skb,2); /* Align */ ··· 695 706 netif_rx(skb); /* deliver it "upstairs" */ 696 707 dev->last_rx = jiffies; 697 708 /* count all receives */ 698 - ((struct net_device_stats *)(dev->priv))->rx_packets++; 699 - ((struct net_device_stats *)(dev->priv))->rx_bytes += size; 709 + dev->stats.rx_packets++; 710 + dev->stats.rx_bytes += size; 700 711 } 701 712 } 702 713 ··· 808 819 int err = -ENOMEM; 809 820 int i; 810 821 811 - dev = alloc_etherdev(sizeof(struct net_device_stats)); 822 + dev = alloc_etherdev(0); 812 823 if (!dev) 813 824 goto out; 814 825 ··· 868 879 else 869 880 printk(" UTP)\n"); 870 881 871 - dev->get_stats = get_stats; 872 882 dev->open = de620_open; 873 883 dev->stop = de620_close; 874 884 dev->hard_start_xmit = de620_start_xmit;
+21 -31
drivers/net/declance.c
··· 258 258 int rx_new, tx_new; 259 259 int rx_old, tx_old; 260 260 261 - struct net_device_stats stats; 262 - 263 261 unsigned short busmaster_regval; 264 262 265 263 struct timer_list multicast_timer; ··· 581 583 582 584 /* We got an incomplete frame? */ 583 585 if ((bits & LE_R1_POK) != LE_R1_POK) { 584 - lp->stats.rx_over_errors++; 585 - lp->stats.rx_errors++; 586 + dev->stats.rx_over_errors++; 587 + dev->stats.rx_errors++; 586 588 } else if (bits & LE_R1_ERR) { 587 589 /* Count only the end frame as a rx error, 588 590 * not the beginning 589 591 */ 590 592 if (bits & LE_R1_BUF) 591 - lp->stats.rx_fifo_errors++; 593 + dev->stats.rx_fifo_errors++; 592 594 if (bits & LE_R1_CRC) 593 - lp->stats.rx_crc_errors++; 595 + dev->stats.rx_crc_errors++; 594 596 if (bits & LE_R1_OFL) 595 - lp->stats.rx_over_errors++; 597 + dev->stats.rx_over_errors++; 596 598 if (bits & LE_R1_FRA) 597 - lp->stats.rx_frame_errors++; 599 + dev->stats.rx_frame_errors++; 598 600 if (bits & LE_R1_EOP) 599 - lp->stats.rx_errors++; 601 + dev->stats.rx_errors++; 600 602 } else { 601 603 len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4; 602 604 skb = dev_alloc_skb(len + 2); ··· 604 606 if (skb == 0) { 605 607 printk("%s: Memory squeeze, deferring packet.\n", 606 608 dev->name); 607 - lp->stats.rx_dropped++; 609 + dev->stats.rx_dropped++; 608 610 *rds_ptr(rd, mblength, lp->type) = 0; 609 611 *rds_ptr(rd, rmd1, lp->type) = 610 612 ((lp->rx_buf_ptr_lnc[entry] >> 16) & ··· 612 614 lp->rx_new = (entry + 1) & RX_RING_MOD_MASK; 613 615 return 0; 614 616 } 615 - lp->stats.rx_bytes += len; 617 + dev->stats.rx_bytes += len; 616 618 617 619 skb_reserve(skb, 2); /* 16 byte align */ 618 620 skb_put(skb, len); /* make room */ ··· 623 625 skb->protocol = eth_type_trans(skb, dev); 624 626 netif_rx(skb); 625 627 dev->last_rx = jiffies; 626 - lp->stats.rx_packets++; 628 + dev->stats.rx_packets++; 627 629 } 628 630 629 631 /* Return the packet to the pool */ ··· 658 660 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_ERR) { 659 661 status = *tds_ptr(td, misc, lp->type); 660 662 661 - lp->stats.tx_errors++; 663 + dev->stats.tx_errors++; 662 664 if (status & LE_T3_RTY) 663 - lp->stats.tx_aborted_errors++; 665 + dev->stats.tx_aborted_errors++; 664 666 if (status & LE_T3_LCOL) 665 - lp->stats.tx_window_errors++; 667 + dev->stats.tx_window_errors++; 666 668 667 669 if (status & LE_T3_CLOS) { 668 - lp->stats.tx_carrier_errors++; 670 + dev->stats.tx_carrier_errors++; 669 671 printk("%s: Carrier Lost\n", dev->name); 670 672 /* Stop the lance */ 671 673 writereg(&ll->rap, LE_CSR0); ··· 679 681 * transmitter, restart the adapter. 680 682 */ 681 683 if (status & (LE_T3_BUF | LE_T3_UFL)) { 682 - lp->stats.tx_fifo_errors++; 684 + dev->stats.tx_fifo_errors++; 683 685 684 686 printk("%s: Tx: ERR_BUF|ERR_UFL, restarting\n", 685 687 dev->name); ··· 700 702 701 703 /* One collision before packet was sent. */ 702 704 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EONE) 703 - lp->stats.collisions++; 705 + dev->stats.collisions++; 704 706 705 707 /* More than one collision, be optimistic. */ 706 708 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EMORE) 707 - lp->stats.collisions += 2; 709 + dev->stats.collisions += 2; 708 710 709 - lp->stats.tx_packets++; 711 + dev->stats.tx_packets++; 710 712 } 711 713 j = (j + 1) & TX_RING_MOD_MASK; 712 714 } ··· 752 754 lance_tx(dev); 753 755 754 756 if (csr0 & LE_C0_BABL) 755 - lp->stats.tx_errors++; 757 + dev->stats.tx_errors++; 756 758 757 759 if (csr0 & LE_C0_MISS) 758 - lp->stats.rx_errors++; 760 + dev->stats.rx_errors++; 759 761 760 762 if (csr0 & LE_C0_MERR) { 761 763 printk("%s: Memory error, status %04x\n", dev->name, csr0); ··· 910 912 len = ETH_ZLEN; 911 913 } 912 914 913 - lp->stats.tx_bytes += len; 915 + dev->stats.tx_bytes += len; 914 916 915 917 entry = lp->tx_new; 916 918 *lib_ptr(ib, btx_ring[entry].length, lp->type) = (-len); ··· 934 936 dev_kfree_skb(skb); 935 937 936 938 return 0; 937 - } 938 - 939 - static struct net_device_stats *lance_get_stats(struct net_device *dev) 940 - { 941 - struct lance_private *lp = netdev_priv(dev); 942 - 943 - return &lp->stats; 944 939 } 945 940 946 941 static void lance_load_multicast(struct net_device *dev) ··· 1235 1244 dev->hard_start_xmit = &lance_start_xmit; 1236 1245 dev->tx_timeout = &lance_tx_timeout; 1237 1246 dev->watchdog_timeo = 5*HZ; 1238 - dev->get_stats = &lance_get_stats; 1239 1247 dev->set_multicast_list = &lance_set_multicast; 1240 1248 1241 1249 /* lp->ll is the location of the registers for lance card */
+15 -27
drivers/net/depca.c
··· 485 485 /* Kernel-only (not device) fields */ 486 486 int rx_new, tx_new; /* The next free ring entry */ 487 487 int rx_old, tx_old; /* The ring entries to be free()ed. */ 488 - struct net_device_stats stats; 489 488 spinlock_t lock; 490 489 struct { /* Private stats counters */ 491 490 u32 bins[DEPCA_PKT_STAT_SZ]; ··· 521 522 static int depca_close(struct net_device *dev); 522 523 static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 523 524 static void depca_tx_timeout(struct net_device *dev); 524 - static struct net_device_stats *depca_get_stats(struct net_device *dev); 525 525 static void set_multicast_list(struct net_device *dev); 526 526 527 527 /* ··· 799 801 dev->open = &depca_open; 800 802 dev->hard_start_xmit = &depca_start_xmit; 801 803 dev->stop = &depca_close; 802 - dev->get_stats = &depca_get_stats; 803 804 dev->set_multicast_list = &set_multicast_list; 804 805 dev->do_ioctl = &depca_ioctl; 805 806 dev->tx_timeout = depca_tx_timeout; ··· 1023 1026 } 1024 1027 if (status & R_ENP) { /* Valid frame status */ 1025 1028 if (status & R_ERR) { /* There was an error. */ 1026 - lp->stats.rx_errors++; /* Update the error stats. */ 1029 + dev->stats.rx_errors++; /* Update the error stats. */ 1027 1030 if (status & R_FRAM) 1028 - lp->stats.rx_frame_errors++; 1031 + dev->stats.rx_frame_errors++; 1029 1032 if (status & R_OFLO) 1030 - lp->stats.rx_over_errors++; 1033 + dev->stats.rx_over_errors++; 1031 1034 if (status & R_CRC) 1032 - lp->stats.rx_crc_errors++; 1035 + dev->stats.rx_crc_errors++; 1033 1036 if (status & R_BUFF) 1034 - lp->stats.rx_fifo_errors++; 1037 + dev->stats.rx_fifo_errors++; 1035 1038 } else { 1036 1039 short len, pkt_len = readw(&lp->rx_ring[entry].msg_length) - 4; 1037 1040 struct sk_buff *skb; ··· 1060 1063 ** Update stats 1061 1064 */ 1062 1065 dev->last_rx = jiffies; 1063 - lp->stats.rx_packets++; 1064 - lp->stats.rx_bytes += pkt_len; 1066 + dev->stats.rx_packets++; 1067 + dev->stats.rx_bytes += pkt_len; 1065 1068 for (i = 1; i < DEPCA_PKT_STAT_SZ - 1; i++) { 1066 1069 if (pkt_len < (i * DEPCA_PKT_BIN_SZ)) { 1067 1070 lp->pktStats.bins[i]++; ··· 1084 1087 } 1085 1088 } else { 1086 1089 printk("%s: Memory squeeze, deferring packet.\n", dev->name); 1087 - lp->stats.rx_dropped++; /* Really, deferred. */ 1090 + dev->stats.rx_dropped++; /* Really, deferred. */ 1088 1091 break; 1089 1092 } 1090 1093 } ··· 1122 1125 break; 1123 1126 } else if (status & T_ERR) { /* An error occurred. */ 1124 1127 status = readl(&lp->tx_ring[entry].misc); 1125 - lp->stats.tx_errors++; 1128 + dev->stats.tx_errors++; 1126 1129 if (status & TMD3_RTRY) 1127 - lp->stats.tx_aborted_errors++; 1130 + dev->stats.tx_aborted_errors++; 1128 1131 if (status & TMD3_LCAR) 1129 - lp->stats.tx_carrier_errors++; 1132 + dev->stats.tx_carrier_errors++; 1130 1133 if (status & TMD3_LCOL) 1131 - lp->stats.tx_window_errors++; 1134 + dev->stats.tx_window_errors++; 1132 1135 if (status & TMD3_UFLO) 1133 - lp->stats.tx_fifo_errors++; 1136 + dev->stats.tx_fifo_errors++; 1134 1137 if (status & (TMD3_BUFF | TMD3_UFLO)) { 1135 1138 /* Trigger an immediate send demand. */ 1136 1139 outw(CSR0, DEPCA_ADDR); 1137 1140 outw(INEA | TDMD, DEPCA_DATA); 1138 1141 } 1139 1142 } else if (status & (T_MORE | T_ONE)) { 1140 - lp->stats.collisions++; 1143 + dev->stats.collisions++; 1141 1144 } else { 1142 - lp->stats.tx_packets++; 1145 + dev->stats.tx_packets++; 1143 1146 } 1144 1147 1145 1148 /* Update all the pointers */ ··· 1229 1232 } 1230 1233 1231 1234 return status; 1232 - } 1233 - 1234 - static struct net_device_stats *depca_get_stats(struct net_device *dev) 1235 - { 1236 - struct depca_private *lp = (struct depca_private *) dev->priv; 1237 - 1238 - /* Null body since there is no framing error counter */ 1239 - 1240 - return &lp->stats; 1241 1235 } 1242 1236 1243 1237 /*
+4 -20
drivers/net/dgrs.c
··· 194 194 typedef struct 195 195 { 196 196 /* 197 - * Stuff for generic ethercard I/F 198 - */ 199 - struct net_device_stats stats; 200 - 201 - /* 202 197 * DGRS specific data 203 198 */ 204 199 char *vmem; ··· 494 499 if ((skb = dev_alloc_skb(len+5)) == NULL) 495 500 { 496 501 printk("%s: dev_alloc_skb failed for rcv buffer\n", devN->name); 497 - ++privN->stats.rx_dropped; 502 + ++dev0->stats.rx_dropped; 498 503 /* discarding the frame */ 499 504 goto out; 500 505 } ··· 662 667 skb->protocol = eth_type_trans(skb, devN); 663 668 netif_rx(skb); 664 669 devN->last_rx = jiffies; 665 - ++privN->stats.rx_packets; 666 - privN->stats.rx_bytes += len; 670 + ++devN->stats.rx_packets; 671 + devN->stats.rx_bytes += len; 667 672 668 673 out: 669 674 cbp->xmit.status = I596_CB_STATUS_C | I596_CB_STATUS_OK; ··· 771 776 priv0->rfdp->status = I596_RFD_C | I596_RFD_OK; 772 777 priv0->rfdp = (I596_RFD *) S2H(priv0->rfdp->next); 773 778 774 - ++privN->stats.tx_packets; 779 + ++devN->stats.tx_packets; 775 780 776 781 dev_kfree_skb (skb); 777 782 return (0); ··· 798 803 { 799 804 netif_stop_queue(dev); 800 805 return (0); 801 - } 802 - 803 - /* 804 - * Get statistics 805 - */ 806 - static struct net_device_stats *dgrs_get_stats( struct net_device *dev ) 807 - { 808 - DGRS_PRIV *priv = (DGRS_PRIV *) dev->priv; 809 - 810 - return (&priv->stats); 811 806 } 812 807 813 808 /* ··· 1198 1213 */ 1199 1214 dev->open = &dgrs_open; 1200 1215 dev->stop = &dgrs_close; 1201 - dev->get_stats = &dgrs_get_stats; 1202 1216 dev->hard_start_xmit = &dgrs_start_xmit; 1203 1217 dev->set_multicast_list = &dgrs_set_multicast_list; 1204 1218 dev->do_ioctl = &dgrs_ioctl;
+7 -22
drivers/net/dm9000.c
··· 148 148 struct resource *irq_res; 149 149 150 150 struct timer_list timer; 151 - struct net_device_stats stats; 152 151 unsigned char srom[128]; 153 152 spinlock_t lock; 154 153 ··· 164 165 165 166 static void dm9000_timer(unsigned long); 166 167 static void dm9000_init_dm9000(struct net_device *); 167 - 168 - static struct net_device_stats *dm9000_get_stats(struct net_device *); 169 168 170 169 static irqreturn_t dm9000_interrupt(int, void *); 171 170 ··· 555 558 ndev->tx_timeout = &dm9000_timeout; 556 559 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); 557 560 ndev->stop = &dm9000_stop; 558 - ndev->get_stats = &dm9000_get_stats; 559 561 ndev->set_multicast_list = &dm9000_hash_table; 560 562 #ifdef CONFIG_NET_POLL_CONTROLLER 561 563 ndev->poll_controller = &dm9000_poll_controller; ··· 709 713 writeb(DM9000_MWCMD, db->io_addr); 710 714 711 715 (db->outblk)(db->io_data, skb->data, skb->len); 712 - db->stats.tx_bytes += skb->len; 716 + dev->stats.tx_bytes += skb->len; 713 717 714 718 db->tx_pkt_cnt++; 715 719 /* TX control: First packet immediately send, second packet queue */ ··· 786 790 if (tx_status & (NSR_TX2END | NSR_TX1END)) { 787 791 /* One packet sent complete */ 788 792 db->tx_pkt_cnt--; 789 - db->stats.tx_packets++; 793 + dev->stats.tx_packets++; 790 794 791 795 /* Queue packet check & send */ 792 796 if (db->tx_pkt_cnt > 0) { ··· 846 850 847 851 return IRQ_HANDLED; 848 852 } 849 - 850 - /* 851 - * Get statistics from driver. 852 - */ 853 - static struct net_device_stats * 854 - dm9000_get_stats(struct net_device *dev) 855 - { 856 - board_info_t *db = (board_info_t *) dev->priv; 857 - return &db->stats; 858 - } 859 - 860 853 861 854 /* 862 855 * A periodic timer routine ··· 924 939 GoodPacket = false; 925 940 if (rxhdr.RxStatus & 0x100) { 926 941 PRINTK1("fifo error\n"); 927 - db->stats.rx_fifo_errors++; 942 + dev->stats.rx_fifo_errors++; 928 943 } 929 944 if (rxhdr.RxStatus & 0x200) { 930 945 PRINTK1("crc error\n"); 931 - db->stats.rx_crc_errors++; 946 + dev->stats.rx_crc_errors++; 932 947 } 933 948 if (rxhdr.RxStatus & 0x8000) { 934 949 PRINTK1("length error\n"); 935 - db->stats.rx_length_errors++; 950 + dev->stats.rx_length_errors++; 936 951 } 937 952 } 938 953 ··· 945 960 /* Read received packet from RX SRAM */ 946 961 947 962 (db->inblk)(db->io_data, rdptr, RxLen); 948 - db->stats.rx_bytes += RxLen; 963 + dev->stats.rx_bytes += RxLen; 949 964 950 965 /* Pass to upper layer */ 951 966 skb->protocol = eth_type_trans(skb, dev); 952 967 netif_rx(skb); 953 - db->stats.rx_packets++; 968 + dev->stats.rx_packets++; 954 969 955 970 } else { 956 971 /* need to dump the packet's data */
+9 -14
drivers/net/e100.c
··· 558 558 enum mac mac; 559 559 enum phy phy; 560 560 struct params params; 561 - struct net_device_stats net_stats; 562 561 struct timer_list watchdog; 563 562 struct timer_list blink_timer; 564 563 struct mii_if_info mii; ··· 1482 1483 1483 1484 static void e100_update_stats(struct nic *nic) 1484 1485 { 1485 - struct net_device_stats *ns = &nic->net_stats; 1486 + struct net_device *dev = nic->netdev; 1487 + struct net_device_stats *ns = &dev->stats; 1486 1488 struct stats *s = &nic->mem->stats; 1487 1489 u32 *complete = (nic->mac < mac_82558_D101_A4) ? &s->fc_xmt_pause : 1488 1490 (nic->mac < mac_82559_D101M) ? (u32 *)&s->xmt_tco_frames : ··· 1661 1661 1662 1662 static int e100_tx_clean(struct nic *nic) 1663 1663 { 1664 + struct net_device *dev = nic->netdev; 1664 1665 struct cb *cb; 1665 1666 int tx_cleaned = 0; 1666 1667 ··· 1676 1675 cb->status); 1677 1676 1678 1677 if(likely(cb->skb != NULL)) { 1679 - nic->net_stats.tx_packets++; 1680 - nic->net_stats.tx_bytes += cb->skb->len; 1678 + dev->stats.tx_packets++; 1679 + dev->stats.tx_bytes += cb->skb->len; 1681 1680 1682 1681 pci_unmap_single(nic->pdev, 1683 1682 le32_to_cpu(cb->u.tcb.tbd.buf_addr), ··· 1808 1807 static int e100_rx_indicate(struct nic *nic, struct rx *rx, 1809 1808 unsigned int *work_done, unsigned int work_to_do) 1810 1809 { 1810 + struct net_device *dev = nic->netdev; 1811 1811 struct sk_buff *skb = rx->skb; 1812 1812 struct rfd *rfd = (struct rfd *)skb->data; 1813 1813 u16 rfd_status, actual_size; ··· 1853 1851 nic->rx_over_length_errors++; 1854 1852 dev_kfree_skb_any(skb); 1855 1853 } else { 1856 - nic->net_stats.rx_packets++; 1857 - nic->net_stats.rx_bytes += actual_size; 1854 + dev->stats.rx_packets++; 1855 + dev->stats.rx_bytes += actual_size; 1858 1856 nic->netdev->last_rx = jiffies; 1859 1857 netif_receive_skb(skb); 1860 1858 if(work_done) ··· 2016 2014 e100_enable_irq(nic); 2017 2015 } 2018 2016 #endif 2019 - 2020 - static struct net_device_stats *e100_get_stats(struct net_device *netdev) 2021 - { 2022 - struct nic *nic = netdev_priv(netdev); 2023 - return &nic->net_stats; 2024 - } 2025 2017 2026 2018 static int e100_set_mac_address(struct net_device *netdev, void *p) 2027 2019 { ··· 2453 2457 int i; 2454 2458 2455 2459 for(i = 0; i < E100_NET_STATS_LEN; i++) 2456 - data[i] = ((unsigned long *)&nic->net_stats)[i]; 2460 + data[i] = ((unsigned long *)&netdev->stats)[i]; 2457 2461 2458 2462 data[i++] = nic->tx_deferred; 2459 2463 data[i++] = nic->tx_single_collisions; ··· 2558 2562 netdev->open = e100_open; 2559 2563 netdev->stop = e100_close; 2560 2564 netdev->hard_start_xmit = e100_xmit_frame; 2561 - netdev->get_stats = e100_get_stats; 2562 2565 netdev->set_multicast_list = e100_set_multicast_list; 2563 2566 netdev->set_mac_address = e100_set_mac_address; 2564 2567 netdev->change_mtu = e100_change_mtu;
+17 -30
drivers/net/eepro.c
··· 192 192 193 193 /* Information that need to be kept for each board. */ 194 194 struct eepro_local { 195 - struct net_device_stats stats; 196 195 unsigned rx_start; 197 196 unsigned tx_start; /* start of the transmit chain */ 198 197 int tx_last; /* pointer to last packet in the transmit chain */ ··· 314 315 static void eepro_rx(struct net_device *dev); 315 316 static void eepro_transmit_interrupt(struct net_device *dev); 316 317 static int eepro_close(struct net_device *dev); 317 - static struct net_device_stats *eepro_get_stats(struct net_device *dev); 318 318 static void set_multicast_list(struct net_device *dev); 319 319 static void eepro_tx_timeout (struct net_device *dev); 320 320 ··· 512 514 513 515 /* a complete sel reset */ 514 516 #define eepro_complete_selreset(ioaddr) { \ 515 - lp->stats.tx_errors++;\ 517 + dev->stats.tx_errors++;\ 516 518 eepro_sel_reset(ioaddr);\ 517 519 lp->tx_end = \ 518 520 lp->xmt_lower_limit;\ ··· 854 856 dev->open = eepro_open; 855 857 dev->stop = eepro_close; 856 858 dev->hard_start_xmit = eepro_send_packet; 857 - dev->get_stats = eepro_get_stats; 858 859 dev->set_multicast_list = &set_multicast_list; 859 860 dev->tx_timeout = eepro_tx_timeout; 860 861 dev->watchdog_timeo = TX_TIMEOUT; ··· 1151 1154 1152 1155 if (hardware_send_packet(dev, buf, length)) 1153 1156 /* we won't wake queue here because we're out of space */ 1154 - lp->stats.tx_dropped++; 1157 + dev->stats.tx_dropped++; 1155 1158 else { 1156 - lp->stats.tx_bytes+=skb->len; 1159 + dev->stats.tx_bytes+=skb->len; 1157 1160 dev->trans_start = jiffies; 1158 1161 netif_wake_queue(dev); 1159 1162 } ··· 1163 1166 dev_kfree_skb (skb); 1164 1167 1165 1168 /* You might need to clean up and record Tx statistics here. */ 1166 - /* lp->stats.tx_aborted_errors++; */ 1169 + /* dev->stats.tx_aborted_errors++; */ 1167 1170 1168 1171 if (net_debug > 5) 1169 1172 printk(KERN_DEBUG "%s: exiting eepro_send_packet routine.\n", dev->name); ··· 1268 1271 /* Update the statistics here. What statistics? */ 1269 1272 1270 1273 return 0; 1271 - } 1272 - 1273 - /* Get the current statistics. This may be called with the card open or 1274 - closed. */ 1275 - static struct net_device_stats * 1276 - eepro_get_stats(struct net_device *dev) 1277 - { 1278 - struct eepro_local *lp = netdev_priv(dev); 1279 - 1280 - return &lp->stats; 1281 1274 } 1282 1275 1283 1276 /* Set or clear the multicast filter for this adaptor. ··· 1562 1575 /* Malloc up new buffer. */ 1563 1576 struct sk_buff *skb; 1564 1577 1565 - lp->stats.rx_bytes+=rcv_size; 1578 + dev->stats.rx_bytes+=rcv_size; 1566 1579 rcv_size &= 0x3fff; 1567 1580 skb = dev_alloc_skb(rcv_size+5); 1568 1581 if (skb == NULL) { 1569 1582 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); 1570 - lp->stats.rx_dropped++; 1583 + dev->stats.rx_dropped++; 1571 1584 rcv_car = lp->rx_start + RCV_HEADER + rcv_size; 1572 1585 lp->rx_start = rcv_next_frame; 1573 1586 outw(rcv_next_frame, ioaddr + HOST_ADDRESS_REG); ··· 1589 1602 skb->protocol = eth_type_trans(skb,dev); 1590 1603 netif_rx(skb); 1591 1604 dev->last_rx = jiffies; 1592 - lp->stats.rx_packets++; 1605 + dev->stats.rx_packets++; 1593 1606 } 1594 1607 1595 1608 else { /* Not sure will ever reach here, 1596 1609 I set the 595 to discard bad received frames */ 1597 - lp->stats.rx_errors++; 1610 + dev->stats.rx_errors++; 1598 1611 1599 1612 if (rcv_status & 0x0100) 1600 - lp->stats.rx_over_errors++; 1613 + dev->stats.rx_over_errors++; 1601 1614 1602 1615 else if (rcv_status & 0x0400) 1603 - lp->stats.rx_frame_errors++; 1616 + dev->stats.rx_frame_errors++; 1604 1617 1605 1618 else if (rcv_status & 0x0800) 1606 - lp->stats.rx_crc_errors++; 1619 + dev->stats.rx_crc_errors++; 1607 1620 1608 1621 printk(KERN_DEBUG "%s: event = %#x, status = %#x, next = %#x, size = %#x\n", 1609 1622 dev->name, rcv_event, rcv_status, rcv_next_frame, rcv_size); 1610 1623 } 1611 1624 1612 1625 if (rcv_status & 0x1000) 1613 - lp->stats.rx_length_errors++; 1626 + dev->stats.rx_length_errors++; 1614 1627 1615 1628 rcv_car = lp->rx_start + RCV_HEADER + rcv_size; 1616 1629 lp->rx_start = rcv_next_frame; ··· 1653 1666 netif_wake_queue (dev); 1654 1667 1655 1668 if (xmt_status & TX_OK) 1656 - lp->stats.tx_packets++; 1669 + dev->stats.tx_packets++; 1657 1670 else { 1658 - lp->stats.tx_errors++; 1671 + dev->stats.tx_errors++; 1659 1672 if (xmt_status & 0x0400) { 1660 - lp->stats.tx_carrier_errors++; 1673 + dev->stats.tx_carrier_errors++; 1661 1674 printk(KERN_DEBUG "%s: carrier error\n", 1662 1675 dev->name); 1663 1676 printk(KERN_DEBUG "%s: XMT status = %#x\n", ··· 1671 1684 } 1672 1685 } 1673 1686 if (xmt_status & 0x000f) { 1674 - lp->stats.collisions += (xmt_status & 0x000f); 1687 + dev->stats.collisions += (xmt_status & 0x000f); 1675 1688 } 1676 1689 1677 1690 if ((xmt_status & 0x0040) == 0x0) { 1678 - lp->stats.tx_heartbeat_errors++; 1691 + dev->stats.tx_heartbeat_errors++; 1679 1692 } 1680 1693 } 1681 1694 }
+21 -35
drivers/net/eexpress.c
··· 135 135 136 136 struct net_local 137 137 { 138 - struct net_device_stats stats; 139 138 unsigned long last_tx; /* jiffies when last transmit started */ 140 139 unsigned long init_time; /* jiffies when eexp_hw_init586 called */ 141 140 unsigned short rx_first; /* first rx buf, same as RX_BUF_START */ ··· 246 247 static int eexp_open(struct net_device *dev); 247 248 static int eexp_close(struct net_device *dev); 248 249 static void eexp_timeout(struct net_device *dev); 249 - static struct net_device_stats *eexp_stats(struct net_device *dev); 250 250 static int eexp_xmit(struct sk_buff *buf, struct net_device *dev); 251 251 252 252 static irqreturn_t eexp_irq(int irq, void *dev_addr); ··· 531 533 } 532 534 533 535 /* 534 - * Return interface stats 535 - */ 536 - 537 - static struct net_device_stats *eexp_stats(struct net_device *dev) 538 - { 539 - struct net_local *lp = netdev_priv(dev); 540 - 541 - return &lp->stats; 542 - } 543 - 544 - /* 545 536 * This gets called when a higher level thinks we are broken. Check that 546 537 * nothing has become jammed in the CU. 547 538 */ ··· 633 646 printk(KERN_INFO "%s: transmit timed out, %s?\n", dev->name, 634 647 (SCB_complete(status)?"lost interrupt": 635 648 "board on fire")); 636 - lp->stats.tx_errors++; 649 + dev->stats.tx_errors++; 637 650 lp->last_tx = jiffies; 638 651 if (!SCB_complete(status)) { 639 652 scb_command(dev, SCB_CUabort); ··· 681 694 { 682 695 unsigned short *data = (unsigned short *)buf->data; 683 696 684 - lp->stats.tx_bytes += length; 697 + dev->stats.tx_bytes += length; 685 698 686 699 eexp_hw_tx_pio(dev,data,length); 687 700 } ··· 830 843 outw(rbd+8, ioaddr+READ_PTR); 831 844 printk("[%04x]\n", inw(ioaddr+DATAPORT)); 832 845 #endif 833 - lp->stats.rx_errors++; 846 + dev->stats.rx_errors++; 834 847 #if 1 835 848 eexp_hw_rxinit(dev); 836 849 #else ··· 939 952 } 940 953 else if (!FD_OK(status)) 941 954 { 942 - lp->stats.rx_errors++; 955 + dev->stats.rx_errors++; 943 956 if (FD_CRC(status)) 944 - lp->stats.rx_crc_errors++; 957 + dev->stats.rx_crc_errors++; 945 958 if (FD_Align(status)) 946 - lp->stats.rx_frame_errors++; 959 + dev->stats.rx_frame_errors++; 947 960 if (FD_Resrc(status)) 948 - lp->stats.rx_fifo_errors++; 961 + dev->stats.rx_fifo_errors++; 949 962 if (FD_DMA(status)) 950 - lp->stats.rx_over_errors++; 963 + dev->stats.rx_over_errors++; 951 964 if (FD_Short(status)) 952 - lp->stats.rx_length_errors++; 965 + dev->stats.rx_length_errors++; 953 966 } 954 967 else 955 968 { ··· 959 972 if (skb == NULL) 960 973 { 961 974 printk(KERN_WARNING "%s: Memory squeeze, dropping packet\n",dev->name); 962 - lp->stats.rx_dropped++; 975 + dev->stats.rx_dropped++; 963 976 break; 964 977 } 965 978 skb_reserve(skb, 2); ··· 968 981 skb->protocol = eth_type_trans(skb,dev); 969 982 netif_rx(skb); 970 983 dev->last_rx = jiffies; 971 - lp->stats.rx_packets++; 972 - lp->stats.rx_bytes += pkt_len; 984 + dev->stats.rx_packets++; 985 + dev->stats.rx_bytes += pkt_len; 973 986 } 974 987 outw(rx_block, ioaddr+WRITE_PTR); 975 988 outw(0, ioaddr+DATAPORT); ··· 1040 1053 outw(0xFFFF, ioaddr+SIGNAL_CA); 1041 1054 } 1042 1055 1043 - lp->stats.tx_packets++; 1056 + dev->stats.tx_packets++; 1044 1057 lp->last_tx = jiffies; 1045 1058 } 1046 1059 ··· 1167 1180 dev->open = eexp_open; 1168 1181 dev->stop = eexp_close; 1169 1182 dev->hard_start_xmit = eexp_xmit; 1170 - dev->get_stats = eexp_stats; 1171 1183 dev->set_multicast_list = &eexp_set_multicast; 1172 1184 dev->tx_timeout = eexp_timeout; 1173 1185 dev->watchdog_timeo = 2*HZ; ··· 1249 1263 else 1250 1264 { 1251 1265 lp->last_tx_restart = 0; 1252 - lp->stats.collisions += Stat_NoColl(status); 1266 + dev->stats.collisions += Stat_NoColl(status); 1253 1267 if (!Stat_OK(status)) 1254 1268 { 1255 1269 char *whatsup = NULL; 1256 - lp->stats.tx_errors++; 1270 + dev->stats.tx_errors++; 1257 1271 if (Stat_Abort(status)) 1258 - lp->stats.tx_aborted_errors++; 1272 + dev->stats.tx_aborted_errors++; 1259 1273 if (Stat_TNoCar(status)) { 1260 1274 whatsup = "aborted, no carrier"; 1261 - lp->stats.tx_carrier_errors++; 1275 + dev->stats.tx_carrier_errors++; 1262 1276 } 1263 1277 if (Stat_TNoCTS(status)) { 1264 1278 whatsup = "aborted, lost CTS"; 1265 - lp->stats.tx_carrier_errors++; 1279 + dev->stats.tx_carrier_errors++; 1266 1280 } 1267 1281 if (Stat_TNoDMA(status)) { 1268 1282 whatsup = "FIFO underran"; 1269 - lp->stats.tx_fifo_errors++; 1283 + dev->stats.tx_fifo_errors++; 1270 1284 } 1271 1285 if (Stat_TXColl(status)) { 1272 1286 whatsup = "aborted, too many collisions"; 1273 - lp->stats.tx_aborted_errors++; 1287 + dev->stats.tx_aborted_errors++; 1274 1288 } 1275 1289 if (whatsup) 1276 1290 printk(KERN_INFO "%s: transmit %s\n", 1277 1291 dev->name, whatsup); 1278 1292 } 1279 1293 else 1280 - lp->stats.tx_packets++; 1294 + dev->stats.tx_packets++; 1281 1295 } 1282 1296 if (tx_block == TX_BUF_START+((lp->num_tx_bufs-1)*TX_BUF_SIZE)) 1283 1297 lp->tx_reap = tx_block = TX_BUF_START;
+2 -10
drivers/net/eql.c
··· 128 128 static int eql_close(struct net_device *dev); 129 129 static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 130 130 static int eql_slave_xmit(struct sk_buff *skb, struct net_device *dev); 131 - static struct net_device_stats *eql_get_stats(struct net_device *dev); 132 131 133 132 #define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) 134 133 #define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER) ··· 179 180 dev->stop = eql_close; 180 181 dev->do_ioctl = eql_ioctl; 181 182 dev->hard_start_xmit = eql_slave_xmit; 182 - dev->get_stats = eql_get_stats; 183 183 184 184 /* 185 185 * Now we undo some of the things that eth_setup does ··· 335 337 skb->priority = 1; 336 338 slave->bytes_queued += skb->len; 337 339 dev_queue_xmit(skb); 338 - eql->stats.tx_packets++; 340 + dev->stats.tx_packets++; 339 341 } else { 340 - eql->stats.tx_dropped++; 342 + dev->stats.tx_dropped++; 341 343 dev_kfree_skb(skb); 342 344 } 343 345 344 346 spin_unlock(&eql->queue.lock); 345 347 346 348 return 0; 347 - } 348 - 349 - static struct net_device_stats * eql_get_stats(struct net_device *dev) 350 - { 351 - equalizer_t *eql = netdev_priv(dev); 352 - return &eql->stats; 353 349 } 354 350 355 351 /*
+19 -30
drivers/net/eth16i.c
··· 380 380 /* Information for each board */ 381 381 382 382 struct eth16i_local { 383 - struct net_device_stats stats; 384 383 unsigned char tx_started; 385 384 unsigned char tx_buf_busy; 386 385 unsigned short tx_queue; /* Number of packets in transmit buffer */ ··· 424 425 #ifdef MODULE 425 426 static ushort eth16i_parse_mediatype(const char* s); 426 427 #endif 427 - 428 - static struct net_device_stats *eth16i_get_stats(struct net_device *dev); 429 428 430 429 static char cardname[] __initdata = "ICL EtherTeam 16i/32"; 431 430 ··· 554 557 dev->open = eth16i_open; 555 558 dev->stop = eth16i_close; 556 559 dev->hard_start_xmit = eth16i_tx; 557 - dev->get_stats = eth16i_get_stats; 558 560 dev->set_multicast_list = eth16i_multicast; 559 561 dev->tx_timeout = eth16i_timeout; 560 562 dev->watchdog_timeo = TX_TIMEOUT; ··· 1041 1045 printk(KERN_DEBUG "lp->tx_queue_len = %d\n", lp->tx_queue_len); 1042 1046 printk(KERN_DEBUG "lp->tx_started = %d\n", lp->tx_started); 1043 1047 } 1044 - lp->stats.tx_errors++; 1048 + dev->stats.tx_errors++; 1045 1049 eth16i_reset(dev); 1046 1050 dev->trans_start = jiffies; 1047 1051 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG); ··· 1126 1130 1127 1131 static void eth16i_rx(struct net_device *dev) 1128 1132 { 1129 - struct eth16i_local *lp = netdev_priv(dev); 1130 1133 int ioaddr = dev->base_addr; 1131 1134 int boguscount = MAX_RX_LOOP; 1132 1135 ··· 1144 1149 inb(ioaddr + RECEIVE_MODE_REG), status); 1145 1150 1146 1151 if( !(status & PKT_GOOD) ) { 1147 - lp->stats.rx_errors++; 1152 + dev->stats.rx_errors++; 1148 1153 1149 1154 if( (pkt_len < ETH_ZLEN) || (pkt_len > ETH_FRAME_LEN) ) { 1150 - lp->stats.rx_length_errors++; 1155 + dev->stats.rx_length_errors++; 1151 1156 eth16i_reset(dev); 1152 1157 return; 1153 1158 } 1154 1159 else { 1155 1160 eth16i_skip_packet(dev); 1156 - lp->stats.rx_dropped++; 1161 + dev->stats.rx_dropped++; 1157 1162 } 1158 1163 } 1159 1164 else { /* Ok so now we should have a good packet */ ··· 1164 1169 printk(KERN_WARNING "%s: Could'n allocate memory for packet (len %d)\n", 1165 1170 dev->name, pkt_len); 1166 1171 eth16i_skip_packet(dev); 1167 - lp->stats.rx_dropped++; 1172 + dev->stats.rx_dropped++; 1168 1173 break; 1169 1174 } 1170 1175 ··· 1207 1212 } 1208 1213 netif_rx(skb); 1209 1214 dev->last_rx = jiffies; 1210 - lp->stats.rx_packets++; 1211 - lp->stats.rx_bytes += pkt_len; 1215 + dev->stats.rx_packets++; 1216 + dev->stats.rx_bytes += pkt_len; 1212 1217 1213 1218 } /* else */ 1214 1219 ··· 1245 1250 1246 1251 if( status & 0x7f00 ) { 1247 1252 1248 - lp->stats.rx_errors++; 1253 + dev->stats.rx_errors++; 1249 1254 1250 1255 if(status & (BUS_RD_ERR << 8) ) 1251 1256 printk(KERN_WARNING "%s: Bus read error.\n",dev->name); 1252 - if(status & (SHORT_PKT_ERR << 8) ) lp->stats.rx_length_errors++; 1253 - if(status & (ALIGN_ERR << 8) ) lp->stats.rx_frame_errors++; 1254 - if(status & (CRC_ERR << 8) ) lp->stats.rx_crc_errors++; 1255 - if(status & (RX_BUF_OVERFLOW << 8) ) lp->stats.rx_over_errors++; 1257 + if(status & (SHORT_PKT_ERR << 8) ) dev->stats.rx_length_errors++; 1258 + if(status & (ALIGN_ERR << 8) ) dev->stats.rx_frame_errors++; 1259 + if(status & (CRC_ERR << 8) ) dev->stats.rx_crc_errors++; 1260 + if(status & (RX_BUF_OVERFLOW << 8) ) dev->stats.rx_over_errors++; 1256 1261 } 1257 1262 if( status & 0x001a) { 1258 1263 1259 - lp->stats.tx_errors++; 1264 + dev->stats.tx_errors++; 1260 1265 1261 - if(status & CR_LOST) lp->stats.tx_carrier_errors++; 1262 - if(status & TX_JABBER_ERR) lp->stats.tx_window_errors++; 1266 + if(status & CR_LOST) dev->stats.tx_carrier_errors++; 1267 + if(status & TX_JABBER_ERR) dev->stats.tx_window_errors++; 1263 1268 1264 1269 #if 0 1265 1270 if(status & COLLISION) { 1266 - lp->stats.collisions += 1271 + dev->stats.collisions += 1267 1272 ((inb(ioaddr+TRANSMIT_MODE_REG) & 0xF0) >> 4); 1268 1273 } 1269 1274 #endif 1270 1275 if(status & COLLISIONS_16) { 1271 1276 if(lp->col_16 < MAX_COL_16) { 1272 1277 lp->col_16++; 1273 - lp->stats.collisions++; 1278 + dev->stats.collisions++; 1274 1279 /* Resume transmitting, skip failed packet */ 1275 1280 outb(0x02, ioaddr + COL_16_REG); 1276 1281 } ··· 1283 1288 if( status & 0x00ff ) { /* Let's check the transmit status reg */ 1284 1289 1285 1290 if(status & TX_DONE) { /* The transmit has been done */ 1286 - lp->stats.tx_packets = lp->tx_buffered_packets; 1287 - lp->stats.tx_bytes += lp->tx_buffered_bytes; 1291 + dev->stats.tx_packets = lp->tx_buffered_packets; 1292 + dev->stats.tx_bytes += lp->tx_buffered_bytes; 1288 1293 lp->col_16 = 0; 1289 1294 1290 1295 if(lp->tx_queue) { /* Is there still packets ? */ ··· 1362 1367 } else { 1363 1368 outb(2, ioaddr + RECEIVE_MODE_REG); 1364 1369 } 1365 - } 1366 - 1367 - static struct net_device_stats *eth16i_get_stats(struct net_device *dev) 1368 - { 1369 - struct eth16i_local *lp = netdev_priv(dev); 1370 - return &lp->stats; 1371 1370 } 1372 1371 1373 1372 static void eth16i_select_regbank(unsigned char banknbr, int ioaddr)
+13 -24
drivers/net/ewrk3.c
··· 275 275 u_long shmem_base; /* Shared memory start address */ 276 276 void __iomem *shmem; 277 277 u_long shmem_length; /* Shared memory window length */ 278 - struct net_device_stats stats; /* Public stats */ 279 278 struct ewrk3_stats pktStats; /* Private stats counters */ 280 279 u_char irq_mask; /* Adapter IRQ mask bits */ 281 280 u_char mPage; /* Maximum 2kB Page number */ ··· 301 302 static int ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev); 302 303 static irqreturn_t ewrk3_interrupt(int irq, void *dev_id); 303 304 static int ewrk3_close(struct net_device *dev); 304 - static struct net_device_stats *ewrk3_get_stats(struct net_device *dev); 305 305 static void set_multicast_list(struct net_device *dev); 306 306 static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 307 307 static const struct ethtool_ops ethtool_ops_203; ··· 609 611 dev->open = ewrk3_open; 610 612 dev->hard_start_xmit = ewrk3_queue_pkt; 611 613 dev->stop = ewrk3_close; 612 - dev->get_stats = ewrk3_get_stats; 613 614 dev->set_multicast_list = set_multicast_list; 614 615 dev->do_ioctl = ewrk3_ioctl; 615 616 if (lp->adapter_name[4] == '3') ··· 860 863 ENABLE_IRQs; 861 864 spin_unlock_irq (&lp->hw_lock); 862 865 863 - lp->stats.tx_bytes += skb->len; 866 + dev->stats.tx_bytes += skb->len; 864 867 dev->trans_start = jiffies; 865 868 dev_kfree_skb (skb); 866 869 ··· 977 980 } 978 981 979 982 if (!(rx_status & R_ROK)) { /* There was an error. */ 980 - lp->stats.rx_errors++; /* Update the error stats. */ 983 + dev->stats.rx_errors++; /* Update the error stats. */ 981 984 if (rx_status & R_DBE) 982 - lp->stats.rx_frame_errors++; 985 + dev->stats.rx_frame_errors++; 983 986 if (rx_status & R_CRC) 984 - lp->stats.rx_crc_errors++; 987 + dev->stats.rx_crc_errors++; 985 988 if (rx_status & R_PLL) 986 - lp->stats.rx_fifo_errors++; 989 + dev->stats.rx_fifo_errors++; 987 990 } else { 988 991 struct sk_buff *skb; 989 992 ··· 1034 1037 ** Update stats 1035 1038 */ 1036 1039 dev->last_rx = jiffies; 1037 - lp->stats.rx_packets++; 1038 - lp->stats.rx_bytes += pkt_len; 1040 + dev->stats.rx_packets++; 1041 + dev->stats.rx_bytes += pkt_len; 1039 1042 } else { 1040 1043 printk("%s: Insufficient memory; nuking packet.\n", dev->name); 1041 - lp->stats.rx_dropped++; /* Really, deferred. */ 1044 + dev->stats.rx_dropped++; /* Really, deferred. */ 1042 1045 break; 1043 1046 } 1044 1047 } ··· 1068 1071 while ((tx_status = inb(EWRK3_TDQ)) > 0) { /* Whilst there's old buffers */ 1069 1072 if (tx_status & T_VSTS) { /* The status is valid */ 1070 1073 if (tx_status & T_TXE) { 1071 - lp->stats.tx_errors++; 1074 + dev->stats.tx_errors++; 1072 1075 if (tx_status & T_NCL) 1073 - lp->stats.tx_carrier_errors++; 1076 + dev->stats.tx_carrier_errors++; 1074 1077 if (tx_status & T_LCL) 1075 - lp->stats.tx_window_errors++; 1078 + dev->stats.tx_window_errors++; 1076 1079 if (tx_status & T_CTU) { 1077 1080 if ((tx_status & T_COLL) ^ T_XUR) { 1078 1081 lp->pktStats.tx_underruns++; ··· 1081 1084 } 1082 1085 } else if (tx_status & T_COLL) { 1083 1086 if ((tx_status & T_COLL) ^ T_XCOLL) { 1084 - lp->stats.collisions++; 1087 + dev->stats.collisions++; 1085 1088 } else { 1086 1089 lp->pktStats.excessive_collisions++; 1087 1090 } 1088 1091 } 1089 1092 } else { 1090 - lp->stats.tx_packets++; 1093 + dev->stats.tx_packets++; 1091 1094 } 1092 1095 } 1093 1096 } ··· 1128 1131 free_irq(dev->irq, dev); 1129 1132 } 1130 1133 return 0; 1131 - } 1132 - 1133 - static struct net_device_stats *ewrk3_get_stats(struct net_device *dev) 1134 - { 1135 - struct ewrk3_private *lp = netdev_priv(dev); 1136 - 1137 - /* Null body since there is no framing error counter */ 1138 - return &lp->stats; 1139 1134 } 1140 1135 1141 1136 /*
+20 -30
drivers/net/fec.c
··· 204 204 cbd_t *tx_bd_base; 205 205 cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ 206 206 cbd_t *dirty_tx; /* The ring entries to be free()ed. */ 207 - struct net_device_stats stats; 208 207 uint tx_full; 209 208 spinlock_t lock; 210 209 ··· 233 234 static void fec_enet_tx(struct net_device *dev); 234 235 static void fec_enet_rx(struct net_device *dev); 235 236 static int fec_enet_close(struct net_device *dev); 236 - static struct net_device_stats *fec_enet_get_stats(struct net_device *dev); 237 237 static void set_multicast_list(struct net_device *dev); 238 238 static void fec_restart(struct net_device *dev, int duplex); 239 239 static void fec_stop(struct net_device *dev); ··· 357 359 */ 358 360 fep->tx_skbuff[fep->skb_cur] = skb; 359 361 360 - fep->stats.tx_bytes += skb->len; 362 + dev->stats.tx_bytes += skb->len; 361 363 fep->skb_cur = (fep->skb_cur+1) & TX_RING_MOD_MASK; 362 364 363 365 /* Push the data cache so the CPM does not get stale memory ··· 407 409 struct fec_enet_private *fep = netdev_priv(dev); 408 410 409 411 printk("%s: transmit timed out.\n", dev->name); 410 - fep->stats.tx_errors++; 412 + dev->stats.tx_errors++; 411 413 #ifndef final_version 412 414 { 413 415 int i; ··· 509 511 if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | 510 512 BD_ENET_TX_RL | BD_ENET_TX_UN | 511 513 BD_ENET_TX_CSL)) { 512 - fep->stats.tx_errors++; 514 + dev->stats.tx_errors++; 513 515 if (status & BD_ENET_TX_HB) /* No heartbeat */ 514 - fep->stats.tx_heartbeat_errors++; 516 + dev->stats.tx_heartbeat_errors++; 515 517 if (status & BD_ENET_TX_LC) /* Late collision */ 516 - fep->stats.tx_window_errors++; 518 + dev->stats.tx_window_errors++; 517 519 if (status & BD_ENET_TX_RL) /* Retrans limit */ 518 - fep->stats.tx_aborted_errors++; 520 + dev->stats.tx_aborted_errors++; 519 521 if (status & BD_ENET_TX_UN) /* Underrun */ 520 - fep->stats.tx_fifo_errors++; 522 + dev->stats.tx_fifo_errors++; 521 523 if (status & BD_ENET_TX_CSL) /* Carrier lost */ 522 - fep->stats.tx_carrier_errors++; 524 + dev->stats.tx_carrier_errors++; 523 525 } else { 524 - fep->stats.tx_packets++; 526 + dev->stats.tx_packets++; 525 527 } 526 528 527 529 #ifndef final_version ··· 532 534 * but we eventually sent the packet OK. 533 535 */ 534 536 if (status & BD_ENET_TX_DEF) 535 - fep->stats.collisions++; 537 + dev->stats.collisions++; 536 538 537 539 /* Free the sk buffer associated with this last transmit. 538 540 */ ··· 605 607 /* Check for errors. */ 606 608 if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO | 607 609 BD_ENET_RX_CR | BD_ENET_RX_OV)) { 608 - fep->stats.rx_errors++; 610 + dev->stats.rx_errors++; 609 611 if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH)) { 610 612 /* Frame too long or too short. */ 611 - fep->stats.rx_length_errors++; 613 + dev->stats.rx_length_errors++; 612 614 } 613 615 if (status & BD_ENET_RX_NO) /* Frame alignment */ 614 - fep->stats.rx_frame_errors++; 616 + dev->stats.rx_frame_errors++; 615 617 if (status & BD_ENET_RX_CR) /* CRC Error */ 616 - fep->stats.rx_crc_errors++; 618 + dev->stats.rx_crc_errors++; 617 619 if (status & BD_ENET_RX_OV) /* FIFO overrun */ 618 - fep->stats.rx_fifo_errors++; 620 + dev->stats.rx_fifo_errors++; 619 621 } 620 622 621 623 /* Report late collisions as a frame error. ··· 623 625 * have in the buffer. So, just drop this frame on the floor. 624 626 */ 625 627 if (status & BD_ENET_RX_CL) { 626 - fep->stats.rx_errors++; 627 - fep->stats.rx_frame_errors++; 628 + dev->stats.rx_errors++; 629 + dev->stats.rx_frame_errors++; 628 630 goto rx_processing_done; 629 631 } 630 632 631 633 /* Process the incoming frame. 632 634 */ 633 - fep->stats.rx_packets++; 635 + dev->stats.rx_packets++; 634 636 pkt_len = bdp->cbd_datlen; 635 - fep->stats.rx_bytes += pkt_len; 637 + dev->stats.rx_bytes += pkt_len; 636 638 data = (__u8*)__va(bdp->cbd_bufaddr); 637 639 638 640 /* This does 16 byte alignment, exactly what we need. ··· 644 646 645 647 if (skb == NULL) { 646 648 printk("%s: Memory squeeze, dropping packet.\n", dev->name); 647 - fep->stats.rx_dropped++; 649 + dev->stats.rx_dropped++; 648 650 } else { 649 651 skb_put(skb,pkt_len-4); /* Make room */ 650 652 skb_copy_to_linear_data(skb, data, pkt_len-4); ··· 2218 2220 return 0; 2219 2221 } 2220 2222 2221 - static struct net_device_stats *fec_enet_get_stats(struct net_device *dev) 2222 - { 2223 - struct fec_enet_private *fep = netdev_priv(dev); 2224 - 2225 - return &fep->stats; 2226 - } 2227 - 2228 2223 /* Set or clear the multicast filter for this adaptor. 2229 2224 * Skeleton taken from sunlance driver. 2230 2225 * The CPM Ethernet implementation allows Multicast as well as individual ··· 2453 2462 dev->tx_timeout = fec_timeout; 2454 2463 dev->watchdog_timeo = TX_TIMEOUT; 2455 2464 dev->stop = fec_enet_close; 2456 - dev->get_stats = fec_enet_get_stats; 2457 2465 dev->set_multicast_list = set_multicast_list; 2458 2466 2459 2467 for (i=0; i<NMII-1; i++)
+15 -25
drivers/net/gianfar.c
··· 116 116 static void gfar_timeout(struct net_device *dev); 117 117 static int gfar_close(struct net_device *dev); 118 118 struct sk_buff *gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp); 119 - static struct net_device_stats *gfar_get_stats(struct net_device *dev); 120 119 static int gfar_set_mac_address(struct net_device *dev); 121 120 static int gfar_change_mtu(struct net_device *dev, int new_mtu); 122 121 static irqreturn_t gfar_error(int irq, void *dev_id); ··· 265 266 dev->poll_controller = gfar_netpoll; 266 267 #endif 267 268 dev->stop = gfar_close; 268 - dev->get_stats = gfar_get_stats; 269 269 dev->change_mtu = gfar_change_mtu; 270 270 dev->mtu = 1500; 271 271 dev->set_multicast_list = gfar_set_multi; ··· 1011 1013 unsigned long flags; 1012 1014 1013 1015 /* Update transmit stats */ 1014 - priv->stats.tx_bytes += skb->len; 1016 + dev->stats.tx_bytes += skb->len; 1015 1017 1016 1018 /* Lock priv now */ 1017 1019 spin_lock_irqsave(&priv->txlock, flags); ··· 1084 1086 if (txbdp == priv->dirty_tx) { 1085 1087 netif_stop_queue(dev); 1086 1088 1087 - priv->stats.tx_fifo_errors++; 1089 + dev->stats.tx_fifo_errors++; 1088 1090 } 1089 1091 1090 1092 /* Update the current txbd to the next one */ ··· 1115 1117 netif_stop_queue(dev); 1116 1118 1117 1119 return 0; 1118 - } 1119 - 1120 - /* returns a net_device_stats structure pointer */ 1121 - static struct net_device_stats * gfar_get_stats(struct net_device *dev) 1122 - { 1123 - struct gfar_private *priv = netdev_priv(dev); 1124 - 1125 - return &(priv->stats); 1126 1120 } 1127 1121 1128 1122 /* Changes the mac address if the controller is not running. */ ··· 1228 1238 { 1229 1239 struct gfar_private *priv = netdev_priv(dev); 1230 1240 1231 - priv->stats.tx_errors++; 1241 + dev->stats.tx_errors++; 1232 1242 1233 1243 if (dev->flags & IFF_UP) { 1234 1244 stop_gfar(dev); ··· 1258 1268 if ((bdp == priv->cur_tx) && (netif_queue_stopped(dev) == 0)) 1259 1269 break; 1260 1270 1261 - priv->stats.tx_packets++; 1271 + dev->stats.tx_packets++; 1262 1272 1263 1273 /* Deferred means some collisions occurred during transmit, */ 1264 1274 /* but we eventually sent the packet. */ 1265 1275 if (bdp->status & TXBD_DEF) 1266 - priv->stats.collisions++; 1276 + dev->stats.collisions++; 1267 1277 1268 1278 /* Free the sk buffer associated with this TxBD */ 1269 1279 dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]); ··· 1335 1345 1336 1346 static inline void count_errors(unsigned short status, struct gfar_private *priv) 1337 1347 { 1338 - struct net_device_stats *stats = &priv->stats; 1348 + struct net_device_stats *stats = &dev->stats; 1339 1349 struct gfar_extra_stats *estats = &priv->extra_stats; 1340 1350 1341 1351 /* If the packet was truncated, none of the other errors ··· 1460 1470 if (NULL == skb) { 1461 1471 if (netif_msg_rx_err(priv)) 1462 1472 printk(KERN_WARNING "%s: Missing skb!!.\n", dev->name); 1463 - priv->stats.rx_dropped++; 1473 + dev->stats.rx_dropped++; 1464 1474 priv->extra_stats.rx_skbmissing++; 1465 1475 } else { 1466 1476 int ret; ··· 1518 1528 (RXBD_LARGE | RXBD_SHORT | RXBD_NONOCTET 1519 1529 | RXBD_CRCERR | RXBD_OVERRUN | RXBD_TRUNCATED))) { 1520 1530 /* Increment the number of packets */ 1521 - priv->stats.rx_packets++; 1531 + dev->stats.rx_packets++; 1522 1532 howmany++; 1523 1533 1524 1534 /* Remove the FCS from the packet length */ ··· 1526 1536 1527 1537 gfar_process_frame(dev, skb, pkt_len); 1528 1538 1529 - priv->stats.rx_bytes += pkt_len; 1539 + dev->stats.rx_bytes += pkt_len; 1530 1540 } else { 1531 1541 count_errors(bdp->status, priv); 1532 1542 ··· 1906 1916 1907 1917 /* Update the error counters */ 1908 1918 if (events & IEVENT_TXE) { 1909 - priv->stats.tx_errors++; 1919 + dev->stats.tx_errors++; 1910 1920 1911 1921 if (events & IEVENT_LC) 1912 - priv->stats.tx_window_errors++; 1922 + dev->stats.tx_window_errors++; 1913 1923 if (events & IEVENT_CRL) 1914 - priv->stats.tx_aborted_errors++; 1924 + dev->stats.tx_aborted_errors++; 1915 1925 if (events & IEVENT_XFUN) { 1916 1926 if (netif_msg_tx_err(priv)) 1917 1927 printk(KERN_DEBUG "%s: TX FIFO underrun, " 1918 1928 "packet dropped.\n", dev->name); 1919 - priv->stats.tx_dropped++; 1929 + dev->stats.tx_dropped++; 1920 1930 priv->extra_stats.tx_underrun++; 1921 1931 1922 1932 /* Reactivate the Tx Queues */ ··· 1926 1936 printk(KERN_DEBUG "%s: Transmit Error\n", dev->name); 1927 1937 } 1928 1938 if (events & IEVENT_BSY) { 1929 - priv->stats.rx_errors++; 1939 + dev->stats.rx_errors++; 1930 1940 priv->extra_stats.rx_bsy++; 1931 1941 1932 1942 gfar_receive(irq, dev_id); ··· 1941 1951 dev->name, gfar_read(&priv->regs->rstat)); 1942 1952 } 1943 1953 if (events & IEVENT_BABR) { 1944 - priv->stats.rx_errors++; 1954 + dev->stats.rx_errors++; 1945 1955 priv->extra_stats.rx_babr++; 1946 1956 1947 1957 if (netif_msg_rx_err(priv))
-1
drivers/net/hplance.c
··· 141 141 dev->poll_controller = lance_poll; 142 142 #endif 143 143 dev->hard_start_xmit = &lance_start_xmit; 144 - dev->get_stats = &lance_get_stats; 145 144 dev->set_multicast_list = &lance_set_multicast; 146 145 dev->dma = 0; 147 146
+14 -23
drivers/net/ibmlana.c
··· 591 591 592 592 skb = dev_alloc_skb(rda.length + 2); 593 593 if (skb == NULL) 594 - priv->stat.rx_dropped++; 594 + dev->stats.rx_dropped++; 595 595 else { 596 596 /* copy out data */ 597 597 ··· 606 606 607 607 /* bookkeeping */ 608 608 dev->last_rx = jiffies; 609 - priv->stat.rx_packets++; 610 - priv->stat.rx_bytes += rda.length; 609 + dev->stats.rx_packets++; 610 + dev->stats.rx_bytes += rda.length; 611 611 612 612 /* pass to the upper layers */ 613 613 netif_rx(skb); ··· 617 617 /* otherwise check error status bits and increase statistics */ 618 618 619 619 else { 620 - priv->stat.rx_errors++; 620 + dev->stats.rx_errors++; 621 621 if (rda.status & RCREG_FAER) 622 - priv->stat.rx_frame_errors++; 622 + dev->stats.rx_frame_errors++; 623 623 if (rda.status & RCREG_CRCR) 624 - priv->stat.rx_crc_errors++; 624 + dev->stats.rx_crc_errors++; 625 625 } 626 626 627 627 /* descriptor processed, will become new last descriptor in queue */ ··· 656 656 memcpy_fromio(&tda, priv->base + priv->tdastart + (priv->currtxdescr * sizeof(tda_t)), sizeof(tda_t)); 657 657 658 658 /* update statistics */ 659 - priv->stat.tx_packets++; 660 - priv->stat.tx_bytes += tda.length; 659 + dev->stats.tx_packets++; 660 + dev->stats.tx_bytes += tda.length; 661 661 662 662 /* update our pointers */ 663 663 priv->txused[priv->currtxdescr] = 0; ··· 680 680 memcpy_fromio(&tda, priv->base + priv->tdastart + (priv->currtxdescr * sizeof(tda_t)), sizeof(tda_t)); 681 681 682 682 /* update statistics */ 683 - priv->stat.tx_errors++; 683 + dev->stats.tx_errors++; 684 684 if (tda.status & (TCREG_NCRS | TCREG_CRSL)) 685 - priv->stat.tx_carrier_errors++; 685 + dev->stats.tx_carrier_errors++; 686 686 if (tda.status & TCREG_EXC) 687 - priv->stat.tx_aborted_errors++; 687 + dev->stats.tx_aborted_errors++; 688 688 if (tda.status & TCREG_OWC) 689 - priv->stat.tx_window_errors++; 689 + dev->stats.tx_window_errors++; 690 690 if (tda.status & TCREG_FU) 691 - priv->stat.tx_fifo_errors++; 691 + dev->stats.tx_fifo_errors++; 692 692 693 693 /* update our pointers */ 694 694 priv->txused[priv->currtxdescr] = 0; ··· 824 824 825 825 if (priv->txusedcnt >= TXBUFCNT) { 826 826 retval = -EIO; 827 - priv->stat.tx_dropped++; 827 + dev->stats.tx_dropped++; 828 828 goto tx_done; 829 829 } 830 830 ··· 874 874 tx_done: 875 875 dev_kfree_skb(skb); 876 876 return retval; 877 - } 878 - 879 - /* return pointer to Ethernet statistics */ 880 - 881 - static struct net_device_stats *ibmlana_stats(struct net_device *dev) 882 - { 883 - ibmlana_priv *priv = netdev_priv(dev); 884 - return &priv->stat; 885 877 } 886 878 887 879 /* switch receiver mode. */ ··· 970 978 dev->stop = ibmlana_close; 971 979 dev->hard_start_xmit = ibmlana_tx; 972 980 dev->do_ioctl = NULL; 973 - dev->get_stats = ibmlana_stats; 974 981 dev->set_multicast_list = ibmlana_set_multicast_list; 975 982 dev->flags |= IFF_MULTICAST; 976 983
-1
drivers/net/ibmlana.h
··· 26 26 27 27 typedef struct { 28 28 unsigned int slot; /* MCA-Slot-# */ 29 - struct net_device_stats stat; /* packet statistics */ 30 29 int realirq; /* memorizes actual IRQ, even when 31 30 currently not allocated */ 32 31 ibmlana_medium medium; /* physical cannector */
+5 -13
drivers/net/ibmveth.c
··· 87 87 static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 88 88 static int ibmveth_poll(struct napi_struct *napi, int budget); 89 89 static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *dev); 90 - static struct net_device_stats *ibmveth_get_stats(struct net_device *dev); 91 90 static void ibmveth_set_multicast_list(struct net_device *dev); 92 91 static int ibmveth_change_mtu(struct net_device *dev, int new_mtu); 93 92 static void ibmveth_proc_register_driver(void); ··· 908 909 skb->len, DMA_TO_DEVICE); 909 910 910 911 out: spin_lock_irqsave(&adapter->stats_lock, flags); 911 - adapter->stats.tx_dropped += tx_dropped; 912 - adapter->stats.tx_bytes += tx_bytes; 913 - adapter->stats.tx_packets += tx_packets; 912 + netdev->stats.tx_dropped += tx_dropped; 913 + netdev->stats.tx_bytes += tx_bytes; 914 + netdev->stats.tx_packets += tx_packets; 914 915 adapter->tx_send_failed += tx_send_failed; 915 916 adapter->tx_map_failed += tx_map_failed; 916 917 spin_unlock_irqrestore(&adapter->stats_lock, flags); ··· 956 957 957 958 netif_receive_skb(skb); /* send it up */ 958 959 959 - adapter->stats.rx_packets++; 960 - adapter->stats.rx_bytes += length; 960 + netdev->stats.rx_packets++; 961 + netdev->stats.rx_bytes += length; 961 962 frames_processed++; 962 963 netdev->last_rx = jiffies; 963 964 } ··· 1000 1001 __netif_rx_schedule(netdev, &adapter->napi); 1001 1002 } 1002 1003 return IRQ_HANDLED; 1003 - } 1004 - 1005 - static struct net_device_stats *ibmveth_get_stats(struct net_device *dev) 1006 - { 1007 - struct ibmveth_adapter *adapter = dev->priv; 1008 - return &adapter->stats; 1009 1004 } 1010 1005 1011 1006 static void ibmveth_set_multicast_list(struct net_device *netdev) ··· 1163 1170 netdev->open = ibmveth_open; 1164 1171 netdev->stop = ibmveth_close; 1165 1172 netdev->hard_start_xmit = ibmveth_start_xmit; 1166 - netdev->get_stats = ibmveth_get_stats; 1167 1173 netdev->set_multicast_list = ibmveth_set_multicast_list; 1168 1174 netdev->do_ioctl = ibmveth_ioctl; 1169 1175 netdev->ethtool_ops = &netdev_ethtool_ops;
+2 -18
drivers/net/ifb.c
··· 40 40 41 41 #define TX_Q_LIMIT 32 42 42 struct ifb_private { 43 - struct net_device_stats stats; 44 43 struct tasklet_struct ifb_tasklet; 45 44 int tasklet_pending; 46 45 /* mostly debug stats leave in for now */ ··· 60 61 61 62 static void ri_tasklet(unsigned long dev); 62 63 static int ifb_xmit(struct sk_buff *skb, struct net_device *dev); 63 - static struct net_device_stats *ifb_get_stats(struct net_device *dev); 64 64 static int ifb_open(struct net_device *dev); 65 65 static int ifb_close(struct net_device *dev); 66 66 ··· 68 70 69 71 struct net_device *_dev = (struct net_device *)dev; 70 72 struct ifb_private *dp = netdev_priv(_dev); 71 - struct net_device_stats *stats = &dp->stats; 73 + struct net_device_stats *stats = &_dev->stats; 72 74 struct sk_buff *skb; 73 75 74 76 dp->st_task_enter++; ··· 138 140 static void ifb_setup(struct net_device *dev) 139 141 { 140 142 /* Initialize the device structure. */ 141 - dev->get_stats = ifb_get_stats; 142 143 dev->hard_start_xmit = ifb_xmit; 143 144 dev->open = &ifb_open; 144 145 dev->stop = &ifb_close; ··· 155 158 static int ifb_xmit(struct sk_buff *skb, struct net_device *dev) 156 159 { 157 160 struct ifb_private *dp = netdev_priv(dev); 158 - struct net_device_stats *stats = &dp->stats; 161 + struct net_device_stats *stats = &dev->stats; 159 162 int ret = 0; 160 163 u32 from = G_TC_FROM(skb->tc_verd); 161 164 ··· 180 183 } 181 184 182 185 return ret; 183 - } 184 - 185 - static struct net_device_stats *ifb_get_stats(struct net_device *dev) 186 - { 187 - struct ifb_private *dp = netdev_priv(dev); 188 - struct net_device_stats *stats = &dp->stats; 189 - 190 - pr_debug("tasklets stats %ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld \n", 191 - dp->st_task_enter, dp->st_txq_refl_try, dp->st_rxq_enter, 192 - dp->st_rx2tx_tran, dp->st_rxq_notenter, dp->st_rx_frm_egr, 193 - dp->st_rx_frm_ing, dp->st_rxq_check, dp->st_rxq_rsch); 194 - 195 - return stats; 196 186 } 197 187 198 188 static int ifb_close(struct net_device *dev)
+5 -18
drivers/net/iseries_veth.c
··· 196 196 197 197 struct veth_port { 198 198 struct device *dev; 199 - struct net_device_stats stats; 200 199 u64 mac_addr; 201 200 HvLpIndexMap lpar_map; 202 201 ··· 935 936 936 937 static int veth_open(struct net_device *dev) 937 938 { 938 - struct veth_port *port = (struct veth_port *) dev->priv; 939 - 940 - memset(&port->stats, 0, sizeof (port->stats)); 941 939 netif_start_queue(dev); 942 940 return 0; 943 941 } ··· 943 947 { 944 948 netif_stop_queue(dev); 945 949 return 0; 946 - } 947 - 948 - static struct net_device_stats *veth_get_stats(struct net_device *dev) 949 - { 950 - struct veth_port *port = (struct veth_port *) dev->priv; 951 - 952 - return &port->stats; 953 950 } 954 951 955 952 static int veth_change_mtu(struct net_device *dev, int new_mtu) ··· 1073 1084 dev->open = veth_open; 1074 1085 dev->hard_start_xmit = veth_start_xmit; 1075 1086 dev->stop = veth_close; 1076 - dev->get_stats = veth_get_stats; 1077 1087 dev->change_mtu = veth_change_mtu; 1078 1088 dev->set_mac_address = NULL; 1079 1089 dev->set_multicast_list = veth_set_multicast_list; ··· 1171 1183 HvLpIndexMap lpmask, 1172 1184 struct net_device *dev) 1173 1185 { 1174 - struct veth_port *port = (struct veth_port *) dev->priv; 1175 1186 int i, success, error; 1176 1187 1177 1188 success = error = 0; ··· 1186 1199 } 1187 1200 1188 1201 if (error) 1189 - port->stats.tx_errors++; 1202 + dev->stats.tx_errors++; 1190 1203 1191 1204 if (success) { 1192 - port->stats.tx_packets++; 1193 - port->stats.tx_bytes += skb->len; 1205 + dev->stats.tx_packets++; 1206 + dev->stats.tx_bytes += skb->len; 1194 1207 } 1195 1208 } 1196 1209 ··· 1528 1541 skb->protocol = eth_type_trans(skb, dev); 1529 1542 skb->ip_summed = CHECKSUM_NONE; 1530 1543 netif_rx(skb); /* send it up */ 1531 - port->stats.rx_packets++; 1532 - port->stats.rx_bytes += length; 1544 + dev->stats.rx_packets++; 1545 + dev->stats.rx_bytes += length; 1533 1546 } while (startchunk += nchunks, startchunk < VETH_MAX_FRAMES_PER_MSG); 1534 1547 1535 1548 /* Ack it */
+27 -37
drivers/net/lib82596.c
··· 322 322 struct i596_cmd *cmd_head; 323 323 int cmd_backlog; 324 324 u32 last_cmd; 325 - struct net_device_stats stats; 326 325 int next_tx_cmd; 327 326 int options; 328 327 spinlock_t lock; /* serialize access to chip */ ··· 351 352 static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); 352 353 static irqreturn_t i596_interrupt(int irq, void *dev_id); 353 354 static int i596_close(struct net_device *dev); 354 - static struct net_device_stats *i596_get_stats(struct net_device *dev); 355 355 static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd); 356 356 static void i596_tx_timeout (struct net_device *dev); 357 357 static void print_eth(unsigned char *buf, char *str); ··· 723 725 printk(KERN_ERR 724 726 "%s: i596_rx Memory squeeze, dropping packet.\n", 725 727 dev->name); 726 - lp->stats.rx_dropped++; 728 + dev->stats.rx_dropped++; 727 729 } else { 728 730 if (!rx_in_place) { 729 731 /* 16 byte align the data fields */ ··· 740 742 skb->protocol = eth_type_trans(skb, dev); 741 743 netif_rx(skb); 742 744 dev->last_rx = jiffies; 743 - lp->stats.rx_packets++; 744 - lp->stats.rx_bytes += pkt_len; 745 + dev->stats.rx_packets++; 746 + dev->stats.rx_bytes += pkt_len; 745 747 } 746 748 } else { 747 749 DEB(DEB_ERRORS, printk(KERN_DEBUG 748 750 "%s: Error, rfd.stat = 0x%04x\n", 749 751 dev->name, rfd->stat)); 750 - lp->stats.rx_errors++; 752 + dev->stats.rx_errors++; 751 753 if (rfd->stat & SWAP16(0x0100)) 752 - lp->stats.collisions++; 754 + dev->stats.collisions++; 753 755 if (rfd->stat & SWAP16(0x8000)) 754 - lp->stats.rx_length_errors++; 756 + dev->stats.rx_length_errors++; 755 757 if (rfd->stat & SWAP16(0x0001)) 756 - lp->stats.rx_over_errors++; 758 + dev->stats.rx_over_errors++; 757 759 if (rfd->stat & SWAP16(0x0002)) 758 - lp->stats.rx_fifo_errors++; 760 + dev->stats.rx_fifo_errors++; 759 761 if (rfd->stat & SWAP16(0x0004)) 760 - lp->stats.rx_frame_errors++; 762 + dev->stats.rx_frame_errors++; 761 763 if (rfd->stat & SWAP16(0x0008)) 762 - lp->stats.rx_crc_errors++; 764 + dev->stats.rx_crc_errors++; 763 765 if (rfd->stat & SWAP16(0x0010)) 764 - lp->stats.rx_length_errors++; 766 + dev->stats.rx_length_errors++; 765 767 } 766 768 767 769 /* Clear the buffer descriptor count and EOF + F flags */ ··· 819 821 820 822 dev_kfree_skb(skb); 821 823 822 - lp->stats.tx_errors++; 823 - lp->stats.tx_aborted_errors++; 824 + dev->stats.tx_errors++; 825 + dev->stats.tx_aborted_errors++; 824 826 825 827 ptr->v_next = NULL; 826 828 ptr->b_next = I596_NULL; ··· 949 951 "%s: transmit timed out, status resetting.\n", 950 952 dev->name)); 951 953 952 - lp->stats.tx_errors++; 954 + dev->stats.tx_errors++; 953 955 954 956 /* Try to restart the adaptor */ 955 - if (lp->last_restart == lp->stats.tx_packets) { 957 + if (lp->last_restart == dev->stats.tx_packets) { 956 958 DEB(DEB_ERRORS, printk(KERN_DEBUG "Resetting board.\n")); 957 959 /* Shutdown and restart */ 958 960 i596_reset (dev, lp); ··· 962 964 lp->dma->scb.command = SWAP16(CUC_START | RX_START); 963 965 DMA_WBACK_INV(dev, &(lp->dma->scb), sizeof(struct i596_scb)); 964 966 ca (dev); 965 - lp->last_restart = lp->stats.tx_packets; 967 + lp->last_restart = dev->stats.tx_packets; 966 968 } 967 969 968 970 dev->trans_start = jiffies; ··· 997 999 DEB(DEB_ERRORS, printk(KERN_DEBUG 998 1000 "%s: xmit ring full, dropping packet.\n", 999 1001 dev->name)); 1000 - lp->stats.tx_dropped++; 1002 + dev->stats.tx_dropped++; 1001 1003 1002 1004 dev_kfree_skb(skb); 1003 1005 } else { ··· 1023 1025 DMA_WBACK_INV(dev, tbd, sizeof(struct i596_tbd)); 1024 1026 i596_add_cmd(dev, &tx_cmd->cmd); 1025 1027 1026 - lp->stats.tx_packets++; 1027 - lp->stats.tx_bytes += length; 1028 + dev->stats.tx_packets++; 1029 + dev->stats.tx_bytes += length; 1028 1030 } 1029 1031 1030 1032 netif_start_queue(dev); ··· 1074 1076 dev->open = i596_open; 1075 1077 dev->stop = i596_close; 1076 1078 dev->hard_start_xmit = i596_start_xmit; 1077 - dev->get_stats = i596_get_stats; 1078 1079 dev->set_multicast_list = set_multicast_list; 1079 1080 dev->tx_timeout = i596_tx_timeout; 1080 1081 dev->watchdog_timeo = TX_TIMEOUT; ··· 1194 1197 DEB(DEB_TXADDR, 1195 1198 print_eth(skb->data, "tx-done")); 1196 1199 } else { 1197 - lp->stats.tx_errors++; 1200 + dev->stats.tx_errors++; 1198 1201 if (ptr->status & SWAP16(0x0020)) 1199 - lp->stats.collisions++; 1202 + dev->stats.collisions++; 1200 1203 if (!(ptr->status & SWAP16(0x0040))) 1201 - lp->stats.tx_heartbeat_errors++; 1204 + dev->stats.tx_heartbeat_errors++; 1202 1205 if (ptr->status & SWAP16(0x0400)) 1203 - lp->stats.tx_carrier_errors++; 1206 + dev->stats.tx_carrier_errors++; 1204 1207 if (ptr->status & SWAP16(0x0800)) 1205 - lp->stats.collisions++; 1208 + dev->stats.collisions++; 1206 1209 if (ptr->status & SWAP16(0x1000)) 1207 - lp->stats.tx_aborted_errors++; 1210 + dev->stats.tx_aborted_errors++; 1208 1211 } 1209 1212 dma_unmap_single(dev->dev.parent, 1210 1213 tx_cmd->dma_addr, ··· 1289 1292 "%s: i596 interrupt receive unit inactive, status 0x%x\n", 1290 1293 dev->name, status)); 1291 1294 ack_cmd |= RX_START; 1292 - lp->stats.rx_errors++; 1293 - lp->stats.rx_fifo_errors++; 1295 + dev->stats.rx_errors++; 1296 + dev->stats.rx_fifo_errors++; 1294 1297 rebuild_rx_bufs(dev); 1295 1298 } 1296 1299 } ··· 1341 1344 remove_rx_bufs(dev); 1342 1345 1343 1346 return 0; 1344 - } 1345 - 1346 - static struct net_device_stats *i596_get_stats(struct net_device *dev) 1347 - { 1348 - struct i596_private *lp = netdev_priv(dev); 1349 - 1350 - return &lp->stats; 1351 1347 } 1352 1348 1353 1349 /*
+23 -33
drivers/net/lp486e.c
··· 350 350 struct i596_cmd *cmd_head; 351 351 int cmd_backlog; 352 352 unsigned long last_cmd; 353 - struct net_device_stats stats; 354 353 spinlock_t cmd_lock; 355 354 }; 356 355 ··· 380 381 static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); 381 382 static irqreturn_t i596_interrupt(int irq, void *dev_id); 382 383 static int i596_close(struct net_device *dev); 383 - static struct net_device_stats *i596_get_stats(struct net_device *dev); 384 384 static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd); 385 385 static void print_eth(char *); 386 386 static void set_multicast_list(struct net_device *dev); ··· 668 670 if (skb == NULL) { 669 671 printk ("%s: i596_rx Memory squeeze, " 670 672 "dropping packet.\n", dev->name); 671 - lp->stats.rx_dropped++; 673 + dev->stats.rx_dropped++; 672 674 return 1; 673 675 } 674 676 ··· 677 679 skb->protocol = eth_type_trans(skb,dev); 678 680 netif_rx(skb); 679 681 dev->last_rx = jiffies; 680 - lp->stats.rx_packets++; 682 + dev->stats.rx_packets++; 681 683 } else { 682 684 #if 0 683 685 printk("Frame reception error status %04x\n", 684 686 rfd->stat); 685 687 #endif 686 - lp->stats.rx_errors++; 688 + dev->stats.rx_errors++; 687 689 if (rfd->stat & RFD_COLLISION) 688 - lp->stats.collisions++; 690 + dev->stats.collisions++; 689 691 if (rfd->stat & RFD_SHORT_FRAME_ERR) 690 - lp->stats.rx_length_errors++; 692 + dev->stats.rx_length_errors++; 691 693 if (rfd->stat & RFD_DMA_ERR) 692 - lp->stats.rx_over_errors++; 694 + dev->stats.rx_over_errors++; 693 695 if (rfd->stat & RFD_NOBUFS_ERR) 694 - lp->stats.rx_fifo_errors++; 696 + dev->stats.rx_fifo_errors++; 695 697 if (rfd->stat & RFD_ALIGN_ERR) 696 - lp->stats.rx_frame_errors++; 698 + dev->stats.rx_frame_errors++; 697 699 if (rfd->stat & RFD_CRC_ERR) 698 - lp->stats.rx_crc_errors++; 700 + dev->stats.rx_crc_errors++; 699 701 if (rfd->stat & RFD_LENGTH_ERR) 700 - lp->stats.rx_length_errors++; 702 + dev->stats.rx_length_errors++; 701 703 } 702 704 rfd->stat = rfd->count = 0; 703 705 return 0; ··· 753 755 754 756 dev_kfree_skb_any(tx_cmd_tbd->skb); 755 757 756 - lp->stats.tx_errors++; 757 - lp->stats.tx_aborted_errors++; 758 + dev->stats.tx_errors++; 759 + dev->stats.tx_aborted_errors++; 758 760 759 761 cmd->pa_next = I596_NULL; 760 762 kfree((unsigned char *)tx_cmd); ··· 865 867 } 866 868 867 869 static int i596_start_xmit (struct sk_buff *skb, struct net_device *dev) { 868 - struct i596_private *lp = dev->priv; 869 870 struct tx_cmd *tx_cmd; 870 871 short length; 871 872 ··· 881 884 tx_cmd = kmalloc((sizeof (struct tx_cmd) + sizeof (struct i596_tbd)), GFP_ATOMIC); 882 885 if (tx_cmd == NULL) { 883 886 printk(KERN_WARNING "%s: i596_xmit Memory squeeze, dropping packet.\n", dev->name); 884 - lp->stats.tx_dropped++; 887 + dev->stats.tx_dropped++; 885 888 dev_kfree_skb (skb); 886 889 } else { 887 890 struct i596_tbd *tx_cmd_tbd; ··· 904 907 905 908 i596_add_cmd (dev, (struct i596_cmd *) tx_cmd); 906 909 907 - lp->stats.tx_packets++; 910 + dev->stats.tx_packets++; 908 911 } 909 912 910 913 return 0; ··· 917 920 918 921 /* Transmitter timeout, serious problems. */ 919 922 printk(KERN_WARNING "%s: transmit timed out, status resetting.\n", dev->name); 920 - lp->stats.tx_errors++; 923 + dev->stats.tx_errors++; 921 924 922 925 /* Try to restart the adaptor */ 923 - if (lp->last_restart == lp->stats.tx_packets) { 926 + if (lp->last_restart == dev->stats.tx_packets) { 924 927 printk ("Resetting board.\n"); 925 928 926 929 /* Shutdown and restart */ ··· 930 933 printk ("Kicking board.\n"); 931 934 lp->scb.command = (CUC_START | RX_START); 932 935 CA(); 933 - lp->last_restart = lp->stats.tx_packets; 936 + lp->last_restart = dev->stats.tx_packets; 934 937 } 935 938 netif_wake_queue(dev); 936 939 } ··· 1018 1021 dev->open = &i596_open; 1019 1022 dev->stop = &i596_close; 1020 1023 dev->hard_start_xmit = &i596_start_xmit; 1021 - dev->get_stats = &i596_get_stats; 1022 1024 dev->set_multicast_list = &set_multicast_list; 1023 1025 dev->watchdog_timeo = 5*HZ; 1024 1026 dev->tx_timeout = i596_tx_timeout; ··· 1074 1078 if (i596_debug) 1075 1079 print_eth(pa_to_va(tx_cmd_tbd->pa_data)); 1076 1080 } else { 1077 - lp->stats.tx_errors++; 1081 + dev->stats.tx_errors++; 1078 1082 if (i596_debug) 1079 1083 printk("transmission failure:%04x\n", 1080 1084 cmd->status); 1081 1085 if (cmd->status & 0x0020) 1082 - lp->stats.collisions++; 1086 + dev->stats.collisions++; 1083 1087 if (!(cmd->status & 0x0040)) 1084 - lp->stats.tx_heartbeat_errors++; 1088 + dev->stats.tx_heartbeat_errors++; 1085 1089 if (cmd->status & 0x0400) 1086 - lp->stats.tx_carrier_errors++; 1090 + dev->stats.tx_carrier_errors++; 1087 1091 if (cmd->status & 0x0800) 1088 - lp->stats.collisions++; 1092 + dev->stats.collisions++; 1089 1093 if (cmd->status & 0x1000) 1090 - lp->stats.tx_aborted_errors++; 1094 + dev->stats.tx_aborted_errors++; 1091 1095 } 1092 1096 dev_kfree_skb_irq(tx_cmd_tbd->skb); 1093 1097 ··· 1236 1240 remove_rx_bufs(dev); 1237 1241 1238 1242 return 0; 1239 - } 1240 - 1241 - static struct net_device_stats * i596_get_stats(struct net_device *dev) { 1242 - struct i596_private *lp = dev->priv; 1243 - 1244 - return &lp->stats; 1245 1243 } 1246 1244 1247 1245 /*
+24 -35
drivers/net/mace.c
··· 57 57 unsigned char tx_fullup; 58 58 unsigned char tx_active; 59 59 unsigned char tx_bad_runt; 60 - struct net_device_stats stats; 61 60 struct timer_list tx_timeout; 62 61 int timeout_active; 63 62 int port_aaui; ··· 77 78 static int mace_open(struct net_device *dev); 78 79 static int mace_close(struct net_device *dev); 79 80 static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev); 80 - static struct net_device_stats *mace_stats(struct net_device *dev); 81 81 static void mace_set_multicast(struct net_device *dev); 82 82 static void mace_reset(struct net_device *dev); 83 83 static int mace_set_address(struct net_device *dev, void *addr); ··· 186 188 mp->tx_cmds = (volatile struct dbdma_cmd *) DBDMA_ALIGN(mp + 1); 187 189 mp->rx_cmds = mp->tx_cmds + NCMDS_TX * N_TX_RING + 1; 188 190 189 - memset(&mp->stats, 0, sizeof(mp->stats)); 190 191 memset((char *) mp->tx_cmds, 0, 191 192 (NCMDS_TX*N_TX_RING + N_RX_RING + 2) * sizeof(struct dbdma_cmd)); 192 193 init_timer(&mp->tx_timeout); ··· 210 213 dev->open = mace_open; 211 214 dev->stop = mace_close; 212 215 dev->hard_start_xmit = mace_xmit_start; 213 - dev->get_stats = mace_stats; 214 216 dev->set_multicast_list = mace_set_multicast; 215 217 dev->set_mac_address = mace_set_address; 216 218 ··· 580 584 return 0; 581 585 } 582 586 583 - static struct net_device_stats *mace_stats(struct net_device *dev) 584 - { 585 - struct mace_data *p = (struct mace_data *) dev->priv; 586 - 587 - return &p->stats; 588 - } 589 - 590 587 static void mace_set_multicast(struct net_device *dev) 591 588 { 592 589 struct mace_data *mp = (struct mace_data *) dev->priv; ··· 633 644 spin_unlock_irqrestore(&mp->lock, flags); 634 645 } 635 646 636 - static void mace_handle_misc_intrs(struct mace_data *mp, int intr) 647 + static void mace_handle_misc_intrs(struct mace_data *mp, int intr, struct net_device *dev) 637 648 { 638 649 volatile struct mace __iomem *mb = mp->mace; 639 650 static int mace_babbles, mace_jabbers; 640 651 641 652 if (intr & MPCO) 642 - mp->stats.rx_missed_errors += 256; 643 - mp->stats.rx_missed_errors += in_8(&mb->mpc); /* reading clears it */ 653 + dev->stats.rx_missed_errors += 256; 654 + dev->stats.rx_missed_errors += in_8(&mb->mpc); /* reading clears it */ 644 655 if (intr & RNTPCO) 645 - mp->stats.rx_length_errors += 256; 646 - mp->stats.rx_length_errors += in_8(&mb->rntpc); /* reading clears it */ 656 + dev->stats.rx_length_errors += 256; 657 + dev->stats.rx_length_errors += in_8(&mb->rntpc); /* reading clears it */ 647 658 if (intr & CERR) 648 - ++mp->stats.tx_heartbeat_errors; 659 + ++dev->stats.tx_heartbeat_errors; 649 660 if (intr & BABBLE) 650 661 if (mace_babbles++ < 4) 651 662 printk(KERN_DEBUG "mace: babbling transmitter\n"); ··· 669 680 spin_lock_irqsave(&mp->lock, flags); 670 681 intr = in_8(&mb->ir); /* read interrupt register */ 671 682 in_8(&mb->xmtrc); /* get retries */ 672 - mace_handle_misc_intrs(mp, intr); 683 + mace_handle_misc_intrs(mp, intr, dev); 673 684 674 685 i = mp->tx_empty; 675 686 while (in_8(&mb->pr) & XMTSV) { ··· 682 693 */ 683 694 intr = in_8(&mb->ir); 684 695 if (intr != 0) 685 - mace_handle_misc_intrs(mp, intr); 696 + mace_handle_misc_intrs(mp, intr, dev); 686 697 if (mp->tx_bad_runt) { 687 698 fs = in_8(&mb->xmtfs); 688 699 mp->tx_bad_runt = 0; ··· 756 767 } 757 768 /* Update stats */ 758 769 if (fs & (UFLO|LCOL|LCAR|RTRY)) { 759 - ++mp->stats.tx_errors; 770 + ++dev->stats.tx_errors; 760 771 if (fs & LCAR) 761 - ++mp->stats.tx_carrier_errors; 772 + ++dev->stats.tx_carrier_errors; 762 773 if (fs & (UFLO|LCOL|RTRY)) 763 - ++mp->stats.tx_aborted_errors; 774 + ++dev->stats.tx_aborted_errors; 764 775 } else { 765 - mp->stats.tx_bytes += mp->tx_bufs[i]->len; 766 - ++mp->stats.tx_packets; 776 + dev->stats.tx_bytes += mp->tx_bufs[i]->len; 777 + ++dev->stats.tx_packets; 767 778 } 768 779 dev_kfree_skb_irq(mp->tx_bufs[i]); 769 780 --mp->tx_active; ··· 817 828 goto out; 818 829 819 830 /* update various counters */ 820 - mace_handle_misc_intrs(mp, in_8(&mb->ir)); 831 + mace_handle_misc_intrs(mp, in_8(&mb->ir), dev); 821 832 822 833 cp = mp->tx_cmds + NCMDS_TX * mp->tx_empty; 823 834 ··· 837 848 /* fix up the transmit side */ 838 849 i = mp->tx_empty; 839 850 mp->tx_active = 0; 840 - ++mp->stats.tx_errors; 851 + ++dev->stats.tx_errors; 841 852 if (mp->tx_bad_runt) { 842 853 mp->tx_bad_runt = 0; 843 854 } else if (i != mp->tx_fill) { ··· 905 916 /* got a packet, have a look at it */ 906 917 skb = mp->rx_bufs[i]; 907 918 if (skb == 0) { 908 - ++mp->stats.rx_dropped; 919 + ++dev->stats.rx_dropped; 909 920 } else if (nb > 8) { 910 921 data = skb->data; 911 922 frame_status = (data[nb-3] << 8) + data[nb-4]; 912 923 if (frame_status & (RS_OFLO|RS_CLSN|RS_FRAMERR|RS_FCSERR)) { 913 - ++mp->stats.rx_errors; 924 + ++dev->stats.rx_errors; 914 925 if (frame_status & RS_OFLO) 915 - ++mp->stats.rx_over_errors; 926 + ++dev->stats.rx_over_errors; 916 927 if (frame_status & RS_FRAMERR) 917 - ++mp->stats.rx_frame_errors; 928 + ++dev->stats.rx_frame_errors; 918 929 if (frame_status & RS_FCSERR) 919 - ++mp->stats.rx_crc_errors; 930 + ++dev->stats.rx_crc_errors; 920 931 } else { 921 932 /* Mace feature AUTO_STRIP_RCV is on by default, dropping the 922 933 * FCS on frames with 802.3 headers. This means that Ethernet ··· 928 939 nb -= 8; 929 940 skb_put(skb, nb); 930 941 skb->protocol = eth_type_trans(skb, dev); 931 - mp->stats.rx_bytes += skb->len; 942 + dev->stats.rx_bytes += skb->len; 932 943 netif_rx(skb); 933 944 dev->last_rx = jiffies; 934 945 mp->rx_bufs[i] = NULL; 935 - ++mp->stats.rx_packets; 946 + ++dev->stats.rx_packets; 936 947 } 937 948 } else { 938 - ++mp->stats.rx_errors; 939 - ++mp->stats.rx_length_errors; 949 + ++dev->stats.rx_errors; 950 + ++dev->stats.rx_length_errors; 940 951 } 941 952 942 953 /* advance to next */
+19 -30
drivers/net/macmace.c
··· 65 65 unsigned char *rx_ring; 66 66 dma_addr_t rx_ring_phys; 67 67 int dma_intr; 68 - struct net_device_stats stats; 69 68 int rx_slot, rx_tail; 70 69 int tx_slot, tx_sloti, tx_count; 71 70 int chipid; ··· 91 92 static int mace_open(struct net_device *dev); 92 93 static int mace_close(struct net_device *dev); 93 94 static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev); 94 - static struct net_device_stats *mace_stats(struct net_device *dev); 95 95 static void mace_set_multicast(struct net_device *dev); 96 96 static int mace_set_address(struct net_device *dev, void *addr); 97 97 static void mace_reset(struct net_device *dev); ··· 240 242 return -ENODEV; 241 243 } 242 244 243 - memset(&mp->stats, 0, sizeof(mp->stats)); 244 - 245 245 dev->open = mace_open; 246 246 dev->stop = mace_close; 247 247 dev->hard_start_xmit = mace_xmit_start; 248 248 dev->tx_timeout = mace_tx_timeout; 249 249 dev->watchdog_timeo = TX_TIMEOUT; 250 - dev->get_stats = mace_stats; 251 250 dev->set_multicast_list = mace_set_multicast; 252 251 dev->set_mac_address = mace_set_address; 253 252 ··· 467 472 mp->tx_count--; 468 473 local_irq_restore(flags); 469 474 470 - mp->stats.tx_packets++; 471 - mp->stats.tx_bytes += skb->len; 475 + dev->stats.tx_packets++; 476 + dev->stats.tx_bytes += skb->len; 472 477 473 478 /* We need to copy into our xmit buffer to take care of alignment and caching issues */ 474 479 skb_copy_from_linear_data(skb, mp->tx_ring, skb->len); ··· 485 490 486 491 dev->trans_start = jiffies; 487 492 return NETDEV_TX_OK; 488 - } 489 - 490 - static struct net_device_stats *mace_stats(struct net_device *dev) 491 - { 492 - struct mace_data *mp = netdev_priv(dev); 493 - return &mp->stats; 494 493 } 495 494 496 495 static void mace_set_multicast(struct net_device *dev) ··· 544 555 static int mace_babbles, mace_jabbers; 545 556 546 557 if (intr & MPCO) 547 - mp->stats.rx_missed_errors += 256; 548 - mp->stats.rx_missed_errors += mb->mpc; /* reading clears it */ 558 + dev->stats.rx_missed_errors += 256; 559 + dev->stats.rx_missed_errors += mb->mpc; /* reading clears it */ 549 560 if (intr & RNTPCO) 550 - mp->stats.rx_length_errors += 256; 551 - mp->stats.rx_length_errors += mb->rntpc; /* reading clears it */ 561 + dev->stats.rx_length_errors += 256; 562 + dev->stats.rx_length_errors += mb->rntpc; /* reading clears it */ 552 563 if (intr & CERR) 553 - ++mp->stats.tx_heartbeat_errors; 564 + ++dev->stats.tx_heartbeat_errors; 554 565 if (intr & BABBLE) 555 566 if (mace_babbles++ < 4) 556 567 printk(KERN_DEBUG "macmace: babbling transmitter\n"); ··· 589 600 } 590 601 /* Update stats */ 591 602 if (fs & (UFLO|LCOL|LCAR|RTRY)) { 592 - ++mp->stats.tx_errors; 603 + ++dev->stats.tx_errors; 593 604 if (fs & LCAR) 594 - ++mp->stats.tx_carrier_errors; 605 + ++dev->stats.tx_carrier_errors; 595 606 else if (fs & (UFLO|LCOL|RTRY)) { 596 - ++mp->stats.tx_aborted_errors; 607 + ++dev->stats.tx_aborted_errors; 597 608 if (mb->xmtfs & UFLO) { 598 609 printk(KERN_ERR "%s: DMA underrun.\n", dev->name); 599 - mp->stats.tx_fifo_errors++; 610 + dev->stats.tx_fifo_errors++; 600 611 mace_txdma_reset(dev); 601 612 } 602 613 } ··· 650 661 unsigned int frame_status = mf->rcvsts; 651 662 652 663 if (frame_status & (RS_OFLO | RS_CLSN | RS_FRAMERR | RS_FCSERR)) { 653 - mp->stats.rx_errors++; 664 + dev->stats.rx_errors++; 654 665 if (frame_status & RS_OFLO) { 655 666 printk(KERN_DEBUG "%s: fifo overflow.\n", dev->name); 656 - mp->stats.rx_fifo_errors++; 667 + dev->stats.rx_fifo_errors++; 657 668 } 658 669 if (frame_status & RS_CLSN) 659 - mp->stats.collisions++; 670 + dev->stats.collisions++; 660 671 if (frame_status & RS_FRAMERR) 661 - mp->stats.rx_frame_errors++; 672 + dev->stats.rx_frame_errors++; 662 673 if (frame_status & RS_FCSERR) 663 - mp->stats.rx_crc_errors++; 674 + dev->stats.rx_crc_errors++; 664 675 } else { 665 676 unsigned int frame_length = mf->rcvcnt + ((frame_status & 0x0F) << 8 ); 666 677 667 678 skb = dev_alloc_skb(frame_length + 2); 668 679 if (!skb) { 669 - mp->stats.rx_dropped++; 680 + dev->stats.rx_dropped++; 670 681 return; 671 682 } 672 683 skb_reserve(skb, 2); ··· 675 686 skb->protocol = eth_type_trans(skb, dev); 676 687 netif_rx(skb); 677 688 dev->last_rx = jiffies; 678 - mp->stats.rx_packets++; 679 - mp->stats.rx_bytes += frame_length; 689 + dev->stats.rx_packets++; 690 + dev->stats.rx_bytes += frame_length; 680 691 } 681 692 } 682 693
+10 -18
drivers/net/meth.c
··· 66 66 * packets in and out, so there is place for a packet 67 67 */ 68 68 struct meth_private { 69 - struct net_device_stats stats; 70 69 /* in-memory copy of MAC Control register */ 71 70 unsigned long mac_ctrl; 72 71 /* in-memory copy of DMA Control register */ ··· 400 401 printk(KERN_DEBUG "%s: bogus packet size: %ld, status=%#2lx.\n", 401 402 dev->name, priv->rx_write, 402 403 priv->rx_ring[priv->rx_write]->status.raw); 403 - priv->stats.rx_errors++; 404 - priv->stats.rx_length_errors++; 404 + dev->stats.rx_errors++; 405 + dev->stats.rx_length_errors++; 405 406 skb = priv->rx_skbs[priv->rx_write]; 406 407 } else { 407 408 skb = alloc_skb(METH_RX_BUFF_SIZE, GFP_ATOMIC); 408 409 if (!skb) { 409 410 /* Ouch! No memory! Drop packet on the floor */ 410 411 DPRINTK("No mem: dropping packet\n"); 411 - priv->stats.rx_dropped++; 412 + dev->stats.rx_dropped++; 412 413 skb = priv->rx_skbs[priv->rx_write]; 413 414 } else { 414 415 struct sk_buff *skb_c = priv->rx_skbs[priv->rx_write]; ··· 420 421 priv->rx_skbs[priv->rx_write] = skb; 421 422 skb_c->protocol = eth_type_trans(skb_c, dev); 422 423 dev->last_rx = jiffies; 423 - priv->stats.rx_packets++; 424 - priv->stats.rx_bytes += len; 424 + dev->stats.rx_packets++; 425 + dev->stats.rx_bytes += len; 425 426 netif_rx(skb_c); 426 427 } 427 428 } 428 429 } else { 429 - priv->stats.rx_errors++; 430 + dev->stats.rx_errors++; 430 431 skb=priv->rx_skbs[priv->rx_write]; 431 432 #if MFE_DEBUG>0 432 433 printk(KERN_WARNING "meth: RX error: status=0x%016lx\n",status); ··· 489 490 #endif 490 491 if (status & METH_TX_ST_DONE) { 491 492 if (status & METH_TX_ST_SUCCESS){ 492 - priv->stats.tx_packets++; 493 - priv->stats.tx_bytes += skb->len; 493 + dev->stats.tx_packets++; 494 + dev->stats.tx_bytes += skb->len; 494 495 } else { 495 - priv->stats.tx_errors++; 496 + dev->stats.tx_errors++; 496 497 #if MFE_DEBUG>=1 497 498 DPRINTK("TX error: status=%016lx <",status); 498 499 if(status & METH_TX_ST_SUCCESS) ··· 733 734 /* Try to reset the interface. */ 734 735 meth_reset(dev); 735 736 736 - priv->stats.tx_errors++; 737 + dev->stats.tx_errors++; 737 738 738 739 /* Clear all rings */ 739 740 meth_free_tx_ring(priv); ··· 772 773 /* 773 774 * Return statistics to the caller 774 775 */ 775 - static struct net_device_stats *meth_stats(struct net_device *dev) 776 - { 777 - struct meth_private *priv = netdev_priv(dev); 778 - return &priv->stats; 779 - } 780 - 781 776 /* 782 777 * The init function. 783 778 */ ··· 789 796 dev->stop = meth_release; 790 797 dev->hard_start_xmit = meth_tx; 791 798 dev->do_ioctl = meth_ioctl; 792 - dev->get_stats = meth_stats; 793 799 #ifdef HAVE_TX_TIMEOUT 794 800 dev->tx_timeout = meth_tx_timeout; 795 801 dev->watchdog_timeo = timeout;
+6 -20
drivers/net/mipsnet.c
··· 21 21 22 22 #define mipsnet_reg_address(dev, field) (dev->base_addr + field_offset(field)) 23 23 24 - struct mipsnet_priv { 25 - struct net_device_stats stats; 26 - }; 27 - 28 24 static char mipsnet_string[] = "mipsnet"; 29 25 30 26 /* ··· 45 49 { 46 50 int count_to_go = skb->len; 47 51 char *buf_ptr = skb->data; 48 - struct mipsnet_priv *mp = netdev_priv(dev); 49 52 50 53 pr_debug("%s: %s(): telling MIPSNET txDataCount(%d)\n", 51 54 dev->name, __FUNCTION__, skb->len); ··· 58 63 outb(*buf_ptr, mipsnet_reg_address(dev, txDataBuffer)); 59 64 } 60 65 61 - mp->stats.tx_packets++; 62 - mp->stats.tx_bytes += skb->len; 66 + dev->stats.tx_packets++; 67 + dev->stats.tx_bytes += skb->len; 63 68 64 69 return skb->len; 65 70 } ··· 82 87 { 83 88 struct sk_buff *skb; 84 89 size_t len = count; 85 - struct mipsnet_priv *mp = netdev_priv(dev); 86 90 87 91 if (!(skb = alloc_skb(len + 2, GFP_KERNEL))) { 88 - mp->stats.rx_dropped++; 92 + dev->stats.rx_dropped++; 89 93 return -ENOMEM; 90 94 } 91 95 ··· 99 105 dev->name, __FUNCTION__); 100 106 netif_rx(skb); 101 107 102 - mp->stats.rx_packets++; 103 - mp->stats.rx_bytes += len; 108 + dev->stats.rx_packets++; 109 + dev->stats.rx_bytes += len; 104 110 105 111 return count; 106 112 } ··· 197 203 return 0; 198 204 } 199 205 200 - static struct net_device_stats *mipsnet_get_stats(struct net_device *dev) 201 - { 202 - struct mipsnet_priv *mp = netdev_priv(dev); 203 - 204 - return &mp->stats; 205 - } 206 - 207 206 static void mipsnet_set_mclist(struct net_device *dev) 208 207 { 209 208 // we don't do anything ··· 208 221 struct net_device *netdev; 209 222 int err; 210 223 211 - netdev = alloc_etherdev(sizeof(struct mipsnet_priv)); 224 + netdev = alloc_etherdev(0); 212 225 if (!netdev) { 213 226 err = -ENOMEM; 214 227 goto out; ··· 219 232 netdev->open = mipsnet_open; 220 233 netdev->stop = mipsnet_close; 221 234 netdev->hard_start_xmit = mipsnet_xmit; 222 - netdev->get_stats = mipsnet_get_stats; 223 235 netdev->set_multicast_list = mipsnet_set_mclist; 224 236 225 237 /*
+3 -22
drivers/net/mv643xx_eth.c
··· 63 63 static int mv643xx_eth_open(struct net_device *); 64 64 static int mv643xx_eth_stop(struct net_device *); 65 65 static int mv643xx_eth_change_mtu(struct net_device *, int); 66 - static struct net_device_stats *mv643xx_eth_get_stats(struct net_device *); 67 66 static void eth_port_init_mac_tables(unsigned int eth_port_num); 68 67 #ifdef MV643XX_NAPI 69 68 static int mv643xx_poll(struct napi_struct *napi, int budget); ··· 340 341 341 342 if (cmd_sts & ETH_ERROR_SUMMARY) { 342 343 printk("%s: Error in TX\n", dev->name); 343 - mp->stats.tx_errors++; 344 + dev->stats.tx_errors++; 344 345 } 345 346 346 347 spin_unlock_irqrestore(&mp->lock, flags); ··· 387 388 static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) 388 389 { 389 390 struct mv643xx_private *mp = netdev_priv(dev); 390 - struct net_device_stats *stats = &mp->stats; 391 + struct net_device_stats *stats = &dev->stats; 391 392 unsigned int received_packets = 0; 392 393 struct sk_buff *skb; 393 394 struct pkt_info pkt_info; ··· 1191 1192 static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) 1192 1193 { 1193 1194 struct mv643xx_private *mp = netdev_priv(dev); 1194 - struct net_device_stats *stats = &mp->stats; 1195 + struct net_device_stats *stats = &dev->stats; 1195 1196 unsigned long flags; 1196 1197 1197 1198 BUG_ON(netif_queue_stopped(dev)); ··· 1225 1226 spin_unlock_irqrestore(&mp->lock, flags); 1226 1227 1227 1228 return 0; /* success */ 1228 - } 1229 - 1230 - /* 1231 - * mv643xx_eth_get_stats 1232 - * 1233 - * Returns a pointer to the interface statistics. 1234 - * 1235 - * Input : dev - a pointer to the required interface 1236 - * 1237 - * Output : a pointer to the interface's statistics 1238 - */ 1239 - 1240 - static struct net_device_stats *mv643xx_eth_get_stats(struct net_device *dev) 1241 - { 1242 - struct mv643xx_private *mp = netdev_priv(dev); 1243 - 1244 - return &mp->stats; 1245 1229 } 1246 1230 1247 1231 #ifdef CONFIG_NET_POLL_CONTROLLER ··· 1321 1339 dev->open = mv643xx_eth_open; 1322 1340 dev->stop = mv643xx_eth_stop; 1323 1341 dev->hard_start_xmit = mv643xx_eth_start_xmit; 1324 - dev->get_stats = mv643xx_eth_get_stats; 1325 1342 dev->set_mac_address = mv643xx_eth_set_mac_address; 1326 1343 dev->set_multicast_list = mv643xx_eth_set_rx_mode; 1327 1344
+8 -12
drivers/net/myri_sbus.c
··· 353 353 sbus_unmap_single(mp->myri_sdev, dma_addr, skb->len, SBUS_DMA_TODEVICE); 354 354 dev_kfree_skb(skb); 355 355 mp->tx_skbs[entry] = NULL; 356 - mp->enet_stats.tx_packets++; 356 + dev->stats.tx_packets++; 357 357 entry = NEXT_TX(entry); 358 358 } 359 359 mp->tx_old = entry; ··· 434 434 RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); 435 435 if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { 436 436 DRX(("ERROR[")); 437 - mp->enet_stats.rx_errors++; 437 + dev->stats.rx_errors++; 438 438 if (len < (ETH_HLEN + MYRI_PAD_LEN)) { 439 439 DRX(("BAD_LENGTH] ")); 440 - mp->enet_stats.rx_length_errors++; 440 + dev->stats.rx_length_errors++; 441 441 } else { 442 442 DRX(("NO_PADDING] ")); 443 - mp->enet_stats.rx_frame_errors++; 443 + dev->stats.rx_frame_errors++; 444 444 } 445 445 446 446 /* Return it to the LANAI. */ 447 447 drop_it: 448 448 drops++; 449 449 DRX(("DROP ")); 450 - mp->enet_stats.rx_dropped++; 450 + dev->stats.rx_dropped++; 451 451 sbus_dma_sync_single_for_device(mp->myri_sdev, 452 452 sbus_readl(&rxd->myri_scatters[0].addr), 453 453 RX_ALLOC_SIZE, ··· 527 527 netif_rx(skb); 528 528 529 529 dev->last_rx = jiffies; 530 - mp->enet_stats.rx_packets++; 531 - mp->enet_stats.rx_bytes += len; 530 + dev->stats.rx_packets++; 531 + dev->stats.rx_bytes += len; 532 532 next: 533 533 DRX(("NEXT\n")); 534 534 entry = NEXT_RX(entry); ··· 596 596 597 597 printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name); 598 598 599 - mp->enet_stats.tx_errors++; 599 + dev->stats.tx_errors++; 600 600 myri_init(mp, 0); 601 601 netif_wake_queue(dev); 602 602 } ··· 805 805 dev->mtu = new_mtu; 806 806 return 0; 807 807 } 808 - 809 - static struct net_device_stats *myri_get_stats(struct net_device *dev) 810 - { return &(((struct myri_eth *)dev->priv)->enet_stats); } 811 808 812 809 static void myri_set_multicast(struct net_device *dev) 813 810 { ··· 1057 1060 dev->hard_start_xmit = &myri_start_xmit; 1058 1061 dev->tx_timeout = &myri_tx_timeout; 1059 1062 dev->watchdog_timeo = 5*HZ; 1060 - dev->get_stats = &myri_get_stats; 1061 1063 dev->set_multicast_list = &myri_set_multicast; 1062 1064 dev->irq = sdev->irqs[0]; 1063 1065
-1
drivers/net/myri_sbus.h
··· 280 280 void __iomem *lregs; /* Quick ptr to LANAI regs. */ 281 281 struct sk_buff *rx_skbs[RX_RING_SIZE+1];/* RX skb's */ 282 282 struct sk_buff *tx_skbs[TX_RING_SIZE]; /* TX skb's */ 283 - struct net_device_stats enet_stats; /* Interface stats. */ 284 283 285 284 /* These are less frequently accessed. */ 286 285 void __iomem *regs; /* MyriCOM register space. */
+5 -13
drivers/net/netx-eth.c
··· 97 97 struct netx_eth_priv { 98 98 void __iomem *sram_base, *xpec_base, *xmac_base; 99 99 int id; 100 - struct net_device_stats stats; 101 100 struct mii_if_info mii; 102 101 u32 msg_enable; 103 102 struct xc *xc; ··· 128 129 FIFO_PTR_FRAMELEN(len)); 129 130 130 131 ndev->trans_start = jiffies; 131 - priv->stats.tx_packets++; 132 - priv->stats.tx_bytes += skb->len; 132 + dev->stats.tx_packets++; 133 + dev->stats.tx_bytes += skb->len; 133 134 134 135 netif_stop_queue(ndev); 135 136 spin_unlock_irq(&priv->lock); ··· 155 156 if (unlikely(skb == NULL)) { 156 157 printk(KERN_NOTICE "%s: Low memory, packet dropped.\n", 157 158 ndev->name); 158 - priv->stats.rx_dropped++; 159 + dev->stats.rx_dropped++; 159 160 return; 160 161 } 161 162 ··· 169 170 ndev->last_rx = jiffies; 170 171 skb->protocol = eth_type_trans(skb, ndev); 171 172 netif_rx(skb); 172 - priv->stats.rx_packets++; 173 - priv->stats.rx_bytes += len; 173 + dev->stats.rx_packets++; 174 + dev->stats.rx_bytes += len; 174 175 } 175 176 176 177 static irqreturn_t ··· 207 208 } 208 209 spin_unlock_irqrestore(&priv->lock, flags); 209 210 return IRQ_HANDLED; 210 - } 211 - 212 - static struct net_device_stats *netx_eth_query_statistics(struct net_device *ndev) 213 - { 214 - struct netx_eth_priv *priv = netdev_priv(ndev); 215 - return &priv->stats; 216 211 } 217 212 218 213 static int netx_eth_open(struct net_device *ndev) ··· 316 323 ndev->hard_start_xmit = netx_eth_hard_start_xmit; 317 324 ndev->tx_timeout = netx_eth_timeout; 318 325 ndev->watchdog_timeo = msecs_to_jiffies(5000); 319 - ndev->get_stats = netx_eth_query_statistics; 320 326 ndev->set_multicast_list = netx_eth_set_multicast_list; 321 327 322 328 priv->msg_enable = NETIF_MSG_LINK;
+13 -34
drivers/net/ni5010.c
··· 89 89 90 90 /* Information that needs to be kept for each board. */ 91 91 struct ni5010_local { 92 - struct net_device_stats stats; 93 92 int o_pkt_size; 94 93 spinlock_t lock; 95 94 }; ··· 102 103 static void ni5010_rx(struct net_device *dev); 103 104 static void ni5010_timeout(struct net_device *dev); 104 105 static int ni5010_close(struct net_device *dev); 105 - static struct net_device_stats *ni5010_get_stats(struct net_device *dev); 106 106 static void ni5010_set_multicast_list(struct net_device *dev); 107 107 static void reset_receiver(struct net_device *dev); 108 108 ··· 332 334 dev->open = ni5010_open; 333 335 dev->stop = ni5010_close; 334 336 dev->hard_start_xmit = ni5010_send_packet; 335 - dev->get_stats = ni5010_get_stats; 336 337 dev->set_multicast_list = ni5010_set_multicast_list; 337 338 dev->tx_timeout = ni5010_timeout; 338 339 dev->watchdog_timeo = HZ/20; ··· 529 532 530 533 if ( (rcv_stat & RS_VALID_BITS) != RS_PKT_OK) { 531 534 PRINTK((KERN_INFO "%s: receive error.\n", dev->name)); 532 - lp->stats.rx_errors++; 533 - if (rcv_stat & RS_RUNT) lp->stats.rx_length_errors++; 534 - if (rcv_stat & RS_ALIGN) lp->stats.rx_frame_errors++; 535 - if (rcv_stat & RS_CRC_ERR) lp->stats.rx_crc_errors++; 536 - if (rcv_stat & RS_OFLW) lp->stats.rx_fifo_errors++; 535 + dev->stats.rx_errors++; 536 + if (rcv_stat & RS_RUNT) dev->stats.rx_length_errors++; 537 + if (rcv_stat & RS_ALIGN) dev->stats.rx_frame_errors++; 538 + if (rcv_stat & RS_CRC_ERR) dev->stats.rx_crc_errors++; 539 + if (rcv_stat & RS_OFLW) dev->stats.rx_fifo_errors++; 537 540 outb(0xff, EDLC_RCLR); /* Clear the interrupt */ 538 541 return; 539 542 } ··· 544 547 if (i_pkt_size > ETH_FRAME_LEN || i_pkt_size < 10 ) { 545 548 PRINTK((KERN_DEBUG "%s: Packet size error, packet size = %#4.4x\n", 546 549 dev->name, i_pkt_size)); 547 - lp->stats.rx_errors++; 548 - lp->stats.rx_length_errors++; 550 + dev->stats.rx_errors++; 551 + dev->stats.rx_length_errors++; 549 552 return; 550 553 } 551 554 ··· 553 556 skb = dev_alloc_skb(i_pkt_size + 3); 554 557 if (skb == NULL) { 555 558 printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); 556 - lp->stats.rx_dropped++; 559 + dev->stats.rx_dropped++; 557 560 return; 558 561 } 559 562 ··· 570 573 skb->protocol = eth_type_trans(skb,dev); 571 574 netif_rx(skb); 572 575 dev->last_rx = jiffies; 573 - lp->stats.rx_packets++; 574 - lp->stats.rx_bytes += i_pkt_size; 576 + dev->stats.rx_packets++; 577 + dev->stats.rx_bytes += i_pkt_size; 575 578 576 579 PRINTK2((KERN_DEBUG "%s: Received packet, size=%#4.4x\n", 577 580 dev->name, i_pkt_size)); ··· 599 602 /* outb(0, IE_MMODE); */ /* xmt buf on sysbus FIXME: needed ? */ 600 603 outb(MM_EN_XMT | MM_MUX, IE_MMODE); 601 604 outb(XM_ALL, EDLC_XMASK); /* Enable xmt IRQ's */ 602 - lp->stats.collisions++; 605 + dev->stats.collisions++; 603 606 return 1; 604 607 } 605 608 606 609 /* FIXME: handle other xmt error conditions */ 607 610 608 - lp->stats.tx_packets++; 609 - lp->stats.tx_bytes += lp->o_pkt_size; 611 + dev->stats.tx_packets++; 612 + dev->stats.tx_bytes += lp->o_pkt_size; 610 613 netif_wake_queue(dev); 611 614 612 615 PRINTK2((KERN_DEBUG "%s: sent packet, size=%#4.4x\n", ··· 633 636 PRINTK((KERN_DEBUG "%s: %s closed down\n", dev->name, boardname)); 634 637 return 0; 635 638 636 - } 637 - 638 - /* Get the current statistics. This may be called with the card open or 639 - closed. */ 640 - static struct net_device_stats *ni5010_get_stats(struct net_device *dev) 641 - { 642 - struct ni5010_local *lp = netdev_priv(dev); 643 - 644 - PRINTK2((KERN_DEBUG "%s: entering ni5010_get_stats\n", dev->name)); 645 - 646 - if (NI5010_DEBUG) ni5010_show_registers(dev); 647 - 648 - /* cli(); */ 649 - /* Update the statistics from the device registers. */ 650 - /* We do this in the interrupt handler */ 651 - /* sti(); */ 652 - 653 - return &lp->stats; 654 639 } 655 640 656 641 /* Set or clear the multicast filter for this adaptor.
+4 -13
drivers/net/pasemi_mac.c
··· 530 530 } else 531 531 skb->ip_summed = CHECKSUM_NONE; 532 532 533 - mac->stats.rx_bytes += len; 534 - mac->stats.rx_packets++; 533 + mac->netdev->stats.rx_bytes += len; 534 + mac->netdev->stats.rx_packets++; 535 535 536 536 skb->protocol = eth_type_trans(skb, mac->netdev); 537 537 netif_receive_skb(skb); ··· 1032 1032 info->skb = skb; 1033 1033 1034 1034 txring->next_to_fill++; 1035 - mac->stats.tx_packets++; 1036 - mac->stats.tx_bytes += skb->len; 1035 + dev->stats.tx_packets++; 1036 + dev->stats.tx_bytes += skb->len; 1037 1037 1038 1038 spin_unlock_irqrestore(&txring->lock, flags); 1039 1039 ··· 1046 1046 pci_unmap_single(mac->dma_pdev, map, skb->len, PCI_DMA_TODEVICE); 1047 1047 return NETDEV_TX_BUSY; 1048 1048 } 1049 - 1050 - static struct net_device_stats *pasemi_mac_get_stats(struct net_device *dev) 1051 - { 1052 - struct pasemi_mac *mac = netdev_priv(dev); 1053 - 1054 - return &mac->stats; 1055 - } 1056 - 1057 1049 1058 1050 static void pasemi_mac_set_rx_mode(struct net_device *dev) 1059 1051 { ··· 1215 1223 dev->open = pasemi_mac_open; 1216 1224 dev->stop = pasemi_mac_close; 1217 1225 dev->hard_start_xmit = pasemi_mac_start_tx; 1218 - dev->get_stats = pasemi_mac_get_stats; 1219 1226 dev->set_multicast_list = pasemi_mac_set_rx_mode; 1220 1227 1221 1228 err = pasemi_mac_map_regs(mac);
-1
drivers/net/pasemi_mac.h
··· 60 60 struct pci_dev *iob_pdev; 61 61 struct phy_device *phydev; 62 62 struct napi_struct napi; 63 - struct net_device_stats stats; 64 63 65 64 /* Pointer to the cacheable per-channel status registers */ 66 65 u64 *rx_status;
+23 -51
drivers/net/pci-skeleton.c
··· 457 457 void *mmio_addr; 458 458 int drv_flags; 459 459 struct pci_dev *pci_dev; 460 - struct net_device_stats stats; 461 460 struct timer_list timer; /* Media selection timer. */ 462 461 unsigned char *rx_ring; 463 462 unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */ ··· 504 505 static irqreturn_t netdrv_interrupt (int irq, void *dev_instance); 505 506 static int netdrv_close (struct net_device *dev); 506 507 static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); 507 - static struct net_device_stats *netdrv_get_stats (struct net_device *dev); 508 508 static void netdrv_set_rx_mode (struct net_device *dev); 509 509 static void netdrv_hw_start (struct net_device *dev); 510 510 ··· 773 775 dev->open = netdrv_open; 774 776 dev->hard_start_xmit = netdrv_start_xmit; 775 777 dev->stop = netdrv_close; 776 - dev->get_stats = netdrv_get_stats; 777 778 dev->set_multicast_list = netdrv_set_rx_mode; 778 779 dev->do_ioctl = netdrv_ioctl; 779 780 dev->tx_timeout = netdrv_tx_timeout; ··· 1273 1276 if (rp->skb) { 1274 1277 dev_kfree_skb (rp->skb); 1275 1278 rp->skb = NULL; 1276 - tp->stats.tx_dropped++; 1279 + dev->stats.tx_dropped++; 1277 1280 } 1278 1281 } 1279 1282 } ··· 1386 1389 /* There was an major error, log it. */ 1387 1390 DPRINTK ("%s: Transmit error, Tx status %8.8x.\n", 1388 1391 dev->name, txstatus); 1389 - tp->stats.tx_errors++; 1392 + dev->stats.tx_errors++; 1390 1393 if (txstatus & TxAborted) { 1391 - tp->stats.tx_aborted_errors++; 1394 + dev->stats.tx_aborted_errors++; 1392 1395 NETDRV_W32 (TxConfig, TxClearAbt | (TX_DMA_BURST << TxDMAShift)); 1393 1396 } 1394 1397 if (txstatus & TxCarrierLost) 1395 - tp->stats.tx_carrier_errors++; 1398 + dev->stats.tx_carrier_errors++; 1396 1399 if (txstatus & TxOutOfWindow) 1397 - tp->stats.tx_window_errors++; 1400 + dev->stats.tx_window_errors++; 1398 1401 } else { 1399 1402 if (txstatus & TxUnderrun) { 1400 1403 /* Add 64 to the Tx FIFO threshold. */ 1401 1404 if (tp->tx_flag < 0x00300000) 1402 1405 tp->tx_flag += 0x00020000; 1403 - tp->stats.tx_fifo_errors++; 1406 + dev->stats.tx_fifo_errors++; 1404 1407 } 1405 - tp->stats.collisions += (txstatus >> 24) & 15; 1406 - tp->stats.tx_bytes += txstatus & 0x7ff; 1407 - tp->stats.tx_packets++; 1408 + dev->stats.collisions += (txstatus >> 24) & 15; 1409 + dev->stats.tx_bytes += txstatus & 0x7ff; 1410 + dev->stats.tx_packets++; 1408 1411 } 1409 1412 1410 1413 /* Free the original skb. */ ··· 1457 1460 dev->name, rx_status); 1458 1461 /* A.C.: The chip hangs here. */ 1459 1462 } 1460 - tp->stats.rx_errors++; 1463 + dev->stats.rx_errors++; 1461 1464 if (rx_status & (RxBadSymbol | RxBadAlign)) 1462 - tp->stats.rx_frame_errors++; 1465 + dev->stats.rx_frame_errors++; 1463 1466 if (rx_status & (RxRunt | RxTooLong)) 1464 - tp->stats.rx_length_errors++; 1467 + dev->stats.rx_length_errors++; 1465 1468 if (rx_status & RxCRCErr) 1466 - tp->stats.rx_crc_errors++; 1469 + dev->stats.rx_crc_errors++; 1467 1470 /* Reset the receiver, based on RealTek recommendation. (Bug?) */ 1468 1471 tp->cur_rx = 0; 1469 1472 ··· 1569 1572 skb->protocol = eth_type_trans (skb, dev); 1570 1573 netif_rx (skb); 1571 1574 dev->last_rx = jiffies; 1572 - tp->stats.rx_bytes += pkt_size; 1573 - tp->stats.rx_packets++; 1575 + dev->stats.rx_bytes += pkt_size; 1576 + dev->stats.rx_packets++; 1574 1577 } else { 1575 1578 printk (KERN_WARNING 1576 1579 "%s: Memory squeeze, dropping packet.\n", 1577 1580 dev->name); 1578 - tp->stats.rx_dropped++; 1581 + dev->stats.rx_dropped++; 1579 1582 } 1580 1583 1581 1584 cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; ··· 1604 1607 assert (ioaddr != NULL); 1605 1608 1606 1609 /* Update the error count. */ 1607 - tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1610 + dev->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1608 1611 NETDRV_W32 (RxMissed, 0); 1609 1612 1610 1613 if ((status & RxUnderrun) && link_changed && ··· 1625 1628 /* XXX along with netdrv_rx_err, are we double-counting errors? */ 1626 1629 if (status & 1627 1630 (RxUnderrun | RxOverflow | RxErr | RxFIFOOver)) 1628 - tp->stats.rx_errors++; 1631 + dev->stats.rx_errors++; 1629 1632 1630 1633 if (status & (PCSTimeout)) 1631 - tp->stats.rx_length_errors++; 1634 + dev->stats.rx_length_errors++; 1632 1635 if (status & (RxUnderrun | RxFIFOOver)) 1633 - tp->stats.rx_fifo_errors++; 1636 + dev->stats.rx_fifo_errors++; 1634 1637 if (status & RxOverflow) { 1635 - tp->stats.rx_over_errors++; 1638 + dev->stats.rx_over_errors++; 1636 1639 tp->cur_rx = NETDRV_R16 (RxBufAddr) % RX_BUF_LEN; 1637 1640 NETDRV_W16_F (RxBufPtr, tp->cur_rx - 16); 1638 1641 } ··· 1736 1739 NETDRV_W16 (IntrMask, 0x0000); 1737 1740 1738 1741 /* Update the error counts. */ 1739 - tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1742 + dev->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1740 1743 NETDRV_W32 (RxMissed, 0); 1741 1744 1742 1745 spin_unlock_irqrestore (&tp->lock, flags); ··· 1801 1804 1802 1805 DPRINTK ("EXIT, returning %d\n", rc); 1803 1806 return rc; 1804 - } 1805 - 1806 - 1807 - static struct net_device_stats *netdrv_get_stats (struct net_device *dev) 1808 - { 1809 - struct netdrv_private *tp = dev->priv; 1810 - void *ioaddr = tp->mmio_addr; 1811 - 1812 - DPRINTK ("ENTER\n"); 1813 - 1814 - assert (tp != NULL); 1815 - 1816 - if (netif_running(dev)) { 1817 - unsigned long flags; 1818 - 1819 - spin_lock_irqsave (&tp->lock, flags); 1820 - 1821 - tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1822 - NETDRV_W32 (RxMissed, 0); 1823 - 1824 - spin_unlock_irqrestore (&tp->lock, flags); 1825 - } 1826 - 1827 - DPRINTK ("EXIT\n"); 1828 - return &tp->stats; 1829 1807 } 1830 1808 1831 1809 /* Set or clear the multicast filter for this adaptor. ··· 1880 1908 NETDRV_W8 (ChipCmd, (NETDRV_R8 (ChipCmd) & ChipCmdClear)); 1881 1909 1882 1910 /* Update the error counts. */ 1883 - tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1911 + dev->stats.rx_missed_errors += NETDRV_R32 (RxMissed); 1884 1912 NETDRV_W32 (RxMissed, 0); 1885 1913 1886 1914 spin_unlock_irqrestore (&tp->lock, flags);
+10 -22
drivers/net/plip.c
··· 154 154 struct hh_cache *hh); 155 155 static int plip_open(struct net_device *dev); 156 156 static int plip_close(struct net_device *dev); 157 - static struct net_device_stats *plip_get_stats(struct net_device *dev); 158 157 static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 159 158 static int plip_preempt(void *handle); 160 159 static void plip_wakeup(void *handle); ··· 205 206 }; 206 207 207 208 struct net_local { 208 - struct net_device_stats enet_stats; 209 209 struct net_device *dev; 210 210 struct work_struct immediate; 211 211 struct delayed_work deferred; ··· 283 285 dev->hard_start_xmit = plip_tx_packet; 284 286 dev->open = plip_open; 285 287 dev->stop = plip_close; 286 - dev->get_stats = plip_get_stats; 287 288 dev->do_ioctl = plip_ioctl; 288 289 dev->header_cache_update = NULL; 289 290 dev->tx_queue_len = 10; ··· 427 430 dev->name, snd->state, c0); 428 431 } else 429 432 error = HS_TIMEOUT; 430 - nl->enet_stats.tx_errors++; 431 - nl->enet_stats.tx_aborted_errors++; 433 + dev->stats.tx_errors++; 434 + dev->stats.tx_aborted_errors++; 432 435 } else if (nl->connection == PLIP_CN_RECEIVE) { 433 436 if (rcv->state == PLIP_PK_TRIGGER) { 434 437 /* Transmission was interrupted. */ ··· 445 448 printk(KERN_WARNING "%s: receive timeout(%d,%02x)\n", 446 449 dev->name, rcv->state, c0); 447 450 } 448 - nl->enet_stats.rx_dropped++; 451 + dev->stats.rx_dropped++; 449 452 } 450 453 rcv->state = PLIP_PK_DONE; 451 454 if (rcv->skb) { ··· 658 661 &rcv->nibble, &rcv->data)) 659 662 return TIMEOUT; 660 663 if (rcv->data != rcv->checksum) { 661 - nl->enet_stats.rx_crc_errors++; 664 + dev->stats.rx_crc_errors++; 662 665 if (net_debug) 663 666 printk(KERN_DEBUG "%s: checksum error\n", dev->name); 664 667 return ERROR; ··· 670 673 rcv->skb->protocol=plip_type_trans(rcv->skb, dev); 671 674 netif_rx(rcv->skb); 672 675 dev->last_rx = jiffies; 673 - nl->enet_stats.rx_bytes += rcv->length.h; 674 - nl->enet_stats.rx_packets++; 676 + dev->stats.rx_bytes += rcv->length.h; 677 + dev->stats.rx_packets++; 675 678 rcv->skb = NULL; 676 679 if (net_debug > 2) 677 680 printk(KERN_DEBUG "%s: receive end\n", dev->name); ··· 773 776 if (nl->connection == PLIP_CN_RECEIVE) { 774 777 spin_unlock_irq(&nl->lock); 775 778 /* Interrupted. */ 776 - nl->enet_stats.collisions++; 779 + dev->stats.collisions++; 777 780 return OK; 778 781 } 779 782 c0 = read_status(dev); ··· 789 792 {enable,disable}_irq *counts* 790 793 them. -- AV */ 791 794 ENABLE(dev->irq); 792 - nl->enet_stats.collisions++; 795 + dev->stats.collisions++; 793 796 return OK; 794 797 } 795 798 disable_parport_interrupts (dev); ··· 837 840 &snd->nibble, snd->checksum)) 838 841 return TIMEOUT; 839 842 840 - nl->enet_stats.tx_bytes += snd->skb->len; 843 + dev->stats.tx_bytes += snd->skb->len; 841 844 dev_kfree_skb(snd->skb); 842 - nl->enet_stats.tx_packets++; 845 + dev->stats.tx_packets++; 843 846 snd->state = PLIP_PK_DONE; 844 847 845 848 case PLIP_PK_DONE: ··· 1194 1197 } 1195 1198 1196 1199 return; 1197 - } 1198 - 1199 - static struct net_device_stats * 1200 - plip_get_stats(struct net_device *dev) 1201 - { 1202 - struct net_local *nl = netdev_priv(dev); 1203 - struct net_device_stats *r = &nl->enet_stats; 1204 - 1205 - return r; 1206 1200 } 1207 1201 1208 1202 static int
+8 -15
drivers/net/qla3xxx.c
··· 2053 2053 if(mac_rsp->flags & OB_MAC_IOCB_RSP_S) { 2054 2054 printk(KERN_ERR "Frame too short to be legal, frame not sent.\n"); 2055 2055 2056 - qdev->stats.tx_errors++; 2056 + qdev->ndev->stats.tx_errors++; 2057 2057 retval = -EIO; 2058 2058 goto frame_not_sent; 2059 2059 } ··· 2061 2061 if(tx_cb->seg_count == 0) { 2062 2062 printk(KERN_ERR "tx_cb->seg_count == 0: %d\n", mac_rsp->transaction_id); 2063 2063 2064 - qdev->stats.tx_errors++; 2064 + qdev->ndev->stats.tx_errors++; 2065 2065 retval = -EIO; 2066 2066 goto invalid_seg_count; 2067 2067 } ··· 2080 2080 PCI_DMA_TODEVICE); 2081 2081 } 2082 2082 } 2083 - qdev->stats.tx_packets++; 2084 - qdev->stats.tx_bytes += tx_cb->skb->len; 2083 + qdev->ndev->stats.tx_packets++; 2084 + qdev->ndev->stats.tx_bytes += tx_cb->skb->len; 2085 2085 2086 2086 frame_not_sent: 2087 2087 dev_kfree_skb_irq(tx_cb->skb); ··· 2140 2140 lrg_buf_cb2 = ql_get_lbuf(qdev); 2141 2141 skb = lrg_buf_cb2->skb; 2142 2142 2143 - qdev->stats.rx_packets++; 2144 - qdev->stats.rx_bytes += length; 2143 + qdev->ndev->stats.rx_packets++; 2144 + qdev->ndev->stats.rx_bytes += length; 2145 2145 2146 2146 skb_put(skb, length); 2147 2147 pci_unmap_single(qdev->pdev, ··· 2225 2225 skb2->protocol = eth_type_trans(skb2, qdev->ndev); 2226 2226 2227 2227 netif_receive_skb(skb2); 2228 - qdev->stats.rx_packets++; 2229 - qdev->stats.rx_bytes += length; 2228 + ndev->stats.rx_packets++; 2229 + ndev->stats.rx_bytes += length; 2230 2230 ndev->last_rx = jiffies; 2231 2231 lrg_buf_cb2->skb = NULL; 2232 2232 ··· 3753 3753 return (ql_adapter_up(qdev)); 3754 3754 } 3755 3755 3756 - static struct net_device_stats *ql3xxx_get_stats(struct net_device *dev) 3757 - { 3758 - struct ql3_adapter *qdev = (struct ql3_adapter *)dev->priv; 3759 - return &qdev->stats; 3760 - } 3761 - 3762 3756 static void ql3xxx_set_multicast_list(struct net_device *ndev) 3763 3757 { 3764 3758 /* ··· 4042 4048 ndev->open = ql3xxx_open; 4043 4049 ndev->hard_start_xmit = ql3xxx_send; 4044 4050 ndev->stop = ql3xxx_close; 4045 - ndev->get_stats = ql3xxx_get_stats; 4046 4051 ndev->set_multicast_list = ql3xxx_set_multicast_list; 4047 4052 SET_ETHTOOL_OPS(ndev, &ql3xxx_ethtool_ops); 4048 4053 ndev->set_mac_address = ql3xxx_set_mac_address;
-1
drivers/net/qla3xxx.h
··· 1283 1283 u32 update_ob_opcode; /* Opcode to use for updating NCB */ 1284 1284 u32 mb_bit_mask; /* MA Bits mask to use on transmission */ 1285 1285 u32 numPorts; 1286 - struct net_device_stats stats; 1287 1286 struct workqueue_struct *workqueue; 1288 1287 struct delayed_work reset_work; 1289 1288 struct delayed_work tx_timeout_work;
+6 -14
drivers/net/rionet.c
··· 53 53 struct rio_mport *mport; 54 54 struct sk_buff *rx_skb[RIONET_RX_RING_SIZE]; 55 55 struct sk_buff *tx_skb[RIONET_TX_RING_SIZE]; 56 - struct net_device_stats stats; 57 56 int rx_slot; 58 57 int tx_slot; 59 58 int tx_cnt; ··· 90 91 #define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001) 91 92 #define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) 92 93 93 - static struct net_device_stats *rionet_stats(struct net_device *ndev) 94 - { 95 - struct rionet_private *rnet = ndev->priv; 96 - return &rnet->stats; 97 - } 98 - 99 94 static int rionet_rx_clean(struct net_device *ndev) 100 95 { 101 96 int i; ··· 113 120 error = netif_rx(rnet->rx_skb[i]); 114 121 115 122 if (error == NET_RX_DROP) { 116 - rnet->stats.rx_dropped++; 123 + ndev->stats.rx_dropped++; 117 124 } else if (error == NET_RX_BAD) { 118 125 if (netif_msg_rx_err(rnet)) 119 126 printk(KERN_WARNING "%s: bad rx packet\n", 120 127 DRV_NAME); 121 - rnet->stats.rx_errors++; 128 + ndev->stats.rx_errors++; 122 129 } else { 123 - rnet->stats.rx_packets++; 124 - rnet->stats.rx_bytes += RIO_MAX_MSG_SIZE; 130 + ndev->stats.rx_packets++; 131 + ndev->stats.rx_bytes += RIO_MAX_MSG_SIZE; 125 132 } 126 133 127 134 } while ((i = (i + 1) % RIONET_RX_RING_SIZE) != rnet->rx_slot); ··· 156 163 rio_add_outb_message(rnet->mport, rdev, 0, skb->data, skb->len); 157 164 rnet->tx_skb[rnet->tx_slot] = skb; 158 165 159 - rnet->stats.tx_packets++; 160 - rnet->stats.tx_bytes += skb->len; 166 + ndev->stats.tx_packets++; 167 + ndev->stats.tx_bytes += skb->len; 161 168 162 169 if (++rnet->tx_cnt == RIONET_TX_RING_SIZE) 163 170 netif_stop_queue(ndev); ··· 459 466 ndev->open = &rionet_open; 460 467 ndev->hard_start_xmit = &rionet_start_xmit; 461 468 ndev->stop = &rionet_close; 462 - ndev->get_stats = &rionet_stats; 463 469 ndev->mtu = RIO_MAX_MSG_SIZE - 14; 464 470 ndev->features = NETIF_F_LLTX; 465 471 SET_ETHTOOL_OPS(ndev, &rionet_ethtool_ops);
+10 -21
drivers/net/rrunner.c
··· 126 126 dev->open = &rr_open; 127 127 dev->hard_start_xmit = &rr_start_xmit; 128 128 dev->stop = &rr_close; 129 - dev->get_stats = &rr_get_stats; 130 129 dev->do_ioctl = &rr_ioctl; 131 130 132 131 dev->base_addr = pci_resource_start(pdev, 0); ··· 807 808 case E_CON_REJ: 808 809 printk(KERN_WARNING "%s: Connection rejected\n", 809 810 dev->name); 810 - rrpriv->stats.tx_aborted_errors++; 811 + dev->stats.tx_aborted_errors++; 811 812 break; 812 813 case E_CON_TMOUT: 813 814 printk(KERN_WARNING "%s: Connection timeout\n", ··· 816 817 case E_DISC_ERR: 817 818 printk(KERN_WARNING "%s: HIPPI disconnect error\n", 818 819 dev->name); 819 - rrpriv->stats.tx_aborted_errors++; 820 + dev->stats.tx_aborted_errors++; 820 821 break; 821 822 case E_INT_PRTY: 822 823 printk(KERN_ERR "%s: HIPPI Internal Parity error\n", ··· 832 833 case E_TX_LINK_DROP: 833 834 printk(KERN_WARNING "%s: Link lost during transmit\n", 834 835 dev->name); 835 - rrpriv->stats.tx_aborted_errors++; 836 + dev->stats.tx_aborted_errors++; 836 837 writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, 837 838 &regs->HostCtrl); 838 839 wmb(); ··· 972 973 printk("len %x, mode %x\n", pkt_len, desc->mode); 973 974 #endif 974 975 if ( (rrpriv->rx_ring[index].mode & PACKET_BAD) == PACKET_BAD){ 975 - rrpriv->stats.rx_dropped++; 976 + dev->stats.rx_dropped++; 976 977 goto defer; 977 978 } 978 979 ··· 985 986 skb = alloc_skb(pkt_len, GFP_ATOMIC); 986 987 if (skb == NULL){ 987 988 printk(KERN_WARNING "%s: Unable to allocate skb (%i bytes), deferring packet\n", dev->name, pkt_len); 988 - rrpriv->stats.rx_dropped++; 989 + dev->stats.rx_dropped++; 989 990 goto defer; 990 991 } else { 991 992 pci_dma_sync_single_for_cpu(rrpriv->pci_dev, ··· 1023 1024 } else { 1024 1025 printk("%s: Out of memory, deferring " 1025 1026 "packet\n", dev->name); 1026 - rrpriv->stats.rx_dropped++; 1027 + dev->stats.rx_dropped++; 1027 1028 goto defer; 1028 1029 } 1029 1030 } ··· 1032 1033 netif_rx(skb); /* send it up */ 1033 1034 1034 1035 dev->last_rx = jiffies; 1035 - rrpriv->stats.rx_packets++; 1036 - rrpriv->stats.rx_bytes += pkt_len; 1036 + dev->stats.rx_packets++; 1037 + dev->stats.rx_bytes += pkt_len; 1037 1038 } 1038 1039 defer: 1039 1040 desc->mode = 0; ··· 1101 1102 desc = &(rrpriv->tx_ring[txcon]); 1102 1103 skb = rrpriv->tx_skbuff[txcon]; 1103 1104 1104 - rrpriv->stats.tx_packets++; 1105 - rrpriv->stats.tx_bytes += skb->len; 1105 + dev->stats.tx_packets++; 1106 + dev->stats.tx_bytes += skb->len; 1106 1107 1107 1108 pci_unmap_single(rrpriv->pci_dev, 1108 1109 desc->addr.addrlo, skb->len, ··· 1487 1488 1488 1489 dev->trans_start = jiffies; 1489 1490 return 0; 1490 - } 1491 - 1492 - 1493 - static struct net_device_stats *rr_get_stats(struct net_device *dev) 1494 - { 1495 - struct rr_private *rrpriv; 1496 - 1497 - rrpriv = netdev_priv(dev); 1498 - 1499 - return(&rrpriv->stats); 1500 1491 } 1501 1492 1502 1493
-2
drivers/net/rrunner.h
··· 819 819 u32 tx_full; 820 820 u32 fw_rev; 821 821 volatile short fw_running; 822 - struct net_device_stats stats; 823 822 struct pci_dev *pci_dev; 824 823 }; 825 824 ··· 833 834 static int rr_open(struct net_device *dev); 834 835 static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev); 835 836 static int rr_close(struct net_device *dev); 836 - static struct net_device_stats *rr_get_stats(struct net_device *dev); 837 837 static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 838 838 static unsigned int rr_read_eeprom(struct rr_private *rrpriv, 839 839 unsigned long offset,
+41 -50
drivers/net/saa9730.c
··· 151 151 printk("lp->lan_saa9730_regs->CamData = %x\n", 152 152 readl(&lp->lan_saa9730_regs->CamData)); 153 153 } 154 - printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); 155 - printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); 156 - printk("lp->stats.tx_aborted_errors = %lx\n", 157 - lp->stats.tx_aborted_errors); 158 - printk("lp->stats.tx_window_errors = %lx\n", 159 - lp->stats.tx_window_errors); 160 - printk("lp->stats.tx_carrier_errors = %lx\n", 161 - lp->stats.tx_carrier_errors); 162 - printk("lp->stats.tx_fifo_errors = %lx\n", 163 - lp->stats.tx_fifo_errors); 164 - printk("lp->stats.tx_heartbeat_errors = %lx\n", 165 - lp->stats.tx_heartbeat_errors); 166 - printk("lp->stats.collisions = %lx\n", lp->stats.collisions); 154 + printk("dev->stats.tx_packets = %lx\n", dev->stats.tx_packets); 155 + printk("dev->stats.tx_errors = %lx\n", dev->stats.tx_errors); 156 + printk("dev->stats.tx_aborted_errors = %lx\n", 157 + dev->stats.tx_aborted_errors); 158 + printk("dev->stats.tx_window_errors = %lx\n", 159 + dev->stats.tx_window_errors); 160 + printk("dev->stats.tx_carrier_errors = %lx\n", 161 + dev->stats.tx_carrier_errors); 162 + printk("dev->stats.tx_fifo_errors = %lx\n", 163 + dev->stats.tx_fifo_errors); 164 + printk("dev->stats.tx_heartbeat_errors = %lx\n", 165 + dev->stats.tx_heartbeat_errors); 166 + printk("dev->stats.collisions = %lx\n", dev->stats.collisions); 167 167 168 - printk("lp->stats.rx_packets = %lx\n", lp->stats.rx_packets); 169 - printk("lp->stats.rx_errors = %lx\n", lp->stats.rx_errors); 170 - printk("lp->stats.rx_dropped = %lx\n", lp->stats.rx_dropped); 171 - printk("lp->stats.rx_crc_errors = %lx\n", lp->stats.rx_crc_errors); 172 - printk("lp->stats.rx_frame_errors = %lx\n", 173 - lp->stats.rx_frame_errors); 174 - printk("lp->stats.rx_fifo_errors = %lx\n", 175 - lp->stats.rx_fifo_errors); 176 - printk("lp->stats.rx_length_errors = %lx\n", 177 - lp->stats.rx_length_errors); 168 + printk("dev->stats.rx_packets = %lx\n", dev->stats.rx_packets); 169 + printk("dev->stats.rx_errors = %lx\n", dev->stats.rx_errors); 170 + printk("dev->stats.rx_dropped = %lx\n", dev->stats.rx_dropped); 171 + printk("dev->stats.rx_crc_errors = %lx\n", dev->stats.rx_crc_errors); 172 + printk("dev->stats.rx_frame_errors = %lx\n", 173 + dev->stats.rx_frame_errors); 174 + printk("dev->stats.rx_fifo_errors = %lx\n", 175 + dev->stats.rx_fifo_errors); 176 + printk("dev->stats.rx_length_errors = %lx\n", 177 + dev->stats.rx_length_errors); 178 178 179 179 printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", 180 180 readl(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); ··· 605 605 printk("lan_saa9730_tx: tx error = %x\n", 606 606 tx_status); 607 607 608 - lp->stats.tx_errors++; 608 + dev->stats.tx_errors++; 609 609 if (tx_status & 610 610 (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) 611 - lp->stats.tx_aborted_errors++; 611 + dev->stats.tx_aborted_errors++; 612 612 if (tx_status & 613 613 (TX_STATUS_LATE_COLL << TX_STAT_CTL_STATUS_SHF)) 614 - lp->stats.tx_window_errors++; 614 + dev->stats.tx_window_errors++; 615 615 if (tx_status & 616 616 (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) 617 - lp->stats.tx_carrier_errors++; 617 + dev->stats.tx_carrier_errors++; 618 618 if (tx_status & 619 619 (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) 620 - lp->stats.tx_fifo_errors++; 620 + dev->stats.tx_fifo_errors++; 621 621 if (tx_status & 622 622 (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) 623 - lp->stats.tx_heartbeat_errors++; 623 + dev->stats.tx_heartbeat_errors++; 624 624 625 - lp->stats.collisions += 625 + dev->stats.collisions += 626 626 tx_status & TX_STATUS_TX_COLL_MSK; 627 627 } 628 628 ··· 684 684 printk 685 685 ("%s: Memory squeeze, deferring packet.\n", 686 686 dev->name); 687 - lp->stats.rx_dropped++; 687 + dev->stats.rx_dropped++; 688 688 } else { 689 - lp->stats.rx_bytes += len; 690 - lp->stats.rx_packets++; 689 + dev->stats.rx_bytes += len; 690 + dev->stats.rx_packets++; 691 691 skb_reserve(skb, 2); /* 16 byte align */ 692 692 skb_put(skb, len); /* make room */ 693 693 skb_copy_to_linear_data(skb, ··· 704 704 ("lan_saa9730_rx: We got an error packet = %x\n", 705 705 rx_status); 706 706 707 - lp->stats.rx_errors++; 707 + dev->stats.rx_errors++; 708 708 if (rx_status & 709 709 (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) 710 - lp->stats.rx_crc_errors++; 710 + dev->stats.rx_crc_errors++; 711 711 if (rx_status & 712 712 (RX_STATUS_ALIGN_ERR << RX_STAT_CTL_STATUS_SHF)) 713 - lp->stats.rx_frame_errors++; 713 + dev->stats.rx_frame_errors++; 714 714 if (rx_status & 715 715 (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) 716 - lp->stats.rx_fifo_errors++; 716 + dev->stats.rx_fifo_errors++; 717 717 if (rx_status & 718 718 (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) 719 - lp->stats.rx_length_errors++; 719 + dev->stats.rx_length_errors++; 720 720 } 721 721 722 722 /* Indicate we have processed the buffer. */ ··· 853 853 struct lan_saa9730_private *lp = netdev_priv(dev); 854 854 855 855 /* Transmitter timeout, serious problems */ 856 - lp->stats.tx_errors++; 856 + dev->stats.tx_errors++; 857 857 printk("%s: transmit timed out, reset\n", dev->name); 858 858 /*show_saa9730_regs(lp); */ 859 859 lan_saa9730_restart(lp); ··· 886 886 return -1; 887 887 } 888 888 889 - lp->stats.tx_bytes += len; 890 - lp->stats.tx_packets++; 889 + dev->stats.tx_bytes += len; 890 + dev->stats.tx_packets++; 891 891 892 892 dev->trans_start = jiffies; 893 893 netif_wake_queue(dev); ··· 917 917 free_irq(dev->irq, (void *) dev); 918 918 919 919 return 0; 920 - } 921 - 922 - static struct net_device_stats *lan_saa9730_get_stats(struct net_device 923 - *dev) 924 - { 925 - struct lan_saa9730_private *lp = netdev_priv(dev); 926 - 927 - return &lp->stats; 928 920 } 929 921 930 922 static void lan_saa9730_set_multicast(struct net_device *dev) ··· 1032 1040 dev->open = lan_saa9730_open; 1033 1041 dev->hard_start_xmit = lan_saa9730_start_xmit; 1034 1042 dev->stop = lan_saa9730_close; 1035 - dev->get_stats = lan_saa9730_get_stats; 1036 1043 dev->set_multicast_list = lan_saa9730_set_multicast; 1037 1044 dev->tx_timeout = lan_saa9730_tx_timeout; 1038 1045 dev->watchdog_timeo = (HZ >> 1);
-1
drivers/net/saa9730.h
··· 378 378 379 379 unsigned char PhysicalAddress[LAN_SAA9730_CAM_ENTRIES][6]; 380 380 381 - struct net_device_stats stats; 382 381 spinlock_t lock; 383 382 }; 384 383
+5 -14
drivers/net/sb1000.c
··· 76 76 unsigned char rx_session_id[NPIDS]; 77 77 unsigned char rx_frame_id[NPIDS]; 78 78 unsigned char rx_pkt_type[NPIDS]; 79 - struct net_device_stats stats; 80 79 }; 81 80 82 81 /* prototypes for Linux interface */ ··· 84 85 static int sb1000_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); 85 86 static int sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev); 86 87 static irqreturn_t sb1000_interrupt(int irq, void *dev_id); 87 - static struct net_device_stats *sb1000_stats(struct net_device *dev); 88 88 static int sb1000_close(struct net_device *dev); 89 89 90 90 ··· 197 199 dev->do_ioctl = sb1000_dev_ioctl; 198 200 dev->hard_start_xmit = sb1000_start_xmit; 199 201 dev->stop = sb1000_close; 200 - dev->get_stats = sb1000_stats; 201 202 202 203 /* hardware address is 0:0:serial_number */ 203 204 dev->dev_addr[2] = serial_number >> 24 & 0xff; ··· 736 739 unsigned int skbsize; 737 740 struct sk_buff *skb; 738 741 struct sb1000_private *lp = netdev_priv(dev); 739 - struct net_device_stats *stats = &lp->stats; 742 + struct net_device_stats *stats = &dev->stats; 740 743 741 744 /* SB1000 frame constants */ 742 745 const int FrameSize = FRAMESIZE; ··· 999 1002 1000 1003 switch (cmd) { 1001 1004 case SIOCGCMSTATS: /* get statistics */ 1002 - stats[0] = lp->stats.rx_bytes; 1005 + stats[0] = dev->stats.rx_bytes; 1003 1006 stats[1] = lp->rx_frames; 1004 - stats[2] = lp->stats.rx_packets; 1005 - stats[3] = lp->stats.rx_errors; 1006 - stats[4] = lp->stats.rx_dropped; 1007 + stats[2] = dev->stats.rx_packets; 1008 + stats[3] = dev->stats.rx_errors; 1009 + stats[4] = dev->stats.rx_dropped; 1007 1010 if(copy_to_user(ifr->ifr_data, stats, sizeof(stats))) 1008 1011 return -EFAULT; 1009 1012 status = 0; ··· 1127 1130 } 1128 1131 1129 1132 return IRQ_HANDLED; 1130 - } 1131 - 1132 - static struct net_device_stats *sb1000_stats(struct net_device *dev) 1133 - { 1134 - struct sb1000_private *lp = netdev_priv(dev); 1135 - return &lp->stats; 1136 1133 } 1137 1134 1138 1135 static int sb1000_close(struct net_device *dev)
+11 -28
drivers/net/sb1250-mac.c
··· 241 241 struct napi_struct napi; 242 242 spinlock_t sbm_lock; /* spin lock */ 243 243 struct timer_list sbm_timer; /* for monitoring MII */ 244 - struct net_device_stats sbm_stats; 245 244 int sbm_devflags; /* current device flags */ 246 245 247 246 int sbm_phy_oldbmsr; ··· 316 317 static int sbmac_open(struct net_device *dev); 317 318 static void sbmac_timer(unsigned long data); 318 319 static void sbmac_tx_timeout (struct net_device *dev); 319 - static struct net_device_stats *sbmac_get_stats(struct net_device *dev); 320 320 static void sbmac_set_rx_mode(struct net_device *dev); 321 321 static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 322 322 static int sbmac_close(struct net_device *dev); ··· 1188 1190 static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, 1189 1191 int work_to_do, int poll) 1190 1192 { 1193 + struct net_device *dev = sc->sbm_dev; 1191 1194 int curidx; 1192 1195 int hwidx; 1193 1196 sbdmadscr_t *dsc; ··· 1201 1202 1202 1203 again: 1203 1204 /* Check if the HW dropped any frames */ 1204 - sc->sbm_stats.rx_fifo_errors 1205 + dev->stats.rx_fifo_errors 1205 1206 += __raw_readq(sc->sbm_rxdma.sbdma_oodpktlost) & 0xffff; 1206 1207 __raw_writeq(0, sc->sbm_rxdma.sbdma_oodpktlost); 1207 1208 ··· 1260 1261 1261 1262 if (unlikely (sbdma_add_rcvbuffer(d,NULL) == 1262 1263 -ENOBUFS)) { 1263 - sc->sbm_stats.rx_dropped++; 1264 + dev->stats.rx_dropped++; 1264 1265 sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ 1265 1266 /* No point in continuing at the moment */ 1266 1267 printk(KERN_ERR "dropped packet (1)\n"); ··· 1296 1297 dropped = netif_rx(sb); 1297 1298 1298 1299 if (dropped == NET_RX_DROP) { 1299 - sc->sbm_stats.rx_dropped++; 1300 + dev->stats.rx_dropped++; 1300 1301 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); 1301 1302 goto done; 1302 1303 } 1303 1304 else { 1304 - sc->sbm_stats.rx_bytes += len; 1305 - sc->sbm_stats.rx_packets++; 1305 + dev->stats.rx_bytes += len; 1306 + dev->stats.rx_packets++; 1306 1307 } 1307 1308 } 1308 1309 } else { ··· 1310 1311 * Packet was mangled somehow. Just drop it and 1311 1312 * put it back on the receive ring. 1312 1313 */ 1313 - sc->sbm_stats.rx_errors++; 1314 + dev->stats.rx_errors++; 1314 1315 sbdma_add_rcvbuffer(d,sb); 1315 1316 } 1316 1317 ··· 1350 1351 1351 1352 static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll) 1352 1353 { 1354 + struct net_device *dev = sc->sbm_dev; 1353 1355 int curidx; 1354 1356 int hwidx; 1355 1357 sbdmadscr_t *dsc; ··· 1401 1401 * Stats 1402 1402 */ 1403 1403 1404 - sc->sbm_stats.tx_bytes += sb->len; 1405 - sc->sbm_stats.tx_packets++; 1404 + dev->stats.tx_bytes += sb->len; 1405 + dev->stats.tx_packets++; 1406 1406 1407 1407 /* 1408 1408 * for transmits, we just free buffers. ··· 2457 2457 dev->open = sbmac_open; 2458 2458 dev->hard_start_xmit = sbmac_start_tx; 2459 2459 dev->stop = sbmac_close; 2460 - dev->get_stats = sbmac_get_stats; 2461 2460 dev->set_multicast_list = sbmac_set_rx_mode; 2462 2461 dev->do_ioctl = sbmac_mii_ioctl; 2463 2462 dev->tx_timeout = sbmac_tx_timeout; ··· 2747 2748 2748 2749 2749 2750 dev->trans_start = jiffies; 2750 - sc->sbm_stats.tx_errors++; 2751 + dev->stats.tx_errors++; 2751 2752 2752 2753 spin_unlock_irq (&sc->sbm_lock); 2753 2754 2754 2755 printk (KERN_WARNING "%s: Transmit timed out\n",dev->name); 2755 2756 } 2756 2757 2757 - 2758 - 2759 - 2760 - static struct net_device_stats *sbmac_get_stats(struct net_device *dev) 2761 - { 2762 - struct sbmac_softc *sc = netdev_priv(dev); 2763 - unsigned long flags; 2764 - 2765 - spin_lock_irqsave(&sc->sbm_lock, flags); 2766 - 2767 - /* XXX update other stats here */ 2768 - 2769 - spin_unlock_irqrestore(&sc->sbm_lock, flags); 2770 - 2771 - return &sc->sbm_stats; 2772 - } 2773 2758 2774 2759 2775 2760
+10 -23
drivers/net/seeq8005.c
··· 67 67 68 68 /* Information that need to be kept for each board. */ 69 69 struct net_local { 70 - struct net_device_stats stats; 71 70 unsigned short receive_ptr; /* What address in packet memory do we expect a recv_pkt_header? */ 72 71 long open_time; /* Useless example local info. */ 73 72 }; ··· 85 86 static irqreturn_t seeq8005_interrupt(int irq, void *dev_id); 86 87 static void seeq8005_rx(struct net_device *dev); 87 88 static int seeq8005_close(struct net_device *dev); 88 - static struct net_device_stats *seeq8005_get_stats(struct net_device *dev); 89 89 static void set_multicast_list(struct net_device *dev); 90 90 91 91 /* Example routines you must write ;->. */ ··· 336 338 dev->hard_start_xmit = seeq8005_send_packet; 337 339 dev->tx_timeout = seeq8005_timeout; 338 340 dev->watchdog_timeo = HZ/20; 339 - dev->get_stats = seeq8005_get_stats; 340 341 dev->set_multicast_list = set_multicast_list; 341 342 dev->flags &= ~IFF_MULTICAST; 342 343 ··· 388 391 389 392 static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev) 390 393 { 391 - struct net_local *lp = netdev_priv(dev); 392 394 short length = skb->len; 393 395 unsigned char *buf; 394 396 ··· 403 407 404 408 hardware_send_packet(dev, buf, length); 405 409 dev->trans_start = jiffies; 406 - lp->stats.tx_bytes += length; 410 + dev->stats.tx_bytes += length; 407 411 dev_kfree_skb (skb); 408 412 /* You might need to clean up and record Tx statistics here. */ 409 413 ··· 459 463 if (status & SEEQSTAT_TX_INT) { 460 464 handled = 1; 461 465 outw( SEEQCMD_TX_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 462 - lp->stats.tx_packets++; 466 + dev->stats.tx_packets++; 463 467 netif_wake_queue(dev); /* Inform upper layers. */ 464 468 } 465 469 if (status & SEEQSTAT_RX_INT) { ··· 527 531 } 528 532 529 533 if (pkt_hdr & SEEQPKTS_ANY_ERROR) { /* There was an error. */ 530 - lp->stats.rx_errors++; 531 - if (pkt_hdr & SEEQPKTS_SHORT) lp->stats.rx_frame_errors++; 532 - if (pkt_hdr & SEEQPKTS_DRIB) lp->stats.rx_frame_errors++; 533 - if (pkt_hdr & SEEQPKTS_OVERSIZE) lp->stats.rx_over_errors++; 534 - if (pkt_hdr & SEEQPKTS_CRC_ERR) lp->stats.rx_crc_errors++; 534 + dev->stats.rx_errors++; 535 + if (pkt_hdr & SEEQPKTS_SHORT) dev->stats.rx_frame_errors++; 536 + if (pkt_hdr & SEEQPKTS_DRIB) dev->stats.rx_frame_errors++; 537 + if (pkt_hdr & SEEQPKTS_OVERSIZE) dev->stats.rx_over_errors++; 538 + if (pkt_hdr & SEEQPKTS_CRC_ERR) dev->stats.rx_crc_errors++; 535 539 /* skip over this packet */ 536 540 outw( SEEQCMD_FIFO_WRITE | SEEQCMD_DMA_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 537 541 outw( (lp->receive_ptr & 0xff00)>>8, SEEQ_REA); ··· 543 547 skb = dev_alloc_skb(pkt_len); 544 548 if (skb == NULL) { 545 549 printk("%s: Memory squeeze, dropping packet.\n", dev->name); 546 - lp->stats.rx_dropped++; 550 + dev->stats.rx_dropped++; 547 551 break; 548 552 } 549 553 skb_reserve(skb, 2); /* align data on 16 byte */ ··· 563 567 skb->protocol=eth_type_trans(skb,dev); 564 568 netif_rx(skb); 565 569 dev->last_rx = jiffies; 566 - lp->stats.rx_packets++; 567 - lp->stats.rx_bytes += pkt_len; 570 + dev->stats.rx_packets++; 571 + dev->stats.rx_bytes += pkt_len; 568 572 } 569 573 } while ((--boguscount) && (pkt_hdr & SEEQPKTH_CHAIN)); 570 574 ··· 593 597 594 598 return 0; 595 599 596 - } 597 - 598 - /* Get the current statistics. This may be called with the card open or 599 - closed. */ 600 - static struct net_device_stats *seeq8005_get_stats(struct net_device *dev) 601 - { 602 - struct net_local *lp = netdev_priv(dev); 603 - 604 - return &lp->stats; 605 600 } 606 601 607 602 /* Set or clear the multicast filter for this adaptor.
+14 -25
drivers/net/sgiseeq.c
··· 93 93 unsigned char control; 94 94 unsigned char mode; 95 95 96 - struct net_device_stats stats; 97 - 98 96 spinlock_t tx_lock; 99 97 }; 100 98 ··· 265 267 return 0; 266 268 } 267 269 268 - static inline void record_rx_errors(struct sgiseeq_private *sp, 269 - unsigned char status) 270 + static void record_rx_errors(struct net_device *dev, unsigned char status) 270 271 { 271 272 if (status & SEEQ_RSTAT_OVERF || 272 273 status & SEEQ_RSTAT_SFRAME) 273 - sp->stats.rx_over_errors++; 274 + dev->stats.rx_over_errors++; 274 275 if (status & SEEQ_RSTAT_CERROR) 275 - sp->stats.rx_crc_errors++; 276 + dev->stats.rx_crc_errors++; 276 277 if (status & SEEQ_RSTAT_DERROR) 277 - sp->stats.rx_frame_errors++; 278 + dev->stats.rx_frame_errors++; 278 279 if (status & SEEQ_RSTAT_REOF) 279 - sp->stats.rx_errors++; 280 + dev->stats.rx_errors++; 280 281 } 281 282 282 283 static inline void rx_maybe_restart(struct sgiseeq_private *sp, ··· 325 328 if (memcmp(eth_hdr(skb)->h_source, dev->dev_addr, ETH_ALEN)) { 326 329 netif_rx(skb); 327 330 dev->last_rx = jiffies; 328 - sp->stats.rx_packets++; 329 - sp->stats.rx_bytes += len; 331 + dev->stats.rx_packets++; 332 + dev->stats.rx_bytes += len; 330 333 } else { 331 334 /* Silently drop my own packets */ 332 335 dev_kfree_skb_irq(skb); ··· 334 337 } else { 335 338 printk (KERN_NOTICE "%s: Memory squeeze, deferring packet.\n", 336 339 dev->name); 337 - sp->stats.rx_dropped++; 340 + dev->stats.rx_dropped++; 338 341 } 339 342 } else { 340 - record_rx_errors(sp, pkt_status); 343 + record_rx_errors(dev, pkt_status); 341 344 } 342 345 343 346 /* Return the entry to the ring pool. */ ··· 389 392 if (!(status & (HPC3_ETXCTRL_ACTIVE | SEEQ_TSTAT_PTRANS))) { 390 393 /* Oops, HPC detected some sort of error. */ 391 394 if (status & SEEQ_TSTAT_R16) 392 - sp->stats.tx_aborted_errors++; 395 + dev->stats.tx_aborted_errors++; 393 396 if (status & SEEQ_TSTAT_UFLOW) 394 - sp->stats.tx_fifo_errors++; 397 + dev->stats.tx_fifo_errors++; 395 398 if (status & SEEQ_TSTAT_LCLS) 396 - sp->stats.collisions++; 399 + dev->stats.collisions++; 397 400 } 398 401 399 402 /* Ack 'em... */ ··· 409 412 } 410 413 break; 411 414 } 412 - sp->stats.tx_packets++; 415 + dev->stats.tx_packets++; 413 416 sp->tx_old = NEXT_TX(sp->tx_old); 414 417 td->tdma.cntinfo &= ~(HPCDMA_XIU | HPCDMA_XIE); 415 418 td->tdma.cntinfo |= HPCDMA_EOX; ··· 513 516 /* Setup... */ 514 517 skblen = skb->len; 515 518 len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen; 516 - sp->stats.tx_bytes += len; 519 + dev->stats.tx_bytes += len; 517 520 entry = sp->tx_new; 518 521 td = &sp->tx_desc[entry]; 519 522 ··· 564 567 565 568 dev->trans_start = jiffies; 566 569 netif_wake_queue(dev); 567 - } 568 - 569 - static struct net_device_stats *sgiseeq_get_stats(struct net_device *dev) 570 - { 571 - struct sgiseeq_private *sp = netdev_priv(dev); 572 - 573 - return &sp->stats; 574 570 } 575 571 576 572 static void sgiseeq_set_multicast(struct net_device *dev) ··· 684 694 dev->hard_start_xmit = sgiseeq_start_xmit; 685 695 dev->tx_timeout = timeout; 686 696 dev->watchdog_timeo = (200 * HZ) / 1000; 687 - dev->get_stats = sgiseeq_get_stats; 688 697 dev->set_multicast_list = sgiseeq_set_multicast; 689 698 dev->set_mac_address = sgiseeq_set_mac_address; 690 699 dev->irq = irq;
+4 -11
drivers/net/shaper.c
··· 171 171 */ 172 172 if(time_after(SHAPERCB(skb)->shapeclock,jiffies + SHAPER_LATENCY)) { 173 173 dev_kfree_skb(skb); 174 - shaper->stats.tx_dropped++; 174 + dev->stats.tx_dropped++; 175 175 } else 176 176 skb_queue_tail(&shaper->sendq, skb); 177 177 } ··· 182 182 { 183 183 ptr=skb_dequeue(&shaper->sendq); 184 184 dev_kfree_skb(ptr); 185 - shaper->stats.collisions++; 185 + dev->stats.collisions++; 186 186 } 187 187 shaper_kick(shaper); 188 188 spin_unlock(&shaper->lock); ··· 207 207 shaper->dev->name,newskb->priority); 208 208 dev_queue_xmit(newskb); 209 209 210 - shaper->stats.tx_bytes += skb->len; 211 - shaper->stats.tx_packets++; 210 + shaper->dev->stats.tx_bytes += skb->len; 211 + shaper->dev->stats.tx_packets++; 212 212 213 213 if(sh_debug) 214 214 printk("Kicked new frame out.\n"); ··· 329 329 * for our attached device. This enables us to bandwidth allocate after 330 330 * ARP and other resolutions and not before. 331 331 */ 332 - 333 - static struct net_device_stats *shaper_get_stats(struct net_device *dev) 334 - { 335 - struct shaper *sh=dev->priv; 336 - return &sh->stats; 337 - } 338 332 339 333 static int shaper_header(struct sk_buff *skb, struct net_device *dev, 340 334 unsigned short type, void *daddr, void *saddr, unsigned len) ··· 532 538 dev->open = shaper_open; 533 539 dev->stop = shaper_close; 534 540 dev->hard_start_xmit = shaper_start_xmit; 535 - dev->get_stats = shaper_get_stats; 536 541 dev->set_multicast_list = NULL; 537 542 538 543 /*
+5 -14
drivers/net/sis190.c
··· 270 270 void __iomem *mmio_addr; 271 271 struct pci_dev *pci_dev; 272 272 struct net_device *dev; 273 - struct net_device_stats stats; 274 273 spinlock_t lock; 275 274 u32 rx_buf_sz; 276 275 u32 cur_rx; ··· 568 569 static int sis190_rx_interrupt(struct net_device *dev, 569 570 struct sis190_private *tp, void __iomem *ioaddr) 570 571 { 571 - struct net_device_stats *stats = &tp->stats; 572 + struct net_device_stats *stats = &dev->stats; 572 573 u32 rx_left, cur_rx = tp->cur_rx; 573 574 u32 delta, count; 574 575 ··· 682 683 683 684 skb = tp->Tx_skbuff[entry]; 684 685 685 - tp->stats.tx_packets++; 686 - tp->stats.tx_bytes += skb->len; 686 + dev->stats.tx_packets++; 687 + dev->stats.tx_bytes += skb->len; 687 688 688 689 sis190_unmap_tx_skb(tp->pci_dev, skb, txd); 689 690 tp->Tx_skbuff[entry] = NULL; ··· 1079 1080 tp->Tx_skbuff[i] = NULL; 1080 1081 dev_kfree_skb(skb); 1081 1082 1082 - tp->stats.tx_dropped++; 1083 + tp->dev->stats.tx_dropped++; 1083 1084 } 1084 1085 tp->cur_tx = tp->dirty_tx = 0; 1085 1086 } ··· 1142 1143 1143 1144 if (unlikely(skb->len < ETH_ZLEN)) { 1144 1145 if (skb_padto(skb, ETH_ZLEN)) { 1145 - tp->stats.tx_dropped++; 1146 + dev->stats.tx_dropped++; 1146 1147 goto out; 1147 1148 } 1148 1149 len = ETH_ZLEN; ··· 1193 1194 } 1194 1195 out: 1195 1196 return NETDEV_TX_OK; 1196 - } 1197 - 1198 - static struct net_device_stats *sis190_get_stats(struct net_device *dev) 1199 - { 1200 - struct sis190_private *tp = netdev_priv(dev); 1201 - 1202 - return &tp->stats; 1203 1197 } 1204 1198 1205 1199 static void sis190_free_phy(struct list_head *first_phy) ··· 1787 1795 dev->open = sis190_open; 1788 1796 dev->stop = sis190_close; 1789 1797 dev->do_ioctl = sis190_ioctl; 1790 - dev->get_stats = sis190_get_stats; 1791 1798 dev->tx_timeout = sis190_tx_timeout; 1792 1799 dev->watchdog_timeo = SIS190_TX_TIMEOUT; 1793 1800 dev->hard_start_xmit = sis190_start_xmit;
+19 -37
drivers/net/sis900.c
··· 158 158 } BufferDesc; 159 159 160 160 struct sis900_private { 161 - struct net_device_stats stats; 162 161 struct pci_dev * pci_dev; 163 162 164 163 spinlock_t lock; ··· 220 221 static irqreturn_t sis900_interrupt(int irq, void *dev_instance); 221 222 static int sis900_close(struct net_device *net_dev); 222 223 static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd); 223 - static struct net_device_stats *sis900_get_stats(struct net_device *net_dev); 224 224 static u16 sis900_mcast_bitnr(u8 *addr, u8 revision); 225 225 static void set_rx_mode(struct net_device *net_dev); 226 226 static void sis900_reset(struct net_device *net_dev); ··· 464 466 net_dev->open = &sis900_open; 465 467 net_dev->hard_start_xmit = &sis900_start_xmit; 466 468 net_dev->stop = &sis900_close; 467 - net_dev->get_stats = &sis900_get_stats; 468 469 net_dev->set_config = &sis900_set_config; 469 470 net_dev->set_multicast_list = &set_rx_mode; 470 471 net_dev->do_ioctl = &mii_ioctl; ··· 1539 1542 sis_priv->tx_skbuff[i] = NULL; 1540 1543 sis_priv->tx_ring[i].cmdsts = 0; 1541 1544 sis_priv->tx_ring[i].bufptr = 0; 1542 - sis_priv->stats.tx_dropped++; 1545 + net_dev->stats.tx_dropped++; 1543 1546 } 1544 1547 } 1545 1548 sis_priv->tx_full = 0; ··· 1736 1739 printk(KERN_DEBUG "%s: Corrupted packet " 1737 1740 "received, buffer status = 0x%8.8x/%d.\n", 1738 1741 net_dev->name, rx_status, data_size); 1739 - sis_priv->stats.rx_errors++; 1742 + net_dev->stats.rx_errors++; 1740 1743 if (rx_status & OVERRUN) 1741 - sis_priv->stats.rx_over_errors++; 1744 + net_dev->stats.rx_over_errors++; 1742 1745 if (rx_status & (TOOLONG|RUNT)) 1743 - sis_priv->stats.rx_length_errors++; 1746 + net_dev->stats.rx_length_errors++; 1744 1747 if (rx_status & (RXISERR | FAERR)) 1745 - sis_priv->stats.rx_frame_errors++; 1748 + net_dev->stats.rx_frame_errors++; 1746 1749 if (rx_status & CRCERR) 1747 - sis_priv->stats.rx_crc_errors++; 1750 + net_dev->stats.rx_crc_errors++; 1748 1751 /* reset buffer descriptor state */ 1749 1752 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; 1750 1753 } else { ··· 1765 1768 * in the rx ring 1766 1769 */ 1767 1770 skb = sis_priv->rx_skbuff[entry]; 1768 - sis_priv->stats.rx_dropped++; 1771 + net_dev->stats.rx_dropped++; 1769 1772 goto refill_rx_ring; 1770 1773 } 1771 1774 ··· 1790 1793 1791 1794 /* some network statistics */ 1792 1795 if ((rx_status & BCAST) == MCAST) 1793 - sis_priv->stats.multicast++; 1796 + net_dev->stats.multicast++; 1794 1797 net_dev->last_rx = jiffies; 1795 - sis_priv->stats.rx_bytes += rx_size; 1796 - sis_priv->stats.rx_packets++; 1798 + net_dev->stats.rx_bytes += rx_size; 1799 + net_dev->stats.rx_packets++; 1797 1800 sis_priv->dirty_rx++; 1798 1801 refill_rx_ring: 1799 1802 sis_priv->rx_skbuff[entry] = skb; ··· 1824 1827 printk(KERN_INFO "%s: Memory squeeze," 1825 1828 "deferring packet.\n", 1826 1829 net_dev->name); 1827 - sis_priv->stats.rx_dropped++; 1830 + net_dev->stats.rx_dropped++; 1828 1831 break; 1829 1832 } 1830 1833 sis_priv->rx_skbuff[entry] = skb; ··· 1875 1878 printk(KERN_DEBUG "%s: Transmit " 1876 1879 "error, Tx status %8.8x.\n", 1877 1880 net_dev->name, tx_status); 1878 - sis_priv->stats.tx_errors++; 1881 + net_dev->stats.tx_errors++; 1879 1882 if (tx_status & UNDERRUN) 1880 - sis_priv->stats.tx_fifo_errors++; 1883 + net_dev->stats.tx_fifo_errors++; 1881 1884 if (tx_status & ABORT) 1882 - sis_priv->stats.tx_aborted_errors++; 1885 + net_dev->stats.tx_aborted_errors++; 1883 1886 if (tx_status & NOCARRIER) 1884 - sis_priv->stats.tx_carrier_errors++; 1887 + net_dev->stats.tx_carrier_errors++; 1885 1888 if (tx_status & OWCOLL) 1886 - sis_priv->stats.tx_window_errors++; 1889 + net_dev->stats.tx_window_errors++; 1887 1890 } else { 1888 1891 /* packet successfully transmitted */ 1889 - sis_priv->stats.collisions += (tx_status & COLCNT) >> 16; 1890 - sis_priv->stats.tx_bytes += tx_status & DSIZE; 1891 - sis_priv->stats.tx_packets++; 1892 + net_dev->stats.collisions += (tx_status & COLCNT) >> 16; 1893 + net_dev->stats.tx_bytes += tx_status & DSIZE; 1894 + net_dev->stats.tx_packets++; 1892 1895 } 1893 1896 /* Free the original skb. */ 1894 1897 skb = sis_priv->tx_skbuff[entry]; ··· 2132 2135 default: 2133 2136 return -EOPNOTSUPP; 2134 2137 } 2135 - } 2136 - 2137 - /** 2138 - * sis900_get_stats - Get sis900 read/write statistics 2139 - * @net_dev: the net device to get statistics for 2140 - * 2141 - * get tx/rx statistics for sis900 2142 - */ 2143 - 2144 - static struct net_device_stats * 2145 - sis900_get_stats(struct net_device *net_dev) 2146 - { 2147 - struct sis900_private *sis_priv = net_dev->priv; 2148 - 2149 - return &sis_priv->stats; 2150 2138 } 2151 2139 2152 2140 /**
+28 -49
drivers/net/smc911x.c
··· 115 115 */ 116 116 struct sk_buff *pending_tx_skb; 117 117 118 - /* 119 - * these are things that the kernel wants me to keep, so users 120 - * can find out semi-useless statistics of how well the card is 121 - * performing 122 - */ 123 - struct net_device_stats stats; 124 - 125 118 /* version/revision of the SMC911x chip */ 126 119 u16 version; 127 120 u16 revision; ··· 308 315 if (lp->pending_tx_skb != NULL) { 309 316 dev_kfree_skb (lp->pending_tx_skb); 310 317 lp->pending_tx_skb = NULL; 311 - lp->stats.tx_errors++; 312 - lp->stats.tx_aborted_errors++; 318 + dev->stats.tx_errors++; 319 + dev->stats.tx_aborted_errors++; 313 320 } 314 321 } 315 322 ··· 442 449 pkt_len = (status & RX_STS_PKT_LEN_) >> 16; 443 450 if (status & RX_STS_ES_) { 444 451 /* Deal with a bad packet */ 445 - lp->stats.rx_errors++; 452 + dev->stats.rx_errors++; 446 453 if (status & RX_STS_CRC_ERR_) 447 - lp->stats.rx_crc_errors++; 454 + dev->stats.rx_crc_errors++; 448 455 else { 449 456 if (status & RX_STS_LEN_ERR_) 450 - lp->stats.rx_length_errors++; 457 + dev->stats.rx_length_errors++; 451 458 if (status & RX_STS_MCAST_) 452 - lp->stats.multicast++; 459 + dev->stats.multicast++; 453 460 } 454 461 /* Remove the bad packet data from the RX FIFO */ 455 462 smc911x_drop_pkt(dev); ··· 460 467 if (unlikely(skb == NULL)) { 461 468 PRINTK( "%s: Low memory, rcvd packet dropped.\n", 462 469 dev->name); 463 - lp->stats.rx_dropped++; 470 + dev->stats.rx_dropped++; 464 471 smc911x_drop_pkt(dev); 465 472 return; 466 473 } ··· 496 503 dev->last_rx = jiffies; 497 504 skb->protocol = eth_type_trans(skb, dev); 498 505 netif_rx(skb); 499 - lp->stats.rx_packets++; 500 - lp->stats.rx_bytes += pkt_len-4; 506 + dev->stats.rx_packets++; 507 + dev->stats.rx_bytes += pkt_len-4; 501 508 #endif 502 509 } 503 510 } ··· 609 616 printk("%s: No Tx free space %d < %d\n", 610 617 dev->name, free, skb->len); 611 618 lp->pending_tx_skb = NULL; 612 - lp->stats.tx_errors++; 613 - lp->stats.tx_dropped++; 619 + dev->stats.tx_errors++; 620 + dev->stats.tx_dropped++; 614 621 dev_kfree_skb(skb); 615 622 return 0; 616 623 } ··· 660 667 dev->name, 661 668 (SMC_GET_TX_FIFO_INF() & TX_FIFO_INF_TSUSED_) >> 16); 662 669 tx_status = SMC_GET_TX_STS_FIFO(); 663 - lp->stats.tx_packets++; 664 - lp->stats.tx_bytes+=tx_status>>16; 670 + dev->stats.tx_packets++; 671 + dev->stats.tx_bytes+=tx_status>>16; 665 672 DBG(SMC_DEBUG_TX, "%s: Tx FIFO tag 0x%04x status 0x%04x\n", 666 673 dev->name, (tx_status & 0xffff0000) >> 16, 667 674 tx_status & 0x0000ffff); ··· 669 676 * full-duplex mode */ 670 677 if ((tx_status & TX_STS_ES_) && !(lp->ctl_rfduplx && 671 678 !(tx_status & 0x00000306))) { 672 - lp->stats.tx_errors++; 679 + dev->stats.tx_errors++; 673 680 } 674 681 if (tx_status & TX_STS_MANY_COLL_) { 675 - lp->stats.collisions+=16; 676 - lp->stats.tx_aborted_errors++; 682 + dev->stats.collisions+=16; 683 + dev->stats.tx_aborted_errors++; 677 684 } else { 678 - lp->stats.collisions+=(tx_status & TX_STS_COLL_CNT_) >> 3; 685 + dev->stats.collisions+=(tx_status & TX_STS_COLL_CNT_) >> 3; 679 686 } 680 687 /* carrier error only has meaning for half-duplex communication */ 681 688 if ((tx_status & (TX_STS_LOC_ | TX_STS_NO_CARR_)) && 682 689 !lp->ctl_rfduplx) { 683 - lp->stats.tx_carrier_errors++; 690 + dev->stats.tx_carrier_errors++; 684 691 } 685 692 if (tx_status & TX_STS_LATE_COLL_) { 686 - lp->stats.collisions++; 687 - lp->stats.tx_aborted_errors++; 693 + dev->stats.collisions++; 694 + dev->stats.tx_aborted_errors++; 688 695 } 689 696 } 690 697 } ··· 1114 1121 /* Handle various error conditions */ 1115 1122 if (status & INT_STS_RXE_) { 1116 1123 SMC_ACK_INT(INT_STS_RXE_); 1117 - lp->stats.rx_errors++; 1124 + dev->stats.rx_errors++; 1118 1125 } 1119 1126 if (status & INT_STS_RXDFH_INT_) { 1120 1127 SMC_ACK_INT(INT_STS_RXDFH_INT_); 1121 - lp->stats.rx_dropped+=SMC_GET_RX_DROP(); 1128 + dev->stats.rx_dropped+=SMC_GET_RX_DROP(); 1122 1129 } 1123 1130 /* Undocumented interrupt-what is the right thing to do here? */ 1124 1131 if (status & INT_STS_RXDF_INT_) { ··· 1133 1140 cr &= ~MAC_CR_RXEN_; 1134 1141 SMC_SET_MAC_CR(cr); 1135 1142 DBG(SMC_DEBUG_RX, "%s: RX overrun\n", dev->name); 1136 - lp->stats.rx_errors++; 1137 - lp->stats.rx_fifo_errors++; 1143 + dev->stats.rx_errors++; 1144 + dev->stats.rx_fifo_errors++; 1138 1145 } 1139 1146 SMC_ACK_INT(INT_STS_RDFL_); 1140 1147 } ··· 1145 1152 SMC_SET_MAC_CR(cr); 1146 1153 rx_overrun=1; 1147 1154 DBG(SMC_DEBUG_RX, "%s: RX overrun\n", dev->name); 1148 - lp->stats.rx_errors++; 1149 - lp->stats.rx_fifo_errors++; 1155 + dev->stats.rx_errors++; 1156 + dev->stats.rx_fifo_errors++; 1150 1157 } 1151 1158 SMC_ACK_INT(INT_STS_RDFO_); 1152 1159 } ··· 1300 1307 dev->last_rx = jiffies; 1301 1308 skb->protocol = eth_type_trans(skb, dev); 1302 1309 netif_rx(skb); 1303 - lp->stats.rx_packets++; 1304 - lp->stats.rx_bytes += skb->len; 1310 + dev->stats.rx_packets++; 1311 + dev->stats.rx_bytes += skb->len; 1305 1312 1306 1313 spin_lock_irqsave(&lp->lock, flags); 1307 1314 pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; ··· 1558 1565 } 1559 1566 1560 1567 return 0; 1561 - } 1562 - 1563 - /* 1564 - * Get the current statistics. 1565 - * This may be called with the card open or closed. 1566 - */ 1567 - static struct net_device_stats *smc911x_query_statistics(struct net_device *dev) 1568 - { 1569 - struct smc911x_local *lp = netdev_priv(dev); 1570 - DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); 1571 - 1572 - 1573 - return &lp->stats; 1574 1568 } 1575 1569 1576 1570 /* ··· 2036 2056 dev->hard_start_xmit = smc911x_hard_start_xmit; 2037 2057 dev->tx_timeout = smc911x_timeout; 2038 2058 dev->watchdog_timeo = msecs_to_jiffies(watchdog); 2039 - dev->get_stats = smc911x_query_statistics; 2040 2059 dev->set_multicast_list = smc911x_set_multicast_list; 2041 2060 dev->ethtool_ops = &smc911x_ethtool_ops; 2042 2061 #ifdef CONFIG_NET_POLL_CONTROLLER
+17 -42
drivers/net/smc9194.c
··· 191 191 /* store this information for the driver.. */ 192 192 struct smc_local { 193 193 /* 194 - these are things that the kernel wants me to keep, so users 195 - can find out semi-useless statistics of how well the card is 196 - performing 197 - */ 198 - struct net_device_stats stats; 199 - 200 - /* 201 194 If I have to wait until memory is available to send 202 195 a packet, I will store the skbuff here, until I get the 203 196 desired memory. Then, I'll send it out and free it. ··· 240 247 . does, and maybe putting the card into a powerdown state. 241 248 */ 242 249 static int smc_close(struct net_device *dev); 243 - 244 - /* 245 - . This routine allows the proc file system to query the driver's 246 - . statistics. 247 - */ 248 - static struct net_device_stats * smc_query_statistics( struct net_device *dev); 249 250 250 251 /* 251 252 . Finally, a call to set promiscuous mode ( for TCPDUMP and related ··· 501 514 502 515 if ( lp->saved_skb) { 503 516 /* THIS SHOULD NEVER HAPPEN. */ 504 - lp->stats.tx_aborted_errors++; 517 + dev->stats.tx_aborted_errors++; 505 518 printk(CARDNAME": Bad Craziness - sent packet while busy.\n" ); 506 519 return 1; 507 520 } ··· 1052 1065 dev->hard_start_xmit = smc_wait_to_send_packet; 1053 1066 dev->tx_timeout = smc_timeout; 1054 1067 dev->watchdog_timeo = HZ/20; 1055 - dev->get_stats = smc_query_statistics; 1056 1068 dev->set_multicast_list = smc_set_multicast_list; 1057 1069 1058 1070 return 0; ··· 1185 1199 */ 1186 1200 static void smc_rcv(struct net_device *dev) 1187 1201 { 1188 - struct smc_local *lp = netdev_priv(dev); 1189 1202 int ioaddr = dev->base_addr; 1190 1203 int packet_number; 1191 1204 word status; ··· 1228 1243 1229 1244 /* set multicast stats */ 1230 1245 if ( status & RS_MULTICAST ) 1231 - lp->stats.multicast++; 1246 + dev->stats.multicast++; 1232 1247 1233 1248 skb = dev_alloc_skb( packet_length + 5); 1234 1249 1235 1250 if ( skb == NULL ) { 1236 1251 printk(KERN_NOTICE CARDNAME ": Low memory, packet dropped.\n"); 1237 - lp->stats.rx_dropped++; 1252 + dev->stats.rx_dropped++; 1238 1253 goto done; 1239 1254 } 1240 1255 ··· 1274 1289 skb->protocol = eth_type_trans(skb, dev ); 1275 1290 netif_rx(skb); 1276 1291 dev->last_rx = jiffies; 1277 - lp->stats.rx_packets++; 1278 - lp->stats.rx_bytes += packet_length; 1292 + dev->stats.rx_packets++; 1293 + dev->stats.rx_bytes += packet_length; 1279 1294 } else { 1280 1295 /* error ... */ 1281 - lp->stats.rx_errors++; 1296 + dev->stats.rx_errors++; 1282 1297 1283 - if ( status & RS_ALGNERR ) lp->stats.rx_frame_errors++; 1298 + if ( status & RS_ALGNERR ) dev->stats.rx_frame_errors++; 1284 1299 if ( status & (RS_TOOSHORT | RS_TOOLONG ) ) 1285 - lp->stats.rx_length_errors++; 1286 - if ( status & RS_BADCRC) lp->stats.rx_crc_errors++; 1300 + dev->stats.rx_length_errors++; 1301 + if ( status & RS_BADCRC) dev->stats.rx_crc_errors++; 1287 1302 } 1288 1303 1289 1304 done: ··· 1331 1346 tx_status = inw( ioaddr + DATA_1 ); 1332 1347 PRINTK3((CARDNAME": TX DONE STATUS: %4x \n", tx_status )); 1333 1348 1334 - lp->stats.tx_errors++; 1335 - if ( tx_status & TS_LOSTCAR ) lp->stats.tx_carrier_errors++; 1349 + dev->stats.tx_errors++; 1350 + if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++; 1336 1351 if ( tx_status & TS_LATCOL ) { 1337 1352 printk(KERN_DEBUG CARDNAME 1338 1353 ": Late collision occurred on last xmit.\n"); 1339 - lp->stats.tx_window_errors++; 1354 + dev->stats.tx_window_errors++; 1340 1355 } 1341 1356 #if 0 1342 1357 if ( tx_status & TS_16COL ) { ... } ··· 1431 1446 SMC_SELECT_BANK( 0 ); 1432 1447 card_stats = inw( ioaddr + COUNTER ); 1433 1448 /* single collisions */ 1434 - lp->stats.collisions += card_stats & 0xF; 1449 + dev->stats.collisions += card_stats & 0xF; 1435 1450 card_stats >>= 4; 1436 1451 /* multiple collisions */ 1437 - lp->stats.collisions += card_stats & 0xF; 1452 + dev->stats.collisions += card_stats & 0xF; 1438 1453 1439 1454 /* these are for when linux supports these statistics */ 1440 1455 ··· 1443 1458 ": TX_BUFFER_EMPTY handled\n")); 1444 1459 outb( IM_TX_EMPTY_INT, ioaddr + INTERRUPT ); 1445 1460 mask &= ~IM_TX_EMPTY_INT; 1446 - lp->stats.tx_packets += lp->packets_waiting; 1461 + dev->stats.tx_packets += lp->packets_waiting; 1447 1462 lp->packets_waiting = 0; 1448 1463 1449 1464 } else if (status & IM_ALLOC_INT ) { ··· 1462 1477 1463 1478 PRINTK2((CARDNAME": Handoff done successfully.\n")); 1464 1479 } else if (status & IM_RX_OVRN_INT ) { 1465 - lp->stats.rx_errors++; 1466 - lp->stats.rx_fifo_errors++; 1480 + dev->stats.rx_errors++; 1481 + dev->stats.rx_fifo_errors++; 1467 1482 outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT ); 1468 1483 } else if (status & IM_EPH_INT ) { 1469 1484 PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT \n")); ··· 1504 1519 1505 1520 /* Update the statistics here. */ 1506 1521 return 0; 1507 - } 1508 - 1509 - /*------------------------------------------------------------ 1510 - . Get the current statistics. 1511 - . This may be called with the card open or closed. 1512 - .-------------------------------------------------------------*/ 1513 - static struct net_device_stats* smc_query_statistics(struct net_device *dev) { 1514 - struct smc_local *lp = netdev_priv(dev); 1515 - 1516 - return &lp->stats; 1517 1522 } 1518 1523 1519 1524 /*-----------------------------------------------------------
+24 -45
drivers/net/smc91x.c
··· 183 183 struct sk_buff *pending_tx_skb; 184 184 struct tasklet_struct tx_task; 185 185 186 - /* 187 - * these are things that the kernel wants me to keep, so users 188 - * can find out semi-useless statistics of how well the card is 189 - * performing 190 - */ 191 - struct net_device_stats stats; 192 - 193 186 /* version/revision of the SMC91x chip */ 194 187 int version; 195 188 ··· 325 332 /* free any pending tx skb */ 326 333 if (pending_skb) { 327 334 dev_kfree_skb(pending_skb); 328 - lp->stats.tx_errors++; 329 - lp->stats.tx_aborted_errors++; 335 + dev->stats.tx_errors++; 336 + dev->stats.tx_aborted_errors++; 330 337 } 331 338 332 339 /* ··· 505 512 } 506 513 SMC_WAIT_MMU_BUSY(); 507 514 SMC_SET_MMU_CMD(MC_RELEASE); 508 - lp->stats.rx_errors++; 515 + dev->stats.rx_errors++; 509 516 if (status & RS_ALGNERR) 510 - lp->stats.rx_frame_errors++; 517 + dev->stats.rx_frame_errors++; 511 518 if (status & (RS_TOOSHORT | RS_TOOLONG)) 512 - lp->stats.rx_length_errors++; 519 + dev->stats.rx_length_errors++; 513 520 if (status & RS_BADCRC) 514 - lp->stats.rx_crc_errors++; 521 + dev->stats.rx_crc_errors++; 515 522 } else { 516 523 struct sk_buff *skb; 517 524 unsigned char *data; ··· 519 526 520 527 /* set multicast stats */ 521 528 if (status & RS_MULTICAST) 522 - lp->stats.multicast++; 529 + dev->stats.multicast++; 523 530 524 531 /* 525 532 * Actual payload is packet_len - 6 (or 5 if odd byte). ··· 535 542 dev->name); 536 543 SMC_WAIT_MMU_BUSY(); 537 544 SMC_SET_MMU_CMD(MC_RELEASE); 538 - lp->stats.rx_dropped++; 545 + dev->stats.rx_dropped++; 539 546 return; 540 547 } 541 548 ··· 563 570 dev->last_rx = jiffies; 564 571 skb->protocol = eth_type_trans(skb, dev); 565 572 netif_rx(skb); 566 - lp->stats.rx_packets++; 567 - lp->stats.rx_bytes += data_len; 573 + dev->stats.rx_packets++; 574 + dev->stats.rx_bytes += data_len; 568 575 } 569 576 } 570 577 ··· 637 644 packet_no = SMC_GET_AR(); 638 645 if (unlikely(packet_no & AR_FAILED)) { 639 646 printk("%s: Memory allocation failed.\n", dev->name); 640 - lp->stats.tx_errors++; 641 - lp->stats.tx_fifo_errors++; 647 + dev->stats.tx_errors++; 648 + dev->stats.tx_fifo_errors++; 642 649 smc_special_unlock(&lp->lock); 643 650 goto done; 644 651 } ··· 681 688 smc_special_unlock(&lp->lock); 682 689 683 690 dev->trans_start = jiffies; 684 - lp->stats.tx_packets++; 685 - lp->stats.tx_bytes += len; 691 + dev->stats.tx_packets++; 692 + dev->stats.tx_bytes += len; 686 693 687 694 SMC_ENABLE_INT(IM_TX_INT | IM_TX_EMPTY_INT); 688 695 ··· 722 729 numPages = ((skb->len & ~1) + (6 - 1)) >> 8; 723 730 if (unlikely(numPages > 7)) { 724 731 printk("%s: Far too big packet error.\n", dev->name); 725 - lp->stats.tx_errors++; 726 - lp->stats.tx_dropped++; 732 + dev->stats.tx_errors++; 733 + dev->stats.tx_dropped++; 727 734 dev_kfree_skb(skb); 728 735 return 0; 729 736 } ··· 796 803 dev->name, tx_status, packet_no); 797 804 798 805 if (!(tx_status & ES_TX_SUC)) 799 - lp->stats.tx_errors++; 806 + dev->stats.tx_errors++; 800 807 801 808 if (tx_status & ES_LOSTCARR) 802 - lp->stats.tx_carrier_errors++; 809 + dev->stats.tx_carrier_errors++; 803 810 804 811 if (tx_status & (ES_LATCOL | ES_16COL)) { 805 812 PRINTK("%s: %s occurred on last xmit\n", dev->name, 806 813 (tx_status & ES_LATCOL) ? 807 814 "late collision" : "too many collisions"); 808 - lp->stats.tx_window_errors++; 809 - if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) { 815 + dev->stats.tx_window_errors++; 816 + if (!(dev->stats.tx_window_errors & 63) && net_ratelimit()) { 810 817 printk(KERN_INFO "%s: unexpectedly large number of " 811 818 "bad collisions. Please check duplex " 812 819 "setting.\n", dev->name); ··· 1340 1347 SMC_SELECT_BANK(2); 1341 1348 1342 1349 /* single collisions */ 1343 - lp->stats.collisions += card_stats & 0xF; 1350 + dev->stats.collisions += card_stats & 0xF; 1344 1351 card_stats >>= 4; 1345 1352 1346 1353 /* multiple collisions */ 1347 - lp->stats.collisions += card_stats & 0xF; 1354 + dev->stats.collisions += card_stats & 0xF; 1348 1355 } else if (status & IM_RX_OVRN_INT) { 1349 1356 DBG(1, "%s: RX overrun (EPH_ST 0x%04x)\n", dev->name, 1350 1357 ({ int eph_st; SMC_SELECT_BANK(0); 1351 1358 eph_st = SMC_GET_EPH_STATUS(); 1352 1359 SMC_SELECT_BANK(2); eph_st; }) ); 1353 1360 SMC_ACK_INT(IM_RX_OVRN_INT); 1354 - lp->stats.rx_errors++; 1355 - lp->stats.rx_fifo_errors++; 1361 + dev->stats.rx_errors++; 1362 + dev->stats.rx_fifo_errors++; 1356 1363 } else if (status & IM_EPH_INT) { 1357 1364 smc_eph_interrupt(dev); 1358 1365 } else if (status & IM_MDINT) { ··· 1618 1625 tasklet_kill(&lp->tx_task); 1619 1626 smc_phy_powerdown(dev); 1620 1627 return 0; 1621 - } 1622 - 1623 - /* 1624 - * Get the current statistics. 1625 - * This may be called with the card open or closed. 1626 - */ 1627 - static struct net_device_stats *smc_query_statistics(struct net_device *dev) 1628 - { 1629 - struct smc_local *lp = netdev_priv(dev); 1630 - 1631 - DBG(2, "%s: %s\n", dev->name, __FUNCTION__); 1632 - 1633 - return &lp->stats; 1634 1628 } 1635 1629 1636 1630 /* ··· 1945 1965 dev->hard_start_xmit = smc_hard_start_xmit; 1946 1966 dev->tx_timeout = smc_timeout; 1947 1967 dev->watchdog_timeo = msecs_to_jiffies(watchdog); 1948 - dev->get_stats = smc_query_statistics; 1949 1968 dev->set_multicast_list = smc_set_multicast_list; 1950 1969 dev->ethtool_ops = &smc_ethtool_ops; 1951 1970 #ifdef CONFIG_NET_POLL_CONTROLLER
+16 -33
drivers/net/spider_net.c
··· 795 795 static int 796 796 spider_net_release_tx_chain(struct spider_net_card *card, int brutal) 797 797 { 798 + struct net_device *dev = card->netdev; 798 799 struct spider_net_descr_chain *chain = &card->tx_chain; 799 800 struct spider_net_descr *descr; 800 801 struct spider_net_hw_descr *hwdescr; ··· 816 815 status = spider_net_get_descr_status(hwdescr); 817 816 switch (status) { 818 817 case SPIDER_NET_DESCR_COMPLETE: 819 - card->netdev_stats.tx_packets++; 820 - card->netdev_stats.tx_bytes += descr->skb->len; 818 + dev->stats.tx_packets++; 819 + dev->stats.tx_bytes += descr->skb->len; 821 820 break; 822 821 823 822 case SPIDER_NET_DESCR_CARDOWNED: ··· 836 835 if (netif_msg_tx_err(card)) 837 836 dev_err(&card->netdev->dev, "forcing end of tx descriptor " 838 837 "with status x%02x\n", status); 839 - card->netdev_stats.tx_errors++; 838 + dev->stats.tx_errors++; 840 839 break; 841 840 842 841 default: 843 - card->netdev_stats.tx_dropped++; 842 + dev->stats.tx_dropped++; 844 843 if (!brutal) { 845 844 spin_unlock_irqrestore(&chain->lock, flags); 846 845 return 1; ··· 920 919 spider_net_release_tx_chain(card, 0); 921 920 922 921 if (spider_net_prepare_tx_descr(card, skb) != 0) { 923 - card->netdev_stats.tx_dropped++; 922 + netdev->stats.tx_dropped++; 924 923 netif_stop_queue(netdev); 925 924 return NETDEV_TX_BUSY; 926 925 } ··· 980 979 spider_net_pass_skb_up(struct spider_net_descr *descr, 981 980 struct spider_net_card *card) 982 981 { 983 - struct spider_net_hw_descr *hwdescr= descr->hwdescr; 984 - struct sk_buff *skb; 985 - struct net_device *netdev; 986 - u32 data_status, data_error; 982 + struct spider_net_hw_descr *hwdescr = descr->hwdescr; 983 + struct sk_buff *skb = descr->skb; 984 + struct net_device *netdev = card->netdev; 985 + u32 data_status = hwdescr->data_status; 986 + u32 data_error = hwdescr->data_error; 987 987 988 - data_status = hwdescr->data_status; 989 - data_error = hwdescr->data_error; 990 - netdev = card->netdev; 991 - 992 - skb = descr->skb; 993 988 skb_put(skb, hwdescr->valid_size); 994 989 995 990 /* the card seems to add 2 bytes of junk in front ··· 1012 1015 } 1013 1016 1014 1017 /* update netdevice statistics */ 1015 - card->netdev_stats.rx_packets++; 1016 - card->netdev_stats.rx_bytes += skb->len; 1018 + netdev->stats.rx_packets++; 1019 + netdev->stats.rx_bytes += skb->len; 1017 1020 1018 1021 /* pass skb up to stack */ 1019 1022 netif_receive_skb(skb); ··· 1181 1184 static int 1182 1185 spider_net_decode_one_descr(struct spider_net_card *card) 1183 1186 { 1187 + struct net_device *dev = card->netdev; 1184 1188 struct spider_net_descr_chain *chain = &card->rx_chain; 1185 1189 struct spider_net_descr *descr = chain->tail; 1186 1190 struct spider_net_hw_descr *hwdescr = descr->hwdescr; ··· 1208 1210 (status == SPIDER_NET_DESCR_PROTECTION_ERROR) || 1209 1211 (status == SPIDER_NET_DESCR_FORCE_END) ) { 1210 1212 if (netif_msg_rx_err(card)) 1211 - dev_err(&card->netdev->dev, 1213 + dev_err(&dev->dev, 1212 1214 "dropping RX descriptor with state %d\n", status); 1213 - card->netdev_stats.rx_dropped++; 1215 + dev->stats.rx_dropped++; 1214 1216 goto bad_desc; 1215 1217 } 1216 1218 ··· 1310 1312 } 1311 1313 1312 1314 return packets_done; 1313 - } 1314 - 1315 - /** 1316 - * spider_net_get_stats - get interface statistics 1317 - * @netdev: interface device structure 1318 - * 1319 - * returns the interface statistics residing in the spider_net_card struct 1320 - */ 1321 - static struct net_device_stats * 1322 - spider_net_get_stats(struct net_device *netdev) 1323 - { 1324 - struct spider_net_card *card = netdev_priv(netdev); 1325 - struct net_device_stats *stats = &card->netdev_stats; 1326 - return stats; 1327 1315 } 1328 1316 1329 1317 /** ··· 2274 2290 netdev->open = &spider_net_open; 2275 2291 netdev->stop = &spider_net_stop; 2276 2292 netdev->hard_start_xmit = &spider_net_xmit; 2277 - netdev->get_stats = &spider_net_get_stats; 2278 2293 netdev->set_multicast_list = &spider_net_set_multi; 2279 2294 netdev->set_mac_address = &spider_net_set_mac; 2280 2295 netdev->change_mtu = &spider_net_change_mtu;
-1
drivers/net/spider_net.h
··· 487 487 488 488 /* for ethtool */ 489 489 int msg_enable; 490 - struct net_device_stats netdev_stats; 491 490 struct spider_net_extra_stats spider_stats; 492 491 struct spider_net_options options; 493 492
+20 -33
drivers/net/sun3lance.c
··· 152 152 struct lance_memory *mem; 153 153 int new_rx, new_tx; /* The next free ring entry */ 154 154 int old_tx, old_rx; /* ring entry to be processed */ 155 - struct net_device_stats stats; 156 155 /* These two must be longs for set_bit() */ 157 156 long tx_full; 158 157 long lock; ··· 240 241 static irqreturn_t lance_interrupt( int irq, void *dev_id); 241 242 static int lance_rx( struct net_device *dev ); 242 243 static int lance_close( struct net_device *dev ); 243 - static struct net_device_stats *lance_get_stats( struct net_device *dev ); 244 244 static void set_multicast_list( struct net_device *dev ); 245 245 246 246 /************************* End of Prototypes **************************/ ··· 399 401 dev->open = &lance_open; 400 402 dev->hard_start_xmit = &lance_start_xmit; 401 403 dev->stop = &lance_close; 402 - dev->get_stats = &lance_get_stats; 403 404 dev->set_multicast_list = &set_multicast_list; 404 405 dev->set_mac_address = NULL; 405 406 // KLUDGE -- REMOVE ME 406 407 set_bit(__LINK_STATE_PRESENT, &dev->state); 407 408 408 - 409 - memset( &lp->stats, 0, sizeof(lp->stats) ); 410 409 411 410 return 1; 412 411 } ··· 529 534 * little endian mode. 530 535 */ 531 536 REGA(CSR3) = CSR3_BSWP; 532 - lp->stats.tx_errors++; 537 + dev->stats.tx_errors++; 533 538 534 539 if(lance_debug >= 2) { 535 540 int i; ··· 629 634 630 635 head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP; 631 636 lp->new_tx = (lp->new_tx + 1) & TX_RING_MOD_MASK; 632 - lp->stats.tx_bytes += skb->len; 637 + dev->stats.tx_bytes += skb->len; 633 638 634 639 /* Trigger an immediate send poll. */ 635 640 REGA(CSR0) = CSR0_INEA | CSR0_TDMD | CSR0_STRT; ··· 707 712 708 713 if (head->flag & TMD1_ERR) { 709 714 int status = head->misc; 710 - lp->stats.tx_errors++; 711 - if (status & TMD3_RTRY) lp->stats.tx_aborted_errors++; 712 - if (status & TMD3_LCAR) lp->stats.tx_carrier_errors++; 713 - if (status & TMD3_LCOL) lp->stats.tx_window_errors++; 715 + dev->stats.tx_errors++; 716 + if (status & TMD3_RTRY) dev->stats.tx_aborted_errors++; 717 + if (status & TMD3_LCAR) dev->stats.tx_carrier_errors++; 718 + if (status & TMD3_LCOL) dev->stats.tx_window_errors++; 714 719 if (status & (TMD3_UFLO | TMD3_BUFF)) { 715 - lp->stats.tx_fifo_errors++; 720 + dev->stats.tx_fifo_errors++; 716 721 printk("%s: Tx FIFO error\n", 717 722 dev->name); 718 723 REGA(CSR0) = CSR0_STOP; ··· 725 730 726 731 head->flag &= ~(TMD1_ENP | TMD1_STP); 727 732 if(head->flag & (TMD1_ONE | TMD1_MORE)) 728 - lp->stats.collisions++; 733 + dev->stats.collisions++; 729 734 730 - lp->stats.tx_packets++; 735 + dev->stats.tx_packets++; 731 736 DPRINTK(3, ("cleared tx ring %d\n", old_tx)); 732 737 } 733 738 old_tx = (old_tx +1) & TX_RING_MOD_MASK; ··· 747 752 lance_rx( dev ); 748 753 749 754 /* Log misc errors. */ 750 - if (csr0 & CSR0_BABL) lp->stats.tx_errors++; /* Tx babble. */ 751 - if (csr0 & CSR0_MISS) lp->stats.rx_errors++; /* Missed a Rx frame. */ 755 + if (csr0 & CSR0_BABL) dev->stats.tx_errors++; /* Tx babble. */ 756 + if (csr0 & CSR0_MISS) dev->stats.rx_errors++; /* Missed a Rx frame. */ 752 757 if (csr0 & CSR0_MERR) { 753 758 DPRINTK( 1, ( "%s: Bus master arbitration failure (?!?), " 754 759 "status %04x.\n", dev->name, csr0 )); ··· 794 799 full-sized buffers it's possible for a jabber packet to use two 795 800 buffers, with only the last correctly noting the error. */ 796 801 if (status & RMD1_ENP) /* Only count a general error at the */ 797 - lp->stats.rx_errors++; /* end of a packet.*/ 798 - if (status & RMD1_FRAM) lp->stats.rx_frame_errors++; 799 - if (status & RMD1_OFLO) lp->stats.rx_over_errors++; 800 - if (status & RMD1_CRC) lp->stats.rx_crc_errors++; 801 - if (status & RMD1_BUFF) lp->stats.rx_fifo_errors++; 802 + dev->stats.rx_errors++; /* end of a packet.*/ 803 + if (status & RMD1_FRAM) dev->stats.rx_frame_errors++; 804 + if (status & RMD1_OFLO) dev->stats.rx_over_errors++; 805 + if (status & RMD1_CRC) dev->stats.rx_crc_errors++; 806 + if (status & RMD1_BUFF) dev->stats.rx_fifo_errors++; 802 807 head->flag &= (RMD1_ENP|RMD1_STP); 803 808 } else { 804 809 /* Malloc up new buffer, compatible with net-3. */ ··· 808 813 809 814 if (pkt_len < 60) { 810 815 printk( "%s: Runt packet!\n", dev->name ); 811 - lp->stats.rx_errors++; 816 + dev->stats.rx_errors++; 812 817 } 813 818 else { 814 819 skb = dev_alloc_skb( pkt_len+2 ); ··· 816 821 DPRINTK( 1, ( "%s: Memory squeeze, deferring packet.\n", 817 822 dev->name )); 818 823 819 - lp->stats.rx_dropped++; 824 + dev->stats.rx_dropped++; 820 825 head->msg_length = 0; 821 826 head->flag |= RMD1_OWN_CHIP; 822 827 lp->new_rx = (lp->new_rx+1) & ··· 854 859 skb->protocol = eth_type_trans( skb, dev ); 855 860 netif_rx( skb ); 856 861 dev->last_rx = jiffies; 857 - lp->stats.rx_packets++; 858 - lp->stats.rx_bytes += pkt_len; 862 + dev->stats.rx_packets++; 863 + dev->stats.rx_bytes += pkt_len; 859 864 } 860 865 } 861 866 ··· 889 894 memory if we don't. */ 890 895 DREG = CSR0_STOP; 891 896 return 0; 892 - } 893 - 894 - 895 - static struct net_device_stats *lance_get_stats( struct net_device *dev ) 896 - { 897 - struct lance_private *lp = netdev_priv(dev); 898 - 899 - return &lp->stats; 900 897 } 901 898 902 899
+39 -48
drivers/net/sunlance.c
··· 248 248 int rx_new, tx_new; 249 249 int rx_old, tx_old; 250 250 251 - struct net_device_stats stats; 252 251 struct sbus_dma *ledma; /* If set this points to ledma */ 253 252 char tpe; /* cable-selection is TPE */ 254 253 char auto_select; /* cable-selection by carrier */ ··· 518 519 519 520 /* We got an incomplete frame? */ 520 521 if ((bits & LE_R1_POK) != LE_R1_POK) { 521 - lp->stats.rx_over_errors++; 522 - lp->stats.rx_errors++; 522 + dev->stats.rx_over_errors++; 523 + dev->stats.rx_errors++; 523 524 } else if (bits & LE_R1_ERR) { 524 525 /* Count only the end frame as a rx error, 525 526 * not the beginning 526 527 */ 527 - if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++; 528 - if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++; 529 - if (bits & LE_R1_OFL) lp->stats.rx_over_errors++; 530 - if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++; 531 - if (bits & LE_R1_EOP) lp->stats.rx_errors++; 528 + if (bits & LE_R1_BUF) dev->stats.rx_fifo_errors++; 529 + if (bits & LE_R1_CRC) dev->stats.rx_crc_errors++; 530 + if (bits & LE_R1_OFL) dev->stats.rx_over_errors++; 531 + if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++; 532 + if (bits & LE_R1_EOP) dev->stats.rx_errors++; 532 533 } else { 533 534 len = (rd->mblength & 0xfff) - 4; 534 535 skb = dev_alloc_skb(len + 2); ··· 536 537 if (skb == NULL) { 537 538 printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n", 538 539 dev->name); 539 - lp->stats.rx_dropped++; 540 + dev->stats.rx_dropped++; 540 541 rd->mblength = 0; 541 542 rd->rmd1_bits = LE_R1_OWN; 542 543 lp->rx_new = RX_NEXT(entry); 543 544 return; 544 545 } 545 546 546 - lp->stats.rx_bytes += len; 547 + dev->stats.rx_bytes += len; 547 548 548 549 skb_reserve(skb, 2); /* 16 byte align */ 549 550 skb_put(skb, len); /* make room */ ··· 553 554 skb->protocol = eth_type_trans(skb, dev); 554 555 netif_rx(skb); 555 556 dev->last_rx = jiffies; 556 - lp->stats.rx_packets++; 557 + dev->stats.rx_packets++; 557 558 } 558 559 559 560 /* Return the packet to the pool */ ··· 585 586 if (bits & LE_T1_ERR) { 586 587 u16 status = td->misc; 587 588 588 - lp->stats.tx_errors++; 589 - if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++; 590 - if (status & LE_T3_LCOL) lp->stats.tx_window_errors++; 589 + dev->stats.tx_errors++; 590 + if (status & LE_T3_RTY) dev->stats.tx_aborted_errors++; 591 + if (status & LE_T3_LCOL) dev->stats.tx_window_errors++; 591 592 592 593 if (status & LE_T3_CLOS) { 593 - lp->stats.tx_carrier_errors++; 594 + dev->stats.tx_carrier_errors++; 594 595 if (lp->auto_select) { 595 596 lp->tpe = 1 - lp->tpe; 596 597 printk(KERN_NOTICE "%s: Carrier Lost, trying %s\n", ··· 607 608 * transmitter, restart the adapter. 608 609 */ 609 610 if (status & (LE_T3_BUF|LE_T3_UFL)) { 610 - lp->stats.tx_fifo_errors++; 611 + dev->stats.tx_fifo_errors++; 611 612 612 613 printk(KERN_ERR "%s: Tx: ERR_BUF|ERR_UFL, restarting\n", 613 614 dev->name); ··· 625 626 626 627 /* One collision before packet was sent. */ 627 628 if (bits & LE_T1_EONE) 628 - lp->stats.collisions++; 629 + dev->stats.collisions++; 629 630 630 631 /* More than one collision, be optimistic. */ 631 632 if (bits & LE_T1_EMORE) 632 - lp->stats.collisions += 2; 633 + dev->stats.collisions += 2; 633 634 634 - lp->stats.tx_packets++; 635 + dev->stats.tx_packets++; 635 636 } 636 637 637 638 j = TX_NEXT(j); ··· 691 692 692 693 /* We got an incomplete frame? */ 693 694 if ((bits & LE_R1_POK) != LE_R1_POK) { 694 - lp->stats.rx_over_errors++; 695 - lp->stats.rx_errors++; 695 + dev->stats.rx_over_errors++; 696 + dev->stats.rx_errors++; 696 697 } else if (bits & LE_R1_ERR) { 697 698 /* Count only the end frame as a rx error, 698 699 * not the beginning 699 700 */ 700 - if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++; 701 - if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++; 702 - if (bits & LE_R1_OFL) lp->stats.rx_over_errors++; 703 - if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++; 704 - if (bits & LE_R1_EOP) lp->stats.rx_errors++; 701 + if (bits & LE_R1_BUF) dev->stats.rx_fifo_errors++; 702 + if (bits & LE_R1_CRC) dev->stats.rx_crc_errors++; 703 + if (bits & LE_R1_OFL) dev->stats.rx_over_errors++; 704 + if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++; 705 + if (bits & LE_R1_EOP) dev->stats.rx_errors++; 705 706 } else { 706 707 len = (sbus_readw(&rd->mblength) & 0xfff) - 4; 707 708 skb = dev_alloc_skb(len + 2); ··· 709 710 if (skb == NULL) { 710 711 printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n", 711 712 dev->name); 712 - lp->stats.rx_dropped++; 713 + dev->stats.rx_dropped++; 713 714 sbus_writew(0, &rd->mblength); 714 715 sbus_writeb(LE_R1_OWN, &rd->rmd1_bits); 715 716 lp->rx_new = RX_NEXT(entry); 716 717 return; 717 718 } 718 719 719 - lp->stats.rx_bytes += len; 720 + dev->stats.rx_bytes += len; 720 721 721 722 skb_reserve (skb, 2); /* 16 byte align */ 722 723 skb_put(skb, len); /* make room */ ··· 724 725 skb->protocol = eth_type_trans(skb, dev); 725 726 netif_rx(skb); 726 727 dev->last_rx = jiffies; 727 - lp->stats.rx_packets++; 728 + dev->stats.rx_packets++; 728 729 } 729 730 730 731 /* Return the packet to the pool */ ··· 756 757 if (bits & LE_T1_ERR) { 757 758 u16 status = sbus_readw(&td->misc); 758 759 759 - lp->stats.tx_errors++; 760 - if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++; 761 - if (status & LE_T3_LCOL) lp->stats.tx_window_errors++; 760 + dev->stats.tx_errors++; 761 + if (status & LE_T3_RTY) dev->stats.tx_aborted_errors++; 762 + if (status & LE_T3_LCOL) dev->stats.tx_window_errors++; 762 763 763 764 if (status & LE_T3_CLOS) { 764 - lp->stats.tx_carrier_errors++; 765 + dev->stats.tx_carrier_errors++; 765 766 if (lp->auto_select) { 766 767 lp->tpe = 1 - lp->tpe; 767 768 printk(KERN_NOTICE "%s: Carrier Lost, trying %s\n", ··· 778 779 * transmitter, restart the adapter. 779 780 */ 780 781 if (status & (LE_T3_BUF|LE_T3_UFL)) { 781 - lp->stats.tx_fifo_errors++; 782 + dev->stats.tx_fifo_errors++; 782 783 783 784 printk(KERN_ERR "%s: Tx: ERR_BUF|ERR_UFL, restarting\n", 784 785 dev->name); ··· 796 797 797 798 /* One collision before packet was sent. */ 798 799 if (bits & LE_T1_EONE) 799 - lp->stats.collisions++; 800 + dev->stats.collisions++; 800 801 801 802 /* More than one collision, be optimistic. */ 802 803 if (bits & LE_T1_EMORE) 803 - lp->stats.collisions += 2; 804 + dev->stats.collisions += 2; 804 805 805 - lp->stats.tx_packets++; 806 + dev->stats.tx_packets++; 806 807 } 807 808 808 809 j = TX_NEXT(j); ··· 843 844 lp->tx(dev); 844 845 845 846 if (csr0 & LE_C0_BABL) 846 - lp->stats.tx_errors++; 847 + dev->stats.tx_errors++; 847 848 848 849 if (csr0 & LE_C0_MISS) 849 - lp->stats.rx_errors++; 850 + dev->stats.rx_errors++; 850 851 851 852 if (csr0 & LE_C0_MERR) { 852 853 if (lp->dregs) { ··· 1126 1127 1127 1128 spin_lock_irq(&lp->lock); 1128 1129 1129 - lp->stats.tx_bytes += len; 1130 + dev->stats.tx_bytes += len; 1130 1131 1131 1132 entry = lp->tx_new & TX_RING_MOD_MASK; 1132 1133 if (lp->pio_buffer) { ··· 1167 1168 dev_kfree_skb(skb); 1168 1169 1169 1170 return 0; 1170 - } 1171 - 1172 - static struct net_device_stats *lance_get_stats(struct net_device *dev) 1173 - { 1174 - struct lance_private *lp = netdev_priv(dev); 1175 - 1176 - return &lp->stats; 1177 1171 } 1178 1172 1179 1173 /* taken from the depca driver */ ··· 1455 1463 dev->hard_start_xmit = &lance_start_xmit; 1456 1464 dev->tx_timeout = &lance_tx_timeout; 1457 1465 dev->watchdog_timeo = 5*HZ; 1458 - dev->get_stats = &lance_get_stats; 1459 1466 dev->set_multicast_list = &lance_set_multicast; 1460 1467 dev->ethtool_ops = &sparc_lance_ethtool_ops; 1461 1468
+49 -56
drivers/net/sunqe.c
··· 260 260 261 261 if (qe_status & CREG_STAT_EDEFER) { 262 262 printk(KERN_ERR "%s: Excessive transmit defers.\n", dev->name); 263 - qep->net_stats.tx_errors++; 263 + dev->stats.tx_errors++; 264 264 } 265 265 266 266 if (qe_status & CREG_STAT_CLOSS) { 267 267 printk(KERN_ERR "%s: Carrier lost, link down?\n", dev->name); 268 - qep->net_stats.tx_errors++; 269 - qep->net_stats.tx_carrier_errors++; 268 + dev->stats.tx_errors++; 269 + dev->stats.tx_carrier_errors++; 270 270 } 271 271 272 272 if (qe_status & CREG_STAT_ERETRIES) { 273 273 printk(KERN_ERR "%s: Excessive transmit retries (more than 16).\n", dev->name); 274 - qep->net_stats.tx_errors++; 274 + dev->stats.tx_errors++; 275 275 mace_hwbug_workaround = 1; 276 276 } 277 277 278 278 if (qe_status & CREG_STAT_LCOLL) { 279 279 printk(KERN_ERR "%s: Late transmit collision.\n", dev->name); 280 - qep->net_stats.tx_errors++; 281 - qep->net_stats.collisions++; 280 + dev->stats.tx_errors++; 281 + dev->stats.collisions++; 282 282 mace_hwbug_workaround = 1; 283 283 } 284 284 285 285 if (qe_status & CREG_STAT_FUFLOW) { 286 286 printk(KERN_ERR "%s: Transmit fifo underflow, driver bug.\n", dev->name); 287 - qep->net_stats.tx_errors++; 287 + dev->stats.tx_errors++; 288 288 mace_hwbug_workaround = 1; 289 289 } 290 290 ··· 297 297 } 298 298 299 299 if (qe_status & CREG_STAT_CCOFLOW) { 300 - qep->net_stats.tx_errors += 256; 301 - qep->net_stats.collisions += 256; 300 + dev->stats.tx_errors += 256; 301 + dev->stats.collisions += 256; 302 302 } 303 303 304 304 if (qe_status & CREG_STAT_TXDERROR) { 305 305 printk(KERN_ERR "%s: Transmit descriptor is bogus, driver bug.\n", dev->name); 306 - qep->net_stats.tx_errors++; 307 - qep->net_stats.tx_aborted_errors++; 306 + dev->stats.tx_errors++; 307 + dev->stats.tx_aborted_errors++; 308 308 mace_hwbug_workaround = 1; 309 309 } 310 310 311 311 if (qe_status & CREG_STAT_TXLERR) { 312 312 printk(KERN_ERR "%s: Transmit late error.\n", dev->name); 313 - qep->net_stats.tx_errors++; 313 + dev->stats.tx_errors++; 314 314 mace_hwbug_workaround = 1; 315 315 } 316 316 317 317 if (qe_status & CREG_STAT_TXPERR) { 318 318 printk(KERN_ERR "%s: Transmit DMA parity error.\n", dev->name); 319 - qep->net_stats.tx_errors++; 320 - qep->net_stats.tx_aborted_errors++; 319 + dev->stats.tx_errors++; 320 + dev->stats.tx_aborted_errors++; 321 321 mace_hwbug_workaround = 1; 322 322 } 323 323 324 324 if (qe_status & CREG_STAT_TXSERR) { 325 325 printk(KERN_ERR "%s: Transmit DMA sbus error ack.\n", dev->name); 326 - qep->net_stats.tx_errors++; 327 - qep->net_stats.tx_aborted_errors++; 326 + dev->stats.tx_errors++; 327 + dev->stats.tx_aborted_errors++; 328 328 mace_hwbug_workaround = 1; 329 329 } 330 330 331 331 if (qe_status & CREG_STAT_RCCOFLOW) { 332 - qep->net_stats.rx_errors += 256; 333 - qep->net_stats.collisions += 256; 332 + dev->stats.rx_errors += 256; 333 + dev->stats.collisions += 256; 334 334 } 335 335 336 336 if (qe_status & CREG_STAT_RUOFLOW) { 337 - qep->net_stats.rx_errors += 256; 338 - qep->net_stats.rx_over_errors += 256; 337 + dev->stats.rx_errors += 256; 338 + dev->stats.rx_over_errors += 256; 339 339 } 340 340 341 341 if (qe_status & CREG_STAT_MCOFLOW) { 342 - qep->net_stats.rx_errors += 256; 343 - qep->net_stats.rx_missed_errors += 256; 342 + dev->stats.rx_errors += 256; 343 + dev->stats.rx_missed_errors += 256; 344 344 } 345 345 346 346 if (qe_status & CREG_STAT_RXFOFLOW) { 347 347 printk(KERN_ERR "%s: Receive fifo overflow.\n", dev->name); 348 - qep->net_stats.rx_errors++; 349 - qep->net_stats.rx_over_errors++; 348 + dev->stats.rx_errors++; 349 + dev->stats.rx_over_errors++; 350 350 } 351 351 352 352 if (qe_status & CREG_STAT_RLCOLL) { 353 353 printk(KERN_ERR "%s: Late receive collision.\n", dev->name); 354 - qep->net_stats.rx_errors++; 355 - qep->net_stats.collisions++; 354 + dev->stats.rx_errors++; 355 + dev->stats.collisions++; 356 356 } 357 357 358 358 if (qe_status & CREG_STAT_FCOFLOW) { 359 - qep->net_stats.rx_errors += 256; 360 - qep->net_stats.rx_frame_errors += 256; 359 + dev->stats.rx_errors += 256; 360 + dev->stats.rx_frame_errors += 256; 361 361 } 362 362 363 363 if (qe_status & CREG_STAT_CECOFLOW) { 364 - qep->net_stats.rx_errors += 256; 365 - qep->net_stats.rx_crc_errors += 256; 364 + dev->stats.rx_errors += 256; 365 + dev->stats.rx_crc_errors += 256; 366 366 } 367 367 368 368 if (qe_status & CREG_STAT_RXDROP) { 369 369 printk(KERN_ERR "%s: Receive packet dropped.\n", dev->name); 370 - qep->net_stats.rx_errors++; 371 - qep->net_stats.rx_dropped++; 372 - qep->net_stats.rx_missed_errors++; 370 + dev->stats.rx_errors++; 371 + dev->stats.rx_dropped++; 372 + dev->stats.rx_missed_errors++; 373 373 } 374 374 375 375 if (qe_status & CREG_STAT_RXSMALL) { 376 376 printk(KERN_ERR "%s: Receive buffer too small, driver bug.\n", dev->name); 377 - qep->net_stats.rx_errors++; 378 - qep->net_stats.rx_length_errors++; 377 + dev->stats.rx_errors++; 378 + dev->stats.rx_length_errors++; 379 379 } 380 380 381 381 if (qe_status & CREG_STAT_RXLERR) { 382 382 printk(KERN_ERR "%s: Receive late error.\n", dev->name); 383 - qep->net_stats.rx_errors++; 383 + dev->stats.rx_errors++; 384 384 mace_hwbug_workaround = 1; 385 385 } 386 386 387 387 if (qe_status & CREG_STAT_RXPERR) { 388 388 printk(KERN_ERR "%s: Receive DMA parity error.\n", dev->name); 389 - qep->net_stats.rx_errors++; 390 - qep->net_stats.rx_missed_errors++; 389 + dev->stats.rx_errors++; 390 + dev->stats.rx_missed_errors++; 391 391 mace_hwbug_workaround = 1; 392 392 } 393 393 394 394 if (qe_status & CREG_STAT_RXSERR) { 395 395 printk(KERN_ERR "%s: Receive DMA sbus error ack.\n", dev->name); 396 - qep->net_stats.rx_errors++; 397 - qep->net_stats.rx_missed_errors++; 396 + dev->stats.rx_errors++; 397 + dev->stats.rx_missed_errors++; 398 398 mace_hwbug_workaround = 1; 399 399 } 400 400 ··· 409 409 static void qe_rx(struct sunqe *qep) 410 410 { 411 411 struct qe_rxd *rxbase = &qep->qe_block->qe_rxd[0]; 412 + struct net_device *dev = qep->dev; 412 413 struct qe_rxd *this; 413 414 struct sunqe_buffers *qbufs = qep->buffers; 414 415 __u32 qbufs_dvma = qep->buffers_dvma; ··· 429 428 430 429 /* Check for errors. */ 431 430 if (len < ETH_ZLEN) { 432 - qep->net_stats.rx_errors++; 433 - qep->net_stats.rx_length_errors++; 434 - qep->net_stats.rx_dropped++; 431 + dev->stats.rx_errors++; 432 + dev->stats.rx_length_errors++; 433 + dev->stats.rx_dropped++; 435 434 } else { 436 435 skb = dev_alloc_skb(len + 2); 437 436 if (skb == NULL) { 438 437 drops++; 439 - qep->net_stats.rx_dropped++; 438 + dev->stats.rx_dropped++; 440 439 } else { 441 440 skb_reserve(skb, 2); 442 441 skb_put(skb, len); ··· 445 444 skb->protocol = eth_type_trans(skb, qep->dev); 446 445 netif_rx(skb); 447 446 qep->dev->last_rx = jiffies; 448 - qep->net_stats.rx_packets++; 449 - qep->net_stats.rx_bytes += len; 447 + dev->stats.rx_packets++; 448 + dev->stats.rx_bytes += len; 450 449 } 451 450 } 452 451 end_rxd->rx_addr = this_qbuf_dvma; ··· 604 603 dev->trans_start = jiffies; 605 604 sbus_writel(CREG_CTRL_TWAKEUP, qep->qcregs + CREG_CTRL); 606 605 607 - qep->net_stats.tx_packets++; 608 - qep->net_stats.tx_bytes += len; 606 + dev->stats.tx_packets++; 607 + dev->stats.tx_bytes += len; 609 608 610 609 if (TX_BUFFS_AVAIL(qep) <= 0) { 611 610 /* Halt the net queue and enable tx interrupts. ··· 621 620 dev_kfree_skb(skb); 622 621 623 622 return 0; 624 - } 625 - 626 - static struct net_device_stats *qe_get_stats(struct net_device *dev) 627 - { 628 - struct sunqe *qep = (struct sunqe *) dev->priv; 629 - 630 - return &qep->net_stats; 631 623 } 632 624 633 625 static void qe_set_multicast(struct net_device *dev) ··· 897 903 dev->open = qe_open; 898 904 dev->stop = qe_close; 899 905 dev->hard_start_xmit = qe_start_xmit; 900 - dev->get_stats = qe_get_stats; 901 906 dev->set_multicast_list = qe_set_multicast; 902 907 dev->tx_timeout = qe_tx_timeout; 903 908 dev->watchdog_timeo = 5*HZ;
-1
drivers/net/sunqe.h
··· 342 342 __u32 buffers_dvma; /* DVMA visible address. */ 343 343 struct sunqec *parent; 344 344 u8 mconfig; /* Base MACE mconfig value */ 345 - struct net_device_stats net_stats; /* Statistical counters */ 346 345 struct sbus_dev *qe_sdev; /* QE's SBUS device struct */ 347 346 struct net_device *dev; /* QE's netdevice struct */ 348 347 int channel; /* Who am I? */
+8 -15
drivers/net/tun.c
··· 110 110 111 111 /* We won't see all dropped packets individually, so overrun 112 112 * error is more appropriate. */ 113 - tun->stats.tx_fifo_errors++; 113 + dev->stats.tx_fifo_errors++; 114 114 } else { 115 115 /* Single queue mode. 116 116 * Driver handles dropping of all packets itself. */ ··· 129 129 return 0; 130 130 131 131 drop: 132 - tun->stats.tx_dropped++; 132 + dev->stats.tx_dropped++; 133 133 kfree_skb(skb); 134 134 return 0; 135 135 } ··· 170 170 mclist->dmi_addr[0], mclist->dmi_addr[1], mclist->dmi_addr[2], 171 171 mclist->dmi_addr[3], mclist->dmi_addr[4], mclist->dmi_addr[5]); 172 172 } 173 - } 174 - 175 - static struct net_device_stats *tun_net_stats(struct net_device *dev) 176 - { 177 - struct tun_struct *tun = netdev_priv(dev); 178 - return &tun->stats; 179 173 } 180 174 181 175 /* Initialize net device. */ ··· 244 250 align = NET_IP_ALIGN; 245 251 246 252 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { 247 - tun->stats.rx_dropped++; 253 + tun->dev->stats.rx_dropped++; 248 254 return -ENOMEM; 249 255 } 250 256 251 257 if (align) 252 258 skb_reserve(skb, align); 253 259 if (memcpy_fromiovec(skb_put(skb, len), iv, len)) { 254 - tun->stats.rx_dropped++; 260 + tun->dev->stats.rx_dropped++; 255 261 kfree_skb(skb); 256 262 return -EFAULT; 257 263 } ··· 273 279 netif_rx_ni(skb); 274 280 tun->dev->last_rx = jiffies; 275 281 276 - tun->stats.rx_packets++; 277 - tun->stats.rx_bytes += len; 282 + tun->dev->stats.rx_packets++; 283 + tun->dev->stats.rx_bytes += len; 278 284 279 285 return count; 280 286 } ··· 330 336 skb_copy_datagram_iovec(skb, 0, iv, len); 331 337 total += len; 332 338 333 - tun->stats.tx_packets++; 334 - tun->stats.tx_bytes += len; 339 + tun->dev->stats.tx_packets++; 340 + tun->dev->stats.tx_bytes += len; 335 341 336 342 return total; 337 343 } ··· 432 438 dev->open = tun_net_open; 433 439 dev->hard_start_xmit = tun_net_xmit; 434 440 dev->stop = tun_net_close; 435 - dev->get_stats = tun_net_stats; 436 441 dev->ethtool_ops = &tun_ethtool_ops; 437 442 dev->destructor = free_netdev; 438 443 }
+9 -18
drivers/net/ucc_geth.c
··· 3350 3350 return 0; 3351 3351 } 3352 3352 3353 - /* returns a net_device_stats structure pointer */ 3354 - static struct net_device_stats *ucc_geth_get_stats(struct net_device *dev) 3355 - { 3356 - struct ucc_geth_private *ugeth = netdev_priv(dev); 3357 - 3358 - return &(ugeth->stats); 3359 - } 3360 - 3361 3353 /* ucc_geth_timeout gets called when a packet has not been 3362 3354 * transmitted after a set amount of time. 3363 3355 * For now, assume that clearing out all the structures, and ··· 3360 3368 3361 3369 ugeth_vdbg("%s: IN", __FUNCTION__); 3362 3370 3363 - ugeth->stats.tx_errors++; 3371 + dev->stats.tx_errors++; 3364 3372 3365 3373 ugeth_dump_regs(ugeth); 3366 3374 ··· 3388 3396 3389 3397 spin_lock_irq(&ugeth->lock); 3390 3398 3391 - ugeth->stats.tx_bytes += skb->len; 3399 + dev->stats.tx_bytes += skb->len; 3392 3400 3393 3401 /* Start from the next BD that should be filled */ 3394 3402 bd = ugeth->txBd[txQ]; ··· 3480 3488 dev_kfree_skb_any(skb); 3481 3489 3482 3490 ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL; 3483 - ugeth->stats.rx_dropped++; 3491 + dev->stats.rx_dropped++; 3484 3492 } else { 3485 - ugeth->stats.rx_packets++; 3493 + dev->stats.rx_packets++; 3486 3494 howmany++; 3487 3495 3488 3496 /* Prep the skb for the packet */ ··· 3491 3499 /* Tell the skb what kind of packet this is */ 3492 3500 skb->protocol = eth_type_trans(skb, ugeth->dev); 3493 3501 3494 - ugeth->stats.rx_bytes += length; 3502 + dev->stats.rx_bytes += length; 3495 3503 /* Send the packet up the stack */ 3496 3504 #ifdef CONFIG_UGETH_NAPI 3497 3505 netif_receive_skb(skb); ··· 3506 3514 if (!skb) { 3507 3515 if (netif_msg_rx_err(ugeth)) 3508 3516 ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); 3509 - ugeth->stats.rx_dropped++; 3517 + dev->stats.rx_dropped++; 3510 3518 break; 3511 3519 } 3512 3520 ··· 3548 3556 if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0)) 3549 3557 break; 3550 3558 3551 - ugeth->stats.tx_packets++; 3559 + dev->stats.tx_packets++; 3552 3560 3553 3561 /* Free the sk buffer associated with this TxBD */ 3554 3562 dev_kfree_skb_irq(ugeth-> ··· 3665 3673 /* Errors and other events */ 3666 3674 if (ucce & UCCE_OTHER) { 3667 3675 if (ucce & UCCE_BSY) { 3668 - ugeth->stats.rx_errors++; 3676 + dev->stats.rx_errors++; 3669 3677 } 3670 3678 if (ucce & UCCE_TXE) { 3671 - ugeth->stats.tx_errors++; 3679 + dev->stats.tx_errors++; 3672 3680 } 3673 3681 } 3674 3682 ··· 3961 3969 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); 3962 3970 #endif /* CONFIG_UGETH_NAPI */ 3963 3971 dev->stop = ucc_geth_close; 3964 - dev->get_stats = ucc_geth_get_stats; 3965 3972 // dev->change_mtu = ucc_geth_change_mtu; 3966 3973 dev->mtu = 1500; 3967 3974 dev->set_multicast_list = ucc_geth_set_multi;
-1
drivers/net/ucc_geth.h
··· 1185 1185 struct ucc_fast_private *uccf; 1186 1186 struct net_device *dev; 1187 1187 struct napi_struct napi; 1188 - struct net_device_stats stats; /* linux network statistics */ 1189 1188 struct ucc_geth *ug_regs; 1190 1189 struct ucc_geth_init_pram *p_init_enet_param_shadow; 1191 1190 struct ucc_geth_exf_global_pram *p_exf_glbl_param;
+8 -19
drivers/net/xen-netfront.c
··· 73 73 struct net_device *netdev; 74 74 75 75 struct napi_struct napi; 76 - struct net_device_stats stats; 77 76 78 77 struct xen_netif_tx_front_ring tx; 79 78 struct xen_netif_rx_front_ring rx; ··· 308 309 { 309 310 struct netfront_info *np = netdev_priv(dev); 310 311 311 - memset(&np->stats, 0, sizeof(np->stats)); 312 - 313 312 napi_enable(&np->napi); 314 313 315 314 spin_lock_bh(&np->rx_lock); ··· 534 537 if (notify) 535 538 notify_remote_via_irq(np->netdev->irq); 536 539 537 - np->stats.tx_bytes += skb->len; 538 - np->stats.tx_packets++; 540 + dev->stats.tx_bytes += skb->len; 541 + dev->stats.tx_packets++; 539 542 540 543 /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ 541 544 xennet_tx_buf_gc(dev); ··· 548 551 return 0; 549 552 550 553 drop: 551 - np->stats.tx_dropped++; 554 + dev->stats.tx_dropped++; 552 555 dev_kfree_skb(skb); 553 556 return 0; 554 557 } ··· 559 562 netif_stop_queue(np->netdev); 560 563 napi_disable(&np->napi); 561 564 return 0; 562 - } 563 - 564 - static struct net_device_stats *xennet_get_stats(struct net_device *dev) 565 - { 566 - struct netfront_info *np = netdev_priv(dev); 567 - return &np->stats; 568 565 } 569 566 570 567 static void xennet_move_rx_slot(struct netfront_info *np, struct sk_buff *skb, ··· 795 804 } 796 805 797 806 static int handle_incoming_queue(struct net_device *dev, 798 - struct sk_buff_head *rxq) 807 + struct sk_buff_head *rxq) 799 808 { 800 - struct netfront_info *np = netdev_priv(dev); 801 809 int packets_dropped = 0; 802 810 struct sk_buff *skb; 803 811 ··· 818 828 if (skb_checksum_setup(skb)) { 819 829 kfree_skb(skb); 820 830 packets_dropped++; 821 - np->stats.rx_errors++; 831 + dev->stats.rx_errors++; 822 832 continue; 823 833 } 824 834 } 825 835 826 - np->stats.rx_packets++; 827 - np->stats.rx_bytes += skb->len; 836 + dev->stats.rx_packets++; 837 + dev->stats.rx_bytes += skb->len; 828 838 829 839 /* Pass it up. */ 830 840 netif_receive_skb(skb); ··· 877 887 err: 878 888 while ((skb = __skb_dequeue(&tmpq))) 879 889 __skb_queue_tail(&errq, skb); 880 - np->stats.rx_errors++; 890 + dev->stats.rx_errors++; 881 891 i = np->rx.rsp_cons; 882 892 continue; 883 893 } ··· 1159 1169 netdev->open = xennet_open; 1160 1170 netdev->hard_start_xmit = xennet_start_xmit; 1161 1171 netdev->stop = xennet_close; 1162 - netdev->get_stats = xennet_get_stats; 1163 1172 netif_napi_add(netdev, &np->napi, xennet_poll, 64); 1164 1173 netdev->uninit = xennet_uninit; 1165 1174 netdev->change_mtu = xennet_change_mtu;
+26 -37
drivers/net/yellowfin.c
··· 318 318 dma_addr_t tx_status_dma; 319 319 320 320 struct timer_list timer; /* Media selection timer. */ 321 - struct net_device_stats stats; 322 321 /* Frequently used and paired value: keep adjacent for cache effect. */ 323 322 int chip_id, drv_flags; 324 323 struct pci_dev *pci_dev; ··· 352 353 static int yellowfin_rx(struct net_device *dev); 353 354 static void yellowfin_error(struct net_device *dev, int intr_status); 354 355 static int yellowfin_close(struct net_device *dev); 355 - static struct net_device_stats *yellowfin_get_stats(struct net_device *dev); 356 356 static void set_rx_mode(struct net_device *dev); 357 357 static const struct ethtool_ops ethtool_ops; 358 358 ··· 467 469 dev->open = &yellowfin_open; 468 470 dev->hard_start_xmit = &yellowfin_start_xmit; 469 471 dev->stop = &yellowfin_close; 470 - dev->get_stats = &yellowfin_get_stats; 471 472 dev->set_multicast_list = &set_rx_mode; 472 473 dev->do_ioctl = &netdev_ioctl; 473 474 SET_ETHTOOL_OPS(dev, &ethtool_ops); ··· 714 717 netif_wake_queue (dev); /* Typical path */ 715 718 716 719 dev->trans_start = jiffies; 717 - yp->stats.tx_errors++; 720 + dev->stats.tx_errors++; 718 721 } 719 722 720 723 /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ ··· 920 923 if (yp->tx_ring[entry].result_status == 0) 921 924 break; 922 925 skb = yp->tx_skbuff[entry]; 923 - yp->stats.tx_packets++; 924 - yp->stats.tx_bytes += skb->len; 926 + dev->stats.tx_packets++; 927 + dev->stats.tx_bytes += skb->len; 925 928 /* Free the original skb. */ 926 929 pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, 927 930 skb->len, PCI_DMA_TODEVICE); ··· 965 968 printk(KERN_DEBUG "%s: Transmit error, Tx status %4.4x.\n", 966 969 dev->name, tx_errs); 967 970 #endif 968 - yp->stats.tx_errors++; 969 - if (tx_errs & 0xF800) yp->stats.tx_aborted_errors++; 970 - if (tx_errs & 0x0800) yp->stats.tx_carrier_errors++; 971 - if (tx_errs & 0x2000) yp->stats.tx_window_errors++; 972 - if (tx_errs & 0x8000) yp->stats.tx_fifo_errors++; 971 + dev->stats.tx_errors++; 972 + if (tx_errs & 0xF800) dev->stats.tx_aborted_errors++; 973 + if (tx_errs & 0x0800) dev->stats.tx_carrier_errors++; 974 + if (tx_errs & 0x2000) dev->stats.tx_window_errors++; 975 + if (tx_errs & 0x8000) dev->stats.tx_fifo_errors++; 973 976 } else { 974 977 #ifndef final_version 975 978 if (yellowfin_debug > 4) 976 979 printk(KERN_DEBUG "%s: Normal transmit, Tx status %4.4x.\n", 977 980 dev->name, tx_errs); 978 981 #endif 979 - yp->stats.tx_bytes += skb->len; 980 - yp->stats.collisions += tx_errs & 15; 981 - yp->stats.tx_packets++; 982 + dev->stats.tx_bytes += skb->len; 983 + dev->stats.collisions += tx_errs & 15; 984 + dev->stats.tx_packets++; 982 985 } 983 986 /* Free the original skb. */ 984 987 pci_unmap_single(yp->pci_dev, ··· 1073 1076 if (data_size != 0) 1074 1077 printk(KERN_WARNING "%s: Oversized Ethernet frame spanned multiple buffers," 1075 1078 " status %4.4x, data_size %d!\n", dev->name, desc_status, data_size); 1076 - yp->stats.rx_length_errors++; 1079 + dev->stats.rx_length_errors++; 1077 1080 } else if ((yp->drv_flags & IsGigabit) && (frame_status & 0x0038)) { 1078 1081 /* There was a error. */ 1079 1082 if (yellowfin_debug > 3) 1080 1083 printk(KERN_DEBUG " yellowfin_rx() Rx error was %4.4x.\n", 1081 1084 frame_status); 1082 - yp->stats.rx_errors++; 1083 - if (frame_status & 0x0060) yp->stats.rx_length_errors++; 1084 - if (frame_status & 0x0008) yp->stats.rx_frame_errors++; 1085 - if (frame_status & 0x0010) yp->stats.rx_crc_errors++; 1086 - if (frame_status < 0) yp->stats.rx_dropped++; 1085 + dev->stats.rx_errors++; 1086 + if (frame_status & 0x0060) dev->stats.rx_length_errors++; 1087 + if (frame_status & 0x0008) dev->stats.rx_frame_errors++; 1088 + if (frame_status & 0x0010) dev->stats.rx_crc_errors++; 1089 + if (frame_status < 0) dev->stats.rx_dropped++; 1087 1090 } else if ( !(yp->drv_flags & IsGigabit) && 1088 1091 ((buf_addr[data_size-1] & 0x85) || buf_addr[data_size-2] & 0xC0)) { 1089 1092 u8 status1 = buf_addr[data_size-2]; 1090 1093 u8 status2 = buf_addr[data_size-1]; 1091 - yp->stats.rx_errors++; 1092 - if (status1 & 0xC0) yp->stats.rx_length_errors++; 1093 - if (status2 & 0x03) yp->stats.rx_frame_errors++; 1094 - if (status2 & 0x04) yp->stats.rx_crc_errors++; 1095 - if (status2 & 0x80) yp->stats.rx_dropped++; 1094 + dev->stats.rx_errors++; 1095 + if (status1 & 0xC0) dev->stats.rx_length_errors++; 1096 + if (status2 & 0x03) dev->stats.rx_frame_errors++; 1097 + if (status2 & 0x04) dev->stats.rx_crc_errors++; 1098 + if (status2 & 0x80) dev->stats.rx_dropped++; 1096 1099 #ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ 1097 1100 } else if ((yp->flags & HasMACAddrBug) && 1098 1101 memcmp(le32_to_cpu(yp->rx_ring_dma + ··· 1142 1145 skb->protocol = eth_type_trans(skb, dev); 1143 1146 netif_rx(skb); 1144 1147 dev->last_rx = jiffies; 1145 - yp->stats.rx_packets++; 1146 - yp->stats.rx_bytes += pkt_len; 1148 + dev->stats.rx_packets++; 1149 + dev->stats.rx_bytes += pkt_len; 1147 1150 } 1148 1151 entry = (++yp->cur_rx) % RX_RING_SIZE; 1149 1152 } ··· 1177 1180 1178 1181 static void yellowfin_error(struct net_device *dev, int intr_status) 1179 1182 { 1180 - struct yellowfin_private *yp = netdev_priv(dev); 1181 - 1182 1183 printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n", 1183 1184 dev->name, intr_status); 1184 1185 /* Hmmmmm, it's not clear what to do here. */ 1185 1186 if (intr_status & (IntrTxPCIErr | IntrTxPCIFault)) 1186 - yp->stats.tx_errors++; 1187 + dev->stats.tx_errors++; 1187 1188 if (intr_status & (IntrRxPCIErr | IntrRxPCIFault)) 1188 - yp->stats.rx_errors++; 1189 + dev->stats.rx_errors++; 1189 1190 } 1190 1191 1191 1192 static int yellowfin_close(struct net_device *dev) ··· 1273 1278 #endif 1274 1279 1275 1280 return 0; 1276 - } 1277 - 1278 - static struct net_device_stats *yellowfin_get_stats(struct net_device *dev) 1279 - { 1280 - struct yellowfin_private *yp = netdev_priv(dev); 1281 - return &yp->stats; 1282 1281 } 1283 1282 1284 1283 /* Set or clear the multicast filter for this adaptor. */
+19 -31
drivers/net/znet.c
··· 128 128 129 129 struct znet_private { 130 130 int rx_dma, tx_dma; 131 - struct net_device_stats stats; 132 131 spinlock_t lock; 133 132 short sia_base, sia_size, io_size; 134 133 struct i82593_conf_block i593_init; ··· 160 161 static irqreturn_t znet_interrupt(int irq, void *dev_id); 161 162 static void znet_rx(struct net_device *dev); 162 163 static int znet_close(struct net_device *dev); 163 - static struct net_device_stats *net_get_stats(struct net_device *dev); 164 164 static void hardware_init(struct net_device *dev); 165 165 static void update_stop_hit(short ioaddr, unsigned short rx_stop_offset); 166 166 static void znet_tx_timeout (struct net_device *dev); ··· 443 445 dev->open = &znet_open; 444 446 dev->hard_start_xmit = &znet_send_packet; 445 447 dev->stop = &znet_close; 446 - dev->get_stats = net_get_stats; 447 448 dev->set_multicast_list = &znet_set_multicast_list; 448 449 dev->tx_timeout = znet_tx_timeout; 449 450 dev->watchdog_timeo = TX_TIMEOUT; ··· 561 564 ushort *tx_link = znet->tx_cur - 1; 562 565 ushort rnd_len = (length + 1)>>1; 563 566 564 - znet->stats.tx_bytes+=length; 567 + dev->stats.tx_bytes+=length; 565 568 566 569 if (znet->tx_cur >= znet->tx_end) 567 570 znet->tx_cur = znet->tx_start; ··· 636 639 tx_status = inw(ioaddr); 637 640 /* It's undocumented, but tx_status seems to match the i82586. */ 638 641 if (tx_status & TX_OK) { 639 - znet->stats.tx_packets++; 640 - znet->stats.collisions += tx_status & TX_NCOL_MASK; 642 + dev->stats.tx_packets++; 643 + dev->stats.collisions += tx_status & TX_NCOL_MASK; 641 644 } else { 642 645 if (tx_status & (TX_LOST_CTS | TX_LOST_CRS)) 643 - znet->stats.tx_carrier_errors++; 646 + dev->stats.tx_carrier_errors++; 644 647 if (tx_status & TX_UND_RUN) 645 - znet->stats.tx_fifo_errors++; 648 + dev->stats.tx_fifo_errors++; 646 649 if (!(tx_status & TX_HRT_BEAT)) 647 - znet->stats.tx_heartbeat_errors++; 650 + dev->stats.tx_heartbeat_errors++; 648 651 if (tx_status & TX_MAX_COL) 649 - znet->stats.tx_aborted_errors++; 652 + dev->stats.tx_aborted_errors++; 650 653 /* ...and the catch-all. */ 651 654 if ((tx_status | (TX_LOST_CRS | TX_LOST_CTS | TX_UND_RUN | TX_HRT_BEAT | TX_MAX_COL)) != (TX_LOST_CRS | TX_LOST_CTS | TX_UND_RUN | TX_HRT_BEAT | TX_MAX_COL)) 652 - znet->stats.tx_errors++; 655 + dev->stats.tx_errors++; 653 656 654 657 /* Transceiver may be stuck if cable 655 658 * was removed while emiting a ··· 745 748 this_rfp_ptr[-3]<<1); 746 749 /* Once again we must assume that the i82586 docs apply. */ 747 750 if ( ! (status & RX_RCV_OK)) { /* There was an error. */ 748 - znet->stats.rx_errors++; 749 - if (status & RX_CRC_ERR) znet->stats.rx_crc_errors++; 750 - if (status & RX_ALG_ERR) znet->stats.rx_frame_errors++; 751 + dev->stats.rx_errors++; 752 + if (status & RX_CRC_ERR) dev->stats.rx_crc_errors++; 753 + if (status & RX_ALG_ERR) dev->stats.rx_frame_errors++; 751 754 #if 0 752 - if (status & 0x0200) znet->stats.rx_over_errors++; /* Wrong. */ 753 - if (status & 0x0100) znet->stats.rx_fifo_errors++; 755 + if (status & 0x0200) dev->stats.rx_over_errors++; /* Wrong. */ 756 + if (status & 0x0100) dev->stats.rx_fifo_errors++; 754 757 #else 755 758 /* maz : Wild guess... */ 756 - if (status & RX_OVRRUN) znet->stats.rx_over_errors++; 759 + if (status & RX_OVRRUN) dev->stats.rx_over_errors++; 757 760 #endif 758 - if (status & RX_SRT_FRM) znet->stats.rx_length_errors++; 761 + if (status & RX_SRT_FRM) dev->stats.rx_length_errors++; 759 762 } else if (pkt_len > 1536) { 760 - znet->stats.rx_length_errors++; 763 + dev->stats.rx_length_errors++; 761 764 } else { 762 765 /* Malloc up new buffer. */ 763 766 struct sk_buff *skb; ··· 766 769 if (skb == NULL) { 767 770 if (znet_debug) 768 771 printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); 769 - znet->stats.rx_dropped++; 772 + dev->stats.rx_dropped++; 770 773 break; 771 774 } 772 775 ··· 786 789 skb->protocol=eth_type_trans(skb,dev); 787 790 netif_rx(skb); 788 791 dev->last_rx = jiffies; 789 - znet->stats.rx_packets++; 790 - znet->stats.rx_bytes += pkt_len; 792 + dev->stats.rx_packets++; 793 + dev->stats.rx_bytes += pkt_len; 791 794 } 792 795 znet->rx_cur = this_rfp_ptr; 793 796 if (znet->rx_cur >= znet->rx_end) ··· 822 825 znet_release_resources (dev); 823 826 824 827 return 0; 825 - } 826 - 827 - /* Get the current statistics. This may be called with the card open or 828 - closed. */ 829 - static struct net_device_stats *net_get_stats(struct net_device *dev) 830 - { 831 - struct znet_private *znet = dev->priv; 832 - 833 - return &znet->stats; 834 828 } 835 829 836 830 static void show_dma(struct net_device *dev)
-1
include/linux/if_eql.h
··· 58 58 slave_queue_t queue; 59 59 int min_slaves; 60 60 int max_slaves; 61 - struct net_device_stats stats; 62 61 struct timer_list timer; 63 62 } equalizer_t; 64 63
-1
include/linux/if_shaper.h
··· 24 24 unsigned long recovery; /* Time we can next clock a packet out on 25 25 an empty queue */ 26 26 spinlock_t lock; 27 - struct net_device_stats stats; 28 27 struct net_device *dev; 29 28 int (*hard_start_xmit) (struct sk_buff *skb, 30 29 struct net_device *dev);
-1
include/linux/if_tun.h
··· 42 42 struct sk_buff_head readq; 43 43 44 44 struct net_device *dev; 45 - struct net_device_stats stats; 46 45 47 46 struct fasync_struct *fasync; 48 47