X-Git-Url: http://git.onelab.eu/?p=ipfw.git;a=blobdiff_plain;f=dummynet2%2Fdn_sched_wf2q.c;fp=dummynet2%2Fdn_sched_wf2q.c;h=c42969ed7757547c4f3b4f2bb78665bc0ad3058b;hp=e221989ae4ac49ee3d101fce3661aa9b9f99c6b1;hb=28a7fe9d930667786b902af6697c01eb87694173;hpb=2a8b6c544cf5ea3c84f763144c7ecfa79daea969 diff --git a/dummynet2/dn_sched_wf2q.c b/dummynet2/dn_sched_wf2q.c index e221989..c42969e 100644 --- a/dummynet2/dn_sched_wf2q.c +++ b/dummynet2/dn_sched_wf2q.c @@ -26,7 +26,7 @@ */ /* - * $Id: dn_sched_wf2q.c 5621 2010-03-04 16:51:27Z luigi $ + * $Id: dn_sched_wf2q.c 6338 2010-05-26 15:06:34Z svn_panicucci $ */ #ifdef _KERNEL @@ -125,7 +125,7 @@ idle_check(struct wf2qp_si *si, int n, int force) } } -static int +static int wf2qp_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m) { struct dn_fsk *fs = q->fs; @@ -140,7 +140,7 @@ wf2qp_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 */ alg_fq = (struct wf2qp_queue *)q; if (DN_KEY_LT(alg_fq->F, alg_fq->S)) { @@ -314,13 +314,18 @@ wf2qp_new_queue(struct dn_queue *_q) * of weights. */ static int -wf2qp_free_queue(struct dn_queue *q) +wf2qp_free_queue(struct dn_queue *q, int safe) { struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1); - + if (alg_fq->S >= alg_fq->F + 1) return 0; /* nothing to do, not in any heap */ + + /* queue is in a scheduler heap */ + if (safe) /* do not delete in safe mode */ + return 1; + si->wsum -= q->fs->fs.par[0]; if (si->wsum > 0) si->inv_wsum = ONE_FP/si->wsum;