From: David Ward <david.ward@ll.mit.edu>
To: netdev@vger.kernel.org
Cc: David Ward <david.ward@ll.mit.edu>
Subject: [PATCH iproute2/net-next] tc: gred: Add support for TCA_GRED_LIMIT attribute
Date: Mon, 18 May 2015 11:35:14 -0400 [thread overview]
Message-ID: <1431963314-56420-11-git-send-email-david.ward@ll.mit.edu> (raw)
In-Reply-To: <1431963314-56420-1-git-send-email-david.ward@ll.mit.edu>
Allow the qdisc limit to be set, which is particularly useful when
the default VQ is not configured with RED parameters.
Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
include/linux/pkt_sched.h | 3 ++-
tc/q_gred.c | 20 +++++++++++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 534b847..700f50a 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -268,7 +268,8 @@ enum {
TCA_GRED_STAB,
TCA_GRED_DPS,
TCA_GRED_MAX_P,
- __TCA_GRED_MAX,
+ TCA_GRED_LIMIT,
+ __TCA_GRED_MAX,
};
#define TCA_GRED_MAX (__TCA_GRED_MAX - 1)
diff --git a/tc/q_gred.c b/tc/q_gred.c
index 463d725..f31daa3 100644
--- a/tc/q_gred.c
+++ b/tc/q_gred.c
@@ -38,7 +38,7 @@
static void explain(void)
{
fprintf(stderr, "Usage: tc qdisc { add | replace | change } ... gred setup vqs NUMBER\n");
- fprintf(stderr, " default DEFAULT_VQ [ grio ]\n");
+ fprintf(stderr, " default DEFAULT_VQ [ grio ] [ limit BYTES ]\n");
fprintf(stderr, " tc qdisc change ... gred vq VQ [ prio VALUE ] limit BYTES\n");
fprintf(stderr, " min BYTES max BYTES avpkt BYTES [ burst PACKETS ]\n");
fprintf(stderr, " [ probability PROBABILITY ] [ bandwidth KBPS ]\n");
@@ -50,6 +50,7 @@ static int init_gred(struct qdisc_util *qu, int argc, char **argv,
struct rtattr *tail;
struct tc_gred_sopt opt = { 0 };
+ __u32 limit = 0;
opt.def_DP = MAX_DPs;
@@ -83,6 +84,12 @@ static int init_gred(struct qdisc_util *qu, int argc, char **argv,
}
} else if (strcmp(*argv, "grio") == 0) {
opt.grio = 1;
+ } else if (strcmp(*argv, "limit") == 0) {
+ NEXT_ARG();
+ if (get_size(&limit, *argv)) {
+ fprintf(stderr, "Illegal \"limit\"\n");
+ return -1;
+ }
} else if (strcmp(*argv, "help") == 0) {
explain();
return -1;
@@ -104,6 +111,8 @@ static int init_gred(struct qdisc_util *qu, int argc, char **argv,
tail = NLMSG_TAIL(n);
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
addattr_l(n, 1024, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
+ if (limit)
+ addattr32(n, 1024, TCA_GRED_LIMIT, limit);
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
return 0;
}
@@ -264,6 +273,7 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
struct tc_gred_sopt *sopt;
struct tc_gred_qopt *qopt;
__u32 *max_p = NULL;
+ __u32 *limit = NULL;
unsigned i;
SPRINT_BUF(b1);
SPRINT_BUF(b2);
@@ -281,6 +291,10 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
RTA_PAYLOAD(tb[TCA_GRED_MAX_P]) >= sizeof(__u32) * MAX_DPs)
max_p = RTA_DATA(tb[TCA_GRED_MAX_P]);
+ if (tb[TCA_GRED_LIMIT] &&
+ RTA_PAYLOAD(tb[TCA_GRED_LIMIT]) == sizeof(__u32))
+ limit = RTA_DATA(tb[TCA_GRED_LIMIT]);
+
sopt = RTA_DATA(tb[TCA_GRED_DPS]);
qopt = RTA_DATA(tb[TCA_GRED_PARMS]);
if (RTA_PAYLOAD(tb[TCA_GRED_DPS]) < sizeof(*sopt) ||
@@ -296,6 +310,10 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
sopt->def_DP,
sopt->grio ? "grio " : "");
+ if (limit)
+ fprintf(f, "limit %s ",
+ sprint_size(*limit, b1));
+
for (i=0;i<MAX_DPs;i++, qopt++) {
if (qopt->DP >= MAX_DPs) continue;
fprintf(f, "\n vq %u prio %hhu limit %s min %s max %s ",
--
1.7.1
prev parent reply other threads:[~2015-05-18 15:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 15:35 [PATCH iproute2 00/10] RED and GRED fixes, plus TCA_GRED_LIMIT support David Ward
2015-05-18 15:35 ` [PATCH iproute2 01/10] tc: red, gred: Rename overloaded variable wlog David Ward
2015-05-21 21:29 ` Stephen Hemminger
2015-05-18 15:35 ` [PATCH iproute2 02/10] tc: red, gred: Fix format specifier in burst size warning David Ward
2015-05-18 15:35 ` [PATCH iproute2 03/10] tc: red, gred: Notify when using the default value for "bandwidth" David Ward
2015-05-18 15:35 ` [PATCH iproute2 04/10] tc: red: Mark "bandwidth" parameter as optional in usage text David Ward
2015-05-18 15:35 ` [PATCH iproute2 05/10] tc: gred: Fix whitespace issues in code David Ward
2015-05-18 15:35 ` [PATCH iproute2 06/10] tc: gred: Print usage text if no arguments appear after "gred" David Ward
2015-05-18 15:35 ` [PATCH iproute2 07/10] tc: gred: Improve parameter/statistics output David Ward
2015-05-18 15:35 ` [PATCH iproute2 08/10] tc: gred: Handle unsigned values properly in option parsing/printing David Ward
2015-05-18 15:35 ` [PATCH iproute2 09/10] tc: gred: Adopt the term VQ in the command syntax and output David Ward
2015-05-18 15:35 ` David Ward [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431963314-56420-11-git-send-email-david.ward@ll.mit.edu \
--to=david.ward@ll.mit.edu \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).