aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dummy.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-06-13 15:04:06 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:14:23 -0400
commit58651b24acfd9a6fd3b217b52e577ce34b0932af (patch)
tree7e6d77a0de777c5a8391a6e25b9bc4493ee43401 /drivers/net/dummy.c
parent38f7b870d4a6a5d3ec21557e849620cb7d032965 (diff)
[DUMMY]: Use dev->stats
Use dev->stats instead of netdev_priv(). Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dummy.c')
-rw-r--r--drivers/net/dummy.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 60673bc292c0..91b474c9bba0 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -38,7 +38,6 @@
38static int numdummies = 1; 38static int numdummies = 1;
39 39
40static int dummy_xmit(struct sk_buff *skb, struct net_device *dev); 40static int dummy_xmit(struct sk_buff *skb, struct net_device *dev);
41static struct net_device_stats *dummy_get_stats(struct net_device *dev);
42 41
43static int dummy_set_address(struct net_device *dev, void *p) 42static int dummy_set_address(struct net_device *dev, void *p)
44{ 43{
@@ -59,7 +58,6 @@ static void set_multicast_list(struct net_device *dev)
59static void __init dummy_setup(struct net_device *dev) 58static void __init dummy_setup(struct net_device *dev)
60{ 59{
61 /* Initialize the device structure. */ 60 /* Initialize the device structure. */
62 dev->get_stats = dummy_get_stats;
63 dev->hard_start_xmit = dummy_xmit; 61 dev->hard_start_xmit = dummy_xmit;
64 dev->set_multicast_list = set_multicast_list; 62 dev->set_multicast_list = set_multicast_list;
65 dev->set_mac_address = dummy_set_address; 63 dev->set_mac_address = dummy_set_address;
@@ -76,20 +74,13 @@ static void __init dummy_setup(struct net_device *dev)
76 74
77static int dummy_xmit(struct sk_buff *skb, struct net_device *dev) 75static int dummy_xmit(struct sk_buff *skb, struct net_device *dev)
78{ 76{
79 struct net_device_stats *stats = netdev_priv(dev); 77 dev->stats.tx_packets++;
80 78 dev->stats.tx_bytes += skb->len;
81 stats->tx_packets++;
82 stats->tx_bytes+=skb->len;
83 79
84 dev_kfree_skb(skb); 80 dev_kfree_skb(skb);
85 return 0; 81 return 0;
86} 82}
87 83
88static struct net_device_stats *dummy_get_stats(struct net_device *dev)
89{
90 return netdev_priv(dev);
91}
92
93static struct net_device **dummies; 84static struct net_device **dummies;
94 85
95/* Number of dummy devices to be set up by this module. */ 86/* Number of dummy devices to be set up by this module. */
@@ -101,8 +92,7 @@ static int __init dummy_init_one(int index)
101 struct net_device *dev_dummy; 92 struct net_device *dev_dummy;
102 int err; 93 int err;
103 94
104 dev_dummy = alloc_netdev(sizeof(struct net_device_stats), 95 dev_dummy = alloc_netdev(0, "dummy%d", dummy_setup);
105 "dummy%d", dummy_setup);
106 96
107 if (!dev_dummy) 97 if (!dev_dummy)
108 return -ENOMEM; 98 return -ENOMEM;