netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] stats output
@ 2018-11-30 13:33 Alexis Vachette
  2018-11-30 18:12 ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: Alexis Vachette @ 2018-11-30 13:33 UTC (permalink / raw)
  To: netdev

When using:

- ip -s link

I think it should be better to print errors stats without adding -s
option twice.

This option print stats for each network interfaces and we want to see
if something is off and especially timers with errors.

Man page of ip command is updated accordingly.

Here is a patchset:

Signed-off-by: Alexis Vachette <avachette@deezer.com>
---
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 85f05a2..c70394d 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -323,7 +323,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
  fprintf(fp,"\n    alias %s",
  (const char *) RTA_DATA(tb[IFLA_IFALIAS]));

- if (do_link && tb[IFLA_STATS64] && show_stats) {
+ if (do_link && tb[IFLA_STATS64]) {
  struct rtnl_link_stats64 slocal;
  struct rtnl_link_stats64 *s = RTA_DATA(tb[IFLA_STATS64]);
  if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
@@ -343,16 +343,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
  if (s->rx_compressed)
  fprintf(fp, " %-7llu",
  (unsigned long long)s->rx_compressed);
- if (show_stats > 1) {
- fprintf(fp, "%s", _SL_);
- fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
- fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
- (unsigned long long)s->rx_length_errors,
- (unsigned long long)s->rx_crc_errors,
- (unsigned long long)s->rx_frame_errors,
- (unsigned long long)s->rx_fifo_errors,
- (unsigned long long)s->rx_missed_errors);
- }
+ fprintf(fp, "%s", _SL_);
+ fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
+ fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
+ (unsigned long long)s->rx_length_errors,
+ (unsigned long long)s->rx_crc_errors,
+ (unsigned long long)s->rx_frame_errors,
+ (unsigned long long)s->rx_fifo_errors,
+ (unsigned long long)s->rx_missed_errors);
  fprintf(fp, "%s", _SL_);
  fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
  s->tx_compressed ? "compressed" : "", _SL_);
@@ -366,17 +364,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
  if (s->tx_compressed)
  fprintf(fp, " %-7llu",
  (unsigned long long)s->tx_compressed);
- if (show_stats > 1) {
- fprintf(fp, "%s", _SL_);
- fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
- fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
- (unsigned long long)s->tx_aborted_errors,
- (unsigned long long)s->tx_fifo_errors,
- (unsigned long long)s->tx_window_errors,
- (unsigned long long)s->tx_heartbeat_errors);
- }
+ fprintf(fp, "%s", _SL_);
+ fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
+ fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
+ (unsigned long long)s->tx_aborted_errors,
+ (unsigned long long)s->tx_fifo_errors,
+ (unsigned long long)s->tx_window_errors,
+ (unsigned long long)s->tx_heartbeat_errors);
  }
- if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS] && show_stats) {
+ if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS]) {
  struct rtnl_link_stats slocal;
  struct rtnl_link_stats *s = RTA_DATA(tb[IFLA_STATS]);
  if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
@@ -393,17 +389,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
  );
  if (s->rx_compressed)
  fprintf(fp, " %-7u", s->rx_compressed);
- if (show_stats > 1) {
- fprintf(fp, "%s", _SL_);
- fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
- fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
- s->rx_length_errors,
- s->rx_crc_errors,
- s->rx_frame_errors,
- s->rx_fifo_errors,
- s->rx_missed_errors
- );
- }
+ fprintf(fp, "%s", _SL_);
+ fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
+ fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
+ s->rx_length_errors,
+ s->rx_crc_errors,
+ s->rx_frame_errors,
+ s->rx_fifo_errors,
+ s->rx_missed_errors
+ );
  fprintf(fp, "%s", _SL_);
  fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
  s->tx_compressed ? "compressed" : "", _SL_);
@@ -412,16 +406,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
  s->tx_dropped, s->tx_carrier_errors, s->collisions);
  if (s->tx_compressed)
  fprintf(fp, " %-7u", s->tx_compressed);
- if (show_stats > 1) {
- fprintf(fp, "%s", _SL_);
- fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
- fprintf(fp, "               %-7u  %-7u %-7u %-7u",
- s->tx_aborted_errors,
- s->tx_fifo_errors,
- s->tx_window_errors,
- s->tx_heartbeat_errors
- );
- }
+ fprintf(fp, "%s", _SL_);
+ fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
+ fprintf(fp, "               %-7u  %-7u %-7u %-7u",
+ s->tx_aborted_errors,
+ s->tx_fifo_errors,
+ s->tx_window_errors,
+ s->tx_heartbeat_errors
+ );
  }
  if (do_link && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) {
  struct rtattr *i, *vflist = tb[IFLA_VFINFO_LIST];
diff --git a/man/man8/ip.8 b/man/man8/ip.8
index 36431b6..6843f0a 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -831,8 +831,7 @@ utility and exit.

 .TP
 .BR "\-s" , " \-stats", " \-statistics"
-output more information.  If the option
-appears twice or more, the amount of information increases.
+output more information.
 As a rule, the information is statistics or some time values.

 .TP
---

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] stats output
  2018-11-30 13:33 [PATCH iproute2] stats output Alexis Vachette
@ 2018-11-30 18:12 ` Stephen Hemminger
  2018-11-30 18:26   ` Roopa Prabhu
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stephen Hemminger @ 2018-11-30 18:12 UTC (permalink / raw)
  To: Alexis Vachette; +Cc: netdev

On Fri, 30 Nov 2018 14:33:49 +0100
Alexis Vachette <avachette@deezer.com> wrote:

> When using:
> 
> - ip -s link
> 
> I think it should be better to print errors stats without adding -s
> option twice.
> 
> This option print stats for each network interfaces and we want to see
> if something is off and especially timers with errors.
> 
> Man page of ip command is updated accordingly.
> 
> Here is a patchset:
> 
> Signed-off-by: Alexis Vachette <avachette@deezer.com>
> ---
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 85f05a2..c70394d 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -323,7 +323,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
>   fprintf(fp,"\n    alias %s",
>   (const char *) RTA_DATA(tb[IFLA_IFALIAS]));
> 
> - if (do_link && tb[IFLA_STATS64] && show_stats) {
> + if (do_link && tb[IFLA_STATS64]) {
>   struct rtnl_link_stats64 slocal;
>   struct rtnl_link_stats64 *s = RTA_DATA(tb[IFLA_STATS64]);
>   if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
> @@ -343,16 +343,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
>   if (s->rx_compressed)
>   fprintf(fp, " %-7llu",
>   (unsigned long long)s->rx_compressed);
> - if (show_stats > 1) {
> - fprintf(fp, "%s", _SL_);
> - fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> - fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
> - (unsigned long long)s->rx_length_errors,
> - (unsigned long long)s->rx_crc_errors,
> - (unsigned long long)s->rx_frame_errors,
> - (unsigned long long)s->rx_fifo_errors,
> - (unsigned long long)s->rx_missed_errors);
> - }
> + fprintf(fp, "%s", _SL_);
> + fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> + fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
> + (unsigned long long)s->rx_length_errors,
> + (unsigned long long)s->rx_crc_errors,
> + (unsigned long long)s->rx_frame_errors,
> + (unsigned long long)s->rx_fifo_errors,
> + (unsigned long long)s->rx_missed_errors);
>   fprintf(fp, "%s", _SL_);
>   fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
>   s->tx_compressed ? "compressed" : "", _SL_);
> @@ -366,17 +364,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
>   if (s->tx_compressed)
>   fprintf(fp, " %-7llu",
>   (unsigned long long)s->tx_compressed);
> - if (show_stats > 1) {
> - fprintf(fp, "%s", _SL_);
> - fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> - fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
> - (unsigned long long)s->tx_aborted_errors,
> - (unsigned long long)s->tx_fifo_errors,
> - (unsigned long long)s->tx_window_errors,
> - (unsigned long long)s->tx_heartbeat_errors);
> - }
> + fprintf(fp, "%s", _SL_);
> + fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> + fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
> + (unsigned long long)s->tx_aborted_errors,
> + (unsigned long long)s->tx_fifo_errors,
> + (unsigned long long)s->tx_window_errors,
> + (unsigned long long)s->tx_heartbeat_errors);
>   }
> - if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS] && show_stats) {
> + if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS]) {
>   struct rtnl_link_stats slocal;
>   struct rtnl_link_stats *s = RTA_DATA(tb[IFLA_STATS]);
>   if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
> @@ -393,17 +389,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
>   );
>   if (s->rx_compressed)
>   fprintf(fp, " %-7u", s->rx_compressed);
> - if (show_stats > 1) {
> - fprintf(fp, "%s", _SL_);
> - fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> - fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
> - s->rx_length_errors,
> - s->rx_crc_errors,
> - s->rx_frame_errors,
> - s->rx_fifo_errors,
> - s->rx_missed_errors
> - );
> - }
> + fprintf(fp, "%s", _SL_);
> + fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> + fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
> + s->rx_length_errors,
> + s->rx_crc_errors,
> + s->rx_frame_errors,
> + s->rx_fifo_errors,
> + s->rx_missed_errors
> + );
>   fprintf(fp, "%s", _SL_);
>   fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
>   s->tx_compressed ? "compressed" : "", _SL_);
> @@ -412,16 +406,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
>   s->tx_dropped, s->tx_carrier_errors, s->collisions);
>   if (s->tx_compressed)
>   fprintf(fp, " %-7u", s->tx_compressed);
> - if (show_stats > 1) {
> - fprintf(fp, "%s", _SL_);
> - fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> - fprintf(fp, "               %-7u  %-7u %-7u %-7u",
> - s->tx_aborted_errors,
> - s->tx_fifo_errors,
> - s->tx_window_errors,
> - s->tx_heartbeat_errors
> - );
> - }
> + fprintf(fp, "%s", _SL_);
> + fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> + fprintf(fp, "               %-7u  %-7u %-7u %-7u",
> + s->tx_aborted_errors,
> + s->tx_fifo_errors,
> + s->tx_window_errors,
> + s->tx_heartbeat_errors
> + );
>   }
>   if (do_link && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) {
>   struct rtattr *i, *vflist = tb[IFLA_VFINFO_LIST];
> diff --git a/man/man8/ip.8 b/man/man8/ip.8
> index 36431b6..6843f0a 100644
> --- a/man/man8/ip.8
> +++ b/man/man8/ip.8
> @@ -831,8 +831,7 @@ utility and exit.
> 
>  .TP
>  .BR "\-s" , " \-stats", " \-statistics"
> -output more information.  If the option
> -appears twice or more, the amount of information increases.
> +output more information.
>  As a rule, the information is statistics or some time values.
> 
>  .TP
> ---

I can understand why you would want this, but it is changing the
behavior of an existing command that might be used in scripts.

Also, your patch was mangled by your mail client. It no longer has
proper indentation and whitespace.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] stats output
  2018-11-30 18:12 ` Stephen Hemminger
@ 2018-11-30 18:26   ` Roopa Prabhu
  2018-11-30 18:31   ` David Ahern
  2018-11-30 19:22   ` Alexis Vachette
  2 siblings, 0 replies; 6+ messages in thread
From: Roopa Prabhu @ 2018-11-30 18:26 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: avachette, netdev

On Fri, Nov 30, 2018 at 10:12 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Fri, 30 Nov 2018 14:33:49 +0100
> Alexis Vachette <avachette@deezer.com> wrote:
>
> > When using:
> >
> > - ip -s link
> >
> > I think it should be better to print errors stats without adding -s
> > option twice.
> >
> > This option print stats for each network interfaces and we want to see
> > if something is off and especially timers with errors.
> >
> > Man page of ip command is updated accordingly.
> >
> > Here is a patchset:
> >
> > Signed-off-by: Alexis Vachette <avachette@deezer.com>
> > ---
> > diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> > index 85f05a2..c70394d 100644
> > --- a/ip/ipaddress.c
> > +++ b/ip/ipaddress.c
> > @@ -323,7 +323,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   fprintf(fp,"\n    alias %s",
> >   (const char *) RTA_DATA(tb[IFLA_IFALIAS]));
> >
> > - if (do_link && tb[IFLA_STATS64] && show_stats) {
> > + if (do_link && tb[IFLA_STATS64]) {
> >   struct rtnl_link_stats64 slocal;
> >   struct rtnl_link_stats64 *s = RTA_DATA(tb[IFLA_STATS64]);
> >   if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
> > @@ -343,16 +343,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   if (s->rx_compressed)
> >   fprintf(fp, " %-7llu",
> >   (unsigned long long)s->rx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > - fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
> > - (unsigned long long)s->rx_length_errors,
> > - (unsigned long long)s->rx_crc_errors,
> > - (unsigned long long)s->rx_frame_errors,
> > - (unsigned long long)s->rx_fifo_errors,
> > - (unsigned long long)s->rx_missed_errors);
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > + fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
> > + (unsigned long long)s->rx_length_errors,
> > + (unsigned long long)s->rx_crc_errors,
> > + (unsigned long long)s->rx_frame_errors,
> > + (unsigned long long)s->rx_fifo_errors,
> > + (unsigned long long)s->rx_missed_errors);
> >   fprintf(fp, "%s", _SL_);
> >   fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
> >   s->tx_compressed ? "compressed" : "", _SL_);
> > @@ -366,17 +364,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   if (s->tx_compressed)
> >   fprintf(fp, " %-7llu",
> >   (unsigned long long)s->tx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > - fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
> > - (unsigned long long)s->tx_aborted_errors,
> > - (unsigned long long)s->tx_fifo_errors,
> > - (unsigned long long)s->tx_window_errors,
> > - (unsigned long long)s->tx_heartbeat_errors);
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > + fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
> > + (unsigned long long)s->tx_aborted_errors,
> > + (unsigned long long)s->tx_fifo_errors,
> > + (unsigned long long)s->tx_window_errors,
> > + (unsigned long long)s->tx_heartbeat_errors);
> >   }
> > - if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS] && show_stats) {
> > + if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS]) {
> >   struct rtnl_link_stats slocal;
> >   struct rtnl_link_stats *s = RTA_DATA(tb[IFLA_STATS]);
> >   if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
> > @@ -393,17 +389,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   );
> >   if (s->rx_compressed)
> >   fprintf(fp, " %-7u", s->rx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > - fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
> > - s->rx_length_errors,
> > - s->rx_crc_errors,
> > - s->rx_frame_errors,
> > - s->rx_fifo_errors,
> > - s->rx_missed_errors
> > - );
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > + fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
> > + s->rx_length_errors,
> > + s->rx_crc_errors,
> > + s->rx_frame_errors,
> > + s->rx_fifo_errors,
> > + s->rx_missed_errors
> > + );
> >   fprintf(fp, "%s", _SL_);
> >   fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
> >   s->tx_compressed ? "compressed" : "", _SL_);
> > @@ -412,16 +406,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   s->tx_dropped, s->tx_carrier_errors, s->collisions);
> >   if (s->tx_compressed)
> >   fprintf(fp, " %-7u", s->tx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > - fprintf(fp, "               %-7u  %-7u %-7u %-7u",
> > - s->tx_aborted_errors,
> > - s->tx_fifo_errors,
> > - s->tx_window_errors,
> > - s->tx_heartbeat_errors
> > - );
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > + fprintf(fp, "               %-7u  %-7u %-7u %-7u",
> > + s->tx_aborted_errors,
> > + s->tx_fifo_errors,
> > + s->tx_window_errors,
> > + s->tx_heartbeat_errors
> > + );
> >   }
> >   if (do_link && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) {
> >   struct rtattr *i, *vflist = tb[IFLA_VFINFO_LIST];
> > diff --git a/man/man8/ip.8 b/man/man8/ip.8
> > index 36431b6..6843f0a 100644
> > --- a/man/man8/ip.8
> > +++ b/man/man8/ip.8
> > @@ -831,8 +831,7 @@ utility and exit.
> >
> >  .TP
> >  .BR "\-s" , " \-stats", " \-statistics"
> > -output more information.  If the option
> > -appears twice or more, the amount of information increases.
> > +output more information.
> >  As a rule, the information is statistics or some time values.
> >
> >  .TP
> > ---
>
> I can understand why you would want this, but it is changing the
> behavior of an existing command that might be used in scripts.
>

+1

> Also, your patch was mangled by your mail client. It no longer has
> proper indentation and whitespace.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] stats output
  2018-11-30 18:12 ` Stephen Hemminger
  2018-11-30 18:26   ` Roopa Prabhu
@ 2018-11-30 18:31   ` David Ahern
  2018-11-30 19:22   ` Alexis Vachette
  2 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2018-11-30 18:31 UTC (permalink / raw)
  To: Stephen Hemminger, Alexis Vachette; +Cc: netdev

On 11/30/18 11:12 AM, Stephen Hemminger wrote:
> I can understand why you would want this, but it is changing the
> behavior of an existing command that might be used in scripts.

+1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] stats output
  2018-11-30 18:12 ` Stephen Hemminger
  2018-11-30 18:26   ` Roopa Prabhu
  2018-11-30 18:31   ` David Ahern
@ 2018-11-30 19:22   ` Alexis Vachette
  2018-11-30 19:55     ` Stephen Hemminger
  2 siblings, 1 reply; 6+ messages in thread
From: Alexis Vachette @ 2018-11-30 19:22 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Hi Stephen,

Thanks for your kind reply.

It's sad to hear that, I am aware of your concern too.

But it's not the best behavior for a network engineer.

Is it possible to add a new option or everything is stone graved ?

If yes I will fix my e-mail client to submit a correct PR.
On Fri, 30 Nov 2018 at 19:12, Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Fri, 30 Nov 2018 14:33:49 +0100
> Alexis Vachette <avachette@deezer.com> wrote:
>
> > When using:
> >
> > - ip -s link
> >
> > I think it should be better to print errors stats without adding -s
> > option twice.
> >
> > This option print stats for each network interfaces and we want to see
> > if something is off and especially timers with errors.
> >
> > Man page of ip command is updated accordingly.
> >
> > Here is a patchset:
> >
> > Signed-off-by: Alexis Vachette <avachette@deezer.com>
> > ---
> > diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> > index 85f05a2..c70394d 100644
> > --- a/ip/ipaddress.c
> > +++ b/ip/ipaddress.c
> > @@ -323,7 +323,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   fprintf(fp,"\n    alias %s",
> >   (const char *) RTA_DATA(tb[IFLA_IFALIAS]));
> >
> > - if (do_link && tb[IFLA_STATS64] && show_stats) {
> > + if (do_link && tb[IFLA_STATS64]) {
> >   struct rtnl_link_stats64 slocal;
> >   struct rtnl_link_stats64 *s = RTA_DATA(tb[IFLA_STATS64]);
> >   if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
> > @@ -343,16 +343,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   if (s->rx_compressed)
> >   fprintf(fp, " %-7llu",
> >   (unsigned long long)s->rx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > - fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
> > - (unsigned long long)s->rx_length_errors,
> > - (unsigned long long)s->rx_crc_errors,
> > - (unsigned long long)s->rx_frame_errors,
> > - (unsigned long long)s->rx_fifo_errors,
> > - (unsigned long long)s->rx_missed_errors);
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > + fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu %-7llu",
> > + (unsigned long long)s->rx_length_errors,
> > + (unsigned long long)s->rx_crc_errors,
> > + (unsigned long long)s->rx_frame_errors,
> > + (unsigned long long)s->rx_fifo_errors,
> > + (unsigned long long)s->rx_missed_errors);
> >   fprintf(fp, "%s", _SL_);
> >   fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
> >   s->tx_compressed ? "compressed" : "", _SL_);
> > @@ -366,17 +364,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   if (s->tx_compressed)
> >   fprintf(fp, " %-7llu",
> >   (unsigned long long)s->tx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > - fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
> > - (unsigned long long)s->tx_aborted_errors,
> > - (unsigned long long)s->tx_fifo_errors,
> > - (unsigned long long)s->tx_window_errors,
> > - (unsigned long long)s->tx_heartbeat_errors);
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > + fprintf(fp, "               %-7llu  %-7llu %-7llu %-7llu",
> > + (unsigned long long)s->tx_aborted_errors,
> > + (unsigned long long)s->tx_fifo_errors,
> > + (unsigned long long)s->tx_window_errors,
> > + (unsigned long long)s->tx_heartbeat_errors);
> >   }
> > - if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS] && show_stats) {
> > + if (do_link && !tb[IFLA_STATS64] && tb[IFLA_STATS]) {
> >   struct rtnl_link_stats slocal;
> >   struct rtnl_link_stats *s = RTA_DATA(tb[IFLA_STATS]);
> >   if (((unsigned long)s) & (sizeof(unsigned long)-1)) {
> > @@ -393,17 +389,15 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   );
> >   if (s->rx_compressed)
> >   fprintf(fp, " %-7u", s->rx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > - fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
> > - s->rx_length_errors,
> > - s->rx_crc_errors,
> > - s->rx_frame_errors,
> > - s->rx_fifo_errors,
> > - s->rx_missed_errors
> > - );
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
> > + fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
> > + s->rx_length_errors,
> > + s->rx_crc_errors,
> > + s->rx_frame_errors,
> > + s->rx_fifo_errors,
> > + s->rx_missed_errors
> > + );
> >   fprintf(fp, "%s", _SL_);
> >   fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
> >   s->tx_compressed ? "compressed" : "", _SL_);
> > @@ -412,16 +406,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
> >   s->tx_dropped, s->tx_carrier_errors, s->collisions);
> >   if (s->tx_compressed)
> >   fprintf(fp, " %-7u", s->tx_compressed);
> > - if (show_stats > 1) {
> > - fprintf(fp, "%s", _SL_);
> > - fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > - fprintf(fp, "               %-7u  %-7u %-7u %-7u",
> > - s->tx_aborted_errors,
> > - s->tx_fifo_errors,
> > - s->tx_window_errors,
> > - s->tx_heartbeat_errors
> > - );
> > - }
> > + fprintf(fp, "%s", _SL_);
> > + fprintf(fp, "    TX errors: aborted fifo    window  heartbeat%s", _SL_);
> > + fprintf(fp, "               %-7u  %-7u %-7u %-7u",
> > + s->tx_aborted_errors,
> > + s->tx_fifo_errors,
> > + s->tx_window_errors,
> > + s->tx_heartbeat_errors
> > + );
> >   }
> >   if (do_link && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) {
> >   struct rtattr *i, *vflist = tb[IFLA_VFINFO_LIST];
> > diff --git a/man/man8/ip.8 b/man/man8/ip.8
> > index 36431b6..6843f0a 100644
> > --- a/man/man8/ip.8
> > +++ b/man/man8/ip.8
> > @@ -831,8 +831,7 @@ utility and exit.
> >
> >  .TP
> >  .BR "\-s" , " \-stats", " \-statistics"
> > -output more information.  If the option
> > -appears twice or more, the amount of information increases.
> > +output more information.
> >  As a rule, the information is statistics or some time values.
> >
> >  .TP
> > ---
>
> I can understand why you would want this, but it is changing the
> behavior of an existing command that might be used in scripts.
>
> Also, your patch was mangled by your mail client. It no longer has
> proper indentation and whitespace.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] stats output
  2018-11-30 19:22   ` Alexis Vachette
@ 2018-11-30 19:55     ` Stephen Hemminger
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2018-11-30 19:55 UTC (permalink / raw)
  To: Alexis Vachette; +Cc: netdev

On Fri, 30 Nov 2018 20:22:35 +0100
Alexis Vachette <avachette@deezer.com> wrote:

> Hi Stephen,
> 
> Thanks for your kind reply.
> 
> It's sad to hear that, I am aware of your concern too.
> 
> But it's not the best behavior for a network engineer.
> 
> Is it possible to add a new option or everything is stone graved ?

You can add new options at will as long as they don't conflict with existing
usage (and you update the man page). JSON and colorized output were added
in the last years.

Note: the iproute options are definitely a hodge-podge collection, the code doesn't
follow the typical Linux style of using getopt and getopt_long, and has a bit of
network OS model as well.

What are you thinking of.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-01  7:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-30 13:33 [PATCH iproute2] stats output Alexis Vachette
2018-11-30 18:12 ` Stephen Hemminger
2018-11-30 18:26   ` Roopa Prabhu
2018-11-30 18:31   ` David Ahern
2018-11-30 19:22   ` Alexis Vachette
2018-11-30 19:55     ` Stephen Hemminger

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).