aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hp100.c
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-04 22:13:46 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-05 22:41:16 -0400
commitad6f84b4ba7e304dc51dba3b3cbc10b8e348e319 (patch)
treeca113de5bab76c8156dae8fb78e3267341fcea21 /drivers/net/hp100.c
parent86678a2018135e57df86a9729795bce1efea641d (diff)
hp100: Use the instance of net_device_stats from net_device.
Since net_device has an instance of net_device_stats, we can remove the instance of this from the adapter structure. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hp100.c')
-rw-r--r--drivers/net/hp100.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 68e5ac8832ad..acbf0d003a6d 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -168,7 +168,6 @@ struct hp100_private {
168 u_char mac1_mode; 168 u_char mac1_mode;
169 u_char mac2_mode; 169 u_char mac2_mode;
170 u_char hash_bytes[8]; 170 u_char hash_bytes[8];
171 struct net_device_stats stats;
172 171
173 /* Rings for busmaster mode: */ 172 /* Rings for busmaster mode: */
174 hp100_ring_t *rxrhead; /* Head (oldest) index into rxring */ 173 hp100_ring_t *rxrhead; /* Head (oldest) index into rxring */
@@ -1582,8 +1581,8 @@ static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
1582 spin_unlock_irqrestore(&lp->lock, flags); 1581 spin_unlock_irqrestore(&lp->lock, flags);
1583 1582
1584 /* Update statistics */ 1583 /* Update statistics */
1585 lp->stats.tx_packets++; 1584 dev->stats.tx_packets++;
1586 lp->stats.tx_bytes += skb->len; 1585 dev->stats.tx_bytes += skb->len;
1587 1586
1588 return NETDEV_TX_OK; 1587 return NETDEV_TX_OK;
1589 1588
@@ -1740,8 +1739,8 @@ static netdev_tx_t hp100_start_xmit(struct sk_buff *skb,
1740 1739
1741 hp100_outb(HP100_TX_CMD | HP100_SET_LB, OPTION_MSW); /* send packet */ 1740 hp100_outb(HP100_TX_CMD | HP100_SET_LB, OPTION_MSW); /* send packet */
1742 1741
1743 lp->stats.tx_packets++; 1742 dev->stats.tx_packets++;
1744 lp->stats.tx_bytes += skb->len; 1743 dev->stats.tx_bytes += skb->len;
1745 hp100_ints_on(); 1744 hp100_ints_on();
1746 spin_unlock_irqrestore(&lp->lock, flags); 1745 spin_unlock_irqrestore(&lp->lock, flags);
1747 1746
@@ -1822,7 +1821,7 @@ static void hp100_rx(struct net_device *dev)
1822 printk("hp100: %s: rx: couldn't allocate a sk_buff of size %d\n", 1821 printk("hp100: %s: rx: couldn't allocate a sk_buff of size %d\n",
1823 dev->name, pkt_len); 1822 dev->name, pkt_len);
1824#endif 1823#endif
1825 lp->stats.rx_dropped++; 1824 dev->stats.rx_dropped++;
1826 } else { /* skb successfully allocated */ 1825 } else { /* skb successfully allocated */
1827 1826
1828 u_char *ptr; 1827 u_char *ptr;
@@ -1848,8 +1847,8 @@ static void hp100_rx(struct net_device *dev)
1848 ptr[9], ptr[10], ptr[11]); 1847 ptr[9], ptr[10], ptr[11]);
1849#endif 1848#endif
1850 netif_rx(skb); 1849 netif_rx(skb);
1851 lp->stats.rx_packets++; 1850 dev->stats.rx_packets++;
1852 lp->stats.rx_bytes += pkt_len; 1851 dev->stats.rx_bytes += pkt_len;
1853 } 1852 }
1854 1853
1855 /* Indicate the card that we have got the packet */ 1854 /* Indicate the card that we have got the packet */
@@ -1858,7 +1857,7 @@ static void hp100_rx(struct net_device *dev)
1858 switch (header & 0x00070000) { 1857 switch (header & 0x00070000) {
1859 case (HP100_MULTI_ADDR_HASH << 16): 1858 case (HP100_MULTI_ADDR_HASH << 16):
1860 case (HP100_MULTI_ADDR_NO_HASH << 16): 1859 case (HP100_MULTI_ADDR_NO_HASH << 16):
1861 lp->stats.multicast++; 1860 dev->stats.multicast++;
1862 break; 1861 break;
1863 } 1862 }
1864 } /* end of while(there are packets) loop */ 1863 } /* end of while(there are packets) loop */
@@ -1930,7 +1929,7 @@ static void hp100_rx_bm(struct net_device *dev)
1930 if (ptr->skb == NULL) { 1929 if (ptr->skb == NULL) {
1931 printk("hp100: %s: rx_bm: skb null\n", dev->name); 1930 printk("hp100: %s: rx_bm: skb null\n", dev->name);
1932 /* can happen if we only allocated room for the pdh due to memory shortage. */ 1931 /* can happen if we only allocated room for the pdh due to memory shortage. */
1933 lp->stats.rx_dropped++; 1932 dev->stats.rx_dropped++;
1934 } else { 1933 } else {
1935 skb_trim(ptr->skb, pkt_len); /* Shorten it */ 1934 skb_trim(ptr->skb, pkt_len); /* Shorten it */
1936 ptr->skb->protocol = 1935 ptr->skb->protocol =
@@ -1938,14 +1937,14 @@ static void hp100_rx_bm(struct net_device *dev)
1938 1937
1939 netif_rx(ptr->skb); /* Up and away... */ 1938 netif_rx(ptr->skb); /* Up and away... */
1940 1939
1941 lp->stats.rx_packets++; 1940 dev->stats.rx_packets++;
1942 lp->stats.rx_bytes += pkt_len; 1941 dev->stats.rx_bytes += pkt_len;
1943 } 1942 }
1944 1943
1945 switch (header & 0x00070000) { 1944 switch (header & 0x00070000) {
1946 case (HP100_MULTI_ADDR_HASH << 16): 1945 case (HP100_MULTI_ADDR_HASH << 16):
1947 case (HP100_MULTI_ADDR_NO_HASH << 16): 1946 case (HP100_MULTI_ADDR_NO_HASH << 16):
1948 lp->stats.multicast++; 1947 dev->stats.multicast++;
1949 break; 1948 break;
1950 } 1949 }
1951 } else { 1950 } else {
@@ -1954,7 +1953,7 @@ static void hp100_rx_bm(struct net_device *dev)
1954#endif 1953#endif
1955 if (ptr->skb != NULL) 1954 if (ptr->skb != NULL)
1956 dev_kfree_skb_any(ptr->skb); 1955 dev_kfree_skb_any(ptr->skb);
1957 lp->stats.rx_errors++; 1956 dev->stats.rx_errors++;
1958 } 1957 }
1959 1958
1960 lp->rxrhead = lp->rxrhead->next; 1959 lp->rxrhead = lp->rxrhead->next;
@@ -1992,14 +1991,13 @@ static struct net_device_stats *hp100_get_stats(struct net_device *dev)
1992 hp100_update_stats(dev); 1991 hp100_update_stats(dev);
1993 hp100_ints_on(); 1992 hp100_ints_on();
1994 spin_unlock_irqrestore(&lp->lock, flags); 1993 spin_unlock_irqrestore(&lp->lock, flags);
1995 return &(lp->stats); 1994 return &(dev->stats);
1996} 1995}
1997 1996
1998static void hp100_update_stats(struct net_device *dev) 1997static void hp100_update_stats(struct net_device *dev)
1999{ 1998{
2000 int ioaddr = dev->base_addr; 1999 int ioaddr = dev->base_addr;
2001 u_short val; 2000 u_short val;
2002 struct hp100_private *lp = netdev_priv(dev);
2003 2001
2004#ifdef HP100_DEBUG_B 2002#ifdef HP100_DEBUG_B
2005 hp100_outw(0x4216, TRACE); 2003 hp100_outw(0x4216, TRACE);
@@ -2009,14 +2007,14 @@ static void hp100_update_stats(struct net_device *dev)
2009 /* Note: Statistics counters clear when read. */ 2007 /* Note: Statistics counters clear when read. */
2010 hp100_page(MAC_CTRL); 2008 hp100_page(MAC_CTRL);
2011 val = hp100_inw(DROPPED) & 0x0fff; 2009 val = hp100_inw(DROPPED) & 0x0fff;
2012 lp->stats.rx_errors += val; 2010 dev->stats.rx_errors += val;
2013 lp->stats.rx_over_errors += val; 2011 dev->stats.rx_over_errors += val;
2014 val = hp100_inb(CRC); 2012 val = hp100_inb(CRC);
2015 lp->stats.rx_errors += val; 2013 dev->stats.rx_errors += val;
2016 lp->stats.rx_crc_errors += val; 2014 dev->stats.rx_crc_errors += val;
2017 val = hp100_inb(ABORT); 2015 val = hp100_inb(ABORT);
2018 lp->stats.tx_errors += val; 2016 dev->stats.tx_errors += val;
2019 lp->stats.tx_aborted_errors += val; 2017 dev->stats.tx_aborted_errors += val;
2020 hp100_page(PERFORMANCE); 2018 hp100_page(PERFORMANCE);
2021} 2019}
2022 2020
@@ -2025,7 +2023,6 @@ static void hp100_misc_interrupt(struct net_device *dev)
2025#ifdef HP100_DEBUG_B 2023#ifdef HP100_DEBUG_B
2026 int ioaddr = dev->base_addr; 2024 int ioaddr = dev->base_addr;
2027#endif 2025#endif
2028 struct hp100_private *lp = netdev_priv(dev);
2029 2026
2030#ifdef HP100_DEBUG_B 2027#ifdef HP100_DEBUG_B
2031 int ioaddr = dev->base_addr; 2028 int ioaddr = dev->base_addr;
@@ -2034,8 +2031,8 @@ static void hp100_misc_interrupt(struct net_device *dev)
2034#endif 2031#endif
2035 2032
2036 /* Note: Statistics counters clear when read. */ 2033 /* Note: Statistics counters clear when read. */
2037 lp->stats.rx_errors++; 2034 dev->stats.rx_errors++;
2038 lp->stats.tx_errors++; 2035 dev->stats.tx_errors++;
2039} 2036}
2040 2037
2041static void hp100_clear_stats(struct hp100_private *lp, int ioaddr) 2038static void hp100_clear_stats(struct hp100_private *lp, int ioaddr)