aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index ecc12411155e..bda89bf9f4ff 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -47,8 +47,8 @@
47#include <linux/pkt_sched.h> 47#include <linux/pkt_sched.h>
48 48
49struct tipc_stats { 49struct tipc_stats {
50 u32 sent_info; /* used in counting # sent packets */ 50 u32 sent_pkts;
51 u32 recv_info; /* used in counting # recv'd packets */ 51 u32 recv_pkts;
52 u32 sent_states; 52 u32 sent_states;
53 u32 recv_states; 53 u32 recv_states;
54 u32 sent_probes; 54 u32 sent_probes;
@@ -857,7 +857,6 @@ void tipc_link_reset(struct tipc_link *l)
857 l->acked = 0; 857 l->acked = 0;
858 l->silent_intv_cnt = 0; 858 l->silent_intv_cnt = 0;
859 l->rst_cnt = 0; 859 l->rst_cnt = 0;
860 l->stats.recv_info = 0;
861 l->stale_count = 0; 860 l->stale_count = 0;
862 l->bc_peer_is_up = false; 861 l->bc_peer_is_up = false;
863 memset(&l->mon_state, 0, sizeof(l->mon_state)); 862 memset(&l->mon_state, 0, sizeof(l->mon_state));
@@ -888,6 +887,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
888 struct sk_buff_head *transmq = &l->transmq; 887 struct sk_buff_head *transmq = &l->transmq;
889 struct sk_buff_head *backlogq = &l->backlogq; 888 struct sk_buff_head *backlogq = &l->backlogq;
890 struct sk_buff *skb, *_skb, *bskb; 889 struct sk_buff *skb, *_skb, *bskb;
890 int pkt_cnt = skb_queue_len(list);
891 891
892 /* Match msg importance against this and all higher backlog limits: */ 892 /* Match msg importance against this and all higher backlog limits: */
893 if (!skb_queue_empty(backlogq)) { 893 if (!skb_queue_empty(backlogq)) {
@@ -901,6 +901,11 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
901 return -EMSGSIZE; 901 return -EMSGSIZE;
902 } 902 }
903 903
904 if (pkt_cnt > 1) {
905 l->stats.sent_fragmented++;
906 l->stats.sent_fragments += pkt_cnt;
907 }
908
904 /* Prepare each packet for sending, and add to relevant queue: */ 909 /* Prepare each packet for sending, and add to relevant queue: */
905 while (skb_queue_len(list)) { 910 while (skb_queue_len(list)) {
906 skb = skb_peek(list); 911 skb = skb_peek(list);
@@ -920,6 +925,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
920 __skb_queue_tail(xmitq, _skb); 925 __skb_queue_tail(xmitq, _skb);
921 TIPC_SKB_CB(skb)->ackers = l->ackers; 926 TIPC_SKB_CB(skb)->ackers = l->ackers;
922 l->rcv_unacked = 0; 927 l->rcv_unacked = 0;
928 l->stats.sent_pkts++;
923 seqno++; 929 seqno++;
924 continue; 930 continue;
925 } 931 }
@@ -968,6 +974,7 @@ void tipc_link_advance_backlog(struct tipc_link *l, struct sk_buff_head *xmitq)
968 msg_set_ack(hdr, ack); 974 msg_set_ack(hdr, ack);
969 msg_set_bcast_ack(hdr, bc_ack); 975 msg_set_bcast_ack(hdr, bc_ack);
970 l->rcv_unacked = 0; 976 l->rcv_unacked = 0;
977 l->stats.sent_pkts++;
971 seqno++; 978 seqno++;
972 } 979 }
973 l->snd_nxt = seqno; 980 l->snd_nxt = seqno;
@@ -1260,7 +1267,7 @@ int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
1260 1267
1261 /* Deliver packet */ 1268 /* Deliver packet */
1262 l->rcv_nxt++; 1269 l->rcv_nxt++;
1263 l->stats.recv_info++; 1270 l->stats.recv_pkts++;
1264 if (!tipc_data_input(l, skb, l->inputq)) 1271 if (!tipc_data_input(l, skb, l->inputq))
1265 rc |= tipc_link_input(l, skb, l->inputq); 1272 rc |= tipc_link_input(l, skb, l->inputq);
1266 if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN)) 1273 if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN))
@@ -1800,10 +1807,6 @@ void tipc_link_set_queue_limits(struct tipc_link *l, u32 win)
1800void tipc_link_reset_stats(struct tipc_link *l) 1807void tipc_link_reset_stats(struct tipc_link *l)
1801{ 1808{
1802 memset(&l->stats, 0, sizeof(l->stats)); 1809 memset(&l->stats, 0, sizeof(l->stats));
1803 if (!link_is_bc_sndlink(l)) {
1804 l->stats.sent_info = l->snd_nxt;
1805 l->stats.recv_info = l->rcv_nxt;
1806 }
1807} 1810}
1808 1811
1809static void link_print(struct tipc_link *l, const char *str) 1812static void link_print(struct tipc_link *l, const char *str)
@@ -1867,12 +1870,12 @@ static int __tipc_nl_add_stats(struct sk_buff *skb, struct tipc_stats *s)
1867 }; 1870 };
1868 1871
1869 struct nla_map map[] = { 1872 struct nla_map map[] = {
1870 {TIPC_NLA_STATS_RX_INFO, s->recv_info}, 1873 {TIPC_NLA_STATS_RX_INFO, 0},
1871 {TIPC_NLA_STATS_RX_FRAGMENTS, s->recv_fragments}, 1874 {TIPC_NLA_STATS_RX_FRAGMENTS, s->recv_fragments},
1872 {TIPC_NLA_STATS_RX_FRAGMENTED, s->recv_fragmented}, 1875 {TIPC_NLA_STATS_RX_FRAGMENTED, s->recv_fragmented},
1873 {TIPC_NLA_STATS_RX_BUNDLES, s->recv_bundles}, 1876 {TIPC_NLA_STATS_RX_BUNDLES, s->recv_bundles},
1874 {TIPC_NLA_STATS_RX_BUNDLED, s->recv_bundled}, 1877 {TIPC_NLA_STATS_RX_BUNDLED, s->recv_bundled},
1875 {TIPC_NLA_STATS_TX_INFO, s->sent_info}, 1878 {TIPC_NLA_STATS_TX_INFO, 0},
1876 {TIPC_NLA_STATS_TX_FRAGMENTS, s->sent_fragments}, 1879 {TIPC_NLA_STATS_TX_FRAGMENTS, s->sent_fragments},
1877 {TIPC_NLA_STATS_TX_FRAGMENTED, s->sent_fragmented}, 1880 {TIPC_NLA_STATS_TX_FRAGMENTED, s->sent_fragmented},
1878 {TIPC_NLA_STATS_TX_BUNDLES, s->sent_bundles}, 1881 {TIPC_NLA_STATS_TX_BUNDLES, s->sent_bundles},
@@ -1947,9 +1950,9 @@ int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
1947 goto attr_msg_full; 1950 goto attr_msg_full;
1948 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_MTU, link->mtu)) 1951 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_MTU, link->mtu))
1949 goto attr_msg_full; 1952 goto attr_msg_full;
1950 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, link->rcv_nxt)) 1953 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, link->stats.recv_pkts))
1951 goto attr_msg_full; 1954 goto attr_msg_full;
1952 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, link->snd_nxt)) 1955 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, link->stats.sent_pkts))
1953 goto attr_msg_full; 1956 goto attr_msg_full;
1954 1957
1955 if (tipc_link_is_up(link)) 1958 if (tipc_link_is_up(link))
@@ -2004,12 +2007,12 @@ static int __tipc_nl_add_bc_link_stat(struct sk_buff *skb,
2004 }; 2007 };
2005 2008
2006 struct nla_map map[] = { 2009 struct nla_map map[] = {
2007 {TIPC_NLA_STATS_RX_INFO, stats->recv_info}, 2010 {TIPC_NLA_STATS_RX_INFO, stats->recv_pkts},
2008 {TIPC_NLA_STATS_RX_FRAGMENTS, stats->recv_fragments}, 2011 {TIPC_NLA_STATS_RX_FRAGMENTS, stats->recv_fragments},
2009 {TIPC_NLA_STATS_RX_FRAGMENTED, stats->recv_fragmented}, 2012 {TIPC_NLA_STATS_RX_FRAGMENTED, stats->recv_fragmented},
2010 {TIPC_NLA_STATS_RX_BUNDLES, stats->recv_bundles}, 2013 {TIPC_NLA_STATS_RX_BUNDLES, stats->recv_bundles},
2011 {TIPC_NLA_STATS_RX_BUNDLED, stats->recv_bundled}, 2014 {TIPC_NLA_STATS_RX_BUNDLED, stats->recv_bundled},
2012 {TIPC_NLA_STATS_TX_INFO, stats->sent_info}, 2015 {TIPC_NLA_STATS_TX_INFO, stats->sent_pkts},
2013 {TIPC_NLA_STATS_TX_FRAGMENTS, stats->sent_fragments}, 2016 {TIPC_NLA_STATS_TX_FRAGMENTS, stats->sent_fragments},
2014 {TIPC_NLA_STATS_TX_FRAGMENTED, stats->sent_fragmented}, 2017 {TIPC_NLA_STATS_TX_FRAGMENTED, stats->sent_fragmented},
2015 {TIPC_NLA_STATS_TX_BUNDLES, stats->sent_bundles}, 2018 {TIPC_NLA_STATS_TX_BUNDLES, stats->sent_bundles},
@@ -2076,9 +2079,9 @@ int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg)
2076 goto attr_msg_full; 2079 goto attr_msg_full;
2077 if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name)) 2080 if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name))
2078 goto attr_msg_full; 2081 goto attr_msg_full;
2079 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, bcl->rcv_nxt)) 2082 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, 0))
2080 goto attr_msg_full; 2083 goto attr_msg_full;
2081 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, bcl->snd_nxt)) 2084 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, 0))
2082 goto attr_msg_full; 2085 goto attr_msg_full;
2083 2086
2084 prop = nla_nest_start(msg->skb, TIPC_NLA_LINK_PROP); 2087 prop = nla_nest_start(msg->skb, TIPC_NLA_LINK_PROP);