netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Yousuk Seung <ysseung@google.com>, netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Michael McLennan <nefario@google.com>,
	Priyaranjan Jha <priyarjha@google.com>,
	Dave Taht <dave.taht@gmail.com>,
	Neal Cardwell <ncardwell@google.com>
Subject: Re: [PATCH iproute2-next 2/3] q_netem: support delivering packets in delayed time slots
Date: Sun, 12 Aug 2018 16:14:34 -0600	[thread overview]
Message-ID: <27d7665c-f683-2470-02e1-f4af72c42b0e@gmail.com> (raw)
In-Reply-To: <20180806170953.164776-3-ysseung@google.com>

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;

  reply	other threads:[~2018-08-13  0:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 17:09 [PATCH iproute2-next 0/3] support delivering packets in delayed Yousuk Seung
2018-08-06 17:09 ` [PATCH iproute2-next 1/3] tc: support conversions to or from 64 bit nanosecond-based time Yousuk Seung
2018-08-12 22:09   ` David Ahern
2018-08-13 18:37     ` Dave Taht
2018-08-06 17:09 ` [PATCH iproute2-next 2/3] q_netem: support delivering packets in delayed time slots Yousuk Seung
2018-08-12 22:14   ` David Ahern [this message]
2018-08-06 17:09 ` [PATCH iproute2-next 3/3] q_netem: slotting with non-uniform distribution Yousuk Seung
2018-08-12 22:18   ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27d7665c-f683-2470-02e1-f4af72c42b0e@gmail.com \
    --to=dsahern@gmail.com \
    --cc=dave.taht@gmail.com \
    --cc=ncardwell@google.com \
    --cc=nefario@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=priyarjha@google.com \
    --cc=stephen@networkplumber.org \
    --cc=ysseung@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).