From: stephen hemminger Date: Wed, 23 Feb 2011 13:04:19 +0000 (+0000) Subject: netem: define NETEM_DIST_MAX X-Git-Tag: firefly_0821_release~7613^2~2196^2~243 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=df173bda2639ac744ccf596ec1f8f7e66fe4c343;p=firefly-linux-kernel-4.4.55.git netem: define NETEM_DIST_MAX 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 Signed-off-by: David S. Miller --- diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 5afee2b238bd..891382268fe1 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h @@ -495,6 +495,7 @@ struct tc_netem_corrupt { }; #define NETEM_DIST_SCALE 8192 +#define NETEM_DIST_MAX 16384 /* DRR */ diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 86dad1eee549..289febd3ccac 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -332,7 +332,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) int i; size_t s; - if (n > 65536) + if (n > NETEM_DIST_MAX) return -EINVAL; s = sizeof(struct disttable) + n * sizeof(s16);