Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH iproute2] ip: support of usec rtt in tcp_metrics
Date: Fri, 5 Sep 2014 17:02:22 -0700	[thread overview]
Message-ID: <20140905170222.1599ad33@urahara> (raw)
In-Reply-To: <1409961244.26422.142.camel@edumazet-glaptop2.roam.corp.google.com>

On Fri, 05 Sep 2014 16:54:04 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> +			if (i != TCP_METRIC_RTT &&
> +			    i != TCP_METRIC_RTT_US &&
> +			    i != TCP_METRIC_RTTVAR &&
> +			    i != TCP_METRIC_RTTVAR_US) {
> +				if (metric_name[i])
> +					fprintf(fp, " %s ", metric_name[i]);
> +				else
> +					fprintf(fp, " metric_%d ", i);

Why not put new metrics in metric_name array? and make the check something like:

			if (i < ARRAY_SIZE(metric_name) && metric_name[i])
				fprintf(fp, " %s ", metric_name[i]);
			else
				fprintf(fp, " metric_%d ", i)

This makes it future proof, and gets rid of the silly test.

  reply	other threads:[~2014-09-06  0:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 23:54 [PATCH iproute2] ip: support of usec rtt in tcp_metrics Eric Dumazet
2014-09-06  0:02 ` Stephen Hemminger [this message]
2014-09-06  0:22   ` Eric Dumazet
2014-09-28 22:59 ` Stephen Hemminger

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=20140905170222.1599ad33@urahara \
    --to=stephen@networkplumber.org \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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