aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bcast.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-02-09 16:20:53 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-09 16:20:53 -0500
commit9dce285b70c157754d753203112cfef22770b1f9 (patch)
tree4859799a8311ecd637e2a582600af1057a78e08b /net/tipc/bcast.c
parentc8ac18f2006b2926ce375c01646b2f487d1c33b2 (diff)
parent941787b82982b3f33ac398c8c00035ddd0f8c514 (diff)
Merge branch 'tipc-next'
Richard Alpe says: ==================== tipc: new compat layer for the legacy NL API This is a compatibility / transcoding layer for the old netlink API. It relies on the new netlink API to collect data or perform actions (dumpit / doit). The main benefit of this compat layer is that it removes a lot of complex code from the tipc core as only the new API needs to be able harness data or perform actions. I.e. the compat layer isn't concerned with locking or how the internal data-structures look. As long as the new API stays relatively intact the compat layer should be fine. The main challenge in this compat layer is the randomness of the legacy API. Some commands send binary data and some send ASCII data, some are very picky in optimizing there buffer sizes and some just don't care. Most legacy commands put there data in a single TLV (data container) but some segment the data into multiple TLV's. This list of randomness goes on and on.. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/bcast.c')
-rw-r--r--net/tipc/bcast.c45
1 files changed, 1 insertions, 44 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 81b1fef1f5e0..3e41704832de 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -810,7 +810,7 @@ int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg)
810 810
811 tipc_bclink_lock(net); 811 tipc_bclink_lock(net);
812 812
813 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_v2_family, 813 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family,
814 NLM_F_MULTI, TIPC_NL_LINK_GET); 814 NLM_F_MULTI, TIPC_NL_LINK_GET);
815 if (!hdr) 815 if (!hdr)
816 return -EMSGSIZE; 816 return -EMSGSIZE;
@@ -860,49 +860,6 @@ msg_full:
860 return -EMSGSIZE; 860 return -EMSGSIZE;
861} 861}
862 862
863int tipc_bclink_stats(struct net *net, char *buf, const u32 buf_size)
864{
865 int ret;
866 struct tipc_stats *s;
867 struct tipc_net *tn = net_generic(net, tipc_net_id);
868 struct tipc_link *bcl = tn->bcl;
869
870 if (!bcl)
871 return 0;
872
873 tipc_bclink_lock(net);
874
875 s = &bcl->stats;
876
877 ret = tipc_snprintf(buf, buf_size, "Link <%s>\n"
878 " Window:%u packets\n",
879 bcl->name, bcl->queue_limit[0]);
880 ret += tipc_snprintf(buf + ret, buf_size - ret,
881 " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
882 s->recv_info, s->recv_fragments,
883 s->recv_fragmented, s->recv_bundles,
884 s->recv_bundled);
885 ret += tipc_snprintf(buf + ret, buf_size - ret,
886 " TX packets:%u fragments:%u/%u bundles:%u/%u\n",
887 s->sent_info, s->sent_fragments,
888 s->sent_fragmented, s->sent_bundles,
889 s->sent_bundled);
890 ret += tipc_snprintf(buf + ret, buf_size - ret,
891 " RX naks:%u defs:%u dups:%u\n",
892 s->recv_nacks, s->deferred_recv, s->duplicates);
893 ret += tipc_snprintf(buf + ret, buf_size - ret,
894 " TX naks:%u acks:%u dups:%u\n",
895 s->sent_nacks, s->sent_acks, s->retransmitted);
896 ret += tipc_snprintf(buf + ret, buf_size - ret,
897 " Congestion link:%u Send queue max:%u avg:%u\n",
898 s->link_congs, s->max_queue_sz,
899 s->queue_sz_counts ?
900 (s->accu_queue_sz / s->queue_sz_counts) : 0);
901
902 tipc_bclink_unlock(net);
903 return ret;
904}
905
906int tipc_bclink_reset_stats(struct net *net) 863int tipc_bclink_reset_stats(struct net *net)
907{ 864{
908 struct tipc_net *tn = net_generic(net, tipc_net_id); 865 struct tipc_net *tn = net_generic(net, tipc_net_id);