* [PATCH iproute2 v2 0/2] two improvements in tc
@ 2014-01-16 3:09 Yang Yingliang
2014-01-16 3:09 ` [PATCH iproute2 v2 1/2] tbf: support sending burst/mtu to kernel directly Yang Yingliang
2014-01-16 3:09 ` [PATCH iproute2 v2 2/2] netem: add 64bit rates support Yang Yingliang
0 siblings, 2 replies; 6+ messages in thread
From: Yang Yingliang @ 2014-01-16 3:09 UTC (permalink / raw)
To: stephen; +Cc: netdev, eric.dumazet
Support sending burst/mtu to kernel directly in tbf.
Support 64bit rate in netem.
v1 -> v2:
patch 2/2: Use rta_getattr_u64() to get value of rate64.
Yang Yingliang (2):
tbf: support sending burst/mtu to kernel directly
netem: add 64bit rates support
tc/q_netem.c | 29 ++++++++++++++++++++++++-----
tc/q_tbf.c | 2 ++
2 files changed, 26 insertions(+), 5 deletions(-)
--
1.8.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH iproute2 v2 1/2] tbf: support sending burst/mtu to kernel directly
2014-01-16 3:09 [PATCH iproute2 v2 0/2] two improvements in tc Yang Yingliang
@ 2014-01-16 3:09 ` Yang Yingliang
2014-01-16 3:09 ` [PATCH iproute2 v2 2/2] netem: add 64bit rates support Yang Yingliang
1 sibling, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2014-01-16 3:09 UTC (permalink / raw)
To: stephen; +Cc: netdev, eric.dumazet
To avoid loss when transforming burst to buffer in userspace, send
burst/mtu to kernel directly.
Kernel commit 2e04ad424b("sch_tbf: add TBF_BURST/TBF_PBURST attribute")
make it can handle burst/mtu.
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
tc/q_tbf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index 2fbfd3b..f3022b6 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -232,12 +232,14 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
tail = NLMSG_TAIL(n);
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
addattr_l(n, 2024, TCA_TBF_PARMS, &opt, sizeof(opt));
+ addattr_l(n, 2124, TCA_TBF_BURST, &buffer, sizeof(buffer));
if (rate64 >= (1ULL << 32))
addattr_l(n, 2124, TCA_TBF_RATE64, &rate64, sizeof(rate64));
addattr_l(n, 3024, TCA_TBF_RTAB, rtab, 1024);
if (opt.peakrate.rate) {
if (prate64 >= (1ULL << 32))
addattr_l(n, 3124, TCA_TBF_PRATE64, &prate64, sizeof(prate64));
+ addattr_l(n, 3224, TCA_TBF_PBURST, &mtu, sizeof(mtu));
addattr_l(n, 4096, TCA_TBF_PTAB, ptab, 1024);
}
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
--
1.8.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH iproute2 v2 2/2] netem: add 64bit rates support
2014-01-16 3:09 [PATCH iproute2 v2 0/2] two improvements in tc Yang Yingliang
2014-01-16 3:09 ` [PATCH iproute2 v2 1/2] tbf: support sending burst/mtu to kernel directly Yang Yingliang
@ 2014-01-16 3:09 ` Yang Yingliang
2014-01-16 3:17 ` Eric Dumazet
` (2 more replies)
1 sibling, 3 replies; 6+ messages in thread
From: Yang Yingliang @ 2014-01-16 3:09 UTC (permalink / raw)
To: stephen; +Cc: netdev, eric.dumazet
netem support 64bit rates start from linux-3.13.
Add 64bit rates support in tc tools.
tc qdisc show dev eth0
qdisc netem 1: dev eth4 root refcnt 2 limit 1000 rate 35Gbit
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
tc/q_netem.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/tc/q_netem.c b/tc/q_netem.c
index 9dd8712..946007c 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -183,6 +183,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
__s16 *dist_data = NULL;
__u16 loss_type = NETEM_LOSS_UNSPEC;
int present[__TCA_NETEM_MAX];
+ __u64 rate64 = 0;
memset(&cor, 0, sizeof(cor));
memset(&reorder, 0, sizeof(reorder));
@@ -391,7 +392,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
} else if (matches(*argv, "rate") == 0) {
++present[TCA_NETEM_RATE];
NEXT_ARG();
- if (get_rate(&rate.rate, *argv)) {
+ if (get_rate64(&rate64, *argv)) {
explain1("rate");
return -1;
}
@@ -496,9 +497,18 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
addattr_nest_end(n, start);
}
- if (present[TCA_NETEM_RATE] &&
- addattr_l(n, 1024, TCA_NETEM_RATE, &rate, sizeof(rate)) < 0)
- return -1;
+ if (present[TCA_NETEM_RATE]) {
+ if (rate64 >= (1ULL << 32)) {
+ if (addattr_l(n, 1024,
+ TCA_NETEM_RATE64, &rate64, sizeof(rate64)) < 0)
+ return -1;
+ rate.rate = ~0U;
+ } else {
+ rate.rate = rate64;
+ }
+ if (addattr_l(n, 1024, TCA_NETEM_RATE, &rate, sizeof(rate)) < 0)
+ return -1;
+ }
if (dist_data) {
if (addattr_l(n, MAX_DIST * sizeof(dist_data[0]),
@@ -522,6 +532,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
struct tc_netem_qopt qopt;
const struct tc_netem_rate *rate = NULL;
int len = RTA_PAYLOAD(opt) - sizeof(qopt);
+ __u64 rate64 = 0;
SPRINT_BUF(b1);
if (opt == NULL)
@@ -572,6 +583,11 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
return -1;
ecn = RTA_DATA(tb[TCA_NETEM_ECN]);
}
+ if (tb[TCA_NETEM_RATE64]) {
+ if (RTA_PAYLOAD(tb[TCA_NETEM_RATE64]) < sizeof(rate64))
+ return -1;
+ rate64 = rta_getattr_u64(tb[TCA_NETEM_RATE64]);
+ }
}
fprintf(f, "limit %d", qopt.limit);
@@ -632,7 +648,10 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
}
if (rate && rate->rate) {
- fprintf(f, " rate %s", sprint_rate(rate->rate, b1));
+ if (rate64)
+ fprintf(f, " rate %s", sprint_rate(rate64, b1));
+ else
+ fprintf(f, " rate %s", sprint_rate(rate->rate, b1));
if (rate->packet_overhead)
fprintf(f, " packetoverhead %d", rate->packet_overhead);
if (rate->cell_size)
--
1.8.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH iproute2 v2 2/2] netem: add 64bit rates support
2014-01-16 3:09 ` [PATCH iproute2 v2 2/2] netem: add 64bit rates support Yang Yingliang
@ 2014-01-16 3:17 ` Eric Dumazet
2014-01-20 20:34 ` Stephen Hemminger
2014-01-20 20:37 ` Stephen Hemminger
2 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2014-01-16 3:17 UTC (permalink / raw)
To: Yang Yingliang; +Cc: stephen, netdev
On Thu, 2014-01-16 at 11:09 +0800, Yang Yingliang wrote:
> netem support 64bit rates start from linux-3.13.
> Add 64bit rates support in tc tools.
>
> tc qdisc show dev eth0
> qdisc netem 1: dev eth4 root refcnt 2 limit 1000 rate 35Gbit
>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> tc/q_netem.c | 29 ++++++++++++++++++++++++-----
> 1 file changed, 24 insertions(+), 5 deletions(-)
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH iproute2 v2 2/2] netem: add 64bit rates support
2014-01-16 3:09 ` [PATCH iproute2 v2 2/2] netem: add 64bit rates support Yang Yingliang
2014-01-16 3:17 ` Eric Dumazet
@ 2014-01-20 20:34 ` Stephen Hemminger
2014-01-20 20:37 ` Stephen Hemminger
2 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2014-01-20 20:34 UTC (permalink / raw)
To: Yang Yingliang; +Cc: netdev, eric.dumazet
On Thu, 16 Jan 2014 11:09:14 +0800
Yang Yingliang <yangyingliang@huawei.com> wrote:
> netem support 64bit rates start from linux-3.13.
> Add 64bit rates support in tc tools.
>
> tc qdisc show dev eth0
> qdisc netem 1: dev eth4 root refcnt 2 limit 1000 rate 35Gbit
>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Applied both
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH iproute2 v2 2/2] netem: add 64bit rates support
2014-01-16 3:09 ` [PATCH iproute2 v2 2/2] netem: add 64bit rates support Yang Yingliang
2014-01-16 3:17 ` Eric Dumazet
2014-01-20 20:34 ` Stephen Hemminger
@ 2014-01-20 20:37 ` Stephen Hemminger
2 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2014-01-20 20:37 UTC (permalink / raw)
To: Yang Yingliang; +Cc: netdev, eric.dumazet
On Thu, 16 Jan 2014 11:09:14 +0800
Yang Yingliang <yangyingliang@huawei.com> wrote:
> netem support 64bit rates start from linux-3.13.
> Add 64bit rates support in tc tools.
>
> tc qdisc show dev eth0
> qdisc netem 1: dev eth4 root refcnt 2 limit 1000 rate 35Gbit
>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Applied to net-next-3.13 branch
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-20 20:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-16 3:09 [PATCH iproute2 v2 0/2] two improvements in tc Yang Yingliang
2014-01-16 3:09 ` [PATCH iproute2 v2 1/2] tbf: support sending burst/mtu to kernel directly Yang Yingliang
2014-01-16 3:09 ` [PATCH iproute2 v2 2/2] netem: add 64bit rates support Yang Yingliang
2014-01-16 3:17 ` Eric Dumazet
2014-01-20 20:34 ` Stephen Hemminger
2014-01-20 20:37 ` Stephen Hemminger
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).