sch_sfq.c (6f9e98f7a96fdf4d621b8241d5a8a55c692de373) | sch_sfq.c (1e90474c377e92db7262a8968a45c1dd980ca9e5) |
---|---|
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 * --- 383 unchanged lines hidden (view full) --- 392 struct sfq_sched_data *q = qdisc_priv(sch); 393 394 q->perturbation = net_random(); 395 396 if (q->perturb_period) 397 mod_timer(&q->perturb_timer, jiffies + q->perturb_period); 398} 399 | 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 * --- 383 unchanged lines hidden (view full) --- 392 struct sfq_sched_data *q = qdisc_priv(sch); 393 394 q->perturbation = net_random(); 395 396 if (q->perturb_period) 397 mod_timer(&q->perturb_timer, jiffies + q->perturb_period); 398} 399 |
400static int sfq_change(struct Qdisc *sch, struct rtattr *opt) | 400static int sfq_change(struct Qdisc *sch, struct nlattr *opt) |
401{ 402 struct sfq_sched_data *q = qdisc_priv(sch); | 401{ 402 struct sfq_sched_data *q = qdisc_priv(sch); |
403 struct tc_sfq_qopt *ctl = RTA_DATA(opt); | 403 struct tc_sfq_qopt *ctl = nla_data(opt); |
404 unsigned int qlen; 405 | 404 unsigned int qlen; 405 |
406 if (opt->rta_len < RTA_LENGTH(sizeof(*ctl))) | 406 if (opt->nla_len < nla_attr_size(sizeof(*ctl))) |
407 return -EINVAL; 408 409 sch_tree_lock(sch); 410 q->quantum = ctl->quantum ? : psched_mtu(sch->dev); 411 q->perturb_period = ctl->perturb_period * HZ; 412 if (ctl->limit) 413 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH - 1); 414 --- 6 unchanged lines hidden (view full) --- 421 if (q->perturb_period) { 422 mod_timer(&q->perturb_timer, jiffies + q->perturb_period); 423 q->perturbation = net_random(); 424 } 425 sch_tree_unlock(sch); 426 return 0; 427} 428 | 407 return -EINVAL; 408 409 sch_tree_lock(sch); 410 q->quantum = ctl->quantum ? : psched_mtu(sch->dev); 411 q->perturb_period = ctl->perturb_period * HZ; 412 if (ctl->limit) 413 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH - 1); 414 --- 6 unchanged lines hidden (view full) --- 421 if (q->perturb_period) { 422 mod_timer(&q->perturb_timer, jiffies + q->perturb_period); 423 q->perturbation = net_random(); 424 } 425 sch_tree_unlock(sch); 426 return 0; 427} 428 |
429static int sfq_init(struct Qdisc *sch, struct rtattr *opt) | 429static int sfq_init(struct Qdisc *sch, struct nlattr *opt) |
430{ 431 struct sfq_sched_data *q = qdisc_priv(sch); 432 int i; 433 434 q->perturb_timer.function = sfq_perturbation; 435 q->perturb_timer.data = (unsigned long)sch;; 436 init_timer_deferrable(&q->perturb_timer); 437 --- 38 unchanged lines hidden (view full) --- 476 477 opt.quantum = q->quantum; 478 opt.perturb_period = q->perturb_period / HZ; 479 480 opt.limit = q->limit; 481 opt.divisor = SFQ_HASH_DIVISOR; 482 opt.flows = q->limit; 483 | 430{ 431 struct sfq_sched_data *q = qdisc_priv(sch); 432 int i; 433 434 q->perturb_timer.function = sfq_perturbation; 435 q->perturb_timer.data = (unsigned long)sch;; 436 init_timer_deferrable(&q->perturb_timer); 437 --- 38 unchanged lines hidden (view full) --- 476 477 opt.quantum = q->quantum; 478 opt.perturb_period = q->perturb_period / HZ; 479 480 opt.limit = q->limit; 481 opt.divisor = SFQ_HASH_DIVISOR; 482 opt.flows = q->limit; 483 |
484 RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 484 NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); |
485 486 return skb->len; 487 | 485 486 return skb->len; 487 |
488rtattr_failure: | 488nla_put_failure: |
489 nlmsg_trim(skb, b); 490 return -1; 491} 492 493static struct Qdisc_ops sfq_qdisc_ops __read_mostly = { 494 .next = NULL, 495 .cl_ops = NULL, 496 .id = "sfq", --- 24 unchanged lines hidden --- | 489 nlmsg_trim(skb, b); 490 return -1; 491} 492 493static struct Qdisc_ops sfq_qdisc_ops __read_mostly = { 494 .next = NULL, 495 .cl_ops = NULL, 496 .id = "sfq", --- 24 unchanged lines hidden --- |