diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2010-05-11 10:30:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-13 02:02:23 -0400 |
commit | 107e7be628821dcb78c43adce0331e8ddb40eabd (patch) | |
tree | dba793bc4424134a380f58b6af17530440bdfb4f /net/tipc | |
parent | 3aec9cc936217a30dbb45a9b6808a39571674e66 (diff) |
tipc: Add support for "-s" configuration option
Provide initial support for displaying overall TIPC status/statistics
information at runtime. Currently, only version info for the TIPC
kernel module is displayed.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/config.c | 40 | ||||
-rw-r--r-- | net/tipc/core.c | 2 | ||||
-rw-r--r-- | net/tipc/core.h | 3 |
3 files changed, 42 insertions, 3 deletions
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 | */ |