All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show
@ 2022-06-09 21:05 Jeffrey Ji
  2022-06-09 21:07 ` Jeffrey Ji
  2022-06-12 15:55 ` David Ahern
  0 siblings, 2 replies; 5+ messages in thread
From: Jeffrey Ji @ 2022-06-09 21:05 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: Brian Vazquez, netdev, Jeffrey Ji

From: Jeffrey Ji <jeffreyji@google.com>

This stat was added in commit 794c24e9921f ("net-core: rx_otherhost_dropped to core_stats")

Tested: sent packet with wrong MAC address from 1
network namespace to another, verified that counter showed "1" in
`ip -s -s link sh` and `ip -s -s -j link sh`

Signed-off-by: Jeffrey Ji <jeffreyji@google.com>
---
changelog:
v2: otherhost <- otherhost_dropped

 ip/ipaddress.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 142731933ba3..d7d047cf901e 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -692,6 +692,7 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
 		strlen("heartbt"),
 		strlen("overrun"),
 		strlen("compressed"),
+		strlen("otherhost"),
 	};
 
 	if (is_json_context()) {
@@ -730,6 +731,10 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
 			if (s->rx_nohandler)
 				print_u64(PRINT_JSON,
 					   "nohandler", NULL, s->rx_nohandler);
+			if (s->rx_otherhost_dropped)
+				print_u64(PRINT_JSON,
+					   "otherhost", NULL,
+					   s->rx_otherhost_dropped);
 		}
 		close_json_object();
 
@@ -778,7 +783,8 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
 			size_columns(cols, ARRAY_SIZE(cols), 0,
 				     s->rx_length_errors, s->rx_crc_errors,
 				     s->rx_frame_errors, s->rx_fifo_errors,
-				     s->rx_over_errors, s->rx_nohandler);
+				     s->rx_over_errors, s->rx_nohandler,
+				     s->rx_otherhost_dropped);
 		size_columns(cols, ARRAY_SIZE(cols),
 			     s->tx_bytes, s->tx_packets, s->tx_errors,
 			     s->tx_dropped, s->tx_carrier_errors,
@@ -811,11 +817,14 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
 		/* RX error stats */
 		if (show_stats > 1) {
 			fprintf(fp, "%s", _SL_);
-			fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s %*s%s",
+			fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s%*s%*s%s",
 				cols[0] - 10, "", cols[1], "length",
 				cols[2], "crc", cols[3], "frame",
 				cols[4], "fifo", cols[5], "overrun",
-				cols[6], s->rx_nohandler ? "nohandler" : "",
+				s->rx_nohandler ? cols[6] + 1 : 0,
+				s->rx_nohandler ? " nohandler" : "",
+				s->rx_otherhost_dropped ? cols[7] + 1 : 0,
+				s->rx_otherhost_dropped ? " otherhost" : "",
 				_SL_);
 			fprintf(fp, "%*s", cols[0] + 5, "");
 			print_num(fp, cols[1], s->rx_length_errors);
@@ -825,6 +834,9 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
 			print_num(fp, cols[5], s->rx_over_errors);
 			if (s->rx_nohandler)
 				print_num(fp, cols[6], s->rx_nohandler);
+			if (s->rx_otherhost_dropped)
+				print_num(fp, cols[7],
+				s->rx_otherhost_dropped);
 		}
 		fprintf(fp, "%s", _SL_);
 
-- 
2.36.1.476.g0c4daa206d-goog


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

* Re: [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show
  2022-06-09 21:05 [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show Jeffrey Ji
@ 2022-06-09 21:07 ` Jeffrey Ji
  2022-06-09 21:08   ` Jeffrey Ji
  2022-06-12 15:55 ` David Ahern
  1 sibling, 1 reply; 5+ messages in thread
From: Jeffrey Ji @ 2022-06-09 21:07 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: Brian Vazquez, netdev, Jeffrey Ji

sample output:

mypc[netns:ns-123771-2]:~# ip netns exec $ns2 ./ip -s -s link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped missed mcast
0 0 0 0 0 0
RX errors: length crc frame fifo overrun
0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
TX errors: aborted fifo window heartbt transns
0 0 0 0 0
2: veth2@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP mode DEFAULT group default qlen 1000
link/ether 8e:c0:a5:7d:87:ad brd ff:ff:ff:ff:ff:ff link-netns ns-123771-1
RX: bytes packets errors dropped missed mcast
1766 22 0 0 0 0
RX errors: length crc frame fifo overrun otherhost
0 0 0 0 0 10
TX: bytes packets errors dropped carrier collsns
1126 13 0 0 0 0
TX errors: aborted fifo window heartbt transns
0 0 0 0 2

On Thu, Jun 9, 2022 at 2:05 PM Jeffrey Ji <jeffreyjilinux@gmail.com> wrote:
>
> From: Jeffrey Ji <jeffreyji@google.com>
>
> This stat was added in commit 794c24e9921f ("net-core: rx_otherhost_dropped to core_stats")
>
> Tested: sent packet with wrong MAC address from 1
> network namespace to another, verified that counter showed "1" in
> `ip -s -s link sh` and `ip -s -s -j link sh`
>
> Signed-off-by: Jeffrey Ji <jeffreyji@google.com>
> ---
> changelog:
> v2: otherhost <- otherhost_dropped
>
>  ip/ipaddress.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 142731933ba3..d7d047cf901e 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -692,6 +692,7 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
>                 strlen("heartbt"),
>                 strlen("overrun"),
>                 strlen("compressed"),
> +               strlen("otherhost"),
>         };
>
>         if (is_json_context()) {
> @@ -730,6 +731,10 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
>                         if (s->rx_nohandler)
>                                 print_u64(PRINT_JSON,
>                                            "nohandler", NULL, s->rx_nohandler);
> +                       if (s->rx_otherhost_dropped)
> +                               print_u64(PRINT_JSON,
> +                                          "otherhost", NULL,
> +                                          s->rx_otherhost_dropped);
>                 }
>                 close_json_object();
>
> @@ -778,7 +783,8 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
>                         size_columns(cols, ARRAY_SIZE(cols), 0,
>                                      s->rx_length_errors, s->rx_crc_errors,
>                                      s->rx_frame_errors, s->rx_fifo_errors,
> -                                    s->rx_over_errors, s->rx_nohandler);
> +                                    s->rx_over_errors, s->rx_nohandler,
> +                                    s->rx_otherhost_dropped);
>                 size_columns(cols, ARRAY_SIZE(cols),
>                              s->tx_bytes, s->tx_packets, s->tx_errors,
>                              s->tx_dropped, s->tx_carrier_errors,
> @@ -811,11 +817,14 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
>                 /* RX error stats */
>                 if (show_stats > 1) {
>                         fprintf(fp, "%s", _SL_);
> -                       fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s %*s%s",
> +                       fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s%*s%*s%s",
>                                 cols[0] - 10, "", cols[1], "length",
>                                 cols[2], "crc", cols[3], "frame",
>                                 cols[4], "fifo", cols[5], "overrun",
> -                               cols[6], s->rx_nohandler ? "nohandler" : "",
> +                               s->rx_nohandler ? cols[6] + 1 : 0,
> +                               s->rx_nohandler ? " nohandler" : "",
> +                               s->rx_otherhost_dropped ? cols[7] + 1 : 0,
> +                               s->rx_otherhost_dropped ? " otherhost" : "",
>                                 _SL_);
>                         fprintf(fp, "%*s", cols[0] + 5, "");
>                         print_num(fp, cols[1], s->rx_length_errors);
> @@ -825,6 +834,9 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
>                         print_num(fp, cols[5], s->rx_over_errors);
>                         if (s->rx_nohandler)
>                                 print_num(fp, cols[6], s->rx_nohandler);
> +                       if (s->rx_otherhost_dropped)
> +                               print_num(fp, cols[7],
> +                               s->rx_otherhost_dropped);
>                 }
>                 fprintf(fp, "%s", _SL_);
>
> --
> 2.36.1.476.g0c4daa206d-goog
>

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

* Re: [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show
  2022-06-09 21:07 ` Jeffrey Ji
@ 2022-06-09 21:08   ` Jeffrey Ji
  2022-06-09 21:12     ` Jeffrey Ji
  0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey Ji @ 2022-06-09 21:08 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: Brian Vazquez, netdev, Jeffrey Ji

json output:

mypc[netns:ns-123771-2]:~# ip netns exec $ns2 ./ip -s -s -j link sh
[{"ifindex":1,"ifname":"lo","flags":["LOOPBACK","UP","LOWER_UP"],"mtu":65536,"qdisc":"noqueue","operstate":"UNKNOWN","linkmode":"DEFAULT","group":"default","txqlen":1000,"link_type":"loopback","address":"00:00:00:00:00:00","broadcast":"00:00:00:00:00:00","stats64":{"rx":{"bytes":0,"packets":0,"errors":0,"dropped":0,"over_errors":0,"multicast":0,"length_errors":0,"crc_errors":0,"frame_errors":0,"fifo_errors":0,"missed_errors":0,"otherhost":0},"tx":{"bytes":0,"packets":0,"errors":0,"dropped":0,"carrier_errors":0,"collisions":0,"aborted_errors":0,"fifo_errors":0,"window_errors":0,"heartbeat_errors":0,"carrier_changes":0}}},{"ifindex":2,"link_index":2,"ifname":"veth2","flags":["BROADCAST","MULTICAST","UP","LOWER_UP"],"mtu":1500,"qdisc":"noqueue","operstate":"UP","linkmode":"DEFAULT","group":"default","txqlen":1000,"link_type":"ether","address":"8e:c0:a5:7d:87:ad","broadcast":"ff:ff:ff:ff:ff:ff","link_netnsid":0,"stats64":{"rx":{"bytes":2116,"packets":27,"errors":0,"dropped":0,"over_errors":0,"multicast":0,"length_errors":0,"crc_errors":0,"frame_errors":0,"fifo_errors":0,"missed_errors":0,"otherhost":10},"tx":{"bytes":1406,"packets":17,"errors":0,"dropped":0,"carrier_errors":0,"collisions":0,"aborted_errors":0,"fifo_errors":0,"window_errors":0,"heartbeat_errors":0,"carrier_changes":2}}}]

On Thu, Jun 9, 2022 at 2:07 PM Jeffrey Ji <jeffreyjilinux@gmail.com> wrote:
>
> sample output:
>
> mypc[netns:ns-123771-2]:~# ip netns exec $ns2 ./ip -s -s link sh
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
> mode DEFAULT group default qlen 1000
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> RX: bytes packets errors dropped missed mcast
> 0 0 0 0 0 0
> RX errors: length crc frame fifo overrun
> 0 0 0 0 0
> TX: bytes packets errors dropped carrier collsns
> 0 0 0 0 0 0
> TX errors: aborted fifo window heartbt transns
> 0 0 0 0 0
> 2: veth2@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
> state UP mode DEFAULT group default qlen 1000
> link/ether 8e:c0:a5:7d:87:ad brd ff:ff:ff:ff:ff:ff link-netns ns-123771-1
> RX: bytes packets errors dropped missed mcast
> 1766 22 0 0 0 0
> RX errors: length crc frame fifo overrun otherhost
> 0 0 0 0 0 10
> TX: bytes packets errors dropped carrier collsns
> 1126 13 0 0 0 0
> TX errors: aborted fifo window heartbt transns
> 0 0 0 0 2
>
> On Thu, Jun 9, 2022 at 2:05 PM Jeffrey Ji <jeffreyjilinux@gmail.com> wrote:
> >
> > From: Jeffrey Ji <jeffreyji@google.com>
> >
> > This stat was added in commit 794c24e9921f ("net-core: rx_otherhost_dropped to core_stats")
> >
> > Tested: sent packet with wrong MAC address from 1
> > network namespace to another, verified that counter showed "1" in
> > `ip -s -s link sh` and `ip -s -s -j link sh`
> >
> > Signed-off-by: Jeffrey Ji <jeffreyji@google.com>
> > ---
> > changelog:
> > v2: otherhost <- otherhost_dropped
> >
> >  ip/ipaddress.c | 18 +++++++++++++++---
> >  1 file changed, 15 insertions(+), 3 deletions(-)
> >
> > diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> > index 142731933ba3..d7d047cf901e 100644
> > --- a/ip/ipaddress.c
> > +++ b/ip/ipaddress.c
> > @@ -692,6 +692,7 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> >                 strlen("heartbt"),
> >                 strlen("overrun"),
> >                 strlen("compressed"),
> > +               strlen("otherhost"),
> >         };
> >
> >         if (is_json_context()) {
> > @@ -730,6 +731,10 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> >                         if (s->rx_nohandler)
> >                                 print_u64(PRINT_JSON,
> >                                            "nohandler", NULL, s->rx_nohandler);
> > +                       if (s->rx_otherhost_dropped)
> > +                               print_u64(PRINT_JSON,
> > +                                          "otherhost", NULL,
> > +                                          s->rx_otherhost_dropped);
> >                 }
> >                 close_json_object();
> >
> > @@ -778,7 +783,8 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> >                         size_columns(cols, ARRAY_SIZE(cols), 0,
> >                                      s->rx_length_errors, s->rx_crc_errors,
> >                                      s->rx_frame_errors, s->rx_fifo_errors,
> > -                                    s->rx_over_errors, s->rx_nohandler);
> > +                                    s->rx_over_errors, s->rx_nohandler,
> > +                                    s->rx_otherhost_dropped);
> >                 size_columns(cols, ARRAY_SIZE(cols),
> >                              s->tx_bytes, s->tx_packets, s->tx_errors,
> >                              s->tx_dropped, s->tx_carrier_errors,
> > @@ -811,11 +817,14 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> >                 /* RX error stats */
> >                 if (show_stats > 1) {
> >                         fprintf(fp, "%s", _SL_);
> > -                       fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s %*s%s",
> > +                       fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s%*s%*s%s",
> >                                 cols[0] - 10, "", cols[1], "length",
> >                                 cols[2], "crc", cols[3], "frame",
> >                                 cols[4], "fifo", cols[5], "overrun",
> > -                               cols[6], s->rx_nohandler ? "nohandler" : "",
> > +                               s->rx_nohandler ? cols[6] + 1 : 0,
> > +                               s->rx_nohandler ? " nohandler" : "",
> > +                               s->rx_otherhost_dropped ? cols[7] + 1 : 0,
> > +                               s->rx_otherhost_dropped ? " otherhost" : "",
> >                                 _SL_);
> >                         fprintf(fp, "%*s", cols[0] + 5, "");
> >                         print_num(fp, cols[1], s->rx_length_errors);
> > @@ -825,6 +834,9 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> >                         print_num(fp, cols[5], s->rx_over_errors);
> >                         if (s->rx_nohandler)
> >                                 print_num(fp, cols[6], s->rx_nohandler);
> > +                       if (s->rx_otherhost_dropped)
> > +                               print_num(fp, cols[7],
> > +                               s->rx_otherhost_dropped);
> >                 }
> >                 fprintf(fp, "%s", _SL_);
> >
> > --
> > 2.36.1.476.g0c4daa206d-goog
> >

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

* Re: [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show
  2022-06-09 21:08   ` Jeffrey Ji
@ 2022-06-09 21:12     ` Jeffrey Ji
  0 siblings, 0 replies; 5+ messages in thread
From: Jeffrey Ji @ 2022-06-09 21:12 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: Brian Vazquez, netdev, Jeffrey Ji

Sorry, the spacing got messed up when I pasted into Gmail, it should
be fixed now.

mypc[netns:ns-123771-2]:~# ip netns exec $ns2 ./ip -s -s link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX:  bytes packets errors dropped  missed   mcast
             0       0      0       0       0       0
    RX errors:  length    crc   frame    fifo overrun
                     0      0       0       0       0
    TX:  bytes packets errors dropped carrier collsns
             0       0      0       0       0       0
    TX errors: aborted   fifo  window heartbt transns
                     0      0       0       0       0
2: veth2@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP mode DEFAULT group default qlen 1000
    link/ether 8e:c0:a5:7d:87:ad brd ff:ff:ff:ff:ff:ff link-netns ns-123771-1
    RX:  bytes packets errors dropped  missed   mcast
          1766      22      0       0       0       0
    RX errors:  length    crc   frame    fifo overrun otherhost
                     0      0       0       0       0        10
    TX:  bytes packets errors dropped carrier collsns
          1126      13      0       0       0       0
    TX errors: aborted   fifo  window heartbt transns
                     0      0       0       0       2

On Thu, Jun 9, 2022 at 2:08 PM Jeffrey Ji <jeffreyjilinux@gmail.com> wrote:
>
> json output:
>
> mypc[netns:ns-123771-2]:~# ip netns exec $ns2 ./ip -s -s -j link sh
> [{"ifindex":1,"ifname":"lo","flags":["LOOPBACK","UP","LOWER_UP"],"mtu":65536,"qdisc":"noqueue","operstate":"UNKNOWN","linkmode":"DEFAULT","group":"default","txqlen":1000,"link_type":"loopback","address":"00:00:00:00:00:00","broadcast":"00:00:00:00:00:00","stats64":{"rx":{"bytes":0,"packets":0,"errors":0,"dropped":0,"over_errors":0,"multicast":0,"length_errors":0,"crc_errors":0,"frame_errors":0,"fifo_errors":0,"missed_errors":0,"otherhost":0},"tx":{"bytes":0,"packets":0,"errors":0,"dropped":0,"carrier_errors":0,"collisions":0,"aborted_errors":0,"fifo_errors":0,"window_errors":0,"heartbeat_errors":0,"carrier_changes":0}}},{"ifindex":2,"link_index":2,"ifname":"veth2","flags":["BROADCAST","MULTICAST","UP","LOWER_UP"],"mtu":1500,"qdisc":"noqueue","operstate":"UP","linkmode":"DEFAULT","group":"default","txqlen":1000,"link_type":"ether","address":"8e:c0:a5:7d:87:ad","broadcast":"ff:ff:ff:ff:ff:ff","link_netnsid":0,"stats64":{"rx":{"bytes":2116,"packets":27,"errors":0,"dropped":0,"over_errors":0,"multicast":0,"length_errors":0,"crc_errors":0,"frame_errors":0,"fifo_errors":0,"missed_errors":0,"otherhost":10},"tx":{"bytes":1406,"packets":17,"errors":0,"dropped":0,"carrier_errors":0,"collisions":0,"aborted_errors":0,"fifo_errors":0,"window_errors":0,"heartbeat_errors":0,"carrier_changes":2}}}]
>
> On Thu, Jun 9, 2022 at 2:07 PM Jeffrey Ji <jeffreyjilinux@gmail.com> wrote:
> >
> > sample output:
> >
> > mypc[netns:ns-123771-2]:~# ip netns exec $ns2 ./ip -s -s link sh
> > 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
> > mode DEFAULT group default qlen 1000
> > link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> > RX: bytes packets errors dropped missed mcast
> > 0 0 0 0 0 0
> > RX errors: length crc frame fifo overrun
> > 0 0 0 0 0
> > TX: bytes packets errors dropped carrier collsns
> > 0 0 0 0 0 0
> > TX errors: aborted fifo window heartbt transns
> > 0 0 0 0 0
> > 2: veth2@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
> > state UP mode DEFAULT group default qlen 1000
> > link/ether 8e:c0:a5:7d:87:ad brd ff:ff:ff:ff:ff:ff link-netns ns-123771-1
> > RX: bytes packets errors dropped missed mcast
> > 1766 22 0 0 0 0
> > RX errors: length crc frame fifo overrun otherhost
> > 0 0 0 0 0 10
> > TX: bytes packets errors dropped carrier collsns
> > 1126 13 0 0 0 0
> > TX errors: aborted fifo window heartbt transns
> > 0 0 0 0 2
> >
> > On Thu, Jun 9, 2022 at 2:05 PM Jeffrey Ji <jeffreyjilinux@gmail.com> wrote:
> > >
> > > From: Jeffrey Ji <jeffreyji@google.com>
> > >
> > > This stat was added in commit 794c24e9921f ("net-core: rx_otherhost_dropped to core_stats")
> > >
> > > Tested: sent packet with wrong MAC address from 1
> > > network namespace to another, verified that counter showed "1" in
> > > `ip -s -s link sh` and `ip -s -s -j link sh`
> > >
> > > Signed-off-by: Jeffrey Ji <jeffreyji@google.com>
> > > ---
> > > changelog:
> > > v2: otherhost <- otherhost_dropped
> > >
> > >  ip/ipaddress.c | 18 +++++++++++++++---
> > >  1 file changed, 15 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> > > index 142731933ba3..d7d047cf901e 100644
> > > --- a/ip/ipaddress.c
> > > +++ b/ip/ipaddress.c
> > > @@ -692,6 +692,7 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> > >                 strlen("heartbt"),
> > >                 strlen("overrun"),
> > >                 strlen("compressed"),
> > > +               strlen("otherhost"),
> > >         };
> > >
> > >         if (is_json_context()) {
> > > @@ -730,6 +731,10 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> > >                         if (s->rx_nohandler)
> > >                                 print_u64(PRINT_JSON,
> > >                                            "nohandler", NULL, s->rx_nohandler);
> > > +                       if (s->rx_otherhost_dropped)
> > > +                               print_u64(PRINT_JSON,
> > > +                                          "otherhost", NULL,
> > > +                                          s->rx_otherhost_dropped);
> > >                 }
> > >                 close_json_object();
> > >
> > > @@ -778,7 +783,8 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> > >                         size_columns(cols, ARRAY_SIZE(cols), 0,
> > >                                      s->rx_length_errors, s->rx_crc_errors,
> > >                                      s->rx_frame_errors, s->rx_fifo_errors,
> > > -                                    s->rx_over_errors, s->rx_nohandler);
> > > +                                    s->rx_over_errors, s->rx_nohandler,
> > > +                                    s->rx_otherhost_dropped);
> > >                 size_columns(cols, ARRAY_SIZE(cols),
> > >                              s->tx_bytes, s->tx_packets, s->tx_errors,
> > >                              s->tx_dropped, s->tx_carrier_errors,
> > > @@ -811,11 +817,14 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> > >                 /* RX error stats */
> > >                 if (show_stats > 1) {
> > >                         fprintf(fp, "%s", _SL_);
> > > -                       fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s %*s%s",
> > > +                       fprintf(fp, "    RX errors:%*s %*s %*s %*s %*s %*s%*s%*s%s",
> > >                                 cols[0] - 10, "", cols[1], "length",
> > >                                 cols[2], "crc", cols[3], "frame",
> > >                                 cols[4], "fifo", cols[5], "overrun",
> > > -                               cols[6], s->rx_nohandler ? "nohandler" : "",
> > > +                               s->rx_nohandler ? cols[6] + 1 : 0,
> > > +                               s->rx_nohandler ? " nohandler" : "",
> > > +                               s->rx_otherhost_dropped ? cols[7] + 1 : 0,
> > > +                               s->rx_otherhost_dropped ? " otherhost" : "",
> > >                                 _SL_);
> > >                         fprintf(fp, "%*s", cols[0] + 5, "");
> > >                         print_num(fp, cols[1], s->rx_length_errors);
> > > @@ -825,6 +834,9 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
> > >                         print_num(fp, cols[5], s->rx_over_errors);
> > >                         if (s->rx_nohandler)
> > >                                 print_num(fp, cols[6], s->rx_nohandler);
> > > +                       if (s->rx_otherhost_dropped)
> > > +                               print_num(fp, cols[7],
> > > +                               s->rx_otherhost_dropped);
> > >                 }
> > >                 fprintf(fp, "%s", _SL_);
> > >
> > > --
> > > 2.36.1.476.g0c4daa206d-goog
> > >

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

* Re: [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show
  2022-06-09 21:05 [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show Jeffrey Ji
  2022-06-09 21:07 ` Jeffrey Ji
@ 2022-06-12 15:55 ` David Ahern
  1 sibling, 0 replies; 5+ messages in thread
From: David Ahern @ 2022-06-12 15:55 UTC (permalink / raw)
  To: Jeffrey Ji, Stephen Hemminger; +Cc: Brian Vazquez, netdev, Jeffrey Ji

On 6/9/22 3:05 PM, Jeffrey Ji wrote:
> From: Jeffrey Ji <jeffreyji@google.com>
> 
> This stat was added in commit 794c24e9921f ("net-core: rx_otherhost_dropped to core_stats")
> 
> Tested: sent packet with wrong MAC address from 1
> network namespace to another, verified that counter showed "1" in
> `ip -s -s link sh` and `ip -s -s -j link sh`
> 
> Signed-off-by: Jeffrey Ji <jeffreyji@google.com>
> ---
> changelog:
> v2: otherhost <- otherhost_dropped
> 
>  ip/ipaddress.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 

...

> @@ -825,6 +834,9 @@ void print_stats64(FILE *fp, struct rtnl_link_stats64 *s,
>  			print_num(fp, cols[5], s->rx_over_errors);
>  			if (s->rx_nohandler)
>  				print_num(fp, cols[6], s->rx_nohandler);
> +			if (s->rx_otherhost_dropped)
> +				print_num(fp, cols[7],
> +				s->rx_otherhost_dropped);

brought  that up to 1-line and applied to iproute2-next



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

end of thread, other threads:[~2022-06-12 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 21:05 [PATCH iproute2-next v2] show rx_otherehost_dropped stat in ip link show Jeffrey Ji
2022-06-09 21:07 ` Jeffrey Ji
2022-06-09 21:08   ` Jeffrey Ji
2022-06-09 21:12     ` Jeffrey Ji
2022-06-12 15:55 ` David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.