Commit ba0f6caeb5d9cf6fbb99f84ff0f2731f04996595

Authored by Paulius Zaleckas
Committed by Jeff Garzik
1 parent dd32f7effd

3c505: use netstats in net_device structure

Use net_device_stats from net_device structure instead of local.
No need to memset it to 0, because it is allocated by kzalloc.

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

Showing 2 changed files with 14 additions and 17 deletions Side-by-side Diff

... ... @@ -670,7 +670,7 @@
670 670 memcpy(adapter->current_dma.target, adapter->dma_buffer, adapter->current_dma.length);
671 671 }
672 672 skb->protocol = eth_type_trans(skb,dev);
673   - adapter->stats.rx_bytes += skb->len;
  673 + dev->stats.rx_bytes += skb->len;
674 674 netif_rx(skb);
675 675 dev->last_rx = jiffies;
676 676 }
... ... @@ -773,12 +773,12 @@
773 773 * received board statistics
774 774 */
775 775 case CMD_NETWORK_STATISTICS_RESPONSE:
776   - adapter->stats.rx_packets += adapter->irx_pcb.data.netstat.tot_recv;
777   - adapter->stats.tx_packets += adapter->irx_pcb.data.netstat.tot_xmit;
778   - adapter->stats.rx_crc_errors += adapter->irx_pcb.data.netstat.err_CRC;
779   - adapter->stats.rx_frame_errors += adapter->irx_pcb.data.netstat.err_align;
780   - adapter->stats.rx_fifo_errors += adapter->irx_pcb.data.netstat.err_ovrrun;
781   - adapter->stats.rx_over_errors += adapter->irx_pcb.data.netstat.err_res;
  776 + dev->stats.rx_packets += adapter->irx_pcb.data.netstat.tot_recv;
  777 + dev->stats.tx_packets += adapter->irx_pcb.data.netstat.tot_xmit;
  778 + dev->stats.rx_crc_errors += adapter->irx_pcb.data.netstat.err_CRC;
  779 + dev->stats.rx_frame_errors += adapter->irx_pcb.data.netstat.err_align;
  780 + dev->stats.rx_fifo_errors += adapter->irx_pcb.data.netstat.err_ovrrun;
  781 + dev->stats.rx_over_errors += adapter->irx_pcb.data.netstat.err_res;
782 782 adapter->got[CMD_NETWORK_STATISTICS] = 1;
783 783 if (elp_debug >= 3)
784 784 printk(KERN_DEBUG "%s: interrupt - statistics response received\n", dev->name);
785 785  
... ... @@ -794,11 +794,11 @@
794 794 break;
795 795 switch (adapter->irx_pcb.data.xmit_resp.c_stat) {
796 796 case 0xffff:
797   - adapter->stats.tx_aborted_errors++;
  797 + dev->stats.tx_aborted_errors++;
798 798 printk(KERN_INFO "%s: transmit timed out, network cable problem?\n", dev->name);
799 799 break;
800 800 case 0xfffe:
801   - adapter->stats.tx_fifo_errors++;
  801 + dev->stats.tx_fifo_errors++;
802 802 printk(KERN_INFO "%s: transmit timed out, FIFO underrun\n", dev->name);
803 803 break;
804 804 }
... ... @@ -986,7 +986,7 @@
986 986 return false;
987 987 }
988 988  
989   - adapter->stats.tx_bytes += nlen;
  989 + dev->stats.tx_bytes += nlen;
990 990  
991 991 /*
992 992 * send the adapter a transmit packet command. Ignore segment and offset
... ... @@ -1041,7 +1041,6 @@
1041 1041  
1042 1042 static void elp_timeout(struct net_device *dev)
1043 1043 {
1044   - elp_device *adapter = dev->priv;
1045 1044 int stat;
1046 1045  
1047 1046 stat = inb_status(dev->base_addr);
... ... @@ -1049,7 +1048,7 @@
1049 1048 if (elp_debug >= 1)
1050 1049 printk(KERN_DEBUG "%s: status %#02x\n", dev->name, stat);
1051 1050 dev->trans_start = jiffies;
1052   - adapter->stats.tx_dropped++;
  1051 + dev->stats.tx_dropped++;
1053 1052 netif_wake_queue(dev);
1054 1053 }
1055 1054  
... ... @@ -1113,7 +1112,7 @@
1113 1112 /* If the device is closed, just return the latest stats we have,
1114 1113 - we cannot ask from the adapter without interrupts */
1115 1114 if (!netif_running(dev))
1116   - return &adapter->stats;
  1115 + return &dev->stats;
1117 1116  
1118 1117 /* send a get statistics command to the board */
1119 1118 adapter->tx_pcb.command = CMD_NETWORK_STATISTICS;
1120 1119  
... ... @@ -1126,12 +1125,12 @@
1126 1125 while (adapter->got[CMD_NETWORK_STATISTICS] == 0 && time_before(jiffies, timeout));
1127 1126 if (time_after_eq(jiffies, timeout)) {
1128 1127 TIMEOUT_MSG(__LINE__);
1129   - return &adapter->stats;
  1128 + return &dev->stats;
1130 1129 }
1131 1130 }
1132 1131  
1133 1132 /* statistics are now up to date */
1134   - return &adapter->stats;
  1133 + return &dev->stats;
1135 1134 }
1136 1135  
1137 1136  
... ... @@ -1571,7 +1570,6 @@
1571 1570 dev->set_multicast_list = elp_set_mc_list; /* local */
1572 1571 dev->ethtool_ops = &netdev_ethtool_ops; /* local */
1573 1572  
1574   - memset(&(adapter->stats), 0, sizeof(struct net_device_stats));
1575 1573 dev->mem_start = dev->mem_end = 0;
1576 1574  
1577 1575 err = register_netdev(dev);
... ... @@ -264,7 +264,6 @@
264 264 pcb_struct rx_pcb; /* PCB for foreground receiving */
265 265 pcb_struct itx_pcb; /* PCB for background sending */
266 266 pcb_struct irx_pcb; /* PCB for background receiving */
267   - struct net_device_stats stats;
268 267  
269 268 void *dma_buffer;
270 269