diff options
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r-- | net/sched/sch_netem.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index b341943555a9..4a5eb2841351 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -689,9 +689,8 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
689 | return 0; | 689 | return 0; |
690 | } | 690 | } |
691 | 691 | ||
692 | static void get_correlation(struct Qdisc *sch, const struct nlattr *attr) | 692 | static void get_correlation(struct netem_sched_data *q, const struct nlattr *attr) |
693 | { | 693 | { |
694 | struct netem_sched_data *q = qdisc_priv(sch); | ||
695 | const struct tc_netem_corr *c = nla_data(attr); | 694 | const struct tc_netem_corr *c = nla_data(attr); |
696 | 695 | ||
697 | init_crandom(&q->delay_cor, c->delay_corr); | 696 | init_crandom(&q->delay_cor, c->delay_corr); |
@@ -699,27 +698,24 @@ static void get_correlation(struct Qdisc *sch, const struct nlattr *attr) | |||
699 | init_crandom(&q->dup_cor, c->dup_corr); | 698 | init_crandom(&q->dup_cor, c->dup_corr); |
700 | } | 699 | } |
701 | 700 | ||
702 | static void get_reorder(struct Qdisc *sch, const struct nlattr *attr) | 701 | static void get_reorder(struct netem_sched_data *q, const struct nlattr *attr) |
703 | { | 702 | { |
704 | struct netem_sched_data *q = qdisc_priv(sch); | ||
705 | const struct tc_netem_reorder *r = nla_data(attr); | 703 | const struct tc_netem_reorder *r = nla_data(attr); |
706 | 704 | ||
707 | q->reorder = r->probability; | 705 | q->reorder = r->probability; |
708 | init_crandom(&q->reorder_cor, r->correlation); | 706 | init_crandom(&q->reorder_cor, r->correlation); |
709 | } | 707 | } |
710 | 708 | ||
711 | static void get_corrupt(struct Qdisc *sch, const struct nlattr *attr) | 709 | static void get_corrupt(struct netem_sched_data *q, const struct nlattr *attr) |
712 | { | 710 | { |
713 | struct netem_sched_data *q = qdisc_priv(sch); | ||
714 | const struct tc_netem_corrupt *r = nla_data(attr); | 711 | const struct tc_netem_corrupt *r = nla_data(attr); |
715 | 712 | ||
716 | q->corrupt = r->probability; | 713 | q->corrupt = r->probability; |
717 | init_crandom(&q->corrupt_cor, r->correlation); | 714 | init_crandom(&q->corrupt_cor, r->correlation); |
718 | } | 715 | } |
719 | 716 | ||
720 | static void get_rate(struct Qdisc *sch, const struct nlattr *attr) | 717 | static void get_rate(struct netem_sched_data *q, const struct nlattr *attr) |
721 | { | 718 | { |
722 | struct netem_sched_data *q = qdisc_priv(sch); | ||
723 | const struct tc_netem_rate *r = nla_data(attr); | 719 | const struct tc_netem_rate *r = nla_data(attr); |
724 | 720 | ||
725 | q->rate = r->rate; | 721 | q->rate = r->rate; |
@@ -732,9 +728,8 @@ static void get_rate(struct Qdisc *sch, const struct nlattr *attr) | |||
732 | q->cell_size_reciprocal = (struct reciprocal_value) { 0 }; | 728 | q->cell_size_reciprocal = (struct reciprocal_value) { 0 }; |
733 | } | 729 | } |
734 | 730 | ||
735 | static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr) | 731 | static int get_loss_clg(struct netem_sched_data *q, const struct nlattr *attr) |
736 | { | 732 | { |
737 | struct netem_sched_data *q = qdisc_priv(sch); | ||
738 | const struct nlattr *la; | 733 | const struct nlattr *la; |
739 | int rem; | 734 | int rem; |
740 | 735 | ||
@@ -838,7 +833,7 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt) | |||
838 | old_loss_model = q->loss_model; | 833 | old_loss_model = q->loss_model; |
839 | 834 | ||
840 | if (tb[TCA_NETEM_LOSS]) { | 835 | if (tb[TCA_NETEM_LOSS]) { |
841 | ret = get_loss_clg(sch, tb[TCA_NETEM_LOSS]); | 836 | ret = get_loss_clg(q, tb[TCA_NETEM_LOSS]); |
842 | if (ret) { | 837 | if (ret) { |
843 | q->loss_model = old_loss_model; | 838 | q->loss_model = old_loss_model; |
844 | return ret; | 839 | return ret; |
@@ -877,16 +872,16 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt) | |||
877 | q->reorder = ~0; | 872 | q->reorder = ~0; |
878 | 873 | ||
879 | if (tb[TCA_NETEM_CORR]) | 874 | if (tb[TCA_NETEM_CORR]) |
880 | get_correlation(sch, tb[TCA_NETEM_CORR]); | 875 | get_correlation(q, tb[TCA_NETEM_CORR]); |
881 | 876 | ||
882 | if (tb[TCA_NETEM_REORDER]) | 877 | if (tb[TCA_NETEM_REORDER]) |
883 | get_reorder(sch, tb[TCA_NETEM_REORDER]); | 878 | get_reorder(q, tb[TCA_NETEM_REORDER]); |
884 | 879 | ||
885 | if (tb[TCA_NETEM_CORRUPT]) | 880 | if (tb[TCA_NETEM_CORRUPT]) |
886 | get_corrupt(sch, tb[TCA_NETEM_CORRUPT]); | 881 | get_corrupt(q, tb[TCA_NETEM_CORRUPT]); |
887 | 882 | ||
888 | if (tb[TCA_NETEM_RATE]) | 883 | if (tb[TCA_NETEM_RATE]) |
889 | get_rate(sch, tb[TCA_NETEM_RATE]); | 884 | get_rate(q, tb[TCA_NETEM_RATE]); |
890 | 885 | ||
891 | if (tb[TCA_NETEM_RATE64]) | 886 | if (tb[TCA_NETEM_RATE64]) |
892 | q->rate = max_t(u64, q->rate, | 887 | q->rate = max_t(u64, q->rate, |