summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_dummynet.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/ip_dummynet.c')
-rw-r--r--sys/netinet/ip_dummynet.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c
index 82b6f7b..63643fd 100644
--- a/sys/netinet/ip_dummynet.c
+++ b/sys/netinet/ip_dummynet.c
@@ -565,8 +565,10 @@ ready_event(struct dn_flow_queue *q)
/* XXX should check errors on heap_insert, and drain the whole
* queue on error hoping next time we are luckier.
*/
- } else /* RED needs to know when the queue becomes empty */
+ } else { /* RED needs to know when the queue becomes empty */
q->q_time = curr_time;
+ q->numbytes = 0;
+ }
/*
* If the delay line was empty call transmit_event(p) now.
* Otherwise, the scheduler will take care of it.
@@ -1509,8 +1511,9 @@ set_fs_parms(struct dn_flow_set *x, struct dn_flow_set *src)
static int
config_pipe(struct dn_pipe *p)
{
- int s ;
+ int i, s;
struct dn_flow_set *pfs = &(p->fs);
+ struct dn_flow_queue *q;
/*
* The config program passes parameters as follows:
@@ -1542,9 +1545,17 @@ config_pipe(struct dn_pipe *p)
*/
x->idle_heap.size = x->idle_heap.elements = 0 ;
x->idle_heap.offset=OFFSET_OF(struct dn_flow_queue, heap_pos);
- } else
+ } else {
x = b;
+ s = splimp();
+ /* Flush accumulated credit for all queues */
+ for (i = 0; i <= x->fs.rq_size; i++)
+ for (q = x->fs.rq[i]; q; q = q->next)
+ q->numbytes = 0;
+ splx(s);
+ }
+ s = splimp();
x->bandwidth = p->bandwidth ;
x->numbytes = 0; /* just in case... */
bcopy(p->if_name, x->if_name, sizeof(p->if_name) );
@@ -1559,14 +1570,13 @@ config_pipe(struct dn_pipe *p)
free(x, M_DUMMYNET);
return s ;
}
- s = splimp() ;
x->next = b ;
if (a == NULL)
all_pipes = x ;
else
a->next = x ;
- splx(s);
}
+ splx(s);
} else { /* config queue */
struct dn_flow_set *x, *a, *b ;
@@ -1595,6 +1605,7 @@ config_pipe(struct dn_pipe *p)
return EINVAL ;
x = b;
}
+ s = splimp();
set_fs_parms(x, pfs);
if ( x->rq == NULL ) { /* a new flow_set */
@@ -1603,14 +1614,13 @@ config_pipe(struct dn_pipe *p)
free(x, M_DUMMYNET);
return s ;
}
- s = splimp() ;
x->next = b;
if (a == NULL)
all_flow_sets = x;
else
a->next = x;
- splx(s);
}
+ splx(s);
}
return 0 ;
}
OpenPOWER on IntegriCloud