diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-04-28 19:27:37 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-29 01:55:11 -0400 |
commit | ba0f6caeb5d9cf6fbb99f84ff0f2731f04996595 (patch) | |
tree | 8e5698c4dc5dc19057a3117ee6d25d0f653c673f /drivers | |
parent | dd32f7effdd2f3f348ef91ca1649d78a0ab2b103 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/3c505.c | 30 | ||||
-rw-r--r-- | drivers/net/3c505.h | 1 |
2 files changed, 14 insertions, 17 deletions
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 9c6573419f5a..fdfb2b2cb734 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c | |||
@@ -670,7 +670,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id) | |||
670 | memcpy(adapter->current_dma.target, adapter->dma_buffer, adapter->current_dma.length); | 670 | memcpy(adapter->current_dma.target, adapter->dma_buffer, adapter->current_dma.length); |
671 | } | 671 | } |
672 | skb->protocol = eth_type_trans(skb,dev); | 672 | skb->protocol = eth_type_trans(skb,dev); |
673 | adapter->stats.rx_bytes += skb->len; | 673 | dev->stats.rx_bytes += skb->len; |
674 | netif_rx(skb); | 674 | netif_rx(skb); |
675 | dev->last_rx = jiffies; | 675 | dev->last_rx = jiffies; |
676 | } | 676 | } |
@@ -773,12 +773,12 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id) | |||
773 | * received board statistics | 773 | * received board statistics |
774 | */ | 774 | */ |
775 | case CMD_NETWORK_STATISTICS_RESPONSE: | 775 | case CMD_NETWORK_STATISTICS_RESPONSE: |
776 | adapter->stats.rx_packets += adapter->irx_pcb.data.netstat.tot_recv; | 776 | dev->stats.rx_packets += adapter->irx_pcb.data.netstat.tot_recv; |
777 | adapter->stats.tx_packets += adapter->irx_pcb.data.netstat.tot_xmit; | 777 | dev->stats.tx_packets += adapter->irx_pcb.data.netstat.tot_xmit; |
778 | adapter->stats.rx_crc_errors += adapter->irx_pcb.data.netstat.err_CRC; | 778 | dev->stats.rx_crc_errors += adapter->irx_pcb.data.netstat.err_CRC; |
779 | adapter->stats.rx_frame_errors += adapter->irx_pcb.data.netstat.err_align; | 779 | dev->stats.rx_frame_errors += adapter->irx_pcb.data.netstat.err_align; |
780 | adapter->stats.rx_fifo_errors += adapter->irx_pcb.data.netstat.err_ovrrun; | 780 | dev->stats.rx_fifo_errors += adapter->irx_pcb.data.netstat.err_ovrrun; |
781 | adapter->stats.rx_over_errors += adapter->irx_pcb.data.netstat.err_res; | 781 | dev->stats.rx_over_errors += adapter->irx_pcb.data.netstat.err_res; |
782 | adapter->got[CMD_NETWORK_STATISTICS] = 1; | 782 | adapter->got[CMD_NETWORK_STATISTICS] = 1; |
783 | if (elp_debug >= 3) | 783 | if (elp_debug >= 3) |
784 | printk(KERN_DEBUG "%s: interrupt - statistics response received\n", dev->name); | 784 | printk(KERN_DEBUG "%s: interrupt - statistics response received\n", dev->name); |
@@ -794,11 +794,11 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id) | |||
794 | break; | 794 | break; |
795 | switch (adapter->irx_pcb.data.xmit_resp.c_stat) { | 795 | switch (adapter->irx_pcb.data.xmit_resp.c_stat) { |
796 | case 0xffff: | 796 | case 0xffff: |
797 | adapter->stats.tx_aborted_errors++; | 797 | dev->stats.tx_aborted_errors++; |
798 | printk(KERN_INFO "%s: transmit timed out, network cable problem?\n", dev->name); | 798 | printk(KERN_INFO "%s: transmit timed out, network cable problem?\n", dev->name); |
799 | break; | 799 | break; |
800 | case 0xfffe: | 800 | case 0xfffe: |
801 | adapter->stats.tx_fifo_errors++; | 801 | dev->stats.tx_fifo_errors++; |
802 | printk(KERN_INFO "%s: transmit timed out, FIFO underrun\n", dev->name); | 802 | printk(KERN_INFO "%s: transmit timed out, FIFO underrun\n", dev->name); |
803 | break; | 803 | break; |
804 | } | 804 | } |
@@ -986,7 +986,7 @@ static bool send_packet(struct net_device *dev, struct sk_buff *skb) | |||
986 | return false; | 986 | return false; |
987 | } | 987 | } |
988 | 988 | ||
989 | adapter->stats.tx_bytes += nlen; | 989 | dev->stats.tx_bytes += nlen; |
990 | 990 | ||
991 | /* | 991 | /* |
992 | * send the adapter a transmit packet command. Ignore segment and offset | 992 | * send the adapter a transmit packet command. Ignore segment and offset |
@@ -1041,7 +1041,6 @@ static bool send_packet(struct net_device *dev, struct sk_buff *skb) | |||
1041 | 1041 | ||
1042 | static void elp_timeout(struct net_device *dev) | 1042 | static void elp_timeout(struct net_device *dev) |
1043 | { | 1043 | { |
1044 | elp_device *adapter = dev->priv; | ||
1045 | int stat; | 1044 | int stat; |
1046 | 1045 | ||
1047 | stat = inb_status(dev->base_addr); | 1046 | stat = inb_status(dev->base_addr); |
@@ -1049,7 +1048,7 @@ static void elp_timeout(struct net_device *dev) | |||
1049 | if (elp_debug >= 1) | 1048 | if (elp_debug >= 1) |
1050 | printk(KERN_DEBUG "%s: status %#02x\n", dev->name, stat); | 1049 | printk(KERN_DEBUG "%s: status %#02x\n", dev->name, stat); |
1051 | dev->trans_start = jiffies; | 1050 | dev->trans_start = jiffies; |
1052 | adapter->stats.tx_dropped++; | 1051 | dev->stats.tx_dropped++; |
1053 | netif_wake_queue(dev); | 1052 | netif_wake_queue(dev); |
1054 | } | 1053 | } |
1055 | 1054 | ||
@@ -1113,7 +1112,7 @@ static struct net_device_stats *elp_get_stats(struct net_device *dev) | |||
1113 | /* If the device is closed, just return the latest stats we have, | 1112 | /* If the device is closed, just return the latest stats we have, |
1114 | - we cannot ask from the adapter without interrupts */ | 1113 | - we cannot ask from the adapter without interrupts */ |
1115 | if (!netif_running(dev)) | 1114 | if (!netif_running(dev)) |
1116 | return &adapter->stats; | 1115 | return &dev->stats; |
1117 | 1116 | ||
1118 | /* send a get statistics command to the board */ | 1117 | /* send a get statistics command to the board */ |
1119 | adapter->tx_pcb.command = CMD_NETWORK_STATISTICS; | 1118 | adapter->tx_pcb.command = CMD_NETWORK_STATISTICS; |
@@ -1126,12 +1125,12 @@ static struct net_device_stats *elp_get_stats(struct net_device *dev) | |||
1126 | while (adapter->got[CMD_NETWORK_STATISTICS] == 0 && time_before(jiffies, timeout)); | 1125 | while (adapter->got[CMD_NETWORK_STATISTICS] == 0 && time_before(jiffies, timeout)); |
1127 | if (time_after_eq(jiffies, timeout)) { | 1126 | if (time_after_eq(jiffies, timeout)) { |
1128 | TIMEOUT_MSG(__LINE__); | 1127 | TIMEOUT_MSG(__LINE__); |
1129 | return &adapter->stats; | 1128 | return &dev->stats; |
1130 | } | 1129 | } |
1131 | } | 1130 | } |
1132 | 1131 | ||
1133 | /* statistics are now up to date */ | 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 @@ static int __init elplus_setup(struct net_device *dev) | |||
1571 | dev->set_multicast_list = elp_set_mc_list; /* local */ | 1570 | dev->set_multicast_list = elp_set_mc_list; /* local */ |
1572 | dev->ethtool_ops = &netdev_ethtool_ops; /* local */ | 1571 | dev->ethtool_ops = &netdev_ethtool_ops; /* local */ |
1573 | 1572 | ||
1574 | memset(&(adapter->stats), 0, sizeof(struct net_device_stats)); | ||
1575 | dev->mem_start = dev->mem_end = 0; | 1573 | dev->mem_start = dev->mem_end = 0; |
1576 | 1574 | ||
1577 | err = register_netdev(dev); | 1575 | err = register_netdev(dev); |
diff --git a/drivers/net/3c505.h b/drivers/net/3c505.h index 1910cb1dc787..04df2a9002b6 100644 --- a/drivers/net/3c505.h +++ b/drivers/net/3c505.h | |||
@@ -264,7 +264,6 @@ typedef struct { | |||
264 | pcb_struct rx_pcb; /* PCB for foreground receiving */ | 264 | pcb_struct rx_pcb; /* PCB for foreground receiving */ |
265 | pcb_struct itx_pcb; /* PCB for background sending */ | 265 | pcb_struct itx_pcb; /* PCB for background sending */ |
266 | pcb_struct irx_pcb; /* PCB for background receiving */ | 266 | pcb_struct irx_pcb; /* PCB for background receiving */ |
267 | struct net_device_stats stats; | ||
268 | 267 | ||
269 | void *dma_buffer; | 268 | void *dma_buffer; |
270 | 269 | ||