* [PATCH net-next v2] net_sched: tbf: support of 64bit rates
@ 2013-11-08 2:23 Yang Yingliang
2013-11-08 2:34 ` Eric Dumazet
2013-11-08 19:17 ` Sergei Shtylyov
0 siblings, 2 replies; 4+ messages in thread
From: Yang Yingliang @ 2013-11-08 2:23 UTC (permalink / raw)
To: davem, netdev; +Cc: eric.dumazet, jhs, sergei.shtylyov
With psched_ratecfg_precompute(), tbf can deal with 64bit rates.
Add two new attributes so that tc can use them to break the 32bit
limit.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
include/uapi/linux/pkt_sched.h | 2 ++
net/sched/sch_tbf.c | 22 ++++++++++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index f2624b5..307f293 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -171,6 +171,8 @@ enum {
TCA_TBF_PARMS,
TCA_TBF_RTAB,
TCA_TBF_PTAB,
+ TCA_TBF_RATE64,
+ TCA_TBF_PRATE64,
__TCA_TBF_MAX,
};
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index b057122..68f9859 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -266,20 +266,23 @@ static const struct nla_policy tbf_policy[TCA_TBF_MAX + 1] = {
[TCA_TBF_PARMS] = { .len = sizeof(struct tc_tbf_qopt) },
[TCA_TBF_RTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
[TCA_TBF_PTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
+ [TCA_TBF_RATE64] = { .type = NLA_U64 },
+ [TCA_TBF_PRATE64] = { .type = NLA_U64 },
};
static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
{
int err;
struct tbf_sched_data *q = qdisc_priv(sch);
- struct nlattr *tb[TCA_TBF_PTAB + 1];
+ struct nlattr *tb[TCA_TBF_MAX + 1];
struct tc_tbf_qopt *qopt;
struct qdisc_rate_table *rtab = NULL;
struct qdisc_rate_table *ptab = NULL;
struct Qdisc *child = NULL;
int max_size, n;
+ u64 rate64 = 0, prate64 = 0;
- err = nla_parse_nested(tb, TCA_TBF_PTAB, opt, tbf_policy);
+ err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy);
if (err < 0)
return err;
@@ -341,9 +344,13 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
q->tokens = q->buffer;
q->ptokens = q->mtu;
- psched_ratecfg_precompute(&q->rate, &rtab->rate, 0);
+ if (tb[TCA_TBF_RATE64])
+ rate64 = nla_get_u64(tb[TCA_TBF_RATE64]);
+ psched_ratecfg_precompute(&q->rate, &rtab->rate, rate64);
if (ptab) {
- psched_ratecfg_precompute(&q->peak, &ptab->rate, 0);
+ if (tb[TCA_TBF_PRATE64])
+ prate64 = nla_get_u64(tb[TCA_TBF_PRATE64]);
+ psched_ratecfg_precompute(&q->peak, &ptab->rate, prate64);
q->peak_present = true;
} else {
q->peak_present = false;
@@ -402,6 +409,13 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
opt.buffer = PSCHED_NS2TICKS(q->buffer);
if (nla_put(skb, TCA_TBF_PARMS, sizeof(opt), &opt))
goto nla_put_failure;
+ if (q->rate.rate_bytes_ps >= (1ULL << 32) &&
+ nla_put_u64(skb, TCA_TBF_RATE64, q->rate.rate_bytes_ps))
+ goto nla_put_failure;
+ if (q->peak_present &&
+ q->peak.rate_bytes_ps >= (1ULL << 32) &&
+ nla_put_u64(skb, TCA_TBF_PRATE64, q->peak.rate_bytes_ps))
+ goto nla_put_failure;
nla_nest_end(skb, nest);
return skb->len;
--
1.7.12
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next v2] net_sched: tbf: support of 64bit rates
2013-11-08 2:23 [PATCH net-next v2] net_sched: tbf: support of 64bit rates Yang Yingliang
@ 2013-11-08 2:34 ` Eric Dumazet
2013-11-08 7:38 ` David Miller
2013-11-08 19:17 ` Sergei Shtylyov
1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2013-11-08 2:34 UTC (permalink / raw)
To: Yang Yingliang; +Cc: davem, netdev, jhs, sergei.shtylyov
On Fri, 2013-11-08 at 10:23 +0800, Yang Yingliang wrote:
> With psched_ratecfg_precompute(), tbf can deal with 64bit rates.
> Add two new attributes so that tc can use them to break the 32bit
> limit.
>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> ---
> include/uapi/linux/pkt_sched.h | 2 ++
> net/sched/sch_tbf.c | 22 ++++++++++++++++++----
> 2 files changed, 20 insertions(+), 4 deletions(-)
Acked-by: Eric Dumazet <edumazet@google.com>
Thanks !
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net_sched: tbf: support of 64bit rates
2013-11-08 2:34 ` Eric Dumazet
@ 2013-11-08 7:38 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-11-08 7:38 UTC (permalink / raw)
To: eric.dumazet; +Cc: yangyingliang, netdev, jhs, sergei.shtylyov
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 07 Nov 2013 18:34:20 -0800
> On Fri, 2013-11-08 at 10:23 +0800, Yang Yingliang wrote:
>> With psched_ratecfg_precompute(), tbf can deal with 64bit rates.
>> Add two new attributes so that tc can use them to break the 32bit
>> limit.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> ---
>> include/uapi/linux/pkt_sched.h | 2 ++
>> net/sched/sch_tbf.c | 22 ++++++++++++++++++----
>> 2 files changed, 20 insertions(+), 4 deletions(-)
>
> Acked-by: Eric Dumazet <edumazet@google.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net_sched: tbf: support of 64bit rates
2013-11-08 2:23 [PATCH net-next v2] net_sched: tbf: support of 64bit rates Yang Yingliang
2013-11-08 2:34 ` Eric Dumazet
@ 2013-11-08 19:17 ` Sergei Shtylyov
1 sibling, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2013-11-08 19:17 UTC (permalink / raw)
To: Yang Yingliang, davem, netdev; +Cc: eric.dumazet, jhs
Hello.
On 11/08/2013 05:23 AM, Yang Yingliang wrote:
> With psched_ratecfg_precompute(), tbf can deal with 64bit rates.
> Add two new attributes so that tc can use them to break the 32bit
> limit.
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
It's too great a honor for me, I didn't suggest this patch. :-)
You can replace that with Reviewed-by: line.
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-08 18:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08 2:23 [PATCH net-next v2] net_sched: tbf: support of 64bit rates Yang Yingliang
2013-11-08 2:34 ` Eric Dumazet
2013-11-08 7:38 ` David Miller
2013-11-08 19:17 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).