diff options
Diffstat (limited to 'drivers/net/ifb.c')
-rw-r--r-- | drivers/net/ifb.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 2e222ef91e22..6469130c1413 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* drivers/net/ifb.c: | 1 | /* drivers/net/ifb.c: |
2 | 2 | ||
3 | The purpose of this driver is to provide a device that allows | 3 | The purpose of this driver is to provide a device that allows |
4 | for sharing of resources: | 4 | for sharing of resources: |
@@ -8,8 +8,8 @@ | |||
8 | an impression of sharing. | 8 | an impression of sharing. |
9 | 9 | ||
10 | 2) Allows for queueing incoming traffic for shaping instead of | 10 | 2) Allows for queueing incoming traffic for shaping instead of |
11 | dropping. | 11 | dropping. |
12 | 12 | ||
13 | The original concept is based on what is known as the IMQ | 13 | The original concept is based on what is known as the IMQ |
14 | driver initially written by Martin Devera, later rewritten | 14 | driver initially written by Martin Devera, later rewritten |
15 | by Patrick McHardy and then maintained by Andre Correa. | 15 | by Patrick McHardy and then maintained by Andre Correa. |
@@ -21,23 +21,22 @@ | |||
21 | modify it under the terms of the GNU General Public License | 21 | modify it under the terms of the GNU General Public License |
22 | as published by the Free Software Foundation; either version | 22 | as published by the Free Software Foundation; either version |
23 | 2 of the License, or (at your option) any later version. | 23 | 2 of the License, or (at your option) any later version. |
24 | 24 | ||
25 | Authors: Jamal Hadi Salim (2005) | 25 | Authors: Jamal Hadi Salim (2005) |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/netdevice.h> | 32 | #include <linux/netdevice.h> |
34 | #include <linux/etherdevice.h> | 33 | #include <linux/etherdevice.h> |
35 | #include <linux/init.h> | 34 | #include <linux/init.h> |
36 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
37 | #include <net/pkt_sched.h> | 36 | #include <net/pkt_sched.h> |
38 | 37 | ||
39 | #define TX_TIMEOUT (2*HZ) | 38 | #define TX_TIMEOUT (2*HZ) |
40 | 39 | ||
41 | #define TX_Q_LIMIT 32 | 40 | #define TX_Q_LIMIT 32 |
42 | struct ifb_private { | 41 | struct ifb_private { |
43 | struct net_device_stats stats; | 42 | struct net_device_stats stats; |
@@ -65,7 +64,7 @@ static struct net_device_stats *ifb_get_stats(struct net_device *dev); | |||
65 | static int ifb_open(struct net_device *dev); | 64 | static int ifb_open(struct net_device *dev); |
66 | static int ifb_close(struct net_device *dev); | 65 | static int ifb_close(struct net_device *dev); |
67 | 66 | ||
68 | static void ri_tasklet(unsigned long dev) | 67 | static void ri_tasklet(unsigned long dev) |
69 | { | 68 | { |
70 | 69 | ||
71 | struct net_device *_dev = (struct net_device *)dev; | 70 | struct net_device *_dev = (struct net_device *)dev; |
@@ -164,7 +163,7 @@ dropped: | |||
164 | stats->rx_dropped++; | 163 | stats->rx_dropped++; |
165 | return ret; | 164 | return ret; |
166 | } else { | 165 | } else { |
167 | /* | 166 | /* |
168 | * note we could be going | 167 | * note we could be going |
169 | * ingress -> egress or | 168 | * ingress -> egress or |
170 | * egress -> ingress | 169 | * egress -> ingress |
@@ -200,7 +199,7 @@ static struct net_device_stats *ifb_get_stats(struct net_device *dev) | |||
200 | struct net_device_stats *stats = &dp->stats; | 199 | struct net_device_stats *stats = &dp->stats; |
201 | 200 | ||
202 | pr_debug("tasklets stats %ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld \n", | 201 | pr_debug("tasklets stats %ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld \n", |
203 | dp->st_task_enter, dp->st_txq_refl_try, dp->st_rxq_enter, | 202 | dp->st_task_enter, dp->st_txq_refl_try, dp->st_rxq_enter, |
204 | dp->st_rx2tx_tran dp->st_rxq_notenter, dp->st_rx_frm_egr, | 203 | dp->st_rx2tx_tran dp->st_rxq_notenter, dp->st_rx_frm_egr, |
205 | dp->st_rx_frm_ing, dp->st_rxq_check, dp->st_rxq_rsch ); | 204 | dp->st_rx_frm_ing, dp->st_rxq_check, dp->st_rxq_rsch ); |
206 | 205 | ||
@@ -251,7 +250,7 @@ static int __init ifb_init_one(int index) | |||
251 | free_netdev(dev_ifb); | 250 | free_netdev(dev_ifb); |
252 | dev_ifb = NULL; | 251 | dev_ifb = NULL; |
253 | } else { | 252 | } else { |
254 | ifbs[index] = dev_ifb; | 253 | ifbs[index] = dev_ifb; |
255 | } | 254 | } |
256 | 255 | ||
257 | return err; | 256 | return err; |
@@ -261,31 +260,32 @@ static void ifb_free_one(int index) | |||
261 | { | 260 | { |
262 | unregister_netdev(ifbs[index]); | 261 | unregister_netdev(ifbs[index]); |
263 | free_netdev(ifbs[index]); | 262 | free_netdev(ifbs[index]); |
264 | } | 263 | } |
265 | 264 | ||
266 | static int __init ifb_init_module(void) | 265 | static int __init ifb_init_module(void) |
267 | { | 266 | { |
268 | int i, err = 0; | 267 | int i, err = 0; |
269 | ifbs = kmalloc(numifbs * sizeof(void *), GFP_KERNEL); | 268 | ifbs = kmalloc(numifbs * sizeof(void *), GFP_KERNEL); |
270 | if (!ifbs) | 269 | if (!ifbs) |
271 | return -ENOMEM; | 270 | return -ENOMEM; |
272 | for (i = 0; i < numifbs && !err; i++) | 271 | for (i = 0; i < numifbs && !err; i++) |
273 | err = ifb_init_one(i); | 272 | err = ifb_init_one(i); |
274 | if (err) { | 273 | if (err) { |
274 | i--; | ||
275 | while (--i >= 0) | 275 | while (--i >= 0) |
276 | ifb_free_one(i); | 276 | ifb_free_one(i); |
277 | } | 277 | } |
278 | 278 | ||
279 | return err; | 279 | return err; |
280 | } | 280 | } |
281 | 281 | ||
282 | static void __exit ifb_cleanup_module(void) | 282 | static void __exit ifb_cleanup_module(void) |
283 | { | 283 | { |
284 | int i; | 284 | int i; |
285 | 285 | ||
286 | for (i = 0; i < numifbs; i++) | 286 | for (i = 0; i < numifbs; i++) |
287 | ifb_free_one(i); | 287 | ifb_free_one(i); |
288 | kfree(ifbs); | 288 | kfree(ifbs); |
289 | } | 289 | } |
290 | 290 | ||
291 | module_init(ifb_init_module); | 291 | module_init(ifb_init_module); |