Improve round robin stream scheduler and cleanup some code.
Approved by: rrs (mentor) MFC after: 3 days
This commit is contained in:
parent
f786e2f82e
commit
08abf6399a
@ -5605,13 +5605,10 @@ sctp_insert_on_wheel(struct sctp_tcb *stcb,
|
||||
if (holds_lock == 0) {
|
||||
SCTP_TCB_SEND_LOCK(stcb);
|
||||
}
|
||||
if ((strq->next_spoke.tqe_next) ||
|
||||
(strq->next_spoke.tqe_prev)) {
|
||||
/* already on wheel */
|
||||
goto outof_here;
|
||||
if ((strq->next_spoke.tqe_next == NULL) &&
|
||||
(strq->next_spoke.tqe_prev == NULL)) {
|
||||
TAILQ_INSERT_TAIL(&asoc->out_wheel, strq, next_spoke);
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&asoc->out_wheel, strq, next_spoke);
|
||||
outof_here:
|
||||
if (holds_lock == 0) {
|
||||
SCTP_TCB_SEND_UNLOCK(stcb);
|
||||
}
|
||||
@ -5624,19 +5621,26 @@ sctp_remove_from_wheel(struct sctp_tcb *stcb,
|
||||
int holds_lock)
|
||||
{
|
||||
/* take off and then setup so we know it is not on the wheel */
|
||||
if (holds_lock == 0)
|
||||
if (holds_lock == 0) {
|
||||
SCTP_TCB_SEND_LOCK(stcb);
|
||||
if (TAILQ_FIRST(&strq->outqueue)) {
|
||||
/* more was added */
|
||||
if (holds_lock == 0)
|
||||
SCTP_TCB_SEND_UNLOCK(stcb);
|
||||
return;
|
||||
}
|
||||
TAILQ_REMOVE(&asoc->out_wheel, strq, next_spoke);
|
||||
strq->next_spoke.tqe_next = NULL;
|
||||
strq->next_spoke.tqe_prev = NULL;
|
||||
if (holds_lock == 0)
|
||||
if (TAILQ_EMPTY(&strq->outqueue)) {
|
||||
if (asoc->last_out_stream == strq) {
|
||||
asoc->last_out_stream = TAILQ_PREV(asoc->last_out_stream, sctpwheel_listhead, next_spoke);
|
||||
if (asoc->last_out_stream == NULL) {
|
||||
asoc->last_out_stream = TAILQ_LAST(&asoc->out_wheel, sctpwheel_listhead);
|
||||
}
|
||||
if (asoc->last_out_stream == strq) {
|
||||
asoc->last_out_stream = NULL;
|
||||
}
|
||||
}
|
||||
TAILQ_REMOVE(&asoc->out_wheel, strq, next_spoke);
|
||||
strq->next_spoke.tqe_next = NULL;
|
||||
strq->next_spoke.tqe_prev = NULL;
|
||||
}
|
||||
if (holds_lock == 0) {
|
||||
SCTP_TCB_SEND_UNLOCK(stcb);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -7185,7 +7189,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb,
|
||||
struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now)
|
||||
{
|
||||
struct sctp_association *asoc;
|
||||
struct sctp_stream_out *strq, *strqn, *strqt;
|
||||
struct sctp_stream_out *strq, *strqn;
|
||||
int goal_mtu, moved_how_much, total_moved = 0, bail = 0;
|
||||
int locked, giveup;
|
||||
struct sctp_stream_queue_pending *sp;
|
||||
@ -7261,11 +7265,10 @@ sctp_fill_outqueue(struct sctp_tcb *stcb,
|
||||
break;
|
||||
} else {
|
||||
asoc->locked_on_sending = NULL;
|
||||
strqt = sctp_select_a_stream(stcb, asoc);
|
||||
if (TAILQ_FIRST(&strq->outqueue) == NULL) {
|
||||
if (TAILQ_EMPTY(&strq->outqueue)) {
|
||||
if (strq == strqn) {
|
||||
/* Must move start to next one */
|
||||
strqn = TAILQ_NEXT(asoc->last_out_stream, next_spoke);
|
||||
strqn = TAILQ_NEXT(strq, next_spoke);
|
||||
if (strqn == NULL) {
|
||||
strqn = TAILQ_FIRST(&asoc->out_wheel);
|
||||
if (strqn == NULL) {
|
||||
@ -7278,7 +7281,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb,
|
||||
if ((giveup) || bail) {
|
||||
break;
|
||||
}
|
||||
strq = strqt;
|
||||
strq = sctp_select_a_stream(stcb, asoc);
|
||||
if (strq == NULL) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user