X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fpinsched.c;h=41e9c8dd47d54c3d6d832b887a4d4c15b2dca54f;hb=eec25dc1ae3ed49ad5e2eda0ca04450c4f75d6f7;hp=695d9b46a8231847e406009da6d5918a48f2290f;hpb=b2fda3effc787f265b5ad5dfa967ac00627bd075;p=openvswitch diff --git a/ofproto/pinsched.c b/ofproto/pinsched.c index 695d9b46..41e9c8dd 100644 --- a/ofproto/pinsched.c +++ b/ofproto/pinsched.c @@ -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 #include #include +#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; +}