aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorRichard Alpe <richard.alpe@ericsson.com>2015-02-09 03:50:09 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-09 16:20:48 -0500
commit1817877b3cd7b4dc73e4a1514d5f48eaa3989ec9 (patch)
tree7aa83bc3d462fc0ba6e14c211435f8fbcce9075c /net/tipc/link.c
parent37e2d4843f9e2f5aad6bf3be5dad174f2838f375 (diff)
tipc: convert legacy nl link stat reset to nl compat
Convert TIPC_CMD_RESET_LINK_STATS to compat doit. Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index ec136b5cc339..dfe6f4d0b402 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1969,39 +1969,6 @@ static void link_reset_statistics(struct tipc_link *l_ptr)
1969 l_ptr->stats.recv_info = l_ptr->next_in_no; 1969 l_ptr->stats.recv_info = l_ptr->next_in_no;
1970} 1970}
1971 1971
1972struct sk_buff *tipc_link_cmd_reset_stats(struct net *net,
1973 const void *req_tlv_area,
1974 int req_tlv_space)
1975{
1976 char *link_name;
1977 struct tipc_link *l_ptr;
1978 struct tipc_node *node;
1979 unsigned int bearer_id;
1980
1981 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
1982 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
1983
1984 link_name = (char *)TLV_DATA(req_tlv_area);
1985 if (!strcmp(link_name, tipc_bclink_name)) {
1986 if (tipc_bclink_reset_stats(net))
1987 return tipc_cfg_reply_error_string("link not found");
1988 return tipc_cfg_reply_none();
1989 }
1990 node = tipc_link_find_owner(net, link_name, &bearer_id);
1991 if (!node)
1992 return tipc_cfg_reply_error_string("link not found");
1993
1994 tipc_node_lock(node);
1995 l_ptr = node->links[bearer_id];
1996 if (!l_ptr) {
1997 tipc_node_unlock(node);
1998 return tipc_cfg_reply_error_string("link not found");
1999 }
2000 link_reset_statistics(l_ptr);
2001 tipc_node_unlock(node);
2002 return tipc_cfg_reply_none();
2003}
2004
2005static void link_print(struct tipc_link *l_ptr, const char *str) 1972static void link_print(struct tipc_link *l_ptr, const char *str)
2006{ 1973{
2007 struct tipc_net *tn = net_generic(l_ptr->owner->net, tipc_net_id); 1974 struct tipc_net *tn = net_generic(l_ptr->owner->net, tipc_net_id);
@@ -2424,7 +2391,7 @@ int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info)
2424 struct tipc_link *link; 2391 struct tipc_link *link;
2425 struct tipc_node *node; 2392 struct tipc_node *node;
2426 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; 2393 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];
2427 struct net *net = genl_info_net(info); 2394 struct net *net = sock_net(skb->sk);
2428 2395
2429 if (!info->attrs[TIPC_NLA_LINK]) 2396 if (!info->attrs[TIPC_NLA_LINK])
2430 return -EINVAL; 2397 return -EINVAL;