integrated
[ipfw.git] / dummynet2 / dn_sched_rr.c
index 59c36ac..2b58cf0 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 /*
- * $Id: dn_sched_rr.c 5621 2010-03-04 16:51:27Z luigi $
+ * $Id: dn_sched_rr.c 6338 2010-05-26 15:06:34Z svn_panicucci $
  */
 
 #ifdef _KERNEL
@@ -94,7 +94,7 @@ rr_remove_head(struct rr_si *si)
        if (si->head == NULL)
                return; /* empty queue */
        si->head->status = 0;
-       
+
        if (si->head == si->tail) {
                si->head = si->tail = NULL;
                return;
@@ -111,7 +111,7 @@ static inline void
 remove_queue_q(struct rr_queue *q, struct rr_si *si)
 {
        struct rr_queue *prev;
-       
+
        if (q->status != 1)
                return;
        if (q == si->head) {
@@ -141,7 +141,7 @@ next_pointer(struct rr_si *si)
        si->tail = si->tail->qnext;
 }
 
-static int 
+static int
 rr_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m)
 {
        struct rr_si *si;
@@ -154,7 +154,7 @@ rr_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m)
                        return 0;
        }
 
-       /* If reach this point, queue q was idle */ 
+       /* If reach this point, queue q was idle */
        si = (struct rr_si *)(_si + 1);
        rrq = (struct rr_queue *)q;
 
@@ -264,11 +264,14 @@ rr_new_queue(struct dn_queue *_q)
 }
 
 static int
-rr_free_queue(struct dn_queue *_q)
+rr_free_queue(struct dn_queue *_q, int safe)
 {
        struct rr_queue *q = (struct rr_queue *)_q;
 
        ND("called");
+       if (safe)       /* Delete only if status == 0 */
+               return q->status;
+
        if (q->status == 1) {
                struct rr_si *si = (struct rr_si *)(_q->_si + 1);
                remove_queue_q(q, si);