Patchwork [7/9] netem: dump distribution table

login
register
mail settings
Submitter stephen hemminger
Date Aug. 6, 2010, 7:35 p.m.
Message ID <20100806193559.108503444@vyatta.com>
Download mbox | patch
Permalink /patch/61142/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Aug. 6, 2010, 7:35 p.m.
The existing netem API is not symmetric; the current distribution
table is not added to dump output.  Since distribution table is 
could be large, only add it if there space available (for compatiablity
with older applications).

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- a/net/sched/sch_netem.c	2010-08-03 08:29:43.926514463 -0700
+++ b/net/sched/sch_netem.c	2010-08-03 08:30:49.297380886 -0700
@@ -592,6 +592,13 @@  static int netem_dump(struct Qdisc *sch,
 	corrupt.correlation = q->corrupt_cor.rho;
 	NLA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt);
 
+	/* dump table if exists and there is space available */
+	if (q->delay_dist) {
+		const struct disttable *d = q->delay_dist;
+		nla_put(skb, TCA_NETEM_DELAY_DIST,
+			d->size * sizeof(__s16), d->table);
+	}
+
 	return nla_nest_end(skb, nla);
 
 nla_put_failure: