diff options
author | Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> | 2016-07-26 02:47:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-26 17:26:42 -0400 |
commit | bf1035b2ff5296c7c49e262152253ce29d87e82d (patch) | |
tree | ab4aba8cf6b93c1787d60c077ff1fe9f95955509 /net/tipc/node.c | |
parent | 7b3f52296493656015f0c0deddb6e90e36b9cda2 (diff) |
tipc: get monitor threshold for the cluster
In this commit, we add support to fetch the configured
cluster monitoring threshold.
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 0fc531d0f709..2a7e74753f9f 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -1955,3 +1955,55 @@ int tipc_nl_node_set_monitor(struct sk_buff *skb, struct genl_info *info) | |||
1955 | 1955 | ||
1956 | return 0; | 1956 | return 0; |
1957 | } | 1957 | } |
1958 | |||
1959 | static int __tipc_nl_add_monitor_prop(struct net *net, struct tipc_nl_msg *msg) | ||
1960 | { | ||
1961 | struct nlattr *attrs; | ||
1962 | void *hdr; | ||
1963 | u32 val; | ||
1964 | |||
1965 | hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, | ||
1966 | 0, TIPC_NL_MON_GET); | ||
1967 | if (!hdr) | ||
1968 | return -EMSGSIZE; | ||
1969 | |||
1970 | attrs = nla_nest_start(msg->skb, TIPC_NLA_MON); | ||
1971 | if (!attrs) | ||
1972 | goto msg_full; | ||
1973 | |||
1974 | val = tipc_nl_monitor_get_threshold(net); | ||
1975 | |||
1976 | if (nla_put_u32(msg->skb, TIPC_NLA_MON_ACTIVATION_THRESHOLD, val)) | ||
1977 | goto attr_msg_full; | ||
1978 | |||
1979 | nla_nest_end(msg->skb, attrs); | ||
1980 | genlmsg_end(msg->skb, hdr); | ||
1981 | |||
1982 | return 0; | ||
1983 | |||
1984 | attr_msg_full: | ||
1985 | nla_nest_cancel(msg->skb, attrs); | ||
1986 | msg_full: | ||
1987 | genlmsg_cancel(msg->skb, hdr); | ||
1988 | |||
1989 | return -EMSGSIZE; | ||
1990 | } | ||
1991 | |||
1992 | int tipc_nl_node_get_monitor(struct sk_buff *skb, struct genl_info *info) | ||
1993 | { | ||
1994 | struct net *net = sock_net(skb->sk); | ||
1995 | struct tipc_nl_msg msg; | ||
1996 | int err; | ||
1997 | |||
1998 | msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); | ||
1999 | msg.portid = info->snd_portid; | ||
2000 | msg.seq = info->snd_seq; | ||
2001 | |||
2002 | err = __tipc_nl_add_monitor_prop(net, &msg); | ||
2003 | if (err) { | ||
2004 | nlmsg_free(msg.skb); | ||
2005 | return err; | ||
2006 | } | ||
2007 | |||
2008 | return genlmsg_reply(msg.skb, info); | ||
2009 | } | ||