upcall: Check for recirc_id in ukey_create_from_dpif_flow()
[cascardo/ovs.git] / ofproto / pinsched.c
index 5a59a50..d81c9b3 100644 (file)
 #include "rconn.h"
 #include "sat-math.h"
 #include "timeval.h"
-#include "token-bucket.h"
-#include "vconn.h"
+#include "openvswitch/token-bucket.h"
+#include "openvswitch/vconn.h"
 
 struct pinqueue {
     struct hmap_node node;      /* In struct pinsched's 'queues' hmap. */
-    ofp_port_t port_no;           /* Port number. */
-    struct list packets;        /* Contains "struct ofpbuf"s. */
+    ofp_port_t port_no;         /* Port number. */
+    struct ovs_list packets;    /* Contains "struct ofpbuf"s. */
     int n;                      /* Number of packets in 'packets'. */
 };
 
@@ -183,7 +183,7 @@ get_token(struct pinsched *ps)
 
 void
 pinsched_send(struct pinsched *ps, ofp_port_t port_no,
-              struct ofpbuf *packet, struct list *txq)
+              struct ofpbuf *packet, struct ovs_list *txq)
 {
     list_init(txq);
     if (!ps) {
@@ -215,7 +215,7 @@ pinsched_send(struct pinsched *ps, ofp_port_t port_no,
 }
 
 void
-pinsched_run(struct pinsched *ps, struct list *txq)
+pinsched_run(struct pinsched *ps, struct ovs_list *txq)
 {
     list_init(txq);
     if (ps) {
@@ -295,10 +295,17 @@ pinsched_set_limits(struct pinsched *ps, int rate_limit, int burst_limit)
     }
 }
 
-/* Returns the number of packets scheduled to be sent eventually by 'ps'.
- * Returns 0 if 'ps' is null. */
-unsigned int
-pinsched_count_txqlen(const struct pinsched *ps)
+/* Retrieves statistics for 'ps'.  The statistics will be all zero if 'ps' is
+ * null. */
+void
+pinsched_get_stats(const struct pinsched *ps, struct pinsched_stats *stats)
 {
-    return ps ? ps->n_queued : 0;
+    if (ps) {
+        stats->n_queued = ps->n_queued;
+        stats->n_normal = ps->n_normal;
+        stats->n_limited = ps->n_limited;
+        stats->n_queue_dropped = ps->n_queue_dropped;
+    } else {
+        memset(stats, 0, sizeof *stats);
+    }
 }