Skip to contentSkip to conversation

For CBQ, implement overhead parameter parsing.

PATCH New Jesper Dangaard Brouer 2 participants 4 messages Mar 23, 2008 – Apr 1, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 3/5 For CBQ, implement overhead parameter parsing.

For CBQ, implement overhead parameter parsing.

The change is ABI (Application Binary Interface) backward compatible with older kernels, but will first have effect from kernel 2.6.24.

---
 tc/q_cbq.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
tc/q_cbq.c +16 -0
index 8e6bd40..c891ac5 100644
@@ -53,6 +53,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
 	struct tc_cbq_lssopt lss;
 	__u32 rtab[256];
 	unsigned mpu=0, avpkt=0, allot=0;
+	unsigned short overhead=0;
 	int cell_log=-1;
 	int ewma_log=-1;
 	struct rtattr *tail;
@@ -113,6 +114,11 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
 				explain1("allot");
 				return -1;
 			}
+		} else if (matches(*argv, "overhead") == 0) {
+			NEXT_ARG();
+			if (get_u16(&overhead, *argv, 10)) {
+				explain1("overhead"); return -1;
+			}
 		} else if (matches(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -138,6 +144,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
 		allot = (avpkt*3)/2;
 
 	r.mpu = mpu;
+	r.overhead = overhead;
 	if (tc_calc_rtable(&r, rtab, cell_log, allot) < 0) {
 		fprintf(stderr, "CBQ: failed to calculate rate table.\n");
 		return -1;
@@ -179,6 +186,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 	int ewma_log=-1;
 	unsigned bndw = 0;
 	unsigned minburst=0, maxburst=0;
+	unsigned short overhead=0;
 	struct rtattr *tail;
 
 	memset(&r, 0, sizeof(r));
@@ -317,6 +325,11 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 			if (err == 1)
 				fopt.defchange = ~0;
 			fopt_ok++;
+		} else if (matches(*argv, "overhead") == 0) {
+			NEXT_ARG();
+			if (get_u16(&overhead, *argv, 10)) {
+				explain1("overhead"); return -1;
+			}
 		} else if (matches(*argv, "help") == 0) {
 			explain_class();
 			return -1;
@@ -336,6 +349,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 		if (wrr.allot < (lss.avpkt*3)/2)
 			wrr.allot = (lss.avpkt*3)/2;
 		r.mpu = mpu;
+		r.overhead = overhead;
 		if (tc_calc_rtable(&r, rtab, cell_log, pktsize) < 0) {
 			fprintf(stderr, "CBQ: failed to calculate rate table.\n");
 			return -1;
@@ -464,6 +478,8 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 			fprintf(f, "cell %ub ", 1<<r->cell_log);
 			if (r->mpu)
 				fprintf(f, "mpu %ub ", r->mpu);
+			if (r->overhead)
+				fprintf(f, "overhead %ub ", r->overhead);
 		}
 	}
 	if (lss && lss->flags) {
Signature · 1 line
1.5.3
#2 lore raw

PATCH 4/5 CBQ remember to doc usage of overhead parameter.

In reply to a message not in the archive

CBQ remember to doc usage of overhead parameter.

---
 tc/q_cbq.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tc/q_cbq.c +1 -0
index c891ac5..e53d167 100644
@@ -32,6 +32,7 @@ static void explain_class(void)
 	fprintf(stderr, "               [ prio NUMBER ] [ cell BYTES ] [ ewma LOG ]\n");
 	fprintf(stderr, "               [ estimator INTERVAL TIME_CONSTANT ]\n");
 	fprintf(stderr, "               [ split CLASSID ] [ defmap MASK/CHANGE ]\n");
+	fprintf(stderr, "               [ overhead BYTES ]\n");
 }
 
 static void explain(void)
Signature · 1 line
1.5.3
#3 lore raw

PATCH 5/5 For police, implement overhead parameter parsing.

In reply to a message not in the archive

For police, implement overhead parameter parsing.

The change is ABI (Application Binary Interface) backward compatible with older kernels, but will first have effect from kernel 2.6.24.

---
 tc/m_police.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
tc/m_police.c +10 -1
index 46c785b..8fa63ad 100644
@@ -35,7 +35,7 @@ struct action_util police_action_util = {
 static void usage(void)
 {
 	fprintf(stderr, "Usage: ... police rate BPS burst BYTES[/BYTES] [ mtu BYTES[/BYTES] ]\n");
-	fprintf(stderr, "                [ peakrate BPS ] [ avrate BPS ]\n");
+	fprintf(stderr, "                [ peakrate BPS ] [ avrate BPS ] [ overhead BYTES ]\n");
 	fprintf(stderr, "                [ ACTIONTERM ]\n");
 	fprintf(stderr, "Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT] \n");
 	fprintf(stderr, "New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT] \n");
@@ -133,6 +133,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
 	__u32 avrate = 0;
 	int presult = 0;
 	unsigned buffer=0, mtu=0, mpu=0;
+	unsigned short overhead;
 	int Rcell_log=-1, Pcell_log = -1;
 	struct rtattr *tail;
 
@@ -234,6 +235,11 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
 				fprintf(stderr, "Illegal \"action\"\n");
 				return -1;
 			}
+		} else if (matches(*argv, "overhead") == 0) {
+			NEXT_ARG();
+			if (get_u16(&overhead, *argv, 10)) {
+				explain1("overhead"); return -1;
+			}
 		} else if (strcmp(*argv, "help") == 0) {
 			usage();
 		} else {
@@ -263,6 +269,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
 
 	if (p.rate.rate) {
 		p.rate.mpu = mpu;
+		p.rate.overhead = overhead;
 		if (tc_calc_rtable(&p.rate, rtab, Rcell_log, mtu) < 0) {
 			fprintf(stderr, "TBF: failed to calculate rate table.\n");
 			return -1;
@@ -272,6 +279,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
 	p.mtu = mtu;
 	if (p.peakrate.rate) {
 		p.peakrate.mpu = mpu;
+		p.peakrate.overhead = overhead;
 		if (tc_calc_rtable(&p.peakrate, ptab, Pcell_log, mtu) < 0) {
 			fprintf(stderr, "POLICE: failed to calculate peak rate table.\n");
 			return -1;
@@ -344,6 +352,7 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg)
 		fprintf(f, "/%s ", police_action_n2a(*(int*)RTA_DATA(tb[TCA_POLICE_RESULT]), b1, sizeof(b1)));
 	} else
 		fprintf(f, " ");
+	fprintf(f, "overhead %ub ", p->rate.overhead);
 	fprintf(f, "\nref %d bind %d\n",p->refcnt, p->bindcnt);
 
 	return 0;
Signature · 1 line
1.5.3
#4 lore raw

Re: [PATCH 0/5] [IPROUTE2] Add overhead parameter for CBQ, TBF and police

In reply to a message not in the archive
Quoted 6 lines · On Sun, 23 Mar 2008 23:44:08 +0100 Jesper Dangaard Brouer <[email protected]> wrote:

Hi Stephen

This can be view as a maintanance patchset for iproute2. The overhead parameter, introduced in kernel 2.6.24, were only implemented for HTB in iproute2/tc.

Quoted 8 lines

This patchset adds overhead parameter parsing for the last rate-table based schedulers CBQ, TFB and police.

The changes are ABI (Application Binary Interface) backward compatible with older kernels, but will first have effect from kernel 2.6.24.

See you soon :-)

Appled for 2.6.25 version