aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-04 22:13:41 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-05 22:41:15 -0400
commit0b9be50b3b66c7940b151dac8b80aaf138804226 (patch)
treed9cb3297c1eb15ad5374748baae681ce53ddb710 /drivers/net
parent661a16ce9da615eb75d1052cbb13b6545f0080b4 (diff)
hamachi: 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')
-rw-r--r--drivers/net/hamachi.c63
1 files changed, 37 insertions, 26 deletions
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 61f2b1cfcd46..49aac7027fbb 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -492,7 +492,6 @@ struct hamachi_private {
492 struct sk_buff* tx_skbuff[TX_RING_SIZE]; 492 struct sk_buff* tx_skbuff[TX_RING_SIZE];
493 dma_addr_t tx_ring_dma; 493 dma_addr_t tx_ring_dma;
494 dma_addr_t rx_ring_dma; 494 dma_addr_t rx_ring_dma;
495 struct net_device_stats stats;
496 struct timer_list timer; /* Media selection timer. */ 495 struct timer_list timer; /* Media selection timer. */
497 /* Frequently used and paired value: keep adjacent for cache effect. */ 496 /* Frequently used and paired value: keep adjacent for cache effect. */
498 spinlock_t lock; 497 spinlock_t lock;
@@ -1036,7 +1035,7 @@ static inline int hamachi_tx(struct net_device *dev)
1036 if (entry >= TX_RING_SIZE-1) 1035 if (entry >= TX_RING_SIZE-1)
1037 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= 1036 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |=
1038 cpu_to_le32(DescEndRing); 1037 cpu_to_le32(DescEndRing);
1039 hmp->stats.tx_packets++; 1038 dev->stats.tx_packets++;
1040 } 1039 }
1041 1040
1042 return 0; 1041 return 0;
@@ -1167,7 +1166,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
1167 1166
1168 /* Trigger an immediate transmit demand. */ 1167 /* Trigger an immediate transmit demand. */
1169 dev->trans_start = jiffies; /* prevent tx timeout */ 1168 dev->trans_start = jiffies; /* prevent tx timeout */
1170 hmp->stats.tx_errors++; 1169 dev->stats.tx_errors++;
1171 1170
1172 /* Restart the chip's Tx/Rx processes . */ 1171 /* Restart the chip's Tx/Rx processes . */
1173 writew(0x0002, ioaddr + TxCmd); /* STOP Tx */ 1172 writew(0x0002, ioaddr + TxCmd); /* STOP Tx */
@@ -1434,7 +1433,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance)
1434 if (entry >= TX_RING_SIZE-1) 1433 if (entry >= TX_RING_SIZE-1)
1435 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= 1434 hmp->tx_ring[TX_RING_SIZE-1].status_n_length |=
1436 cpu_to_le32(DescEndRing); 1435 cpu_to_le32(DescEndRing);
1437 hmp->stats.tx_packets++; 1436 dev->stats.tx_packets++;
1438 } 1437 }
1439 if (hmp->cur_tx - hmp->dirty_tx < TX_RING_SIZE - 4){ 1438 if (hmp->cur_tx - hmp->dirty_tx < TX_RING_SIZE - 4){
1440 /* The ring is no longer full */ 1439 /* The ring is no longer full */
@@ -1525,18 +1524,22 @@ static int hamachi_rx(struct net_device *dev)
1525 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000, 1524 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000,
1526 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff, 1525 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff,
1527 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length)); 1526 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length));
1528 hmp->stats.rx_length_errors++; 1527 dev->stats.rx_length_errors++;
1529 } /* else Omit for prototype errata??? */ 1528 } /* else Omit for prototype errata??? */
1530 if (frame_status & 0x00380000) { 1529 if (frame_status & 0x00380000) {
1531 /* There was an error. */ 1530 /* There was an error. */
1532 if (hamachi_debug > 2) 1531 if (hamachi_debug > 2)
1533 printk(KERN_DEBUG " hamachi_rx() Rx error was %8.8x.\n", 1532 printk(KERN_DEBUG " hamachi_rx() Rx error was %8.8x.\n",
1534 frame_status); 1533 frame_status);
1535 hmp->stats.rx_errors++; 1534 dev->stats.rx_errors++;
1536 if (frame_status & 0x00600000) hmp->stats.rx_length_errors++; 1535 if (frame_status & 0x00600000)
1537 if (frame_status & 0x00080000) hmp->stats.rx_frame_errors++; 1536 dev->stats.rx_length_errors++;
1538 if (frame_status & 0x00100000) hmp->stats.rx_crc_errors++; 1537 if (frame_status & 0x00080000)
1539 if (frame_status < 0) hmp->stats.rx_dropped++; 1538 dev->stats.rx_frame_errors++;
1539 if (frame_status & 0x00100000)
1540 dev->stats.rx_crc_errors++;
1541 if (frame_status < 0)
1542 dev->stats.rx_dropped++;
1540 } else { 1543 } else {
1541 struct sk_buff *skb; 1544 struct sk_buff *skb;
1542 /* Omit CRC */ 1545 /* Omit CRC */
@@ -1654,7 +1657,7 @@ static int hamachi_rx(struct net_device *dev)
1654#endif /* RX_CHECKSUM */ 1657#endif /* RX_CHECKSUM */
1655 1658
1656 netif_rx(skb); 1659 netif_rx(skb);
1657 hmp->stats.rx_packets++; 1660 dev->stats.rx_packets++;
1658 } 1661 }
1659 entry = (++hmp->cur_rx) % RX_RING_SIZE; 1662 entry = (++hmp->cur_rx) % RX_RING_SIZE;
1660 } 1663 }
@@ -1724,9 +1727,9 @@ static void hamachi_error(struct net_device *dev, int intr_status)
1724 dev->name, intr_status); 1727 dev->name, intr_status);
1725 /* Hmmmmm, it's not clear how to recover from PCI faults. */ 1728 /* Hmmmmm, it's not clear how to recover from PCI faults. */
1726 if (intr_status & (IntrTxPCIErr | IntrTxPCIFault)) 1729 if (intr_status & (IntrTxPCIErr | IntrTxPCIFault))
1727 hmp->stats.tx_fifo_errors++; 1730 dev->stats.tx_fifo_errors++;
1728 if (intr_status & (IntrRxPCIErr | IntrRxPCIFault)) 1731 if (intr_status & (IntrRxPCIErr | IntrRxPCIFault))
1729 hmp->stats.rx_fifo_errors++; 1732 dev->stats.rx_fifo_errors++;
1730} 1733}
1731 1734
1732static int hamachi_close(struct net_device *dev) 1735static int hamachi_close(struct net_device *dev)
@@ -1828,19 +1831,27 @@ static struct net_device_stats *hamachi_get_stats(struct net_device *dev)
1828 so I think I'll comment it out here and see if better things 1831 so I think I'll comment it out here and see if better things
1829 happen. 1832 happen.
1830 */ 1833 */
1831 /* hmp->stats.tx_packets = readl(ioaddr + 0x000); */ 1834 /* dev->stats.tx_packets = readl(ioaddr + 0x000); */
1832 1835
1833 hmp->stats.rx_bytes = readl(ioaddr + 0x330); /* Total Uni+Brd+Multi */ 1836 /* Total Uni+Brd+Multi */
1834 hmp->stats.tx_bytes = readl(ioaddr + 0x3B0); /* Total Uni+Brd+Multi */ 1837 dev->stats.rx_bytes = readl(ioaddr + 0x330);
1835 hmp->stats.multicast = readl(ioaddr + 0x320); /* Multicast Rx */ 1838 /* Total Uni+Brd+Multi */
1836 1839 dev->stats.tx_bytes = readl(ioaddr + 0x3B0);
1837 hmp->stats.rx_length_errors = readl(ioaddr + 0x368); /* Over+Undersized */ 1840 /* Multicast Rx */
1838 hmp->stats.rx_over_errors = readl(ioaddr + 0x35C); /* Jabber */ 1841 dev->stats.multicast = readl(ioaddr + 0x320);
1839 hmp->stats.rx_crc_errors = readl(ioaddr + 0x360); /* Jabber */ 1842
1840 hmp->stats.rx_frame_errors = readl(ioaddr + 0x364); /* Symbol Errs */ 1843 /* Over+Undersized */
1841 hmp->stats.rx_missed_errors = readl(ioaddr + 0x36C); /* Dropped */ 1844 dev->stats.rx_length_errors = readl(ioaddr + 0x368);
1842 1845 /* Jabber */
1843 return &hmp->stats; 1846 dev->stats.rx_over_errors = readl(ioaddr + 0x35C);
1847 /* Jabber */
1848 dev->stats.rx_crc_errors = readl(ioaddr + 0x360);
1849 /* Symbol Errs */
1850 dev->stats.rx_frame_errors = readl(ioaddr + 0x364);
1851 /* Dropped */
1852 dev->stats.rx_missed_errors = readl(ioaddr + 0x36C);
1853
1854 return &dev->stats;
1844} 1855}
1845 1856
1846static void set_rx_mode(struct net_device *dev) 1857static void set_rx_mode(struct net_device *dev)