aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Hałasa <khc@pm.waw.pl>2008-12-19 19:58:59 -0500
committerKrzysztof Hałasa <khc@pm.waw.pl>2008-12-21 18:42:55 -0500
commitb4c7d3b07257528d3c0bfd07c5b38b48beb9b6d1 (patch)
treeeb8bcbfb07120bafce2152292cf0f8c5e1f5f6b3 /drivers
parent3c36a837a960ccbff05fa773a495c389fbd42f0e (diff)
IXP4xx: Make the Ethernet driver use built-in netdev stats.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/arm/ixp4xx_eth.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index e6e4004b13bb..44679f804be3 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -164,7 +164,6 @@ struct port {
164 struct npe *npe; 164 struct npe *npe;
165 struct net_device *netdev; 165 struct net_device *netdev;
166 struct napi_struct napi; 166 struct napi_struct napi;
167 struct net_device_stats stat;
168 struct mii_if_info mii; 167 struct mii_if_info mii;
169 struct delayed_work mdio_thread; 168 struct delayed_work mdio_thread;
170 struct eth_plat_info *plat; 169 struct eth_plat_info *plat;
@@ -562,7 +561,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
562#endif 561#endif
563 562
564 if (!skb) { 563 if (!skb) {
565 port->stat.rx_dropped++; 564 dev->stats.rx_dropped++;
566 /* put the desc back on RX-ready queue */ 565 /* put the desc back on RX-ready queue */
567 desc->buf_len = MAX_MRU; 566 desc->buf_len = MAX_MRU;
568 desc->pkt_len = 0; 567 desc->pkt_len = 0;
@@ -588,8 +587,8 @@ static int eth_poll(struct napi_struct *napi, int budget)
588 debug_pkt(dev, "eth_poll", skb->data, skb->len); 587 debug_pkt(dev, "eth_poll", skb->data, skb->len);
589 588
590 skb->protocol = eth_type_trans(skb, dev); 589 skb->protocol = eth_type_trans(skb, dev);
591 port->stat.rx_packets++; 590 dev->stats.rx_packets++;
592 port->stat.rx_bytes += skb->len; 591 dev->stats.rx_bytes += skb->len;
593 netif_receive_skb(skb); 592 netif_receive_skb(skb);
594 593
595 /* put the new buffer on RX-free queue */ 594 /* put the new buffer on RX-free queue */
@@ -634,8 +633,8 @@ static void eth_txdone_irq(void *unused)
634 debug_desc(phys, desc); 633 debug_desc(phys, desc);
635 634
636 if (port->tx_buff_tab[n_desc]) { /* not the draining packet */ 635 if (port->tx_buff_tab[n_desc]) { /* not the draining packet */
637 port->stat.tx_packets++; 636 port->netdev->stats.tx_packets++;
638 port->stat.tx_bytes += desc->pkt_len; 637 port->netdev->stats.tx_bytes += desc->pkt_len;
639 638
640 dma_unmap_tx(port, desc); 639 dma_unmap_tx(port, desc);
641#if DEBUG_TX 640#if DEBUG_TX
@@ -673,7 +672,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
673 672
674 if (unlikely(skb->len > MAX_MRU)) { 673 if (unlikely(skb->len > MAX_MRU)) {
675 dev_kfree_skb(skb); 674 dev_kfree_skb(skb);
676 port->stat.tx_errors++; 675 dev->stats.tx_errors++;
677 return NETDEV_TX_OK; 676 return NETDEV_TX_OK;
678 } 677 }
679 678
@@ -689,7 +688,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
689 bytes = ALIGN(offset + len, 4); 688 bytes = ALIGN(offset + len, 4);
690 if (!(mem = kmalloc(bytes, GFP_ATOMIC))) { 689 if (!(mem = kmalloc(bytes, GFP_ATOMIC))) {
691 dev_kfree_skb(skb); 690 dev_kfree_skb(skb);
692 port->stat.tx_dropped++; 691 dev->stats.tx_dropped++;
693 return NETDEV_TX_OK; 692 return NETDEV_TX_OK;
694 } 693 }
695 memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); 694 memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4);
@@ -703,7 +702,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
703#else 702#else
704 kfree(mem); 703 kfree(mem);
705#endif 704#endif
706 port->stat.tx_dropped++; 705 dev->stats.tx_dropped++;
707 return NETDEV_TX_OK; 706 return NETDEV_TX_OK;
708 } 707 }
709 708
@@ -746,12 +745,6 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
746} 745}
747 746
748 747
749static struct net_device_stats *eth_stats(struct net_device *dev)
750{
751 struct port *port = netdev_priv(dev);
752 return &port->stat;
753}
754
755static void eth_set_mcast_list(struct net_device *dev) 748static void eth_set_mcast_list(struct net_device *dev)
756{ 749{
757 struct port *port = netdev_priv(dev); 750 struct port *port = netdev_priv(dev);
@@ -1155,7 +1148,6 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1155 dev->open = eth_open; 1148 dev->open = eth_open;
1156 dev->hard_start_xmit = eth_xmit; 1149 dev->hard_start_xmit = eth_xmit;
1157 dev->stop = eth_close; 1150 dev->stop = eth_close;
1158 dev->get_stats = eth_stats;
1159 dev->do_ioctl = eth_ioctl; 1151 dev->do_ioctl = eth_ioctl;
1160 dev->set_multicast_list = eth_set_mcast_list; 1152 dev->set_multicast_list = eth_set_mcast_list;
1161 dev->tx_queue_len = 100; 1153 dev->tx_queue_len = 100;