tipc: Improve accuracy of link transmit queue maximum size statistic
authorAllan Stephens <Allan.Stephens@windriver.com>
Tue, 18 Jan 2011 20:02:50 +0000 (15:02 -0500)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Wed, 23 Feb 2011 23:05:15 +0000 (18:05 -0500)
Enhances TIPC's unicast and broadcast link code to update the transmit
queue maximum size counter in a single place, namely the routine that
adds messages to the queue. This ensures that the maximum size statistic
reported for unicast links is completely accurate, rather than being
partially based on statistical sampling.

The changes to link.h are just documenting the roles of the variables.

Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
net/tipc/bcast.c
net/tipc/link.c
net/tipc/link.h

index a5eb7dbfa0c36cf7bd28b7905b343c4fa88ac57d..63df42b2d10151403156d0a3beff31675d1995c1 100644 (file)
@@ -418,8 +418,6 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
        else
                bclink_set_last_sent();
 
-       if (bcl->out_queue_size > bcl->stats.max_queue_sz)
-               bcl->stats.max_queue_sz = bcl->out_queue_size;
        bcl->stats.queue_sz_counts++;
        bcl->stats.accu_queue_sz += bcl->out_queue_size;
 
index 0cb773b7ee21dc2bf960489a2b4caa712ab01e5e..d1818fbc19a3dc8e23a121fd74126e31c7a6ace3 100644 (file)
@@ -246,9 +246,6 @@ static void link_timeout(struct link *l_ptr)
        l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size;
        l_ptr->stats.queue_sz_counts++;
 
-       if (l_ptr->out_queue_size > l_ptr->stats.max_queue_sz)
-               l_ptr->stats.max_queue_sz = l_ptr->out_queue_size;
-
        if (l_ptr->first_out) {
                struct tipc_msg *msg = buf_msg(l_ptr->first_out);
                u32 length = msg_size(msg);
@@ -824,7 +821,10 @@ static void link_add_to_outqueue(struct link *l_ptr,
                l_ptr->last_out = buf;
        } else
                l_ptr->first_out = l_ptr->last_out = buf;
+
        l_ptr->out_queue_size++;
+       if (l_ptr->out_queue_size > l_ptr->stats.max_queue_sz)
+               l_ptr->stats.max_queue_sz = l_ptr->out_queue_size;
 }
 
 /*
@@ -867,9 +867,6 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
 
        /* Packet can be queued or sent: */
 
-       if (queue_size > l_ptr->stats.max_queue_sz)
-               l_ptr->stats.max_queue_sz = queue_size;
-
        if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
                   !link_congested(l_ptr))) {
                link_add_to_outqueue(l_ptr, buf, msg);
index bdb0fa263d20cb3de903f0fbd9c319838892bcb8..a7794e7ede291b7143f63b7707ad7a02982f73c0 100644 (file)
@@ -196,18 +196,12 @@ struct link {
                u32 bearer_congs;
                u32 deferred_recv;
                u32 duplicates;
-
-               /* for statistical profiling of send queue size */
-
-               u32 max_queue_sz;
-               u32 accu_queue_sz;
-               u32 queue_sz_counts;
-
-               /* for statistical profiling of message lengths */
-
-               u32 msg_length_counts;
-               u32 msg_lengths_total;
-               u32 msg_length_profile[7];
+               u32 max_queue_sz;       /* send queue size high water mark */
+               u32 accu_queue_sz;      /* used for send queue size profiling */
+               u32 queue_sz_counts;    /* used for send queue size profiling */
+               u32 msg_length_counts;  /* used for message length profiling */
+               u32 msg_lengths_total;  /* used for message length profiling */
+               u32 msg_length_profile[7]; /* used for msg. length profiling */
        } stats;
 };