diff options
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_dummynet.c | 24 | ||||
-rw-r--r-- | sys/netinet/ip_dummynet.h | 2 |
2 files changed, 18 insertions, 8 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 ; } diff --git a/sys/netinet/ip_dummynet.h b/sys/netinet/ip_dummynet.h index 588461e..626d698 100644 --- a/sys/netinet/ip_dummynet.h +++ b/sys/netinet/ip_dummynet.h @@ -218,7 +218,7 @@ struct dn_flow_queue { struct dn_pkt *head, *tail ; /* queue of packets */ u_int len ; u_int len_bytes ; - long numbytes ; /* credit for transmission (dynamic queues) */ + u_long numbytes ; /* credit for transmission (dynamic queues) */ u_int64_t tot_pkts ; /* statistics counters */ u_int64_t tot_bytes ; |