200 lines
5.5 KiB
Diff
200 lines
5.5 KiB
Diff
From f63968d217f4d7aeabd3194781e0f4c7c6f18970 Mon Sep 17 00:00:00 2001
|
|
From: Shashank Balashankar <sbalasha@qti.qualcomm.com>
|
|
Date: Fri, 31 May 2013 14:33:17 -0700
|
|
Subject: [PATCH 1/1] tc: Add flow control setting on PRIO qdisc Enable filter
|
|
fw, qdiscs prio, and qdisc fifo. Add "flow
|
|
enable|disable" clause for PRIO qdisc Now using
|
|
sanitized kernel headers
|
|
|
|
---
|
|
tc/Makefile | 2 +-
|
|
tc/q_prio.c | 24 +++++++++++++++++++++---
|
|
tc/tc.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
tc/tc_qdisc.c | 4 +++-
|
|
4 files changed, 72 insertions(+), 5 deletions(-)
|
|
mode change 100644 => 100755 tc/Makefile
|
|
mode change 100644 => 100755 tc/q_prio.c
|
|
mode change 100644 => 100755 tc/tc.c
|
|
mode change 100644 => 100755 tc/tc_qdisc.c
|
|
|
|
diff --git a/tc/Makefile b/tc/Makefile
|
|
old mode 100644
|
|
new mode 100755
|
|
index 9cc1bf0..141cf9d
|
|
--- a/tc/Makefile
|
|
+++ b/tc/Makefile
|
|
@@ -82,7 +82,7 @@ TCLIB += tc_cbq.o
|
|
TCLIB += tc_estimator.o
|
|
TCLIB += tc_stab.o
|
|
|
|
-CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
|
|
+CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB -DANDROID -DFEATURE_PRIO
|
|
ifneq ($(IPT_LIB_DIR),)
|
|
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
|
|
endif
|
|
diff --git a/tc/q_prio.c b/tc/q_prio.c
|
|
old mode 100644
|
|
new mode 100755
|
|
index 2f54d55..3bae52c
|
|
--- a/tc/q_prio.c
|
|
+++ b/tc/q_prio.c
|
|
@@ -19,20 +19,21 @@
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <string.h>
|
|
+#include <linux/pkt_sched.h>
|
|
|
|
#include "utils.h"
|
|
#include "tc_util.h"
|
|
|
|
static void explain(void)
|
|
{
|
|
- fprintf(stderr, "Usage: ... prio bands NUMBER priomap P1 P2...[multiqueue]\n");
|
|
+ fprintf(stderr, "Usage: ... prio bands NUMBER priomap P1 P2...[multiqueue] [flow (enable|disable)]\n");
|
|
}
|
|
|
|
static int prio_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
|
|
{
|
|
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 },1};
|
|
struct rtattr *nest;
|
|
unsigned char mq = 0;
|
|
|
|
@@ -53,6 +54,21 @@ static int prio_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
|
|
pmap_mode = 1;
|
|
} else if (strcmp(*argv, "multiqueue") == 0) {
|
|
mq = 1;
|
|
+ } else if (strcmp(*argv, "flow") == 0) {
|
|
+ NEXT_ARG();
|
|
+ if (strcmp(*argv, "enable") == 0)
|
|
+ {
|
|
+ opt.enable_flow = 1;
|
|
+ }
|
|
+ else if (strcmp(*argv, "disable") == 0)
|
|
+ {
|
|
+ opt.enable_flow = 0;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ explain();
|
|
+ return -1;
|
|
+ }
|
|
} else if (strcmp(*argv, "help") == 0) {
|
|
explain();
|
|
return -1;
|
|
@@ -114,6 +130,9 @@ int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
|
fprintf(f, " multiqueue: %s ",
|
|
*(unsigned char *)RTA_DATA(tb[TCA_PRIO_MQ]) ? "on" : "off");
|
|
|
|
+ if (qu && !strcmp(qu->id, "prio"))
|
|
+ fprintf(f, " flow %s", qopt->enable_flow ? "enabled" : "disabled");
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -122,4 +141,3 @@ struct qdisc_util prio_qdisc_util = {
|
|
.parse_qopt = prio_parse_opt,
|
|
.print_qopt = prio_print_opt,
|
|
};
|
|
-
|
|
diff --git a/tc/tc.c b/tc/tc.c
|
|
old mode 100644
|
|
new mode 100755
|
|
index 8e362d2..bc58e3e
|
|
--- a/tc/tc.c
|
|
+++ b/tc/tc.c
|
|
@@ -44,6 +44,19 @@ static void *BODY = NULL; /* cached handle dlopen(NULL) */
|
|
static struct qdisc_util * qdisc_list;
|
|
static struct filter_util * filter_list;
|
|
|
|
+#ifdef ANDROID
|
|
+extern struct qdisc_util cbq_qdisc_util;
|
|
+extern struct qdisc_util htb_qdisc_util;
|
|
+extern struct qdisc_util ingress_qdisc_util;
|
|
+extern struct filter_util u32_filter_util;
|
|
+#ifdef FEATURE_PRIO
|
|
+extern struct filter_util fw_filter_util;
|
|
+extern struct qdisc_util prio_qdisc_util;
|
|
+extern struct qdisc_util pfifo_fast_qdisc_util;
|
|
+extern struct qdisc_util pfifo_qdisc_util;
|
|
+#endif
|
|
+#endif
|
|
+
|
|
static int print_noqopt(struct qdisc_util *qu, FILE *f,
|
|
struct rtattr *opt)
|
|
{
|
|
@@ -97,6 +110,27 @@ struct qdisc_util *get_qdisc_kind(const char *str)
|
|
char buf[256];
|
|
struct qdisc_util *q;
|
|
|
|
+
|
|
+#ifdef ANDROID
|
|
+ if (!strcmp(str, "cbq"))
|
|
+ return &cbq_qdisc_util;
|
|
+ else if (!strcmp(str, "htb"))
|
|
+ return &htb_qdisc_util;
|
|
+ else if (!strcmp(str, "ingress"))
|
|
+ return &ingress_qdisc_util;
|
|
+#ifdef FEATURE_PRIO
|
|
+ else if (!strcmp(str, "pfifo_fast"))
|
|
+ return &pfifo_fast_qdisc_util;
|
|
+ else if (!strcmp(str, "prio"))
|
|
+ return &prio_qdisc_util;
|
|
+ else if (!strcmp(str, "pfifo"))
|
|
+ return &pfifo_qdisc_util;
|
|
+#endif
|
|
+ else {
|
|
+ fprintf(stderr, "Android does not support qdisc '%s'\n", str);
|
|
+ return NULL;
|
|
+ }
|
|
+#endif
|
|
for (q = qdisc_list; q; q = q->next)
|
|
if (strcmp(q->id, str) == 0)
|
|
return q;
|
|
@@ -143,6 +177,19 @@ struct filter_util *get_filter_kind(const char *str)
|
|
char buf[256];
|
|
struct filter_util *q;
|
|
|
|
+#ifdef ANDROID
|
|
+ if (!strcmp(str, "u32"))
|
|
+ return &u32_filter_util;
|
|
+#ifdef FEATURE_PRIO
|
|
+ else if (!strcmp(str, "fw"))
|
|
+ return &fw_filter_util;
|
|
+#endif
|
|
+ else {
|
|
+ fprintf(stderr, "Android does not support filter '%s'\n", str);
|
|
+ return NULL;
|
|
+ }
|
|
+#endif
|
|
+
|
|
for (q = filter_list; q; q = q->next)
|
|
if (strcmp(q->id, str) == 0)
|
|
return q;
|
|
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
|
|
old mode 100644
|
|
new mode 100755
|
|
index 0822e63..6fdfab4
|
|
--- a/tc/tc_qdisc.c
|
|
+++ b/tc/tc_qdisc.c
|
|
@@ -241,11 +241,13 @@ int print_qdisc(const struct sockaddr_nl *who,
|
|
if (t->tcm_info != 1) {
|
|
fprintf(fp, "refcnt %d ", t->tcm_info);
|
|
}
|
|
- /* pfifo_fast is generic enough to warrant the hardcoding --JHS */
|
|
|
|
+#if 0 /* Suppressed to dinstinguish between prio & pfifo_fast */
|
|
+ /* pfifo_fast is generic enough to warrant the hardcoding --JHS */
|
|
if (0 == strcmp("pfifo_fast", RTA_DATA(tb[TCA_KIND])))
|
|
q = get_qdisc_kind("prio");
|
|
else
|
|
+#endif
|
|
q = get_qdisc_kind(RTA_DATA(tb[TCA_KIND]));
|
|
|
|
if (tb[TCA_OPTIONS]) {
|
|
--
|
|
1.7.8.3
|
|
|