[Netem] How to reorder packets based on jitter?

Marie Laurent laurent.marie at grassvalley.com
Thu Jun 24 07:45:39 PDT 2010


  Hello,

I have applied your patch but I have simplified it because we only rely
on pfifo queue discipline.

Jitter seems to work fine with moderate values. If I apply more
stressing parameters but packets get requeued and sometimes dropped. I
will check next week.

Thanks for the patch. We resumed testing jitter on 2.6.32 kernel based
PCs

Here is the patch I applied on my 2.6.32 linux box (diff -u format)

Yours sincerely,

Mr Laurent MARIE

diff -u -r1.2 sch_netem.c
--- sch_netem.c	27 Apr 2010 09:17:19 -0000	1.2
+++ sch_netem.c	24 Jun 2010 12:44:27 -0000
@@ -93,6 +93,11 @@
 	return (struct netem_skb_cb *)qdisc_skb_cb(skb)->data;
 }
 
+static char *inner_qdisc;
+module_param_named(qdisc, inner_qdisc, charp, 0); 
+MODULE_PARM_DESC(qdisc, "Inner queue discipline");
+
+
 /* init_crandom - initialize correlated random number generator
  * Use entropy source for initial seed.
  */
@@ -549,9 +554,29 @@
 	.dump		=	tfifo_dump,
 };
 
+static struct Qdisc_ops *netem_dflt_qdisc(void) {
+#if 0
+        /* Original patch */
+	if (!inner_qdisc)
+		return &tfifo_qdisc_ops;
+
+	if (strcmp(inner_qdisc, "pfifo") == 0)
+		return &pfifo_qdisc_ops;
+
+	if (strcmp(inner_qdisc, "bfifo") == 0)
+		return &bfifo_qdisc_ops;
+
+	return NULL;
+#else
+    printk ("%s: pfifo default option\n", __FUNCTION__);
+    return &pfifo_qdisc_ops;
+#endif
+}
+
 static int netem_init(struct Qdisc *sch, struct nlattr *opt)
 {
 	struct netem_sched_data *q = qdisc_priv(sch);
+	struct Qdisc_ops *ops;
 	int ret;
 
 	if (!opt)
@@ -559,9 +584,12 @@
 
 	qdisc_watchdog_init(&q->watchdog, sch);
 
+	ops = netem_dflt_qdisc();
+	if (!ops)
+		return -ENOENT;
+
 	q->qdisc = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
-				     &tfifo_qdisc_ops,
-				     TC_H_MAKE(sch->handle, 1));
+				     ops, TC_H_MAKE(sch->handle, 1));
 	if (!q->qdisc) {
 		pr_debug("netem: qdisc create failed\n");
 		return -ENOMEM;


========================================================================
=
If you want to switch to packet or byte count fifo, try the following.



More information about the Netem mailing list