sch_sfq.c (05668381140309088443bf5dc53add4104610fbb) sch_sfq.c (5e50da01d0ce7ef0ba3ed6cfabd62f327da0aca6)
1/*
2 * net/sched/sch_sfq.c Stochastic Fairness Queueing discipline.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 379 unchanged lines hidden (view full) ---

388 add_timer(&q->perturb_timer);
389 }
390}
391
392static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
393{
394 struct sfq_sched_data *q = qdisc_priv(sch);
395 struct tc_sfq_qopt *ctl = RTA_DATA(opt);
1/*
2 * net/sched/sch_sfq.c Stochastic Fairness Queueing discipline.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 379 unchanged lines hidden (view full) ---

388 add_timer(&q->perturb_timer);
389 }
390}
391
392static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
393{
394 struct sfq_sched_data *q = qdisc_priv(sch);
395 struct tc_sfq_qopt *ctl = RTA_DATA(opt);
396 unsigned int qlen;
396
397 if (opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
398 return -EINVAL;
399
400 sch_tree_lock(sch);
401 q->quantum = ctl->quantum ? : psched_mtu(sch->dev);
402 q->perturb_period = ctl->perturb_period*HZ;
403 if (ctl->limit)
404 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH);
405
397
398 if (opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
399 return -EINVAL;
400
401 sch_tree_lock(sch);
402 q->quantum = ctl->quantum ? : psched_mtu(sch->dev);
403 q->perturb_period = ctl->perturb_period*HZ;
404 if (ctl->limit)
405 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH);
406
407 qlen = sch->q.qlen;
406 while (sch->q.qlen >= q->limit-1)
407 sfq_drop(sch);
408 while (sch->q.qlen >= q->limit-1)
409 sfq_drop(sch);
410 qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen);
408
409 del_timer(&q->perturb_timer);
410 if (q->perturb_period) {
411 q->perturb_timer.expires = jiffies + q->perturb_period;
412 add_timer(&q->perturb_timer);
413 }
414 sch_tree_unlock(sch);
415 return 0;

--- 90 unchanged lines hidden ---
411
412 del_timer(&q->perturb_timer);
413 if (q->perturb_period) {
414 q->perturb_timer.expires = jiffies + q->perturb_period;
415 add_timer(&q->perturb_timer);
416 }
417 sch_tree_unlock(sch);
418 return 0;

--- 90 unchanged lines hidden ---