From: Vivien Didelot <vivien.didelot@gmail.com> To: "David S. Miller" <davem@davemloft.net> Cc: Roopa Prabhu <roopa@cumulusnetworks.com>, Nikolay Aleksandrov <nikolay@cumulusnetworks.com>, netdev@vger.kernel.org, bridge@lists.linux-foundation.org, Stephen Hemminger <stephen@networkplumber.org>, David Ahern <dsahern@gmail.com>, Vivien Didelot <vivien.didelot@gmail.com> Subject: [PATCH iproute2 v4] iplink: add support for STP xstats Date: Wed, 11 Dec 2019 20:07:11 -0500 [thread overview] Message-ID: <20191212010711.1664000-2-vivien.didelot@gmail.com> (raw) In-Reply-To: <20191212010711.1664000-1-vivien.didelot@gmail.com> Add support for the BRIDGE_XSTATS_STP xstats, as follow: # ip link xstats type bridge_slave dev lan4 stp lan4 STP BPDU: RX: 0 TX: 61 STP TCN: RX: 0 TX: 0 STP Transitions: Blocked: 2 Forwarding: 1 Or below as JSON: # ip -j -p link xstats type bridge_slave dev lan0 stp [ { "ifname": "lan0", "stp": { "rx_bpdu": 0, "tx_bpdu": 500, "rx_tcn": 0, "tx_tcn": 0, "transition_blk": 0, "transition_fwd": 0 } } ] Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> --- include/uapi/linux/if_bridge.h | 10 ++++++++++ ip/iplink_bridge.c | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index 31fc51bd..9fefc7f3 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h @@ -156,6 +156,15 @@ struct bridge_vlan_xstats { __u32 pad2; }; +struct bridge_stp_xstats { + __u64 transition_blk; + __u64 transition_fwd; + __u64 rx_bpdu; + __u64 tx_bpdu; + __u64 rx_tcn; + __u64 tx_tcn; +}; + /* Bridge multicast database attributes * [MDBA_MDB] = { * [MDBA_MDB_ENTRY] = { @@ -262,6 +271,7 @@ enum { BRIDGE_XSTATS_VLAN, BRIDGE_XSTATS_MCAST, BRIDGE_XSTATS_PAD, + BRIDGE_XSTATS_STP, __BRIDGE_XSTATS_MAX }; #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c index 06f736d4..bbd6f3a8 100644 --- a/ip/iplink_bridge.c +++ b/ip/iplink_bridge.c @@ -688,6 +688,7 @@ static void bridge_print_xstats_help(struct link_util *lu, FILE *f) static void bridge_print_stats_attr(struct rtattr *attr, int ifindex) { struct rtattr *brtb[LINK_XSTATS_TYPE_MAX+1]; + struct bridge_stp_xstats *sstats; struct br_mcast_stats *mstats; struct rtattr *i, *list; const char *ifname = ""; @@ -807,6 +808,29 @@ static void bridge_print_stats_attr(struct rtattr *attr, int ifindex) mstats->mld_parse_errors); close_json_object(); break; + case BRIDGE_XSTATS_STP: + sstats = RTA_DATA(i); + open_json_object("stp"); + print_string(PRINT_FP, NULL, + "%-16s STP BPDU: ", ""); + print_u64(PRINT_ANY, "rx_bpdu", "RX: %llu ", + sstats->rx_bpdu); + print_u64(PRINT_ANY, "tx_bpdu", "TX: %llu\n", + sstats->tx_bpdu); + print_string(PRINT_FP, NULL, + "%-16s STP TCN: ", ""); + print_u64(PRINT_ANY, "rx_tcn", "RX: %llu ", + sstats->rx_tcn); + print_u64(PRINT_ANY, "tx_tcn", "TX: %llu\n", + sstats->tx_tcn); + print_string(PRINT_FP, NULL, + "%-16s STP Transitions: ", ""); + print_u64(PRINT_ANY, "transition_blk", "Blocked: %llu ", + sstats->transition_blk); + print_u64(PRINT_ANY, "transition_fwd", "Forwarding: %llu\n", + sstats->transition_fwd); + close_json_object(); + break; } } close_json_object(); @@ -843,6 +867,8 @@ int bridge_parse_xstats(struct link_util *lu, int argc, char **argv) while (argc > 0) { if (strcmp(*argv, "igmp") == 0 || strcmp(*argv, "mcast") == 0) { xstats_print_attr = BRIDGE_XSTATS_MCAST; + } else if (strcmp(*argv, "stp") == 0) { + xstats_print_attr = BRIDGE_XSTATS_STP; } else if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); filter_index = ll_name_to_index(*argv); -- 2.24.0
WARNING: multiple messages have this Message-ID (diff)
From: Vivien Didelot <vivien.didelot@gmail.com> To: "David S. Miller" <davem@davemloft.net> Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>, netdev@vger.kernel.org, Roopa Prabhu <roopa@cumulusnetworks.com>, bridge@lists.linux-foundation.org, David Ahern <dsahern@gmail.com>, Vivien Didelot <vivien.didelot@gmail.com> Subject: [Bridge] [PATCH iproute2 v4] iplink: add support for STP xstats Date: Wed, 11 Dec 2019 20:07:11 -0500 [thread overview] Message-ID: <20191212010711.1664000-2-vivien.didelot@gmail.com> (raw) In-Reply-To: <20191212010711.1664000-1-vivien.didelot@gmail.com> Add support for the BRIDGE_XSTATS_STP xstats, as follow: # ip link xstats type bridge_slave dev lan4 stp lan4 STP BPDU: RX: 0 TX: 61 STP TCN: RX: 0 TX: 0 STP Transitions: Blocked: 2 Forwarding: 1 Or below as JSON: # ip -j -p link xstats type bridge_slave dev lan0 stp [ { "ifname": "lan0", "stp": { "rx_bpdu": 0, "tx_bpdu": 500, "rx_tcn": 0, "tx_tcn": 0, "transition_blk": 0, "transition_fwd": 0 } } ] Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> --- include/uapi/linux/if_bridge.h | 10 ++++++++++ ip/iplink_bridge.c | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index 31fc51bd..9fefc7f3 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h @@ -156,6 +156,15 @@ struct bridge_vlan_xstats { __u32 pad2; }; +struct bridge_stp_xstats { + __u64 transition_blk; + __u64 transition_fwd; + __u64 rx_bpdu; + __u64 tx_bpdu; + __u64 rx_tcn; + __u64 tx_tcn; +}; + /* Bridge multicast database attributes * [MDBA_MDB] = { * [MDBA_MDB_ENTRY] = { @@ -262,6 +271,7 @@ enum { BRIDGE_XSTATS_VLAN, BRIDGE_XSTATS_MCAST, BRIDGE_XSTATS_PAD, + BRIDGE_XSTATS_STP, __BRIDGE_XSTATS_MAX }; #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c index 06f736d4..bbd6f3a8 100644 --- a/ip/iplink_bridge.c +++ b/ip/iplink_bridge.c @@ -688,6 +688,7 @@ static void bridge_print_xstats_help(struct link_util *lu, FILE *f) static void bridge_print_stats_attr(struct rtattr *attr, int ifindex) { struct rtattr *brtb[LINK_XSTATS_TYPE_MAX+1]; + struct bridge_stp_xstats *sstats; struct br_mcast_stats *mstats; struct rtattr *i, *list; const char *ifname = ""; @@ -807,6 +808,29 @@ static void bridge_print_stats_attr(struct rtattr *attr, int ifindex) mstats->mld_parse_errors); close_json_object(); break; + case BRIDGE_XSTATS_STP: + sstats = RTA_DATA(i); + open_json_object("stp"); + print_string(PRINT_FP, NULL, + "%-16s STP BPDU: ", ""); + print_u64(PRINT_ANY, "rx_bpdu", "RX: %llu ", + sstats->rx_bpdu); + print_u64(PRINT_ANY, "tx_bpdu", "TX: %llu\n", + sstats->tx_bpdu); + print_string(PRINT_FP, NULL, + "%-16s STP TCN: ", ""); + print_u64(PRINT_ANY, "rx_tcn", "RX: %llu ", + sstats->rx_tcn); + print_u64(PRINT_ANY, "tx_tcn", "TX: %llu\n", + sstats->tx_tcn); + print_string(PRINT_FP, NULL, + "%-16s STP Transitions: ", ""); + print_u64(PRINT_ANY, "transition_blk", "Blocked: %llu ", + sstats->transition_blk); + print_u64(PRINT_ANY, "transition_fwd", "Forwarding: %llu\n", + sstats->transition_fwd); + close_json_object(); + break; } } close_json_object(); @@ -843,6 +867,8 @@ int bridge_parse_xstats(struct link_util *lu, int argc, char **argv) while (argc > 0) { if (strcmp(*argv, "igmp") == 0 || strcmp(*argv, "mcast") == 0) { xstats_print_attr = BRIDGE_XSTATS_MCAST; + } else if (strcmp(*argv, "stp") == 0) { + xstats_print_attr = BRIDGE_XSTATS_STP; } else if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); filter_index = ll_name_to_index(*argv); -- 2.24.0
next prev parent reply other threads:[~2019-12-12 1:07 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-12 1:07 [PATCH net-next v3] net: bridge: add STP xstats Vivien Didelot 2019-12-12 1:07 ` [Bridge] " Vivien Didelot 2019-12-12 1:07 ` Vivien Didelot [this message] 2019-12-12 1:07 ` [Bridge] [PATCH iproute2 v4] iplink: add support for " Vivien Didelot 2019-12-17 4:45 ` Stephen Hemminger 2019-12-17 4:45 ` [Bridge] " Stephen Hemminger 2019-12-17 16:35 ` David Ahern 2019-12-17 16:35 ` [Bridge] " David Ahern 2019-12-12 6:55 ` [PATCH net-next v3] net: bridge: add " Nikolay Aleksandrov 2019-12-12 6:55 ` [Bridge] " Nikolay Aleksandrov 2019-12-15 4:03 ` Jakub Kicinski 2019-12-15 4:03 ` [Bridge] " Jakub Kicinski
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=20191212010711.1664000-2-vivien.didelot@gmail.com \ --to=vivien.didelot@gmail.com \ --cc=bridge@lists.linux-foundation.org \ --cc=davem@davemloft.net \ --cc=dsahern@gmail.com \ --cc=netdev@vger.kernel.org \ --cc=nikolay@cumulusnetworks.com \ --cc=roopa@cumulusnetworks.com \ --cc=stephen@networkplumber.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.