diff options
Diffstat (limited to 'net/tipc/bcast.c')
-rw-r--r-- | net/tipc/bcast.c | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index fef3689bcf23..e4e6d8cd47e6 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -701,48 +701,43 @@ void tipc_bcbearer_sort(void) | |||
701 | 701 | ||
702 | int tipc_bclink_stats(char *buf, const u32 buf_size) | 702 | int tipc_bclink_stats(char *buf, const u32 buf_size) |
703 | { | 703 | { |
704 | struct print_buf pb; | 704 | int ret; |
705 | struct tipc_stats *s; | ||
705 | 706 | ||
706 | if (!bcl) | 707 | if (!bcl) |
707 | return 0; | 708 | return 0; |
708 | 709 | ||
709 | tipc_printbuf_init(&pb, buf, buf_size); | ||
710 | |||
711 | spin_lock_bh(&bc_lock); | 710 | spin_lock_bh(&bc_lock); |
712 | 711 | ||
713 | tipc_printf(&pb, "Link <%s>\n" | 712 | s = &bcl->stats; |
714 | " Window:%u packets\n", | 713 | |
715 | bcl->name, bcl->queue_limit[0]); | 714 | ret = tipc_snprintf(buf, buf_size, "Link <%s>\n" |
716 | tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", | 715 | " Window:%u packets\n", |
717 | bcl->stats.recv_info, | 716 | bcl->name, bcl->queue_limit[0]); |
718 | bcl->stats.recv_fragments, | 717 | ret += tipc_snprintf(buf + ret, buf_size - ret, |
719 | bcl->stats.recv_fragmented, | 718 | " RX packets:%u fragments:%u/%u bundles:%u/%u\n", |
720 | bcl->stats.recv_bundles, | 719 | s->recv_info, s->recv_fragments, |
721 | bcl->stats.recv_bundled); | 720 | s->recv_fragmented, s->recv_bundles, |
722 | tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", | 721 | s->recv_bundled); |
723 | bcl->stats.sent_info, | 722 | ret += tipc_snprintf(buf + ret, buf_size - ret, |
724 | bcl->stats.sent_fragments, | 723 | " TX packets:%u fragments:%u/%u bundles:%u/%u\n", |
725 | bcl->stats.sent_fragmented, | 724 | s->sent_info, s->sent_fragments, |
726 | bcl->stats.sent_bundles, | 725 | s->sent_fragmented, s->sent_bundles, |
727 | bcl->stats.sent_bundled); | 726 | s->sent_bundled); |
728 | tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n", | 727 | ret += tipc_snprintf(buf + ret, buf_size - ret, |
729 | bcl->stats.recv_nacks, | 728 | " RX naks:%u defs:%u dups:%u\n", |
730 | bcl->stats.deferred_recv, | 729 | s->recv_nacks, s->deferred_recv, s->duplicates); |
731 | bcl->stats.duplicates); | 730 | ret += tipc_snprintf(buf + ret, buf_size - ret, |
732 | tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n", | 731 | " TX naks:%u acks:%u dups:%u\n", |
733 | bcl->stats.sent_nacks, | 732 | s->sent_nacks, s->sent_acks, s->retransmitted); |
734 | bcl->stats.sent_acks, | 733 | ret += tipc_snprintf(buf + ret, buf_size - ret, |
735 | bcl->stats.retransmitted); | 734 | " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", |
736 | tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", | 735 | s->bearer_congs, s->link_congs, s->max_queue_sz, |
737 | bcl->stats.bearer_congs, | 736 | s->queue_sz_counts ? |
738 | bcl->stats.link_congs, | 737 | (s->accu_queue_sz / s->queue_sz_counts) : 0); |
739 | bcl->stats.max_queue_sz, | ||
740 | bcl->stats.queue_sz_counts | ||
741 | ? (bcl->stats.accu_queue_sz / bcl->stats.queue_sz_counts) | ||
742 | : 0); | ||
743 | 738 | ||
744 | spin_unlock_bh(&bc_lock); | 739 | spin_unlock_bh(&bc_lock); |
745 | return tipc_printbuf_validate(&pb); | 740 | return ret; |
746 | } | 741 | } |
747 | 742 | ||
748 | int tipc_bclink_reset_stats(void) | 743 | int tipc_bclink_reset_stats(void) |