pinsched: Report queued packet count correctly.
authorBen Pfaff <blp@nicira.com>
Thu, 17 Jul 2014 17:23:52 +0000 (10:23 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 17 Jul 2014 17:23:52 +0000 (10:23 -0700)
'n_txq' was initialized to 0 and never modified, so pinsched_count_txqlen()
always returned 0.  Instead, return the correct number.

This only affected the results of "ovs-appctl memory/show", and only if
controller rate limiting was turned on, so it is not a serious bug.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
ofproto/pinsched.c

index 831afef..5a59a50 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,12 +46,9 @@ struct pinsched {
 
     /* One queue per physical port. */
     struct hmap queues;         /* Contains "struct pinqueue"s. */
-    int n_queued;               /* Sum over queues[*].n. */
+    unsigned int n_queued;      /* Sum over queues[*].n. */
     struct pinqueue *next_txq;  /* Next pinqueue check in round-robin. */
 
-    /* Transmission queue. */
-    int n_txq;                  /* No. of packets waiting in rconn for tx. */
-
     /* Statistics reporting. */
     unsigned long long n_normal;        /* # txed w/o rate limit queuing. */
     unsigned long long n_limited;       /* # queued for rate limiting. */
@@ -256,7 +253,6 @@ pinsched_create(int rate_limit, int burst_limit)
     hmap_init(&ps->queues);
     ps->n_queued = 0;
     ps->next_txq = NULL;
-    ps->n_txq = 0;
     ps->n_normal = 0;
     ps->n_limited = 0;
     ps->n_queue_dropped = 0;
@@ -304,5 +300,5 @@ pinsched_set_limits(struct pinsched *ps, int rate_limit, int burst_limit)
 unsigned int
 pinsched_count_txqlen(const struct pinsched *ps)
 {
-    return ps ? ps->n_txq : 0;
+    return ps ? ps->n_queued : 0;
 }