All of lore.kernel.org
 help / color / mirror / Atom feed
* [IPROUTE2 0/2] Add ECN support to tc-netem
@ 2012-05-16 23:51 Vijay Subramanian
  2012-05-16 23:51 ` [IPROUTE2 1/2] Update tc-netem manpage to add ecn capability Vijay Subramanian
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vijay Subramanian @ 2012-05-16 23:51 UTC (permalink / raw)
  To: netdev; +Cc: Eric Dumazet, Stephen Hemminger, Vijay Subramanian

Recent patch to net-next kernel from Eric Dumazet (e4ae004b84b netem: add ECN
capability) made it possible for netem to mark packets with ECN instead of
dropping them. These two patches add support to iproute2/tc and update the
manpage.

Vijay Subramanian (2):
  Update tc-netem manpage to add ecn capability
  tc-netem: Add support for ECN packet marking

 include/linux/pkt_sched.h |    1 +
 man/man8/tc-netem.8       |    8 ++++++--
 tc/q_netem.c              |   25 +++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [IPROUTE2 1/2] Update tc-netem manpage to add ecn capability
  2012-05-16 23:51 [IPROUTE2 0/2] Add ECN support to tc-netem Vijay Subramanian
@ 2012-05-16 23:51 ` Vijay Subramanian
  2012-05-16 23:51 ` [IPROUTE2 2/2] tc-netem: Add support for ECN packet marking Vijay Subramanian
  2012-05-17 21:54 ` [IPROUTE2 0/2] Add ECN support to tc-netem Stephen Hemminger
  2 siblings, 0 replies; 5+ messages in thread
From: Vijay Subramanian @ 2012-05-16 23:51 UTC (permalink / raw)
  To: netdev; +Cc: Eric Dumazet, Stephen Hemminger, Vijay Subramanian

This patch updates the netem manpage to describe how to use
netem to mark packets with ecn instead of dropping them.

Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
---
 man/man8/tc-netem.8 |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/man/man8/tc-netem.8 b/man/man8/tc-netem.8
index 39f8454..b0b7864 100644
--- a/man/man8/tc-netem.8
+++ b/man/man8/tc-netem.8
@@ -30,8 +30,8 @@ NetEm \- Network Emulator
 .IR p13 " [ " p31 " [ " p32 " [ " p23 " [ " p14 "]]]] |"
 .br
 .RB "               " gemodel
-.IR p " [ " r " [ " 1-h " [ " 1-k " ]]]"
-.BR " }"
+.IR p " [ " r " [ " 1-h " [ " 1-k " ]]] } "
+.RB  " [ " ecn " ] "
 
 .IR CORRUPT " := "
 .B corrupt
@@ -102,6 +102,10 @@ model. As known, p and r are the transition probabilities between the bad and
 the good states, 1-h is the loss probability in the bad state and 1-k is the
 loss probability in the good state.
 
+.SS ecn
+can be used optionally to mark packets instead of dropping them. A loss model
+has to be used for this to be enabled.
+
 .SS corrupt
 allows the emulation of random noise introducing an error in a random position
 for a chosen percent of packets. It is also possible to add a correlation
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [IPROUTE2 2/2] tc-netem: Add support for ECN packet marking
  2012-05-16 23:51 [IPROUTE2 0/2] Add ECN support to tc-netem Vijay Subramanian
  2012-05-16 23:51 ` [IPROUTE2 1/2] Update tc-netem manpage to add ecn capability Vijay Subramanian
@ 2012-05-16 23:51 ` Vijay Subramanian
  2012-05-22 21:12   ` Stephen Hemminger
  2012-05-17 21:54 ` [IPROUTE2 0/2] Add ECN support to tc-netem Stephen Hemminger
  2 siblings, 1 reply; 5+ messages in thread
From: Vijay Subramanian @ 2012-05-16 23:51 UTC (permalink / raw)
  To: netdev; +Cc: Eric Dumazet, Stephen Hemminger, Vijay Subramanian

This patch provides support for marking packets with ECN instead of
dropping them with netem. This makes it possible to make use of the
netem ECN marking feature that was added recently to the kernel.

Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
---
 include/linux/pkt_sched.h |    1 +
 tc/q_netem.c              |   26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 410b33d..ffe975c 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -509,6 +509,7 @@ enum {
 	TCA_NETEM_CORRUPT,
 	TCA_NETEM_LOSS,
 	TCA_NETEM_RATE,
+	TCA_NETEM_ECN,
 	__TCA_NETEM_MAX,
 };
 
diff --git a/tc/q_netem.c b/tc/q_netem.c
index 360080c..f8489e9 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -38,6 +38,7 @@ static void explain(void)
 "                 [ loss random PERCENT [CORRELATION]]\n" \
 "                 [ loss state P13 [P31 [P32 [P23 P14]]]\n" \
 "                 [ loss gemodel PERCENT [R [1-H [1-K]]]\n" \
+"                 [ ecn ]\n" \
 "                 [ reorder PRECENT [CORRELATION] [ gap DISTANCE ]]\n" \
 "                 [ rate RATE [PACKETOVERHEAD] [CELLSIZE] [CELLOVERHEAD]]\n");
 }
@@ -326,6 +327,8 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 					*argv);
 				return -1;
 			}
+		} else if (matches(*argv, "ecn") == 0) {
+				present[TCA_NETEM_ECN] = 1;
 		} else if (matches(*argv, "reorder") == 0) {
 			NEXT_ARG();
 			present[TCA_NETEM_REORDER] = 1;
@@ -437,6 +440,14 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 		return -1;
 	}
 
+	if (present[TCA_NETEM_ECN]) {
+		if (opt.loss <= 0 && loss_type == NETEM_LOSS_UNSPEC) {
+			fprintf(stderr, "ecn requested without loss model\n");
+			explain();
+			return -1;
+		}
+	}
+
 	if (dist_data && (opt.latency == 0 || opt.jitter == 0)) {
 		fprintf(stderr, "distribution specified but no latency and jitter values\n");
 		explain();
@@ -454,6 +465,11 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 	    addattr_l(n, 1024, TCA_NETEM_REORDER, &reorder, sizeof(reorder)) < 0)
 		return -1;
 
+	if (present[TCA_NETEM_ECN] &&
+	    addattr_l(n, 1024, TCA_NETEM_ECN, &present[TCA_NETEM_ECN],
+		      sizeof(present[TCA_NETEM_ECN])) < 0)
+			return -1;
+
 	if (present[TCA_NETEM_CORRUPT] &&
 	    addattr_l(n, 1024, TCA_NETEM_CORRUPT, &corrupt, sizeof(corrupt)) < 0)
 		return -1;
@@ -500,6 +516,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	const struct tc_netem_corrupt *corrupt = NULL;
 	const struct tc_netem_gimodel *gimodel = NULL;
 	const struct tc_netem_gemodel *gemodel = NULL;
+	int *ecn = NULL;
 	struct tc_netem_qopt qopt;
 	const struct tc_netem_rate *rate = NULL;
 	int len = RTA_PAYLOAD(opt) - sizeof(qopt);
@@ -548,6 +565,11 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 				return -1;
 			rate = RTA_DATA(tb[TCA_NETEM_RATE]);
 		}
+		if (tb[TCA_NETEM_ECN]) {
+			if (RTA_PAYLOAD(tb[TCA_NETEM_ECN]) < sizeof(*ecn))
+				return -1;
+			ecn = RTA_DATA(tb[TCA_NETEM_ECN]);
+		}
 	}
 
 	fprintf(f, "limit %d", qopt.limit);
@@ -617,9 +639,13 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 			fprintf(f, " celloverhead %d", rate->cell_overhead);
 	}
 
+	if (ecn)
+		fprintf(f, " ecn ");
+
 	if (qopt.gap)
 		fprintf(f, " gap %lu", (unsigned long)qopt.gap);
 
+
 	return 0;
 }
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [IPROUTE2 0/2] Add ECN support to tc-netem
  2012-05-16 23:51 [IPROUTE2 0/2] Add ECN support to tc-netem Vijay Subramanian
  2012-05-16 23:51 ` [IPROUTE2 1/2] Update tc-netem manpage to add ecn capability Vijay Subramanian
  2012-05-16 23:51 ` [IPROUTE2 2/2] tc-netem: Add support for ECN packet marking Vijay Subramanian
@ 2012-05-17 21:54 ` Stephen Hemminger
  2 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2012-05-17 21:54 UTC (permalink / raw)
  To: Vijay Subramanian; +Cc: netdev, Eric Dumazet

On Wed, 16 May 2012 16:51:56 -0700
Vijay Subramanian <subramanian.vijay@gmail.com> wrote:

> Recent patch to net-next kernel from Eric Dumazet (e4ae004b84b netem: add ECN
> capability) made it possible for netem to mark packets with ECN instead of
> dropping them. These two patches add support to iproute2/tc and update the
> manpage.
> 
> Vijay Subramanian (2):
>   Update tc-netem manpage to add ecn capability
>   tc-netem: Add support for ECN packet marking
> 
>  include/linux/pkt_sched.h |    1 +
>  man/man8/tc-netem.8       |    8 ++++++--
>  tc/q_netem.c              |   25 +++++++++++++++++++++++++
>  3 files changed, 32 insertions(+), 2 deletions(-)
> 


I am holding these until 3.5 merge window, since they depend
on the feature still in net-next

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [IPROUTE2 2/2] tc-netem: Add support for ECN packet marking
  2012-05-16 23:51 ` [IPROUTE2 2/2] tc-netem: Add support for ECN packet marking Vijay Subramanian
@ 2012-05-22 21:12   ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2012-05-22 21:12 UTC (permalink / raw)
  To: Vijay Subramanian; +Cc: netdev, Eric Dumazet

On Wed, 16 May 2012 16:51:58 -0700
Vijay Subramanian <subramanian.vijay@gmail.com> wrote:

> This patch provides support for marking packets with ECN instead of
> dropping them with netem. This makes it possible to make use of the
> netem ECN marking feature that was added recently to the kernel.
> 
> Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
> ---
>  include/linux/pkt_sched.h |    1 +
>  tc/q_netem.c              |   26 ++++++++++++++++++++++++++
>  2 files changed, 27 insertions(+), 0 deletions(-)
> 

Applied.

Note: I update kernel headers first (before applying changes), then
prune off the header changes from the patches. This is to make sure
that sanitized kernel headers are correct.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-22 21:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-16 23:51 [IPROUTE2 0/2] Add ECN support to tc-netem Vijay Subramanian
2012-05-16 23:51 ` [IPROUTE2 1/2] Update tc-netem manpage to add ecn capability Vijay Subramanian
2012-05-16 23:51 ` [IPROUTE2 2/2] tc-netem: Add support for ECN packet marking Vijay Subramanian
2012-05-22 21:12   ` Stephen Hemminger
2012-05-17 21:54 ` [IPROUTE2 0/2] Add ECN support to tc-netem Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.