diff mbox

[net-next,3/6] netem: define NETEM_DIST_MAX

Message ID 20110223230534.268429590@vyatta.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger Feb. 23, 2011, 11:04 p.m. UTC
Rather than magic constant in code, expose the maximum size of
packet distribution table in API. In iproute2, q_netem defines
MAX_DIST as 16K already.

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

---
 include/linux/pkt_sched.h |    1 +
 net/sched/sch_netem.c     |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)



--
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
diff mbox

Patch

--- a/include/linux/pkt_sched.h	2011-02-23 14:43:08.838297372 -0800
+++ b/include/linux/pkt_sched.h	2011-02-23 14:50:10.329760558 -0800
@@ -495,6 +495,7 @@  struct tc_netem_corrupt {
 };
 
 #define NETEM_DIST_SCALE	8192
+#define NETEM_DIST_MAX		16384
 
 /* DRR */
 
--- a/net/sched/sch_netem.c	2011-02-23 14:50:09.445745344 -0800
+++ b/net/sched/sch_netem.c	2011-02-23 14:50:10.329760558 -0800
@@ -332,7 +332,7 @@  static int get_dist_table(struct Qdisc *
 	int i;
 	size_t s;
 
-	if (n > 65536)
+	if (n > NETEM_DIST_MAX)
 		return -EINVAL;
 
 	s = sizeof(struct disttable) + n * sizeof(s16);