* [PATCH iproute2 v1] iproute2: show counter of carrier on<->off transitions [not found] <cover.1396455409.git.decot@googlers.com> @ 2014-04-02 16:19 ` David Decotigny 2014-04-22 22:46 ` Stephen Hemminger 0 siblings, 1 reply; 2+ messages in thread From: David Decotigny @ 2014-04-02 16:19 UTC (permalink / raw) To: netdev; +Cc: David Decotigny This patch allows to display the current counter of carrier on<->off transitions (IFLA_CARRIER_CHANGES, see kernel commit "expose number of carrier on/off changes"): ip -s -s link show dev eth0 ... 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 etc. link/ether ............ brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 134705 758 0 0 0 0 RX errors: length crc frame fifo missed 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns 77374 731 0 0 0 0 TX errors: aborted fifo window heartbeat 0 0 0 0 link: carrier_changes 4 Tested: - kernel with patch "net-sysfs: expose number of carrier on/off changes": see above - kernel wthout the patch: line "link:" not displayed (as expected) Signed-off-by: David Decotigny <decot@googlers.com> --- include/linux/if_link.h | 1 + ip/ipaddress.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/linux/if_link.h b/include/linux/if_link.h index f08505c..84fca1e 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -144,6 +144,7 @@ enum { IFLA_NUM_RX_QUEUES, IFLA_CARRIER, IFLA_PHYS_PORT_ID, + IFLA_CARRIER_CHANGES, __IFLA_MAX }; diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 14d1720..78b80ee 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -527,6 +527,11 @@ int print_linkinfo(const struct sockaddr_nl *who, print_link_stats(fp, RTA_DATA(tb[IFLA_STATS])); } + if (do_link && (show_stats > 1) && tb[IFLA_CARRIER_CHANGES]) { + fprintf(fp, "%s link: carrier_changes %u", _SL_, + *(int*)RTA_DATA(tb[IFLA_CARRIER_CHANGES])); + } + if (do_link && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) { struct rtattr *i, *vflist = tb[IFLA_VFINFO_LIST]; int rem = RTA_PAYLOAD(vflist); -- 1.9.1.423.g4596e3a ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2 v1] iproute2: show counter of carrier on<->off transitions 2014-04-02 16:19 ` [PATCH iproute2 v1] iproute2: show counter of carrier on<->off transitions David Decotigny @ 2014-04-22 22:46 ` Stephen Hemminger 0 siblings, 0 replies; 2+ messages in thread From: Stephen Hemminger @ 2014-04-22 22:46 UTC (permalink / raw) To: David Decotigny; +Cc: netdev On Wed, 2 Apr 2014 09:19:00 -0700 David Decotigny <decot@googlers.com> wrote: > This patch allows to display the current counter of carrier on<->off > transitions (IFLA_CARRIER_CHANGES, see kernel commit "expose number of > carrier on/off changes"): > > ip -s -s link show dev eth0 > ... > 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 etc. > link/ether ............ brd ff:ff:ff:ff:ff:ff > RX: bytes packets errors dropped overrun mcast > 134705 758 0 0 0 0 > RX errors: length crc frame fifo missed > 0 0 0 0 0 > TX: bytes packets errors dropped carrier collsns > 77374 731 0 0 0 0 > TX errors: aborted fifo window heartbeat > 0 0 0 0 > link: carrier_changes 4 > I wonder if putting it under TX errors would make sense. This is where Juniper classifies the error, and it would also fit on same line, avoiding adding more clutter. 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 etc. link/ether ............ brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 134705 758 0 0 0 0 RX errors: length crc frame fifo missed 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns 77374 731 0 0 0 0 TX errors: aborted fifo window heartbeat transition 0 0 0 0 4 The risk is break some screen scraping script, but that doesn't seem to be that big an issue for adding one column. The columns also need some re-aligning here but that is different correctness issue. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-22 22:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1396455409.git.decot@googlers.com>
2014-04-02 16:19 ` [PATCH iproute2 v1] iproute2: show counter of carrier on<->off transitions David Decotigny
2014-04-22 22:46 ` Stephen Hemminger
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.