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
Unified · Split
| @@ -357,6 +357,8 @@ enum { · 356 unmodified lines | ||
| 357 | 357 | TCA_HTB_CTAB, |
| 358 | 358 | TCA_HTB_RTAB, |
| 359 | 359 | TCA_HTB_DIRECT_QLEN, |
| 360 | + TCA_HTB_RATE64, | |
| 361 | + TCA_HTB_CEIL64, | |
| 360 | 362 | __TCA_HTB_MAX, |
| 361 | 363 | }; |
| 362 | 364 | |
| @@ -997,6 +997,8 @@ static const struct nla_policy htb_policy[TCA_HTB_MAX + 1] = { · 996 unmodified lines | ||
| 997 | 997 | [TCA_HTB_CTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, |
| 998 | 998 | [TCA_HTB_RTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, |
| 999 | 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 | |
| 1002 | 1004 | static void htb_work_func(struct work_struct *work) |
| @@ -1114,6 +1116,12 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, · 111 unmodified lines | ||
| 1114 | 1116 | opt.level = cl->level; |
| 1115 | 1117 | if (nla_put(skb, TCA_HTB_PARMS, sizeof(opt), &opt)) |
| 1116 | 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 | 1126 | nla_nest_end(skb, nest); |
| 1119 | 1127 | spin_unlock_bh(root_lock); |
| @@ -1332,6 +1340,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, · 212 unmodified lines | ||
| 1332 | 1340 | struct qdisc_rate_table *rtab = NULL, *ctab = NULL; |
| 1333 | 1341 | struct nlattr *tb[TCA_HTB_MAX + 1]; |
| 1334 | 1342 | struct tc_htb_opt *hopt; |
| 1343 | + u64 rate64, ceil64; | |
| 1335 | 1344 | |
| 1336 | 1345 | /* extract all subattrs from opt attr */ |
| 1337 | 1346 | if (!opt) |
| @@ -1491,8 +1500,12 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, · 153 unmodified lines | ||
| 1491 | 1500 | cl->prio = TC_HTB_NUMPRIO - 1; |
| 1492 | 1501 | } |
| 1493 | 1502 | |
| 1494 | − psched_ratecfg_precompute(&cl->rate, &hopt->rate, 0); | |
| 1495 | − psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, 0); | |
| 1503 | + rate64 = tb[TCA_HTB_RATE64] ? nla_get_u64(tb[TCA_HTB_RATE64]) : 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 | 1510 | cl->buffer = PSCHED_TICKS2NS(hopt->buffer); |
| 1498 | 1511 | cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); |