aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_netem.c
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2013-12-25 04:35:15 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-31 14:31:44 -0500
commit6a031f67c83aa175aedd10d4ae64750415ab57b0 (patch)
treeb24d6647a8362ae3b814bb22b55a53c554be5a99 /net/sched/sch_netem.c
parent8cfd88d6d70735c47b17aef855b4c81dde83c85c (diff)
sch_netem: support of 64bit rates
Add a new attribute to support 64bit rates so that tc can use them to break the 32bit limit. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r--net/sched/sch_netem.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 9632a4e753b7..090a4e3ecd0d 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -88,7 +88,7 @@ struct netem_sched_data {
88 u32 duplicate; 88 u32 duplicate;
89 u32 reorder; 89 u32 reorder;
90 u32 corrupt; 90 u32 corrupt;
91 u32 rate; 91 u64 rate;
92 s32 packet_overhead; 92 s32 packet_overhead;
93 u32 cell_size; 93 u32 cell_size;
94 u32 cell_size_reciprocal; 94 u32 cell_size_reciprocal;
@@ -782,6 +782,7 @@ static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = {
782 [TCA_NETEM_RATE] = { .len = sizeof(struct tc_netem_rate) }, 782 [TCA_NETEM_RATE] = { .len = sizeof(struct tc_netem_rate) },
783 [TCA_NETEM_LOSS] = { .type = NLA_NESTED }, 783 [TCA_NETEM_LOSS] = { .type = NLA_NESTED },
784 [TCA_NETEM_ECN] = { .type = NLA_U32 }, 784 [TCA_NETEM_ECN] = { .type = NLA_U32 },
785 [TCA_NETEM_RATE64] = { .type = NLA_U64 },
785}; 786};
786 787
787static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla, 788static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
@@ -852,6 +853,10 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt)
852 if (tb[TCA_NETEM_RATE]) 853 if (tb[TCA_NETEM_RATE])
853 get_rate(sch, tb[TCA_NETEM_RATE]); 854 get_rate(sch, tb[TCA_NETEM_RATE]);
854 855
856 if (tb[TCA_NETEM_RATE64])
857 q->rate = max_t(u64, q->rate,
858 nla_get_u64(tb[TCA_NETEM_RATE64]));
859
855 if (tb[TCA_NETEM_ECN]) 860 if (tb[TCA_NETEM_ECN])
856 q->ecn = nla_get_u32(tb[TCA_NETEM_ECN]); 861 q->ecn = nla_get_u32(tb[TCA_NETEM_ECN]);
857 862
@@ -974,7 +979,13 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
974 if (nla_put(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt)) 979 if (nla_put(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt))
975 goto nla_put_failure; 980 goto nla_put_failure;
976 981
977 rate.rate = q->rate; 982 if (q->rate >= (1ULL << 32)) {
983 if (nla_put_u64(skb, TCA_NETEM_RATE64, q->rate))
984 goto nla_put_failure;
985 rate.rate = ~0U;
986 } else {
987 rate.rate = q->rate;
988 }
978 rate.packet_overhead = q->packet_overhead; 989 rate.packet_overhead = q->packet_overhead;
979 rate.cell_size = q->cell_size; 990 rate.cell_size = q->cell_size;
980 rate.cell_overhead = q->cell_overhead; 991 rate.cell_overhead = q->cell_overhead;