aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPaulius Zaleckas <paulius.zaleckas@teltonika.lt>2008-07-17 04:01:26 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-22 19:45:41 -0400
commit7a2f53ee0b56ff7e1c0c24404575cb62935d37d9 (patch)
treea567c6b7e5814ecdf329823803532302f6009acd /drivers/net
parentaa6ef27ea906e74bd23d14f43f095c012469d9c7 (diff)
at91_ether: use netstats in net_device structure
Use net_device_stats from net_device structure instead of local. Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt> Tested-by: Marc Pignat <marc.pignat@hevs.ch> Acked-by: Andrew Victor <linux@maxim.org.za> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/arm/at91_ether.c39
-rw-r--r--drivers/net/arm/at91_ether.h1
2 files changed, 19 insertions, 21 deletions
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 1e39e78f1778..49c320bca345 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -820,7 +820,7 @@ static int at91ether_tx(struct sk_buff *skb, struct net_device *dev)
820 lp->skb = skb; 820 lp->skb = skb;
821 lp->skb_length = skb->len; 821 lp->skb_length = skb->len;
822 lp->skb_physaddr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE); 822 lp->skb_physaddr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
823 lp->stats.tx_bytes += skb->len; 823 dev->stats.tx_bytes += skb->len;
824 824
825 /* Set address of the data in the Transmit Address register */ 825 /* Set address of the data in the Transmit Address register */
826 at91_emac_write(AT91_EMAC_TAR, lp->skb_physaddr); 826 at91_emac_write(AT91_EMAC_TAR, lp->skb_physaddr);
@@ -843,34 +843,33 @@ static int at91ether_tx(struct sk_buff *skb, struct net_device *dev)
843 */ 843 */
844static struct net_device_stats *at91ether_stats(struct net_device *dev) 844static struct net_device_stats *at91ether_stats(struct net_device *dev)
845{ 845{
846 struct at91_private *lp = netdev_priv(dev);
847 int ale, lenerr, seqe, lcol, ecol; 846 int ale, lenerr, seqe, lcol, ecol;
848 847
849 if (netif_running(dev)) { 848 if (netif_running(dev)) {
850 lp->stats.rx_packets += at91_emac_read(AT91_EMAC_OK); /* Good frames received */ 849 dev->stats.rx_packets += at91_emac_read(AT91_EMAC_OK); /* Good frames received */
851 ale = at91_emac_read(AT91_EMAC_ALE); 850 ale = at91_emac_read(AT91_EMAC_ALE);
852 lp->stats.rx_frame_errors += ale; /* Alignment errors */ 851 dev->stats.rx_frame_errors += ale; /* Alignment errors */
853 lenerr = at91_emac_read(AT91_EMAC_ELR) + at91_emac_read(AT91_EMAC_USF); 852 lenerr = at91_emac_read(AT91_EMAC_ELR) + at91_emac_read(AT91_EMAC_USF);
854 lp->stats.rx_length_errors += lenerr; /* Excessive Length or Undersize Frame error */ 853 dev->stats.rx_length_errors += lenerr; /* Excessive Length or Undersize Frame error */
855 seqe = at91_emac_read(AT91_EMAC_SEQE); 854 seqe = at91_emac_read(AT91_EMAC_SEQE);
856 lp->stats.rx_crc_errors += seqe; /* CRC error */ 855 dev->stats.rx_crc_errors += seqe; /* CRC error */
857 lp->stats.rx_fifo_errors += at91_emac_read(AT91_EMAC_DRFC); /* Receive buffer not available */ 856 dev->stats.rx_fifo_errors += at91_emac_read(AT91_EMAC_DRFC); /* Receive buffer not available */
858 lp->stats.rx_errors += (ale + lenerr + seqe 857 dev->stats.rx_errors += (ale + lenerr + seqe
859 + at91_emac_read(AT91_EMAC_CDE) + at91_emac_read(AT91_EMAC_RJB)); 858 + at91_emac_read(AT91_EMAC_CDE) + at91_emac_read(AT91_EMAC_RJB));
860 859
861 lp->stats.tx_packets += at91_emac_read(AT91_EMAC_FRA); /* Frames successfully transmitted */ 860 dev->stats.tx_packets += at91_emac_read(AT91_EMAC_FRA); /* Frames successfully transmitted */
862 lp->stats.tx_fifo_errors += at91_emac_read(AT91_EMAC_TUE); /* Transmit FIFO underruns */ 861 dev->stats.tx_fifo_errors += at91_emac_read(AT91_EMAC_TUE); /* Transmit FIFO underruns */
863 lp->stats.tx_carrier_errors += at91_emac_read(AT91_EMAC_CSE); /* Carrier Sense errors */ 862 dev->stats.tx_carrier_errors += at91_emac_read(AT91_EMAC_CSE); /* Carrier Sense errors */
864 lp->stats.tx_heartbeat_errors += at91_emac_read(AT91_EMAC_SQEE);/* Heartbeat error */ 863 dev->stats.tx_heartbeat_errors += at91_emac_read(AT91_EMAC_SQEE);/* Heartbeat error */
865 864
866 lcol = at91_emac_read(AT91_EMAC_LCOL); 865 lcol = at91_emac_read(AT91_EMAC_LCOL);
867 ecol = at91_emac_read(AT91_EMAC_ECOL); 866 ecol = at91_emac_read(AT91_EMAC_ECOL);
868 lp->stats.tx_window_errors += lcol; /* Late collisions */ 867 dev->stats.tx_window_errors += lcol; /* Late collisions */
869 lp->stats.tx_aborted_errors += ecol; /* 16 collisions */ 868 dev->stats.tx_aborted_errors += ecol; /* 16 collisions */
870 869
871 lp->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + lcol + ecol); 870 dev->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + lcol + ecol);
872 } 871 }
873 return &lp->stats; 872 return &dev->stats;
874} 873}
875 874
876/* 875/*
@@ -896,16 +895,16 @@ static void at91ether_rx(struct net_device *dev)
896 895
897 skb->protocol = eth_type_trans(skb, dev); 896 skb->protocol = eth_type_trans(skb, dev);
898 dev->last_rx = jiffies; 897 dev->last_rx = jiffies;
899 lp->stats.rx_bytes += pktlen; 898 dev->stats.rx_bytes += pktlen;
900 netif_rx(skb); 899 netif_rx(skb);
901 } 900 }
902 else { 901 else {
903 lp->stats.rx_dropped += 1; 902 dev->stats.rx_dropped += 1;
904 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); 903 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
905 } 904 }
906 905
907 if (dlist->descriptors[lp->rxBuffIndex].size & EMAC_MULTICAST) 906 if (dlist->descriptors[lp->rxBuffIndex].size & EMAC_MULTICAST)
908 lp->stats.multicast++; 907 dev->stats.multicast++;
909 908
910 dlist->descriptors[lp->rxBuffIndex].addr &= ~EMAC_DESC_DONE; /* reset ownership bit */ 909 dlist->descriptors[lp->rxBuffIndex].addr &= ~EMAC_DESC_DONE; /* reset ownership bit */
911 if (lp->rxBuffIndex == MAX_RX_DESCR-1) /* wrap after last buffer */ 910 if (lp->rxBuffIndex == MAX_RX_DESCR-1) /* wrap after last buffer */
@@ -934,7 +933,7 @@ static irqreturn_t at91ether_interrupt(int irq, void *dev_id)
934 if (intstatus & AT91_EMAC_TCOM) { /* Transmit complete */ 933 if (intstatus & AT91_EMAC_TCOM) { /* Transmit complete */
935 /* The TCOM bit is set even if the transmission failed. */ 934 /* The TCOM bit is set even if the transmission failed. */
936 if (intstatus & (AT91_EMAC_TUND | AT91_EMAC_RTRY)) 935 if (intstatus & (AT91_EMAC_TUND | AT91_EMAC_RTRY))
937 lp->stats.tx_errors += 1; 936 dev->stats.tx_errors += 1;
938 937
939 if (lp->skb) { 938 if (lp->skb) {
940 dev_kfree_skb_irq(lp->skb); 939 dev_kfree_skb_irq(lp->skb);
diff --git a/drivers/net/arm/at91_ether.h b/drivers/net/arm/at91_ether.h
index a38fd2d053a6..353f4dab62be 100644
--- a/drivers/net/arm/at91_ether.h
+++ b/drivers/net/arm/at91_ether.h
@@ -84,7 +84,6 @@ struct recv_desc_bufs
84 84
85struct at91_private 85struct at91_private
86{ 86{
87 struct net_device_stats stats;
88 struct mii_if_info mii; /* ethtool support */ 87 struct mii_if_info mii; /* ethtool support */
89 struct at91_eth_data board_data; /* board-specific configuration */ 88 struct at91_eth_data board_data; /* board-specific configuration */
90 struct clk *ether_clk; /* clock */ 89 struct clk *ether_clk; /* clock */