summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2003-11-20 20:07:39 +0000
committerandre <andre@FreeBSD.org>2003-11-20 20:07:39 +0000
commit6164d7c280688f20cf827e8374984c6e0175fab0 (patch)
treef947a08d66395dd498056038f0c360783fa281c7 /sys/netinet/tcp_output.c
parent6dca20de0718f19b3cdc5a7d5ebb71cd54b2374e (diff)
downloadFreeBSD-src-6164d7c280688f20cf827e8374984c6e0175fab0.zip
FreeBSD-src-6164d7c280688f20cf827e8374984c6e0175fab0.tar.gz
Introduce tcp_hostcache and remove the tcp specific metrics from
the routing table. Move all usage and references in the tcp stack from the routing table metrics to the tcp hostcache. It caches measured parameters of past tcp sessions to provide better initial start values for following connections from or to the same source or destination. Depending on the network parameters to/from the remote host this can lead to significant speedups for new tcp connections after the first one because they inherit and shortcut the learning curve. tcp_hostcache is designed for multiple concurrent access in SMP environments with high contention and is hash indexed by remote ip address. It removes significant locking requirements from the tcp stack with regard to the routing table. Reviewed by: sam (mentor), bms Reviewed by: -net, -current, core@kame.net (IPv6 parts) Approved by: re (scottl)
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index a48ec4a..a8b8e53 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -125,11 +125,12 @@ tcp_output(struct tcpcb *tp)
#if 0
int maxburst = TCP_MAXBURST;
#endif
- struct rmxp_tao *taop;
+ struct rmxp_tao tao;
#ifdef INET6
struct ip6_hdr *ip6 = NULL;
int isipv6;
+ bzero(&tao, sizeof(tao));
isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0;
#endif
@@ -232,7 +233,6 @@ again:
*/
len = (long)ulmin(so->so_snd.sb_cc, win) - off;
- taop = tcp_gettaocache(&tp->t_inpcb->inp_inc);
/*
* Lop off SYN bit if it has already been sent. However, if this
@@ -242,8 +242,10 @@ again:
if ((flags & TH_SYN) && SEQ_GT(tp->snd_nxt, tp->snd_una)) {
flags &= ~TH_SYN;
off--, len++;
+ if (tcp_do_rfc1644)
+ tcp_hc_gettao(&tp->t_inpcb->inp_inc, &tao);
if (len > 0 && tp->t_state == TCPS_SYN_SENT &&
- (taop == NULL || taop->tao_ccsent == 0))
+ tao.tao_ccsent == 0)
return 0;
}
@@ -429,7 +431,7 @@ send:
opt[0] = TCPOPT_MAXSEG;
opt[1] = TCPOLEN_MAXSEG;
- mss = htons((u_short) tcp_mssopt(tp));
+ mss = htons((u_short) tcp_mssopt(&tp->t_inpcb->inp_inc));
(void)memcpy(opt + 2, &mss, sizeof(mss));
optlen = TCPOLEN_MAXSEG;
@@ -872,10 +874,7 @@ send:
* Also, desired default hop limit might be changed via
* Neighbor Discovery.
*/
- ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb,
- tp->t_inpcb->in6p_route.ro_rt ?
- tp->t_inpcb->in6p_route.ro_rt->rt_ifp
- : NULL);
+ ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb, NULL);
/* TODO: IPv6 IP6TOS_ECT bit on */
#if defined(IPSEC) && !defined(FAST_IPSEC)
@@ -886,36 +885,27 @@ send:
}
#endif /*IPSEC*/
error = ip6_output(m,
- tp->t_inpcb->in6p_outputopts,
- &tp->t_inpcb->in6p_route,
+ tp->t_inpcb->in6p_outputopts, NULL,
(so->so_options & SO_DONTROUTE), NULL, NULL,
tp->t_inpcb);
} else
#endif /* INET6 */
{
- struct rtentry *rt;
ip->ip_len = m->m_pkthdr.len;
#ifdef INET6
if (INP_CHECK_SOCKAF(so, AF_INET6))
- ip->ip_ttl = in6_selecthlim(tp->t_inpcb,
- tp->t_inpcb->in6p_route.ro_rt ?
- tp->t_inpcb->in6p_route.ro_rt->rt_ifp
- : NULL);
+ ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL);
#endif /* INET6 */
/*
- * See if we should do MTU discovery. We do it only if the following
- * are true:
- * 1) we have a valid route to the destination
- * 2) the MTU is not locked (if it is, then discovery has been
- * disabled)
+ * If we do path MTU discovery, then we set DF on every packet.
+ * This might not be the best thing to do according to RFC3390
+ * Section 2. However the tcp hostcache migitates the problem
+ * so it affects only the first tcp connection with a host.
*/
- if (path_mtu_discovery
- && (rt = tp->t_inpcb->inp_route.ro_rt)
- && rt->rt_flags & RTF_UP
- && !(rt->rt_rmx.rmx_locks & RTV_MTU)) {
+ if (path_mtu_discovery)
ip->ip_off |= IP_DF;
- }
- error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
+
+ error = ip_output(m, tp->t_inpcb->inp_options, NULL,
(so->so_options & SO_DONTROUTE), 0, tp->t_inpcb);
}
if (error) {
OpenPOWER on IntegriCloud