[PATCH] IPROUTE: Modify tc for new PRIO multiqueue behavior

From: Peter P Waskiewicz Jr
Date: Tue Apr 24 2007 - 21:23:31 EST


From: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@xxxxxxxxx>

Modified tc so PRIO can now have a multiqueue parameter passed to it. This
will turn on multiqueue behavior if a device has more than 1 queue. Also,
running tc qdisc ls dev <dev> will display if multiqueue is on or off.

Signed-off-by: Peter P. Waskiewicz Jr <peter.p.waskiewicz.jr@xxxxxxxxx>
---

include/linux/pkt_sched.h | 1 +
tc/q_prio.c | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index d10f353..bab0b9e 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -99,6 +99,7 @@ struct tc_prio_qopt
{
int bands; /* Number of bands */
__u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
+ unsigned short multiqueue; /* 0 for no mq, 1 for mq */
};

/* TBF section */
diff --git a/tc/q_prio.c b/tc/q_prio.c
index d696e1b..55cb207 100644
--- a/tc/q_prio.c
+++ b/tc/q_prio.c
@@ -29,7 +29,7 @@

static void explain(void)
{
- fprintf(stderr, "Usage: ... prio bands NUMBER priomap P1 P2...\n");
+ fprintf(stderr, "Usage: ... prio [multiqueue] bands NUMBER priomap P1 P2...\n");
}

#define usage() return(-1)
@@ -39,7 +39,7 @@ static int prio_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
int ok=0;
int pmap_mode = 0;
int idx = 0;
- struct tc_prio_qopt opt={3,{ 1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 }};
+ struct tc_prio_qopt opt={3,{ 1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 },0};

while (argc > 0) {
if (strcmp(*argv, "bands") == 0) {
@@ -57,7 +57,9 @@ static int prio_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
return -1;
}
pmap_mode = 1;
- } else if (strcmp(*argv, "help") == 0) {
+ } else if (strcmp(*argv, "multiqueue") == 0)
+ opt.multiqueue = 1;
+ else if (strcmp(*argv, "help") == 0) {
explain();
return -1;
} else {
@@ -105,6 +107,7 @@ int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (RTA_PAYLOAD(opt) < sizeof(*qopt))
return -1;
qopt = RTA_DATA(opt);
+ fprintf(f, "multiqueue %s ", qopt->multiqueue ? "on" : "off");
fprintf(f, "bands %u priomap ", qopt->bands);
for (i=0; i<=TC_PRIO_MAX; i++)
fprintf(f, " %d", qopt->priomap[i]);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/