From owner-svn-src-all@FreeBSD.ORG Sun Jan 17 17:45:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D27CC10656AA; Sun, 17 Jan 2010 17:45:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C187A8FC1D; Sun, 17 Jan 2010 17:45:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0HHj9kZ097788; Sun, 17 Jan 2010 17:45:09 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0HHj97X097786; Sun, 17 Jan 2010 17:45:09 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201001171745.o0HHj97X097786@svn.freebsd.org> From: Michael Tuexen Date: Sun, 17 Jan 2010 17:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202497 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jan 2010 17:45:09 -0000 Author: tuexen Date: Sun Jan 17 17:45:09 2010 New Revision: 202497 URL: http://svn.freebsd.org/changeset/base/202497 Log: MFC 198621 Improve round robin stream scheduler and cleanup some code. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Sun Jan 17 17:41:43 2010 (r202496) +++ stable/8/sys/netinet/sctp_output.c Sun Jan 17 17:45:09 2010 (r202497) @@ -5605,13 +5605,10 @@ sctp_insert_on_wheel(struct sctp_tcb *st 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 * 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; }