aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/config.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2010-05-11 10:30:08 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-13 02:02:23 -0400
commit107e7be628821dcb78c43adce0331e8ddb40eabd (patch)
treedba793bc4424134a380f58b6af17530440bdfb4f /net/tipc/config.c
parent3aec9cc936217a30dbb45a9b6808a39571674e66 (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/config.c')
-rw-r--r--net/tipc/config.c40
1 files changed, 39 insertions, 1 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: 249exit:
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
258static 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
256static struct sk_buff *cfg_enable_bearer(void) 291static 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: