On 2016-06-08 22:01, Jon Maloy wrote: > > >> -----Original Message----- >> From: Jon Maloy [mailto:jon.ma...@ericsson.com] >> Sent: Wednesday, 08 June, 2016 15:46 >> To: Parthasarathy Bhuvaragan; tipc-discussion@lists.sourceforge.net; >> ma...@donjonn.com; Ying Xue; Richard Alpe >> Subject: Re: [tipc-discussion] [PATCH iproute2 v3 07/10] tipc: add link >> monitor >> summary >> >> >> >>> -----Original Message----- >>> From: Parthasarathy Bhuvaragan >>> Sent: Thursday, 02 June, 2016 10:10 >>> To: tipc-discussion@lists.sourceforge.net; Jon Maloy; ma...@donjonn.com; >> Ying >>> Xue; Richard Alpe >>> Subject: [PATCH iproute2 v3 07/10] tipc: add link monitor summary >>> >>> The monitor summary command prints the basic attributes >>> specific to the local node. >>> A sample usage is shown below: >>> $ tipc link monitor summary >>> >>> bearer eth:data0 >>> table 8 >> >> I suspect you mean "table generation" here? Then you should spell it out. If >> it for >> some reason has to be one single word, call the entry "generation", as just >> "table" gives no useful information at all. >> >>> members 8 >> >> "local domain members" ? What other type of members could "members" be referring to? Just curious.
Regards Richard >> >> ///jon >> >>> state active > > "algorithm" "full-mesh"/"overlapping-ring" ?? > > ///jon > >>> >>> bearer eth:data1 >>> table 8 >>> members 8 >>> state active >>> >>> $ tipc link monitor summary -h >>> Usage: tipc monitor summary >>> >>> Signed-off-by: Parthasarathy Bhuvaragan >>> <parthasarathy.bhuvara...@ericsson.com> >>> --- >>> include/linux/tipc_netlink.h | 25 ++++++++++++++++++++++++ >>> tipc/link.c | 45 >> +++++++++++++++++++++++++++++++++++++++++++- >>> 2 files changed, 69 insertions(+), 1 deletion(-) >>> >>> diff --git a/include/linux/tipc_netlink.h b/include/linux/tipc_netlink.h >>> index d07c6ec76062..5f3f6d09fb79 100644 >>> --- a/include/linux/tipc_netlink.h >>> +++ b/include/linux/tipc_netlink.h >>> @@ -58,6 +58,7 @@ enum { >>> TIPC_NL_NAME_TABLE_GET, >>> TIPC_NL_MON_SET, >>> TIPC_NL_MON_GET, >>> + TIPC_NL_MON_PEER_GET, >>> >>> __TIPC_NL_CMD_MAX, >>> TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1 >>> @@ -75,6 +76,7 @@ enum { >>> TIPC_NLA_NET, /* nest */ >>> TIPC_NLA_NAME_TABLE, /* nest */ >>> TIPC_NLA_MON, /* nest */ >>> + TIPC_NLA_MON_PEER, /* nest */ >>> >>> __TIPC_NLA_MAX, >>> TIPC_NLA_MAX = __TIPC_NLA_MAX - 1 >>> @@ -173,6 +175,11 @@ enum { >>> enum { >>> TIPC_NLA_MON_UNSPEC, >>> TIPC_NLA_MON_ACTIVATION_THRESHOLD, /* u32 */ >>> + TIPC_NLA_MON_REF, /* u32 */ >>> + TIPC_NLA_MON_ACTIVE, /* flag */ >>> + TIPC_NLA_MON_BEARER_NAME, /* string */ >>> + TIPC_NLA_MON_PEERCNT, /* u32 */ >>> + TIPC_NLA_MON_LISTGEN, /* u32 */ >>> >>> __TIPC_NLA_MON_MAX, >>> TIPC_NLA_MON_MAX = __TIPC_NLA_MON_MAX - 1 >>> @@ -194,6 +201,24 @@ enum { >>> TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1 >>> }; >>> >>> +/* Monitor peer info */ >>> +enum { >>> + TIPC_NLA_MON_PEER_UNSPEC, >>> + >>> + TIPC_NLA_MON_PEER_ADDR, /* u32 */ >>> + TIPC_NLA_MON_PEER_DOMGEN, /* u32 */ >>> + TIPC_NLA_MON_PEER_APPLIED, /* u32 */ >>> + TIPC_NLA_MON_PEER_UPMAP, /* u64 */ >>> + TIPC_NLA_MON_PEER_MEMBERS, /* tlv */ >>> + TIPC_NLA_MON_PEER_UP, /* flag */ >>> + TIPC_NLA_MON_PEER_HEAD, /* flag */ >>> + TIPC_NLA_MON_PEER_LOCAL, /* flag */ >>> + TIPC_NLA_MON_PEER_PAD, /* flag */ >>> + >>> + __TIPC_NLA_MON_PEER_MAX, >>> + TIPC_NLA_MON_PEER_MAX = __TIPC_NLA_MON_PEER_MAX - 1 >>> +}; >>> + >>> /* Nest, connection info */ >>> enum { >>> TIPC_NLA_CON_UNSPEC, >>> diff --git a/tipc/link.c b/tipc/link.c >>> index a09444912515..46a25b314311 100644 >>> --- a/tipc/link.c >>> +++ b/tipc/link.c >>> @@ -515,6 +515,47 @@ static int cmd_link_mon_set_prop(struct nlmsghdr >> *nlh, >>> const struct cmd *cmd, >>> return msg_doit(nlh, NULL, NULL); >>> } >>> >>> +static int link_mon_summary_cb(const struct nlmsghdr *nlh, void *data) >>> +{ >>> + struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); >>> + struct nlattr *info[TIPC_NLA_MAX + 1] = {}; >>> + struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {}; >>> + >>> + mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); >>> + if (!info[TIPC_NLA_MON]) >>> + return MNL_CB_ERROR; >>> + >>> + mnl_attr_parse_nested(info[TIPC_NLA_MON], parse_attrs, attrs); >>> + >>> + printf("\nbearer %s\n", >>> + mnl_attr_get_str(attrs[TIPC_NLA_MON_BEARER_NAME])); >>> + >>> + printf(" table %u\n members %u\n state %s\n", >>> + mnl_attr_get_u32(attrs[TIPC_NLA_MON_LISTGEN]), >>> + mnl_attr_get_u32(attrs[TIPC_NLA_MON_PEERCNT]), >>> + attrs[TIPC_NLA_MON_ACTIVE] ? "active" : "inactive"); >>> + >>> + return MNL_CB_OK; >>> +} >>> + >>> +static int cmd_link_mon_summary(struct nlmsghdr *nlh, const struct cmd >> *cmd, >>> + struct cmdl *cmdl, void *data) >>> +{ >>> + char buf[MNL_SOCKET_BUFFER_SIZE]; >>> + >>> + if (help_flag) { >>> + fprintf(stderr, "Usage: %s monitor summary\n", cmdl->argv[0]); >>> + return -EINVAL; >>> + } >>> + >>> + if (!(nlh = msg_init(buf, TIPC_NL_MON_GET))) { >>> + fprintf(stderr, "error, message initialisation failed\n"); >>> + return -1; >>> + } >>> + >>> + return msg_dumpit(nlh, link_mon_summary_cb, NULL); >>> +} >>> + >>> static void cmd_link_mon_set_help(struct cmdl *cmdl) >>> { >>> fprintf(stderr, "Usage: %s monitor set PPROPERTY\n\n" >>> @@ -592,7 +633,8 @@ static void cmd_link_mon_help(struct cmdl *cmdl) >>> "Usage: %s montior COMMAND [ARGS] ...\n\n" >>> "COMMANDS\n" >>> " set - Set monitor properties\n" >>> - " get - Get monitor properties\n", >>> + " get - Get monitor properties\n" >>> + " summary - Show local node monitor summary\n", >>> cmdl->argv[0]); >>> } >>> >>> @@ -602,6 +644,7 @@ static int cmd_link_mon(struct nlmsghdr *nlh, const >> struct >>> cmd *cmd, struct cmdl >>> const struct cmd cmds[] = { >>> { "set", cmd_link_mon_set, cmd_link_mon_set_help }, >>> { "get", cmd_link_mon_get, cmd_link_mon_get_help }, >>> + { "summary", cmd_link_mon_summary, NULL }, >>> { NULL } >>> }; >>> >>> -- >>> 2.1.4 >> >> >> ------------------------------------------------------------------------------ >> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic >> patterns at an interface-level. Reveals which users, apps, and protocols are >> consuming the most bandwidth. Provides multi-vendor support for NetFlow, >> J-Flow, sFlow and other flows. Make informed decisions using capacity >> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e >> _______________________________________________ >> tipc-discussion mailing list >> tipc-discussion@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/tipc-discussion ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e _______________________________________________ tipc-discussion mailing list tipc-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tipc-discussion