Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_output.c
Show All 36 Lines | |||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include "opt_ipsec.h" | #include "opt_ipsec.h" | ||||
#include "opt_kern_tls.h" | #include "opt_kern_tls.h" | ||||
#include "opt_tcpdebug.h" | #include "opt_tcpdebug.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/arb.h> | |||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#ifdef TCP_HHOOK | #ifdef TCP_HHOOK | ||||
#include <sys/hhook.h> | #include <sys/hhook.h> | ||||
#endif | #endif | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
#include <sys/ktls.h> | #include <sys/ktls.h> | ||||
#endif | #endif | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/protosw.h> | #include <sys/protosw.h> | ||||
#include <sys/qmath.h> | |||||
#include <sys/sdt.h> | #include <sys/sdt.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/socketvar.h> | #include <sys/socketvar.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/stats.h> | |||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_kdtrace.h> | #include <netinet/in_kdtrace.h> | ||||
#include <netinet/in_systm.h> | #include <netinet/in_systm.h> | ||||
▲ Show 20 Lines • Show All 917 Lines • ▼ Show 20 Lines | /*#endif*/ | ||||
* be transmitted, and initialize the header from | * be transmitted, and initialize the header from | ||||
* the template for sends on this connection. | * the template for sends on this connection. | ||||
*/ | */ | ||||
if (len) { | if (len) { | ||||
struct mbuf *mb; | struct mbuf *mb; | ||||
struct sockbuf *msb; | struct sockbuf *msb; | ||||
u_int moff; | u_int moff; | ||||
if ((tp->t_flags & TF_FORCEDATA) && len == 1) | if ((tp->t_flags & TF_FORCEDATA) && len == 1) { | ||||
TCPSTAT_INC(tcps_sndprobe); | TCPSTAT_INC(tcps_sndprobe); | ||||
else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) { | #ifdef STATS | ||||
if (SEQ_LT(tp->snd_nxt, tp->snd_max)) | |||||
stats_voi_update_abs_u32(tp->t_stats, | |||||
VOI_TCP_RETXPB, len); | |||||
else | |||||
stats_voi_update_abs_u64(tp->t_stats, | |||||
VOI_TCP_TXPB, len); | |||||
#endif /* STATS */ | |||||
} else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) { | |||||
tp->t_sndrexmitpack++; | tp->t_sndrexmitpack++; | ||||
TCPSTAT_INC(tcps_sndrexmitpack); | TCPSTAT_INC(tcps_sndrexmitpack); | ||||
TCPSTAT_ADD(tcps_sndrexmitbyte, len); | TCPSTAT_ADD(tcps_sndrexmitbyte, len); | ||||
#ifdef STATS | |||||
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RETXPB, | |||||
len); | |||||
#endif /* STATS */ | |||||
} else { | } else { | ||||
TCPSTAT_INC(tcps_sndpack); | TCPSTAT_INC(tcps_sndpack); | ||||
TCPSTAT_ADD(tcps_sndbyte, len); | TCPSTAT_ADD(tcps_sndbyte, len); | ||||
#ifdef STATS | |||||
stats_voi_update_abs_u64(tp->t_stats, VOI_TCP_TXPB, | |||||
len); | |||||
#endif /* STATS */ | |||||
} | } | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if (MHLEN < hdrlen + max_linkhdr) | if (MHLEN < hdrlen + max_linkhdr) | ||||
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); | m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); | ||||
else | else | ||||
#endif | #endif | ||||
m = m_gethdr(M_NOWAIT, MT_DATA); | m = m_gethdr(M_NOWAIT, MT_DATA); | ||||
▲ Show 20 Lines • Show All 456 Lines • ▼ Show 20 Lines | if (SEQ_GT(tp->snd_nxt, tp->snd_max)) { | ||||
* Time this transmission if not a retransmission and | * Time this transmission if not a retransmission and | ||||
* not currently timing anything. | * not currently timing anything. | ||||
*/ | */ | ||||
if (tp->t_rtttime == 0) { | if (tp->t_rtttime == 0) { | ||||
tp->t_rtttime = ticks; | tp->t_rtttime = ticks; | ||||
tp->t_rtseq = startseq; | tp->t_rtseq = startseq; | ||||
TCPSTAT_INC(tcps_segstimed); | TCPSTAT_INC(tcps_segstimed); | ||||
} | } | ||||
#ifdef STATS | |||||
if (!(tp->t_flags & TF_GPUTINPROG) && len) { | |||||
tp->t_flags |= TF_GPUTINPROG; | |||||
tp->gput_seq = startseq; | |||||
tp->gput_ack = startseq + | |||||
ulmin(sbavail(&so->so_snd) - off, sendwin); | |||||
tp->gput_ts = tcp_ts_getticks(); | |||||
} | |||||
#endif /* STATS */ | |||||
} | } | ||||
/* | /* | ||||
* Set retransmit timer if not currently set, | * Set retransmit timer if not currently set, | ||||
* and not doing a pure ack or a keep-alive probe. | * and not doing a pure ack or a keep-alive probe. | ||||
* Initial value for retransmit timer is smoothed | * Initial value for retransmit timer is smoothed | ||||
* round-trip time + 2 * round-trip time variance. | * round-trip time + 2 * round-trip time variance. | ||||
* Initialize shift counter which is used for backoff | * Initialize shift counter which is used for backoff | ||||
▲ Show 20 Lines • Show All 592 Lines • Show Last 20 Lines |