diff options
author | Patrick McHardy <kaber@trash.net> | 2007-06-13 15:04:06 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:14:23 -0400 |
commit | 58651b24acfd9a6fd3b217b52e577ce34b0932af (patch) | |
tree | 7e6d77a0de777c5a8391a6e25b9bc4493ee43401 /drivers/net/dummy.c | |
parent | 38f7b870d4a6a5d3ec21557e849620cb7d032965 (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.c | 16 |
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 @@ | |||
38 | static int numdummies = 1; | 38 | static int numdummies = 1; |
39 | 39 | ||
40 | static int dummy_xmit(struct sk_buff *skb, struct net_device *dev); | 40 | static int dummy_xmit(struct sk_buff *skb, struct net_device *dev); |
41 | static struct net_device_stats *dummy_get_stats(struct net_device *dev); | ||
42 | 41 | ||
43 | static int dummy_set_address(struct net_device *dev, void *p) | 42 | static 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) | |||
59 | static void __init dummy_setup(struct net_device *dev) | 58 | static 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 | ||
77 | static int dummy_xmit(struct sk_buff *skb, struct net_device *dev) | 75 | static 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 | ||
88 | static struct net_device_stats *dummy_get_stats(struct net_device *dev) | ||
89 | { | ||
90 | return netdev_priv(dev); | ||
91 | } | ||
92 | |||
93 | static struct net_device **dummies; | 84 | static 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; |