[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27d7665c-f683-2470-02e1-f4af72c42b0e@gmail.com>
Date: Sun, 12 Aug 2018 16:14:34 -0600
From: David Ahern <dsahern@...il.com>
To: Yousuk Seung <ysseung@...gle.com>, netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>,
Michael McLennan <nefario@...gle.com>,
Priyaranjan Jha <priyarjha@...gle.com>,
Dave Taht <dave.taht@...il.com>,
Neal Cardwell <ncardwell@...gle.com>
Subject: Re: [PATCH iproute2-next 2/3] q_netem: support delivering packets in
delayed time slots
On 8/6/18 11:09 AM, Yousuk Seung wrote:
> diff --git a/tc/q_netem.c b/tc/q_netem.c
> index 9f9a9b3df255..f52a36b6c31c 100644
> --- a/tc/q_netem.c
> +++ b/tc/q_netem.c
> @@ -40,7 +40,10 @@ static void explain(void)
> " [ loss gemodel PERCENT [R [1-H [1-K]]]\n" \
> " [ ecn ]\n" \
> " [ reorder PRECENT [CORRELATION] [ gap DISTANCE ]]\n" \
> -" [ rate RATE [PACKETOVERHEAD] [CELLSIZE] [CELLOVERHEAD]]\n");
> +" [ rate RATE [PACKETOVERHEAD] [CELLSIZE] [CELLOVERHEAD]]\n" \
> +" [ slot MIN_DELAY [MAX_DELAY] [packets MAX_PACKETS]" \
> +" [bytes MAX_BYTES]]\n" \
> + );
> }
>
> static void explain1(const char *arg)
> @@ -164,6 +167,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
> struct tc_netem_gimodel gimodel;
> struct tc_netem_gemodel gemodel;
> struct tc_netem_rate rate = {};
> + struct tc_netem_slot slot = {};
> __s16 *dist_data = NULL;
> __u16 loss_type = NETEM_LOSS_UNSPEC;
> int present[__TCA_NETEM_MAX] = {};
> @@ -412,6 +416,44 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
> return -1;
> }
> }
> + } else if (matches(*argv, "slot") == 0) {
> + NEXT_ARG();
> + present[TCA_NETEM_SLOT] = 1;
> + if (get_time64(&slot.min_delay, *argv)) {
> + explain1("slot min_delay");
> + return -1;
> + }
> + if (NEXT_IS_NUMBER()) {
> + NEXT_ARG();
> + if (get_time64(&slot.max_delay, *argv)) {
> + explain1("slot min_delay max_delay");
> + return -1;
> + }
> + }
> + if (slot.max_delay < slot.min_delay)
If max_delay is user specified, this should generate an error rather
than just overwriting the value.
> + slot.max_delay = slot.min_delay;
> + if (NEXT_ARG_OK() &&
> + matches(*(argv+1), "packets") == 0) {
> + NEXT_ARG();
> + if (!NEXT_ARG_OK() ||
> + get_s32(&slot.max_packets, *(argv+1), 0)) {
> + explain1("slot packets");
> + return -1;
> + }
> + NEXT_ARG();
> + }
> + if (NEXT_ARG_OK() &&
> + matches(*(argv+1), "bytes") == 0) {
> + unsigned int max_bytes;
> + NEXT_ARG();
> + if (!NEXT_ARG_OK() ||
> + get_size(&max_bytes, *(argv+1))) {
> + explain1("slot bytes");
> + return -1;
> + }
> + slot.max_bytes = (int) max_bytes;
> + NEXT_ARG();
> + }
> } else if (strcmp(*argv, "help") == 0) {
> explain();
> return -1;
Powered by blists - more mailing lists