tipc: Minor optimization of broadcast link transmit queue statistic
authorAllan Stephens <allan.stephens@windriver.com>
Mon, 24 Oct 2011 17:27:31 +0000 (13:27 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Tue, 27 Dec 2011 16:33:51 +0000 (11:33 -0500)
The two broadcast link statistics fields that are used to derive the
average length of that link's transmit queue are now updated only after
a successful attempt to send a broadcast message, since there is no need
to update these values when an unsuccessful send attempt leaves the
queue unchanged.

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

index 8f58df24bac5f0f375694b41ddc6520c3ba6c5f6..dd990b081435158bc387b3522d87a7e9a7aeee32 100644 (file)
@@ -424,11 +424,11 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
        }
 
        res = tipc_link_send_buf(bcl, buf);
-       if (likely(res > 0))
+       if (likely(res >= 0)) {
                bclink_set_last_sent();
-
-       bcl->stats.queue_sz_counts++;
-       bcl->stats.accu_queue_sz += bcl->out_queue_size;
+               bcl->stats.queue_sz_counts++;
+               bcl->stats.accu_queue_sz += bcl->out_queue_size;
+       }
 exit:
        spin_unlock_bh(&bc_lock);
        return res;