diff options
-rw-r--r-- | include/linux/tipc_config.h | 1 | ||||
-rw-r--r-- | net/tipc/config.c | 40 | ||||
-rw-r--r-- | net/tipc/core.c | 2 | ||||
-rw-r--r-- | net/tipc/core.h | 3 |
4 files changed, 43 insertions, 3 deletions
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h index 2bc6fa4adeb5..9cde86c32412 100644 --- a/include/linux/tipc_config.h +++ b/include/linux/tipc_config.h | |||
@@ -74,6 +74,7 @@ | |||
74 | #define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ | 74 | #define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ |
75 | #define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ | 75 | #define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ |
76 | #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ | 76 | #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ |
77 | #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ | ||
77 | 78 | ||
78 | #if 0 | 79 | #if 0 |
79 | #define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ | 80 | #define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ |
diff --git a/net/tipc/config.c b/net/tipc/config.c index 7370241412cb..961d1b097146 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -246,13 +246,48 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg, | |||
246 | default: | 246 | default: |
247 | rv = tipc_cfg_cmd(msg, data, sz, (u32 *)&msg_sect[1].iov_len, orig); | 247 | rv = tipc_cfg_cmd(msg, data, sz, (u32 *)&msg_sect[1].iov_len, orig); |
248 | } | 248 | } |
249 | exit: | 249 | exit: |
250 | rmsg.result_len = htonl(msg_sect[1].iov_len); | 250 | rmsg.result_len = htonl(msg_sect[1].iov_len); |
251 | rmsg.retval = htonl(rv); | 251 | rmsg.retval = htonl(rv); |
252 | tipc_cfg_respond(msg_sect, 2u, orig); | 252 | tipc_cfg_respond(msg_sect, 2u, orig); |
253 | } | 253 | } |
254 | #endif | 254 | #endif |
255 | 255 | ||
256 | #define MAX_STATS_INFO 2000 | ||
257 | |||
258 | static struct sk_buff *tipc_show_stats(void) | ||
259 | { | ||
260 | struct sk_buff *buf; | ||
261 | struct tlv_desc *rep_tlv; | ||
262 | struct print_buf pb; | ||
263 | int str_len; | ||
264 | u32 value; | ||
265 | |||
266 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | ||
267 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | ||
268 | |||
269 | value = ntohl(*(u32 *)TLV_DATA(req_tlv_area)); | ||
270 | if (value != 0) | ||
271 | return tipc_cfg_reply_error_string("unsupported argument"); | ||
272 | |||
273 | buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_STATS_INFO)); | ||
274 | if (buf == NULL) | ||
275 | return NULL; | ||
276 | |||
277 | rep_tlv = (struct tlv_desc *)buf->data; | ||
278 | tipc_printbuf_init(&pb, (char *)TLV_DATA(rep_tlv), MAX_STATS_INFO); | ||
279 | |||
280 | tipc_printf(&pb, "TIPC version " TIPC_MOD_VER "\n"); | ||
281 | |||
282 | /* Use additional tipc_printf()'s to return more info ... */ | ||
283 | |||
284 | str_len = tipc_printbuf_validate(&pb); | ||
285 | skb_put(buf, TLV_SPACE(str_len)); | ||
286 | TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); | ||
287 | |||
288 | return buf; | ||
289 | } | ||
290 | |||
256 | static struct sk_buff *cfg_enable_bearer(void) | 291 | static struct sk_buff *cfg_enable_bearer(void) |
257 | { | 292 | { |
258 | struct tipc_bearer_config *args; | 293 | struct tipc_bearer_config *args; |
@@ -536,6 +571,9 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area | |||
536 | case TIPC_CMD_DUMP_LOG: | 571 | case TIPC_CMD_DUMP_LOG: |
537 | rep_tlv_buf = tipc_log_dump(); | 572 | rep_tlv_buf = tipc_log_dump(); |
538 | break; | 573 | break; |
574 | case TIPC_CMD_SHOW_STATS: | ||
575 | rep_tlv_buf = tipc_show_stats(); | ||
576 | break; | ||
539 | case TIPC_CMD_SET_LINK_TOL: | 577 | case TIPC_CMD_SET_LINK_TOL: |
540 | case TIPC_CMD_SET_LINK_PRI: | 578 | case TIPC_CMD_SET_LINK_PRI: |
541 | case TIPC_CMD_SET_LINK_WINDOW: | 579 | case TIPC_CMD_SET_LINK_WINDOW: |
diff --git a/net/tipc/core.c b/net/tipc/core.c index 4e84c8431f32..b47d1842a970 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -49,8 +49,6 @@ | |||
49 | #include "config.h" | 49 | #include "config.h" |
50 | 50 | ||
51 | 51 | ||
52 | #define TIPC_MOD_VER "2.0.0" | ||
53 | |||
54 | #ifndef CONFIG_TIPC_ZONES | 52 | #ifndef CONFIG_TIPC_ZONES |
55 | #define CONFIG_TIPC_ZONES 3 | 53 | #define CONFIG_TIPC_ZONES 3 |
56 | #endif | 54 | #endif |
diff --git a/net/tipc/core.h b/net/tipc/core.h index c58a1d16563a..1e149f55f3e2 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -59,6 +59,9 @@ | |||
59 | #include <linux/slab.h> | 59 | #include <linux/slab.h> |
60 | #include <linux/vmalloc.h> | 60 | #include <linux/vmalloc.h> |
61 | 61 | ||
62 | |||
63 | #define TIPC_MOD_VER "2.0.0" | ||
64 | |||
62 | /* | 65 | /* |
63 | * TIPC sanity test macros | 66 | * TIPC sanity test macros |
64 | */ | 67 | */ |