aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_netem.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r--net/sched/sch_netem.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 79542af9dab1..1ccbfb55b0b8 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -7,7 +7,7 @@
7 * 2 of the License. 7 * 2 of the License.
8 * 8 *
9 * Many of the algorithms and ideas for this came from 9 * Many of the algorithms and ideas for this came from
10 * NIST Net which is not copyrighted. 10 * NIST Net which is not copyrighted.
11 * 11 *
12 * Authors: Stephen Hemminger <shemminger@osdl.org> 12 * Authors: Stephen Hemminger <shemminger@osdl.org>
13 * Catalin(ux aka Dino) BOIE <catab at umbrella dot ro> 13 * Catalin(ux aka Dino) BOIE <catab at umbrella dot ro>
@@ -114,7 +114,7 @@ static unsigned long get_crandom(struct crndstate *state)
114 * std deviation sigma. Uses table lookup to approximate the desired 114 * std deviation sigma. Uses table lookup to approximate the desired
115 * distribution, and a uniformly-distributed pseudo-random source. 115 * distribution, and a uniformly-distributed pseudo-random source.
116 */ 116 */
117static long tabledist(unsigned long mu, long sigma, 117static long tabledist(unsigned long mu, long sigma,
118 struct crndstate *state, const struct disttable *dist) 118 struct crndstate *state, const struct disttable *dist)
119{ 119{
120 long t, x; 120 long t, x;
@@ -126,7 +126,7 @@ static long tabledist(unsigned long mu, long sigma,
126 rnd = get_crandom(state); 126 rnd = get_crandom(state);
127 127
128 /* default uniform distribution */ 128 /* default uniform distribution */
129 if (dist == NULL) 129 if (dist == NULL)
130 return (rnd % (2*sigma)) - sigma + mu; 130 return (rnd % (2*sigma)) - sigma + mu;
131 131
132 t = dist->table[rnd % dist->size]; 132 t = dist->table[rnd % dist->size];
@@ -218,7 +218,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
218 ++q->counter; 218 ++q->counter;
219 ret = q->qdisc->enqueue(skb, q->qdisc); 219 ret = q->qdisc->enqueue(skb, q->qdisc);
220 } else { 220 } else {
221 /* 221 /*
222 * Do re-ordering by putting one out of N packets at the front 222 * Do re-ordering by putting one out of N packets at the front
223 * of the queue. 223 * of the queue.
224 */ 224 */
@@ -323,7 +323,7 @@ static void netem_reset(struct Qdisc *sch)
323/* Pass size change message down to embedded FIFO */ 323/* Pass size change message down to embedded FIFO */
324static int set_fifo_limit(struct Qdisc *q, int limit) 324static int set_fifo_limit(struct Qdisc *q, int limit)
325{ 325{
326 struct rtattr *rta; 326 struct rtattr *rta;
327 int ret = -ENOMEM; 327 int ret = -ENOMEM;
328 328
329 /* Hack to avoid sending change message to non-FIFO */ 329 /* Hack to avoid sending change message to non-FIFO */
@@ -333,9 +333,9 @@ static int set_fifo_limit(struct Qdisc *q, int limit)
333 rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL); 333 rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
334 if (rta) { 334 if (rta) {
335 rta->rta_type = RTM_NEWQDISC; 335 rta->rta_type = RTM_NEWQDISC;
336 rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); 336 rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
337 ((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit; 337 ((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
338 338
339 ret = q->ops->change(q, rta); 339 ret = q->ops->change(q, rta);
340 kfree(rta); 340 kfree(rta);
341 } 341 }
@@ -364,7 +364,7 @@ static int get_dist_table(struct Qdisc *sch, const struct rtattr *attr)
364 d->size = n; 364 d->size = n;
365 for (i = 0; i < n; i++) 365 for (i = 0; i < n; i++)
366 d->table[i] = data[i]; 366 d->table[i] = data[i];
367 367
368 spin_lock_bh(&sch->dev->queue_lock); 368 spin_lock_bh(&sch->dev->queue_lock);
369 d = xchg(&q->delay_dist, d); 369 d = xchg(&q->delay_dist, d);
370 spin_unlock_bh(&sch->dev->queue_lock); 370 spin_unlock_bh(&sch->dev->queue_lock);
@@ -419,7 +419,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)
419 struct netem_sched_data *q = qdisc_priv(sch); 419 struct netem_sched_data *q = qdisc_priv(sch);
420 struct tc_netem_qopt *qopt; 420 struct tc_netem_qopt *qopt;
421 int ret; 421 int ret;
422 422
423 if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt)) 423 if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
424 return -EINVAL; 424 return -EINVAL;
425 425
@@ -429,7 +429,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)
429 pr_debug("netem: can't set fifo limit\n"); 429 pr_debug("netem: can't set fifo limit\n");
430 return ret; 430 return ret;
431 } 431 }
432 432
433 q->latency = qopt->latency; 433 q->latency = qopt->latency;
434 q->jitter = qopt->jitter; 434 q->jitter = qopt->jitter;
435 q->limit = qopt->limit; 435 q->limit = qopt->limit;
@@ -445,10 +445,10 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)
445 445
446 /* Handle nested options after initial queue options. 446 /* Handle nested options after initial queue options.
447 * Should have put all options in nested format but too late now. 447 * Should have put all options in nested format but too late now.
448 */ 448 */
449 if (RTA_PAYLOAD(opt) > sizeof(*qopt)) { 449 if (RTA_PAYLOAD(opt) > sizeof(*qopt)) {
450 struct rtattr *tb[TCA_NETEM_MAX]; 450 struct rtattr *tb[TCA_NETEM_MAX];
451 if (rtattr_parse(tb, TCA_NETEM_MAX, 451 if (rtattr_parse(tb, TCA_NETEM_MAX,
452 RTA_DATA(opt) + sizeof(*qopt), 452 RTA_DATA(opt) + sizeof(*qopt),
453 RTA_PAYLOAD(opt) - sizeof(*qopt))) 453 RTA_PAYLOAD(opt) - sizeof(*qopt)))
454 return -EINVAL; 454 return -EINVAL;
@@ -681,7 +681,7 @@ static void netem_put(struct Qdisc *sch, unsigned long arg)
681{ 681{
682} 682}
683 683
684static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid, 684static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
685 struct rtattr **tca, unsigned long *arg) 685 struct rtattr **tca, unsigned long *arg)
686{ 686{
687 return -ENOSYS; 687 return -ENOSYS;