sctputil.c (170354) | sctputil.c (170428) |
---|---|
1/*- 2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 170354 2007-06-06 00:40:41Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 170428 2007-06-08 10:57:11Z rrs $"); |
35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> 39#include <netinet/sctp_var.h> 40#include <netinet/sctp_sysctl.h> 41#ifdef INET6 42#include <netinet6/sctp6_var.h> --- 2529 unchanged lines hidden (view full) --- 2572 goto calc_rto; 2573 } 2574 /***************************/ 2575 /* 2. update RTTVAR & SRTT */ 2576 /***************************/ 2577 o_calctime = calc_time; 2578 /* this is Van Jacobson's integer version */ 2579 if (net->RTO) { | 35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> 39#include <netinet/sctp_var.h> 40#include <netinet/sctp_sysctl.h> 41#ifdef INET6 42#include <netinet6/sctp6_var.h> --- 2529 unchanged lines hidden (view full) --- 2572 goto calc_rto; 2573 } 2574 /***************************/ 2575 /* 2. update RTTVAR & SRTT */ 2576 /***************************/ 2577 o_calctime = calc_time; 2578 /* this is Van Jacobson's integer version */ 2579 if (net->RTO) { |
2580 calc_time -= (net->lastsa >> 3); | 2580 calc_time -= (net->lastsa >> SCTP_RTT_SHIFT); /* take away 1/8th when 2581 * shift=3 */ |
2581#ifdef SCTP_RTTVAR_LOGGING 2582 rto_logging(net, SCTP_LOG_RTTVAR); 2583#endif 2584 net->prev_rtt = o_calctime; | 2582#ifdef SCTP_RTTVAR_LOGGING 2583 rto_logging(net, SCTP_LOG_RTTVAR); 2584#endif 2585 net->prev_rtt = o_calctime; |
2585 net->lastsa += calc_time; | 2586 net->lastsa += calc_time; /* add 7/8th into sa when 2587 * shift=3 */ |
2586 if (calc_time < 0) { 2587 calc_time = -calc_time; 2588 } | 2588 if (calc_time < 0) { 2589 calc_time = -calc_time; 2590 } |
2589 calc_time -= (net->lastsv >> 2); | 2591 calc_time -= (net->lastsv >> SCTP_RTT_VAR_SHIFT); /* take away 1/4 when 2592 * VAR shift=2 */ |
2590 net->lastsv += calc_time; 2591 if (net->lastsv == 0) { 2592 net->lastsv = SCTP_CLOCK_GRANULARITY; 2593 } 2594 } else { 2595 /* First RTO measurment */ | 2593 net->lastsv += calc_time; 2594 if (net->lastsv == 0) { 2595 net->lastsv = SCTP_CLOCK_GRANULARITY; 2596 } 2597 } else { 2598 /* First RTO measurment */ |
2596 net->lastsa = calc_time; 2597 net->lastsv = calc_time >> 1; | 2599 net->lastsa = calc_time << SCTP_RTT_SHIFT; /* Multiply by 8 when 2600 * shift=3 */ 2601 net->lastsv = calc_time; 2602 if (net->lastsv == 0) { 2603 net->lastsv = SCTP_CLOCK_GRANULARITY; 2604 } |
2598 first_measure = 1; 2599 net->prev_rtt = o_calctime; 2600#ifdef SCTP_RTTVAR_LOGGING 2601 rto_logging(net, SCTP_LOG_INITIAL_RTT); 2602#endif 2603 } 2604calc_rto: | 2605 first_measure = 1; 2606 net->prev_rtt = o_calctime; 2607#ifdef SCTP_RTTVAR_LOGGING 2608 rto_logging(net, SCTP_LOG_INITIAL_RTT); 2609#endif 2610 } 2611calc_rto: |
2605 new_rto = ((net->lastsa >> 2) + net->lastsv) >> 1; | 2612 new_rto = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv; |
2606 if ((new_rto > SCTP_SAT_NETWORK_MIN) && 2607 (stcb->asoc.sat_network_lockout == 0)) { 2608 stcb->asoc.sat_network = 1; 2609 } else if ((!first_measure) && stcb->asoc.sat_network) { 2610 stcb->asoc.sat_network = 0; 2611 stcb->asoc.sat_network_lockout = 1; 2612 } 2613 /* bound it, per C6/C7 in Section 5.3.1 */ --- 3255 unchanged lines hidden --- | 2613 if ((new_rto > SCTP_SAT_NETWORK_MIN) && 2614 (stcb->asoc.sat_network_lockout == 0)) { 2615 stcb->asoc.sat_network = 1; 2616 } else if ((!first_measure) && stcb->asoc.sat_network) { 2617 stcb->asoc.sat_network = 0; 2618 stcb->asoc.sat_network_lockout = 1; 2619 } 2620 /* bound it, per C6/C7 in Section 5.3.1 */ --- 3255 unchanged lines hidden --- |