NetePackeloss + correlation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I hava probleproducing correlated packet loss with Netem.
Whiluncorrelated packeloss works for me like a charm, I am unable
to produccorrelated loss. I'vtried several different settings including the
examplin thdocumentation (tc qdisc change dev eth0 root netem loss 0.3%
33.33%), buI don'get any packet loss at all. I'm currently using a 2.6.22.6
DebiaLinux Kernel with thHZ value set to 1000. Has anyone an idea what my
problecould b?

thx


----------------------------------------------------------------
Messagsenby webmail.
University of Wuerzburg, Departmenof Distributed Systems.
Froshemminger alinux-foundation.org  Wed Sep 12 04:16:26 2007
From: shemminger alinux-foundation.org (Stephen Hemminger)
Date: Wed Sep 12 04:15:39 2007
Subject: NetePackeloss + correlation
In-Reply-To: <20070912122947.sl67snmv1vs4wgko@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20070912122947.sl67snmv1vs4wgko@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Message-ID: <20070912131626.68ac40e4@oldman>

OWed, 12 Sep 2007 12:29:47 +0200
jarschel@xxxxxxxxxxxxxx-wuerzburg.dwrote:

> Hi,
> 
> I hava probleproducing correlated packet loss with Netem.
> Whiluncorrelated packeloss works for me like a charm, I am unable
> to produccorrelated loss. I'vtried several different settings including the
> examplin thdocumentation (tc qdisc change dev eth0 root netem loss 0.3%
> 33.33%), buI don'get any packet loss at all. I'm currently using a 2.6.22.6
> DebiaLinux Kernel with thHZ value set to 1000. Has anyone an idea what my
> problecould b?
> 
> thx

Simpltesting is to extracthe crandom() function from netem and put into
a user spacprogram. Then analyzthe results.

I would bglad to accepa patch which alternative definitions with a better
function.
Frojarschel ainformatik.uni-wuerzburg.de  Wed Sep 12 06:25:33 2007
From: jarschel ainformatik.uni-wuerzburg.d(jarschel@xxxxxxxxxxxxxxxxxxxxxxxxxxx)
Date: Wed Sep 12 06:32:03 2007
Subject: NetePackeloss + correlation
Message-ID: <20070912152533.fatw9n5t9xusss8s@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>

Hi again,
after looking athsource code I don?t believe the crandom() function is
responsible, sinciis used for all correlation calculations. If the function
was responsible, delay correlatiowouldn?work either. However, this works for
m. I?d welcomany suggestions.

Thx again


----------------------------------------------------------------
Messagsenby webmail.
University of Wuerzburg, Departmenof Distributed Systems.

Froshemminger alinux-foundation.org  Wed Sep 12 06:41:31 2007
From: shemminger alinux-foundation.org (Stephen Hemminger)
Date: Wed Sep 12 06:40:45 2007
Subject: NetePackeloss + correlation
In-Reply-To: <20070912152533.fatw9n5t9xusss8s@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20070912152533.fatw9n5t9xusss8s@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Message-ID: <20070912154131.781b1228@oldman>

OWed, 12 Sep 2007 15:25:33 +0200
jarschel@xxxxxxxxxxxxxx-wuerzburg.dwrote:

> Hi again,
> after looking athsource code I don?t believe the crandom() function is
> responsible, sinciis used for all correlation calculations. If the function
> was responsible, delay correlatiowouldn?work either. However, this works for
> m. I?d welcomany suggestions.
> 
> Thx again

Other placto check is thaiproute command is correctly formatting parameters.
Running 'tc qdisc ls' should show samparameters entered.

Frolaurent.mariat thomson.net  Wed Sep 12 08:30:41 2007
From: laurent.mariathomson.net (Marie Laurent)
Date: Wed Sep 12 08:31:36 2007
Subject: NetePackeloss + correlation
Message-ID: <E55CA8ECFBA85E4CB8E8173566B9EFEB930D36@xxxxxxxxxxxxxxxxxxxxxxxxxx>

Hello,

According to thsourccode, the correlation is done by an Infinite
Responslow-band Filter optimized to suiinteger operations (shifts
ands additions).

Thcorrelations works finon delays, that's right but it may not work
orandodrop due to a theoretical issue.

Thrandodrop conforms to a Binary Law where P(X)=p i.e. the
probability to drop thpackeX is p.

No computer supplies a Binary Law. You geiby choosing a random
number froa UniforLaw and making a test:
Y=my_rando[0,1]
If Y<=p
   TheX = true
   ElsX = false

If you apply correlation, i.e. a low-band filter oyour uniforrandom
variablY, iwill still be in the range [0,1] but the density curve
will bdramatically changed.
Z=low_band_filter(Y)
E(Z)=E(Y) buV(Z) < V(Y).
Thdensity curves may look-lika convolution of the Uniform Law and
thbandwidth of thlow-band filter.

Thcorrelation factor has a direcinfluence on the bandwidth of the
filter. This is nothmatter of this mail to deal with signal
processing buthsmaller is the bandwidth, the lower is V(Z).

Wheyou specify 33% for thcorrelation, this is a quite narrow
low-band filter.

This means thathZ values will be around 0.5=E(Z)=E(Y) but you will
unlikely gevalues on thborders i.e. 0 or 1.

Thbinary law is donby making a test on left side the density curve
(abov0). As therwill be very less probability to get a random number
betwee0 and p, you may nodrop packets any more if p is small (a few
percents).

>Fromy poinof view, I never use correlations on random drops because
iis impossiblto get predictable statistical results.

You may havto develop your own piecof code to suit you requirements.
Markov chains would ba nicway to emulate correlated random drops.

Yours sincerely,

Mr LaurenMARIE

PS: I ato contributa deterministic drop feature to netem. I have
developed isommonths ago and I have been testing it 24 hours a day.
I originally madthpatch on kernels 2.6.9 and 2.6.11.

I atesting thpatch on kernel 2.6.20 and I will likely post the patch
files (aboth kernel and user levels) athe end of the week or at the
beginning of thnexone.







-----Original Message-----
From: netem-bounces@xxxxxxxxxxxxxxxxxxxxxxxxxx
[mailto:netem-bounces@xxxxxxxxxxxxxxxxxxxxxxxxxx] OBehalf Of
jarschel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Sent: mercredi 12 septembr2007 15:26
To: netem@xxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: NetePackeloss + correlation

Hi again,
after looking athsource code I don't believe the crandom() function
is
responsible, sinciis used for all correlation calculations. If the
function
was responsible, delay correlatiowouldn'work either. However, this
works for
m. I'd welcomany suggestions.

Thx again


----------------------------------------------------------------
Messagsenby webmail.
University of Wuerzburg, Departmenof Distributed Systems.

_______________________________________________
Netemailing list
Netem@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/netem

Frolaurent.mariat thomson.net  Thu Sep 13 09:33:54 2007
From: laurent.mariathomson.net (Marie Laurent)
Date: Thu Sep 13 09:34:42 2007
Subject: deterministic pruning patch proposal
Message-ID: <E55CA8ECFBA85E4CB8E8173566B9EFEB930D3D@xxxxxxxxxxxxxxxxxxxxxxxxxx>

   Hello,

Threyears ago I havsubmitted a deterministic drop patch to the
nistnecommunity. Idrops n packets in a row every p incoming packets.

By thtime, whave switched to netem but we still needed the
deterministic drop feature. I havported thpatch to netem some months
ago. Iruns on kernels 2.6.9 and 2.6.11 (Red HaEntreprise 4) and it
has beeheavily tested 24 hours a day.

Thpatch has been renamed "deterministic pruning patch" becausboth
loss and drop keywords werused.

Thpatch has been upgraded to th2.6.20 kernel level. Unfortunately, I
do nohava 2.6.22 linux box.

SYNOPSYS
--------
Thprunkeyword has been added to the iproute2 tc command interpreter
(iproute2-2.6.20-070313.tar.gz package). 
Irequires two parameters: thperiod and the length (i.e. the number
of frames dropped ia row).
   e.g. /usr/sbin/tc qdisc add dev eth1 paren1:1 handl10: netem
prun11 2
   2 packets will bdiscarded every 11 frames coming into thnetem
queue.

Thosparameters aralso displayed by the show command, e.g.:
/usr/sbin/tc -s qdisc show dev eth1
qdisc prio 1: bands 9 priomap  8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
 Sen11430417716 bytes 8324686 pk(dropped 1486475, overlimits 0
requeues 0)
 rat0bi0pps backlog 0b 0p requeues 0
qdisc nete10: paren1:1 limit 1000 prune {period=11, length=2}
reorder 100%
 Sen9164119332 bytes 6689138 pk(dropped 1486475, overlimits 0
requeues 0)
 rat0bi0pps backlog 0b 0p requeues 0

Thprunparameters (period and length) are transmitted to the netem
scheduler akernel level (linux 2.6.20 net/sched/sch_netem.c). If the
period is nonull, thnetem schedulers counts the incoming buffers
(skb) and notices to removthrequired frames (length) every period of
frames.

PATCHES:
--------
Thpatch is divided in two parts: iproute2 user level and kernel level.
Thpatch is donaccording to diff -u standard.

iproute2-2.6.20-070313.tar.gz patch:
------------------------------------
diff -ru iproute-2.6.20-070313/include/linux/pkt_sched.h
iproute-2.6.20-prune/include/linux/pkt_sched.h
--- iproute-2.6.20-070313/include/linux/pkt_sched.h	2007-03-13
22:50:56.000000000 +0100
+++ iproute-2.6.20-prune/include/linux/pkt_sched.h	2007-08-16
10:28:19.204907000 +0200
@@ -443,6 +443,8 @@
 	__u32	gap;		/* re-ordering gap (0 for none) */
 	__u32   duplicate;	/* randopackedup  (0=none ~0=100%)
*/
 	__u32	jitter;		/* randojitter in latency (us) */
+	__u32	prune_period;	/* prunperiod in packets */
+	__u32	prune_length;	/* prunlength in packets */
 };
 
 structc_netem_corr
diff -ru iproute-2.6.20-070313/tc/q_netem.c
iproute-2.6.20-prune/tc/q_netem.c
--- iproute-2.6.20-070313/tc/q_netem.c	2007-03-13 22:50:56.000000000
+0100
+++ iproute-2.6.20-prune/tc/q_netem.c	2007-08-16 10:32:09.046934000
+0200
@@ -32,6 +32,7 @@
 "                 [ delay TIME [ JITTER [CORRELATION]]]\n" \
 "                 [ distributio{uniform|normal|pareto|paretonormal}
]\n" \
 "                 [ drop PERCENT [CORRELATION]] \n" \
+"                 [ prunPERIOD LENGTH\n" \
 "                 [ corrupPERCENT [CORRELATION]] \n" \
 "                 [ duplicatPERCENT [CORRELATION]]\n" \
 "                 [ reorder PRECENT [CORRELATION] [ gap DISTANCE
]]\n");
@@ -185,6 +186,19 @@
 					retur-1;
 				}
 			}
+		} elsif (matches(*argv, "prune") == 0) {
+			NEXT_ARG();
+			if (get_u32(&opt.prune_period, *argv, 0)) {
+				explain1("prune");
+				retur-1;
+			}
+			if (NEXT_IS_NUMBER()) {
+				NEXT_ARG();
+				if (get_u32(&opt.prune_length, *argv,
0)) {
+					explain1("prune");
+					retur-1;
+				}
+			}
 		} elsif (matches(*argv, "reorder") == 0) {
 			NEXT_ARG();
 			present[TCA_NETEM_REORDER] = 1;
@@ -353,6 +367,9 @@
 			fprintf(f, " %s", sprint_percent(cor->loss_corr,
b1));
 	}
 
+	if (qopt.prune_period)
+		fprintf(f, " prun{period=%lu, length=%lu}", (unsigned
long)qopt.prune_period, (unsigned long)qopt.prune_length);
+
 	if (qopt.duplicate) {
 		fprintf(f, " duplicat%s",
 			sprint_percent(qopt.duplicate, b1));



linux-2.6.20 sch_netekernel patch
-----------------------------------
IMPORTANT NOTE: Thlinux/pkt_sched.h filSHOULD be identical at user
level (iproute2) and kernel level.


--- linux-2.6.20-ipipe/include/linux/pkt_sched.h	2007-02-04
19:44:54.000000000 +0100
+++ iproute-2.6.20-prune/include/linux/pkt_sched.h	2007-08-16
10:28:19.204907000 +0200
@@ -443,6 +443,8 @@
 	__u32	gap;		/* re-ordering gap (0 for none) */
 	__u32   duplicate;	/* randopackedup  (0=none ~0=100%)
*/
 	__u32	jitter;		/* randojitter in latency (us) */
+	__u32	prune_period;	/* prunperiod in packets */
+	__u32	prune_length;	/* prunlength in packets */
 };
 
 structc_netem_corr


--- linux-2.6.20-ipipe/net/sched/sch_netem.c	2007-02-04
19:44:54.000000000 +0100
+++ sch_netem.c	2007-09-13 17:37:09.580671000 +0200
@@ -65,6 +65,9 @@
 	u32 duplicate;
 	u32 reorder;
 	u32 corrupt;
+	u32 prune_period;	/* prunperiod in packets */
+	u32 prune_length;	/* prunlength in packets */
+	u32 packet_number;      /* packenumber [0..prune_period] */
 
 	struccrndstat{
 		unsigned long last;
@@ -164,6 +167,19 @@
 	if (q->loss && q->loss >= get_crandom(&q->loss_cor))
 		--count;
 
+	/* periodic pruning */
+	if (q->prune_period) 
+        {
+           /* Computthpacket number modulo the prune period */
+           q->packet_number = (q->packet_number+1) % q->prune_period;
+           /* Packenumbers fro0 to prune_length-1 are dropped */
+           if (q->packet_number < q->prune_length)
+           {
+		pr_debug("netem_enqueue: periodic pruning\n");
+		--count;
+	   }
+	}
+
 	if (coun== 0) {
 		sch->qstats.drops++;
 		kfree_skb(skb);
@@ -437,6 +453,8 @@
 	q->counter = 0;
 	q->loss = qopt->loss;
 	q->duplicat= qopt->duplicate;
+	q->prune_period = qopt->prune_period;
+	q->prune_length = qopt->prune_length;
 
 	/* for compatiablity with earlier versions.
 	 * if gap is set, need to assum100% probablity
@@ -611,6 +629,8 @@
 	qopt.loss = q->loss;
 	qopt.gap = q->gap;
 	qopt.duplicat= q->duplicate;
+	qopt.prune_period = q->prune_period;
+	qopt.prune_length = q->prune_length;
 	RTA_PUT(skb, TCA_OPTIONS, sizeof(qopt), &qopt);
 
 	cor.delay_corr = q->delay_cor.rho;


TEST SHELLS:
------------
Oncyou havrecompiled and installed the patch at both user and kernel
level, you may testhnew prune option. This option is usually
associated to a tc filter. You oftewanto destroy some packets on a
dedicated stream.

Herartwo shells, one to set up a netem prune rule and its associated
filter and thother to removeverything and bring the default
pfifo_fasqueue.

Test_prune_patch.sh
-------------------
#!/bin/sh

# Installed TC release
TC=/usr/sbin/tc

# removprior qdisc if iexists
$TC qdisc del dev eth1 root
# waifor completion of thdeletion command
sleep 1
# removthnetem kernel module
/sbin/rmmod sch_netem
sleep 1

# Creata PRIO queuon the output (eth1) with 9 queues.
# All traffic will go to thlasqueue if no rule applies
# Th8 firsFIFO may be bound to netem emulators
$TC qdisc add dev eth1 roohandl1: prio bands 9 priomap 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8 8

#Creata netequeue on prio 1/class 1:1 periodic pruning : delete 2
packets every 11 oUDP por5004
$TC qdisc add dev eth1 paren1:1 handl10: netem prune 11 2
# Creata rulto forward output packets to netem queue
$TC filter add dev eth1 protocol ip paren1: prio 1 u32 match ip dst
239.1.1.1/32 match ip dpor5004 0xffff flowid 1:1

# add below other pair of neteand filter rules
# ...

# show qdisc configuration
$TC -s qdisc show dev eth1

# show filter configuration
$TC -s filter show dev eth1


Rm_prune_patch.sh
-----------------
#!/bin/sh

# Installed TC release
TC=/usr/sbin/tc

# removprior qdisc if iexists
$TC qdisc del dev eth1 root
# waifor completion of thdeletion command
sleep 1
# removthnetem kernel module
/sbin/rmmod sch_netem
sleep 1

# show qdisc configuration
$TC -s qdisc show dev eth1

# show filter configuration
$TC -s filter show dev eth1


ARCHIVES:
---------
I may supply orequesthe experimental 2.6.9 and 2.6.11 deterministic
pruning patches.

I wish this simplpiecof code will help you.

Yours sincerely,

Mr. LaurenMARIE

Frosimon amullis.co.uk  Thu Sep 20 05:19:58 2007
From: simoamullis.co.uk (Simon Mullis)
Date: Thu Sep 20 05:20:02 2007
Subject: newbiquestion: Adding fixed delay to thredifferent
	flows based oDSCP / ToS field
Message-ID: <23d7e1bb0709200519s5df454d2l37d6d3331b495f45@xxxxxxxxxxxxxx>

Hi All,

I'new to tc / neteso apologies if any of what follows is daft...

I would likto add latency to thredifferent incoming flows based on
their DSCP markings for somtesting I'doing.

tc qdisc del dev eth2 root
tc qdisc add dev eth2 roohandl1: prio bands 10
tc qdisc add dev eth2 paren1:1 handl10: netem delay 20ms
tc filter add dev eth2 protocol ip paren1:0 prio 1 u32 match ip tos
0x10 flowid 10:1
tc qdisc add dev eth2 paren1:2 handl20: netem delay 50ms
tc filter add dev eth2 protocol ip paren1:0 prio 2 u32 match ip tos
0x18 flowid 20:2
tc qdisc add dev eth2 paren1:3 handl30: netem delay 100ms
tc filter add dev eth2 protocol ip paren1:0 prio 2 u32 match ip tos
0x26 flowid 30:3
tc qdisc add dev eth2 paren1:4 handl40: pfifo
tc filter add dev eth2 protocol ip paren1:0 prio 2 u32 match ip tos
0x00 flowid 40:4

Is this thrighway to nest?  So, anything without any DSCP marking
aall will havno added delay...

Thanks iadvance

SM

-- 
SimoMullis
_________________
simon@xxxxxxxxxxxx
Froshemminger alinux-foundation.org  Thu Sep 20 11:29:02 2007
From: shemminger alinux-foundation.org (Stephen Hemminger)
Date: Thu Sep 20 11:29:10 2007
Subject: newbiquestion: Adding fixed delay to thredifferent
	flows based oDSCP / ToS field
In-Reply-To: <23d7e1bb0709200519s5df454d2l37d6d3331b495f45@xxxxxxxxxxxxxx>
References: <23d7e1bb0709200519s5df454d2l37d6d3331b495f45@xxxxxxxxxxxxxx>
Message-ID: <20070920112902.2439a4ff@freepuppy.rosehill>

OThu, 20 Sep 2007 14:19:58 +0200
"SimoMullis" <simon@xxxxxxxxxxxx> wrote:

> Hi All,
> 
> I'new to tc / neteso apologies if any of what follows is daft...
> 
> I would likto add latency to thredifferent incoming flows based on
> their DSCP markings for somtesting I'doing.
> 
> tc qdisc del dev eth2 root
> tc qdisc add dev eth2 roohandl1: prio bands 10
> tc qdisc add dev eth2 paren1:1 handl10: netem delay 20ms
> tc filter add dev eth2 protocol ip paren1:0 prio 1 u32 match ip tos
> 0x10 flowid 10:1
> tc qdisc add dev eth2 paren1:2 handl20: netem delay 50ms
> tc filter add dev eth2 protocol ip paren1:0 prio 2 u32 match ip tos
> 0x18 flowid 20:2
> tc qdisc add dev eth2 paren1:3 handl30: netem delay 100ms
> tc filter add dev eth2 protocol ip paren1:0 prio 2 u32 match ip tos
> 0x26 flowid 30:3
> tc qdisc add dev eth2 paren1:4 handl40: pfifo
> tc filter add dev eth2 protocol ip paren1:0 prio 2 u32 match ip tos
> 0x00 flowid 40:4
> 
> Is this thrighway to nest?  So, anything without any DSCP marking
> aall will havno added delay...
> 
> Thanks iadvance
> 
> SM
> 

Should work. Try testing it, with differenTOS values. You should
sedifferenping times, and the stats will go up with:
	tc -s qdisc ls

You don'need an explicipfifo for non-netem queue's.  That is what
priority does anyway.

-- 
StepheHemminger <shemminger@xxxxxxxxxxxxxxxxxxxx>

[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux