FreeBSD/sys/netinet/khelp/h_ertt.c
/*
 * This fuction measures the RTT of a particular segment/ack pair, or the next
 * closest if this will yield an inaccurate result due to delayed acking or
 * other issues.
 */
This fuction measures the RTT of a particular segment/ack pair, or the next
closest if this will yield an inaccurate result due to delayed acking or
other issues.
This fuction measures the RTT of a particular segment / ack pair or the next closest if this will yield an inaccurate result due to delayed acking or other issues .
static void inline
marked_packet_rtt(struct txseginfo *txsi, struct ertt *e_t, struct tcpcb *tp,
    uint32_t *pmeasurenext, int *pmeasurenext_len, int *prtt_bytes_adjust,
    int mflag)
{
	if (mflag & (MULTI_ACK|OLD_TXSI)) {
		*pmeasurenext = txsi->tx_ts;
		*pmeasurenext_len = txsi->len;
		*prtt_bytes_adjust += *pmeasurenext_len;
	} else {
		if (mflag & FORCED_MEASUREMENT) {
			e_t->markedpkt_rtt = tcp_ts_getticks() -
			    *pmeasurenext + 1;
			e_t->bytes_tx_in_marked_rtt = e_t->bytes_tx_in_rtt +
			    *pmeasurenext_len - *prtt_bytes_adjust;
		} else {
			e_t->markedpkt_rtt = tcp_ts_getticks() -
			    txsi->tx_ts + 1;
			e_t->bytes_tx_in_marked_rtt = e_t->bytes_tx_in_rtt -
			    *prtt_bytes_adjust;
		}
		e_t->marked_snd_cwnd = tp->snd_cwnd;
		e_t->flags &= ~ERTT_MEASUREMENT_IN_PROGRESS;
		e_t->flags |= ERTT_NEW_MEASUREMENT;
		if (tp->t_flags & TF_TSO) {
			tp->t_flags &= ~TF_TSO;
			e_t->flags |= ERTT_TSO_DISABLED;
		}
	}
}
static void inline marked_packet_rtt ( struct txseginfo * txsi , struct ertt * e_t , struct tcpcb * tp , uint32_t * pmeasurenext , int * pmeasurenext_len , int * prtt_bytes_adjust , int mflag ) { if ( mflag & ( MULTI_ACK | OLD_TXSI ) ) { * pmeasurenext = txsi -> tx_ts ; * pmeasurenext_len = txsi -> len ; * prtt_bytes_adjust += * pmeasurenext_len ; } else { if ( mflag & FORCED_MEASUREMENT ) { e_t -> markedpkt_rtt = tcp_ts_getticks ( ) - * pmeasurenext + 1 ; e_t -> bytes_tx_in_marked_rtt = e_t -> bytes_tx_in_rtt + * pmeasurenext_len - * prtt_bytes_adjust ; } else { e_t -> markedpkt_rtt = tcp_ts_getticks ( ) - txsi -> tx_ts + 1 ; e_t -> bytes_tx_in_marked_rtt = e_t -> bytes_tx_in_rtt - * prtt_bytes_adjust ; } e_t -> marked_snd_cwnd = tp -> snd_cwnd ; e_t -> flags &= ~ ERTT_MEASUREMENT_IN_PROGRESS ; e_t -> flags |= ERTT_NEW_MEASUREMENT ; if ( tp -> t_flags & TF_TSO ) { tp -> t_flags &= ~ TF_TSO ; e_t -> flags |= ERTT_TSO_DISABLED ; } } }
This fuction measures the RTT of a particular segment/ack pair, or the next
 closest if this will yield an inaccurate result due to delayed acking or
 other issues.
This fuction measures the RTT of a particular segment / ack pair or the next closest if this will yield an inaccurate result due to delayed acking or other issues .
/*
	 * If we can't measure this one properly due to delayed acking adjust
	 * byte counters and flag to measure next txsi. Note that since the
	 * marked packet's transmitted bytes are measured we need to subtract the
	 * transmitted bytes. Then pretend the next txsi was marked.
	 */ /*
		 * Reset the ERTT_MEASUREMENT_IN_PROGRESS flag to indicate to
		 * add_tx_segment_info that a new measurement should be started.
		 */ /*
		 * Set ERTT_NEW_MEASUREMENT to tell the congestion control
		 * algorithm that a new marked RTT measurement has has been made
		 * and is available for use.
		 */ /* Temporarily disable TSO to aid a new measurment. */ /* Keep track that we've disabled it. */