aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netfront.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/xen-netfront.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (diff)
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device, and the default ->get_stats() hook does the obvious thing for us. Run through drivers/net/* and remove the driver-local storage of statistics, and driver-local ->get_stats() hook where applicable. This was just the low-hanging fruit in drivers/net; plenty more drivers remain to be updated. [ Resolved conflicts with napi_struct changes and fix sunqe build regression... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netfront.c')
-rw-r--r--drivers/net/xen-netfront.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 8eeb068dc4a6..78e344ae7051 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -73,7 +73,6 @@ struct netfront_info {
73 struct net_device *netdev; 73 struct net_device *netdev;
74 74
75 struct napi_struct napi; 75 struct napi_struct napi;
76 struct net_device_stats stats;
77 76
78 struct xen_netif_tx_front_ring tx; 77 struct xen_netif_tx_front_ring tx;
79 struct xen_netif_rx_front_ring rx; 78 struct xen_netif_rx_front_ring rx;
@@ -309,8 +308,6 @@ static int xennet_open(struct net_device *dev)
309{ 308{
310 struct netfront_info *np = netdev_priv(dev); 309 struct netfront_info *np = netdev_priv(dev);
311 310
312 memset(&np->stats, 0, sizeof(np->stats));
313
314 napi_enable(&np->napi); 311 napi_enable(&np->napi);
315 312
316 spin_lock_bh(&np->rx_lock); 313 spin_lock_bh(&np->rx_lock);
@@ -537,8 +534,8 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
537 if (notify) 534 if (notify)
538 notify_remote_via_irq(np->netdev->irq); 535 notify_remote_via_irq(np->netdev->irq);
539 536
540 np->stats.tx_bytes += skb->len; 537 dev->stats.tx_bytes += skb->len;
541 np->stats.tx_packets++; 538 dev->stats.tx_packets++;
542 539
543 /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ 540 /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
544 xennet_tx_buf_gc(dev); 541 xennet_tx_buf_gc(dev);
@@ -551,7 +548,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
551 return 0; 548 return 0;
552 549
553 drop: 550 drop:
554 np->stats.tx_dropped++; 551 dev->stats.tx_dropped++;
555 dev_kfree_skb(skb); 552 dev_kfree_skb(skb);
556 return 0; 553 return 0;
557} 554}
@@ -564,12 +561,6 @@ static int xennet_close(struct net_device *dev)
564 return 0; 561 return 0;
565} 562}
566 563
567static struct net_device_stats *xennet_get_stats(struct net_device *dev)
568{
569 struct netfront_info *np = netdev_priv(dev);
570 return &np->stats;
571}
572
573static void xennet_move_rx_slot(struct netfront_info *np, struct sk_buff *skb, 564static void xennet_move_rx_slot(struct netfront_info *np, struct sk_buff *skb,
574 grant_ref_t ref) 565 grant_ref_t ref)
575{ 566{
@@ -804,9 +795,8 @@ out:
804} 795}
805 796
806static int handle_incoming_queue(struct net_device *dev, 797static int handle_incoming_queue(struct net_device *dev,
807 struct sk_buff_head *rxq) 798 struct sk_buff_head *rxq)
808{ 799{
809 struct netfront_info *np = netdev_priv(dev);
810 int packets_dropped = 0; 800 int packets_dropped = 0;
811 struct sk_buff *skb; 801 struct sk_buff *skb;
812 802
@@ -828,13 +818,13 @@ static int handle_incoming_queue(struct net_device *dev,
828 if (skb_checksum_setup(skb)) { 818 if (skb_checksum_setup(skb)) {
829 kfree_skb(skb); 819 kfree_skb(skb);
830 packets_dropped++; 820 packets_dropped++;
831 np->stats.rx_errors++; 821 dev->stats.rx_errors++;
832 continue; 822 continue;
833 } 823 }
834 } 824 }
835 825
836 np->stats.rx_packets++; 826 dev->stats.rx_packets++;
837 np->stats.rx_bytes += skb->len; 827 dev->stats.rx_bytes += skb->len;
838 828
839 /* Pass it up. */ 829 /* Pass it up. */
840 netif_receive_skb(skb); 830 netif_receive_skb(skb);
@@ -887,7 +877,7 @@ static int xennet_poll(struct napi_struct *napi, int budget)
887err: 877err:
888 while ((skb = __skb_dequeue(&tmpq))) 878 while ((skb = __skb_dequeue(&tmpq)))
889 __skb_queue_tail(&errq, skb); 879 __skb_queue_tail(&errq, skb);
890 np->stats.rx_errors++; 880 dev->stats.rx_errors++;
891 i = np->rx.rsp_cons; 881 i = np->rx.rsp_cons;
892 continue; 882 continue;
893 } 883 }
@@ -1169,7 +1159,6 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev
1169 netdev->open = xennet_open; 1159 netdev->open = xennet_open;
1170 netdev->hard_start_xmit = xennet_start_xmit; 1160 netdev->hard_start_xmit = xennet_start_xmit;
1171 netdev->stop = xennet_close; 1161 netdev->stop = xennet_close;
1172 netdev->get_stats = xennet_get_stats;
1173 netif_napi_add(netdev, &np->napi, xennet_poll, 64); 1162 netif_napi_add(netdev, &np->napi, xennet_poll, 64);
1174 netdev->uninit = xennet_uninit; 1163 netdev->uninit = xennet_uninit;
1175 netdev->change_mtu = xennet_change_mtu; 1164 netdev->change_mtu = xennet_change_mtu;