History

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

Eric Dumazet committed 13 years ago

Commit df62cdf1 parent 3e1e3aa2 files · +17 −2Browse files

Unified · Split

2 files
  1. include/uapi/linux/pkt_sched.h +2 −0
  2. net/sched/sch_htb.c +15 −2
include/uapi/linux/pkt_sched.h+2−0
@@ -357,6 +357,8 @@ enum { · 356 unmodified lines
357357 TCA_HTB_CTAB,
358358 TCA_HTB_RTAB,
359359 TCA_HTB_DIRECT_QLEN,
360+ TCA_HTB_RATE64,
361+ TCA_HTB_CEIL64,
360362 __TCA_HTB_MAX,
361363 };
362364
net/sched/sch_htb.c+15−2
@@ -997,6 +997,8 @@ static const struct nla_policy htb_policy[TCA_HTB_MAX + 1] = { · 996 unmodified lines
997997 [TCA_HTB_CTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
998998 [TCA_HTB_RTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
999999 [TCA_HTB_DIRECT_QLEN] = { .type = NLA_U32 },
1000+ [TCA_HTB_RATE64] = { .type = NLA_U64 },
1001+ [TCA_HTB_CEIL64] = { .type = NLA_U64 },
10001002 };
10011003
10021004 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
11141116 opt.level = cl->level;
11151117 if (nla_put(skb, TCA_HTB_PARMS, sizeof(opt), &opt))
11161118 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;
11171125
11181126 nla_nest_end(skb, nest);
11191127 spin_unlock_bh(root_lock);
@@ -1332,6 +1340,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, · 212 unmodified lines
13321340 struct qdisc_rate_table *rtab = NULL, *ctab = NULL;
13331341 struct nlattr *tb[TCA_HTB_MAX + 1];
13341342 struct tc_htb_opt *hopt;
1343+ u64 rate64, ceil64;
13351344
13361345 /* extract all subattrs from opt attr */
13371346 if (!opt)
@@ -1491,8 +1500,12 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, · 153 unmodified lines
14911500 cl->prio = TC_HTB_NUMPRIO - 1;
14921501 }
14931502
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);
14961509
14971510 cl->buffer = PSCHED_TICKS2NS(hopt->buffer);
14981511 cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer);