aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_fifo.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_fifo.c')
-rw-r--r--net/sched/sch_fifo.c50
1 files changed, 12 insertions, 38 deletions
diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
index 83a4db4d3cdc..033083bf0e74 100644
--- a/net/sched/sch_fifo.c
+++ b/net/sched/sch_fifo.c
@@ -11,39 +11,21 @@
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <asm/uaccess.h>
15#include <asm/system.h>
16#include <linux/bitops.h>
17#include <linux/types.h> 14#include <linux/types.h>
18#include <linux/kernel.h> 15#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h>
21#include <linux/mm.h>
22#include <linux/socket.h>
23#include <linux/sockios.h>
24#include <linux/in.h>
25#include <linux/errno.h> 16#include <linux/errno.h>
26#include <linux/interrupt.h>
27#include <linux/if_ether.h>
28#include <linux/inet.h>
29#include <linux/netdevice.h> 17#include <linux/netdevice.h>
30#include <linux/etherdevice.h>
31#include <linux/notifier.h>
32#include <net/ip.h>
33#include <net/route.h>
34#include <linux/skbuff.h> 18#include <linux/skbuff.h>
35#include <net/sock.h>
36#include <net/pkt_sched.h> 19#include <net/pkt_sched.h>
37 20
38/* 1 band FIFO pseudo-"scheduler" */ 21/* 1 band FIFO pseudo-"scheduler" */
39 22
40struct fifo_sched_data 23struct fifo_sched_data
41{ 24{
42 unsigned limit; 25 u32 limit;
43}; 26};
44 27
45static int 28static int bfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)
46bfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)
47{ 29{
48 struct fifo_sched_data *q = qdisc_priv(sch); 30 struct fifo_sched_data *q = qdisc_priv(sch);
49 31
@@ -53,8 +35,7 @@ bfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)
53 return qdisc_reshape_fail(skb, sch); 35 return qdisc_reshape_fail(skb, sch);
54} 36}
55 37
56static int 38static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)
57pfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)
58{ 39{
59 struct fifo_sched_data *q = qdisc_priv(sch); 40 struct fifo_sched_data *q = qdisc_priv(sch);
60 41
@@ -69,40 +50,37 @@ static int fifo_init(struct Qdisc *sch, struct rtattr *opt)
69 struct fifo_sched_data *q = qdisc_priv(sch); 50 struct fifo_sched_data *q = qdisc_priv(sch);
70 51
71 if (opt == NULL) { 52 if (opt == NULL) {
72 unsigned int limit = sch->dev->tx_queue_len ? : 1; 53 u32 limit = sch->dev->tx_queue_len ? : 1;
73 54
74 if (sch->ops == &bfifo_qdisc_ops) 55 if (sch->ops == &bfifo_qdisc_ops)
75 q->limit = limit*sch->dev->mtu; 56 limit *= sch->dev->mtu;
76 else 57
77 q->limit = limit; 58 q->limit = limit;
78 } else { 59 } else {
79 struct tc_fifo_qopt *ctl = RTA_DATA(opt); 60 struct tc_fifo_qopt *ctl = RTA_DATA(opt);
80 if (opt->rta_len < RTA_LENGTH(sizeof(*ctl))) 61
62 if (RTA_PAYLOAD(opt) < sizeof(*ctl))
81 return -EINVAL; 63 return -EINVAL;
64
82 q->limit = ctl->limit; 65 q->limit = ctl->limit;
83 } 66 }
67
84 return 0; 68 return 0;
85} 69}
86 70
87static int fifo_dump(struct Qdisc *sch, struct sk_buff *skb) 71static int fifo_dump(struct Qdisc *sch, struct sk_buff *skb)
88{ 72{
89 struct fifo_sched_data *q = qdisc_priv(sch); 73 struct fifo_sched_data *q = qdisc_priv(sch);
90 unsigned char *b = skb->tail; 74 struct tc_fifo_qopt opt = { .limit = q->limit };
91 struct tc_fifo_qopt opt;
92 75
93 opt.limit = q->limit;
94 RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); 76 RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
95
96 return skb->len; 77 return skb->len;
97 78
98rtattr_failure: 79rtattr_failure:
99 skb_trim(skb, b - skb->data);
100 return -1; 80 return -1;
101} 81}
102 82
103struct Qdisc_ops pfifo_qdisc_ops = { 83struct Qdisc_ops pfifo_qdisc_ops = {
104 .next = NULL,
105 .cl_ops = NULL,
106 .id = "pfifo", 84 .id = "pfifo",
107 .priv_size = sizeof(struct fifo_sched_data), 85 .priv_size = sizeof(struct fifo_sched_data),
108 .enqueue = pfifo_enqueue, 86 .enqueue = pfifo_enqueue,
@@ -111,15 +89,12 @@ struct Qdisc_ops pfifo_qdisc_ops = {
111 .drop = qdisc_queue_drop, 89 .drop = qdisc_queue_drop,
112 .init = fifo_init, 90 .init = fifo_init,
113 .reset = qdisc_reset_queue, 91 .reset = qdisc_reset_queue,
114 .destroy = NULL,
115 .change = fifo_init, 92 .change = fifo_init,
116 .dump = fifo_dump, 93 .dump = fifo_dump,
117 .owner = THIS_MODULE, 94 .owner = THIS_MODULE,
118}; 95};
119 96
120struct Qdisc_ops bfifo_qdisc_ops = { 97struct Qdisc_ops bfifo_qdisc_ops = {
121 .next = NULL,
122 .cl_ops = NULL,
123 .id = "bfifo", 98 .id = "bfifo",
124 .priv_size = sizeof(struct fifo_sched_data), 99 .priv_size = sizeof(struct fifo_sched_data),
125 .enqueue = bfifo_enqueue, 100 .enqueue = bfifo_enqueue,
@@ -128,7 +103,6 @@ struct Qdisc_ops bfifo_qdisc_ops = {
128 .drop = qdisc_queue_drop, 103 .drop = qdisc_queue_drop,
129 .init = fifo_init, 104 .init = fifo_init,
130 .reset = qdisc_reset_queue, 105 .reset = qdisc_reset_queue,
131 .destroy = NULL,
132 .change = fifo_init, 106 .change = fifo_init,
133 .dump = fifo_dump, 107 .dump = fifo_dump,
134 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,