From owner-svn-src-all@FreeBSD.ORG Sat Nov 20 19:33:42 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 D7745106564A; Sat, 20 Nov 2010 19:33:42 +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 C58568FC1D; Sat, 20 Nov 2010 19:33:42 +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 oAKJXgOO023440; Sat, 20 Nov 2010 19:33:42 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAKJXgi9023438; Sat, 20 Nov 2010 19:33:42 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201011201933.oAKJXgi9023438@svn.freebsd.org> From: Michael Tuexen Date: Sat, 20 Nov 2010 19:33:42 +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: r215581 - 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: Sat, 20 Nov 2010 19:33:43 -0000 Author: tuexen Date: Sat Nov 20 19:33:42 2010 New Revision: 215581 URL: http://svn.freebsd.org/changeset/base/215581 Log: MFC r214928: * Use exponential backoff for retransmission of SHUTDOWN and SHUTDOWN-ACK chunks. * While there, do some cleanups. Modified: stable/8/sys/netinet/sctp_timer.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_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Sat Nov 20 19:31:31 2010 (r215580) +++ stable/8/sys/netinet/sctp_timer.c Sat Nov 20 19:33:42 2010 (r215581) @@ -291,6 +291,10 @@ sctp_threshold_management(struct sctp_in return (0); } +/* + * sctp_find_alternate_net() returns a non-NULL pointer as long + * the argument net is non-NULL. + */ struct sctp_nets * sctp_find_alternate_net(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -440,8 +444,7 @@ sctp_find_alternate_net(struct sctp_tcb else if (mode == 1) { TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) { if (((mnet->dest_state & SCTP_ADDR_REACHABLE) != SCTP_ADDR_REACHABLE) || - (mnet->dest_state & SCTP_ADDR_UNCONFIRMED) - ) { + (mnet->dest_state & SCTP_ADDR_UNCONFIRMED)) { /* * will skip ones that are not-reachable or * unconfirmed @@ -505,12 +508,10 @@ sctp_find_alternate_net(struct sctp_tcb } alt->src_addr_selected = 0; } - if ( - ((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && - (alt->ro.ro_rt != NULL) && /* sa_ignore NO_NULL_CHK */ - (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) - ) { + if (((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && + (alt->ro.ro_rt != NULL) && + (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) { /* Found a reachable address */ break; } @@ -549,8 +550,6 @@ sctp_find_alternate_net(struct sctp_tcb return (alt); } - - static void sctp_backoff_on_timeout(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -1021,8 +1020,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * used, then pick dest with largest ssthresh for any * retransmission. */ - alt = net; - alt = sctp_find_alternate_net(stcb, alt, 1); + alt = sctp_find_alternate_net(stcb, net, 1); /* * CUCv2: If a different dest is picked for the * retransmission, then new (rtx-)pseudo_cumack needs to be @@ -1213,7 +1211,7 @@ sctp_t1init_timer(struct sctp_inpcb *inp struct sctp_nets *alt; alt = sctp_find_alternate_net(stcb, stcb->asoc.primary_destination, 0); - if ((alt != NULL) && (alt != stcb->asoc.primary_destination)) { + if (alt != stcb->asoc.primary_destination) { sctp_move_chunks_from_net(stcb, stcb->asoc.primary_destination); stcb->asoc.primary_destination = alt; } @@ -1480,6 +1478,7 @@ sctp_delete_prim_timer(struct sctp_inpcb * For the shutdown and shutdown-ack, we do not keep one around on the * control queue. This means we must generate a new one and call the general * chunk output routine, AFTER having done threshold management. + * It is assumed that net is non-NULL. */ int sctp_shutdown_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, @@ -1492,18 +1491,13 @@ sctp_shutdown_timer(struct sctp_inpcb *i /* Assoc is over */ return (1); } + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); /* second select an alternative */ alt = sctp_find_alternate_net(stcb, net, 0); /* third generate a shutdown into the queue for out net */ - if (alt) { - sctp_send_shutdown(stcb, alt); - } else { - /* - * if alt is NULL, there is no dest to send to?? - */ - return (0); - } + sctp_send_shutdown(stcb, alt); + /* fourth restart timer */ sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, inp, stcb, alt); return (0); @@ -1520,6 +1514,7 @@ sctp_shutdownack_timer(struct sctp_inpcb /* Assoc is over */ return (1); } + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); /* second select an alternative */ alt = sctp_find_alternate_net(stcb, net, 0);