aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_htb.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-09-19 12:10:20 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-20 14:41:03 -0400
commitdf62cdf348c91baac61b4cb19d19ea1ef87b271e (patch)
tree1431e01c9a2fbada8dec374a63167f8796a84a84 /net/sched/sch_htb.c
parent3e1e3aae1f5d4e8e5edb7e332f6e265597cc5b0a (diff)
net_sched: htb: support of 64bit rates
HTB already can deal with 64bit rates, we only have to add two new attributes so that tc can use them to break the current 32bit ABI barrier. TCA_HTB_RATE64 : class rate (in bytes per second) TCA_HTB_CEIL64 : class ceil (in bytes per second) This allows us to setup HTB on 40Gbps links, as 32bit limit is actually ~34Gbps Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r--net/sched/sch_htb.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 6b126f6c9957..0e1e38b40025 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -997,6 +997,8 @@ static const struct nla_policy htb_policy[TCA_HTB_MAX + 1] = {
997 [TCA_HTB_CTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, 997 [TCA_HTB_CTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
998 [TCA_HTB_RTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, 998 [TCA_HTB_RTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
999 [TCA_HTB_DIRECT_QLEN] = { .type = NLA_U32 }, 999 [TCA_HTB_DIRECT_QLEN] = { .type = NLA_U32 },
1000 [TCA_HTB_RATE64] = { .type = NLA_U64 },
1001 [TCA_HTB_CEIL64] = { .type = NLA_U64 },
1000}; 1002};
1001 1003
1002static void htb_work_func(struct work_struct *work) 1004static void htb_work_func(struct work_struct *work)
@@ -1114,6 +1116,12 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
1114 opt.level = cl->level; 1116 opt.level = cl->level;
1115 if (nla_put(skb, TCA_HTB_PARMS, sizeof(opt), &opt)) 1117 if (nla_put(skb, TCA_HTB_PARMS, sizeof(opt), &opt))
1116 goto nla_put_failure; 1118 goto nla_put_failure;
1119 if ((cl->rate.rate_bytes_ps >= (1ULL << 32)) &&
1120 nla_put_u64(skb, TCA_HTB_RATE64, cl->rate.rate_bytes_ps))
1121 goto nla_put_failure;
1122 if ((cl->ceil.rate_bytes_ps >= (1ULL << 32)) &&
1123 nla_put_u64(skb, TCA_HTB_CEIL64, cl->ceil.rate_bytes_ps))
1124 goto nla_put_failure;
1117 1125
1118 nla_nest_end(skb, nest); 1126 nla_nest_end(skb, nest);
1119 spin_unlock_bh(root_lock); 1127 spin_unlock_bh(root_lock);
@@ -1332,6 +1340,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1332 struct qdisc_rate_table *rtab = NULL, *ctab = NULL; 1340 struct qdisc_rate_table *rtab = NULL, *ctab = NULL;
1333 struct nlattr *tb[TCA_HTB_MAX + 1]; 1341 struct nlattr *tb[TCA_HTB_MAX + 1];
1334 struct tc_htb_opt *hopt; 1342 struct tc_htb_opt *hopt;
1343 u64 rate64, ceil64;
1335 1344
1336 /* extract all subattrs from opt attr */ 1345 /* extract all subattrs from opt attr */
1337 if (!opt) 1346 if (!opt)
@@ -1491,8 +1500,12 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1491 cl->prio = TC_HTB_NUMPRIO - 1; 1500 cl->prio = TC_HTB_NUMPRIO - 1;
1492 } 1501 }
1493 1502
1494 psched_ratecfg_precompute(&cl->rate, &hopt->rate, 0); 1503 rate64 = tb[TCA_HTB_RATE64] ? nla_get_u64(tb[TCA_HTB_RATE64]) : 0;
1495 psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, 0); 1504
1505 ceil64 = tb[TCA_HTB_CEIL64] ? nla_get_u64(tb[TCA_HTB_CEIL64]) : 0;
1506
1507 psched_ratecfg_precompute(&cl->rate, &hopt->rate, rate64);
1508 psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64);
1496 1509
1497 cl->buffer = PSCHED_TICKS2NS(hopt->buffer); 1510 cl->buffer = PSCHED_TICKS2NS(hopt->buffer);
1498 cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); 1511 cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer);