openflow-1.0: Rename ofp_match to ofp10_match, OFPFW_* to OFPFW10_*.
[openvswitch] / ofproto / pinsched.c
index 695d9b46a8231847e406009da6d5918a48f2290f..41e9c8dd47d54c3d6d832b887a4d4c15b2dca54f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
 #include <arpa/inet.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include "hash.h"
 #include "hmap.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
@@ -319,3 +320,11 @@ pinsched_set_limits(struct pinsched *ps, int rate_limit, int burst_limit)
         drop_packet(ps);
     }
 }
+
+/* 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)
+{
+    return ps ? ps->n_txq : 0;
+}