[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1409962978.26422.150.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Fri, 05 Sep 2014 17:22:58 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2] ip: support of usec rtt in tcp_metrics
On Fri, 2014-09-05 at 17:02 -0700, Stephen Hemminger wrote:
> On Fri, 05 Sep 2014 16:54:04 -0700
> Eric Dumazet <eric.dumazet@...il.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.
Because for compatibility reasons, kernel gives all values,
we want to output one of them, the most accurate one.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists