From nobody Wed Dec 7 17:53:17 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NS4dV0kWwz4jPrC; Wed, 7 Dec 2022 17:53:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NS4dV0GrQz4Gvs; Wed, 7 Dec 2022 17:53:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670435598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YNsgxx7KPbYdQXmRc2xHTdel4KbIH+pkSCR8NmgEwPk=; b=SalBJVR4+6XysYdYZHAW7E6eRPC6MRUVgGg8eryp5EB5V9X25EZRxv1pgw4yPyi/1VQOzP UhFm33OLlvGjjpYOkJ07HzqjVE2BbzS4hbW0VuJU97IpoY233z0cgpD77Lns053HZAZXck zn9h1JxcoZzlnsyZlRoVY3VsIPW7EqsXZQ/KwkG5NiU3GZQyaHKdSrnhjptarU6cnSlOwu W6007geffHKdH3qFgVLQe/0azxGZY30yNwZqGki+g4WxpLqM/BuHT2HfjYHTS5vxhWWVhb fhmRff2LnNS9rQvunhaJK3N+cxji0JBoPAX3BX+CUi8tP4kTz5sFRame/Jkpeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670435598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YNsgxx7KPbYdQXmRc2xHTdel4KbIH+pkSCR8NmgEwPk=; b=RMGjiNYDEGoshs9oblxXz/grwfVr7CYiG6SkdZC/NV/iuYCW/zPQ7sxCADfoGlvBrkVWui lo1ZCtpy003+6+3jsvTEssNqRIsO5ptiefd1eOSBAJvdondOxg/oFx99tKcqxEnlm4n6Ll 7YVOS3gAzReQkzDOK+FP0M16KxIHMdgt8kszEd+UgPZaM9rb/Qe3Ee4C5WXukRu0tiaJSf EEHKk5apOxPCVWOyK13KuwhHzcxglukihtpkfnK0pTUHBfo8khvlVItL2yqn08Pd3FGA/r tIOcy2bGmb5SAkmb7dUEzKvaDGKroLACWVDpg0IcWkV1n+51kXFCXfuCWQZUhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670435598; a=rsa-sha256; cv=none; b=j7MiSA8ms8xUlzoxkCM9jx9trp7LsazLxjj71VMeX8IIMCNj9yq7AH6/ZH9t/UTTwqWAXy 2ekiQpB1qGAKp3J4YMNM5v7q2rG/xv98hghQXDOpeeNNpG/79jaw00rrVoo7KIiONbuZkP yScJ5EsODCC7vXCgRii+YE5B5HWy6S1TruL0pOg8MviamOnBaMgrhuFoSFdREdg6dMhqJr YPiu8dcstynCPsaDogyVVi6IOJl1OsmKooRXajXA0I5QqrEHC5FMuRoGZzQVGq8RC/9vt3 H8ZlJFNCVbMXI4bclu5t0zZbC7EJTWXextckD1+37rNLs/JPY+D8OXQ4TRA5Iw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NS4dT6QytzQmW; Wed, 7 Dec 2022 17:53:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2B7HrH4S056910; Wed, 7 Dec 2022 17:53:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B7HrHk3056909; Wed, 7 Dec 2022 17:53:17 GMT (envelope-from git) Date: Wed, 7 Dec 2022 17:53:17 GMT Message-Id: <202212071753.2B7HrHk3056909@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: e68b3792440c - main - tcp: embed inpcb into tcpcb List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e68b3792440cac248347afe08ba5881a00ba6523 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=e68b3792440cac248347afe08ba5881a00ba6523 commit e68b3792440cac248347afe08ba5881a00ba6523 Author: Gleb Smirnoff AuthorDate: 2022-12-07 17:00:48 +0000 Commit: Gleb Smirnoff CommitDate: 2022-12-07 17:00:48 +0000 tcp: embed inpcb into tcpcb For the TCP protocol inpcb storage specify allocation size that would provide space to most of the data a TCP connection needs, embedding into struct tcpcb several structures, that previously were allocated separately. The most import one is the inpcb itself. With embedding we can provide strong guarantee that with a valid TCP inpcb the tcpcb is always valid and vice versa. Also we reduce number of allocs/frees per connection. The embedded inpcb is placed in the beginning of the struct tcpcb, since in_pcballoc() requires that. However, later we may want to move it around for cache line efficiency, and this can be done with a little effort. The new intotcpcb() macro is ready for such move. The congestion algorithm data, the TCP timers and osd(9) data are also embedded into tcpcb, and temprorary struct tcpcb_mem goes away. There was no extra allocation here, but we went through extra pointer every time we accessed this data. One interesting side effect is that now TCP data is allocated from SMR-protected zone. Potentially this allows the TCP stacks or other TCP related modules to utilize that for their own synchronization. Large part of the change was done with sed script: s/tp->ccv->/tp->t_ccv./g s/tp->ccv/\&tp->t_ccv/g s/tp->cc_algo/tp->t_cc/g s/tp->t_timers->tt_/tp->tt_/g s/CCV\(ccv, osd\)/\&CCV(ccv, t_osd)/g Dependency side effect is that code that needs to know struct tcpcb should also know struct inpcb, that added several . Differential revision: https://reviews.freebsd.org/D37127 --- cddl/lib/libdtrace/tcp.d | 22 ++--- sys/conf/options | 2 +- sys/dev/cxgbe/tom/t4_tom_l2t.c | 1 + sys/netinet/cc/cc.h | 10 +- sys/netinet/cc/cc_cdg.c | 2 +- sys/netinet/cc/cc_chd.c | 4 +- sys/netinet/cc/cc_hd.c | 5 +- sys/netinet/cc/cc_vegas.c | 2 +- sys/netinet/tcp_debug.c | 1 + sys/netinet/tcp_hpts.c | 9 +- sys/netinet/tcp_input.c | 44 ++++----- sys/netinet/tcp_output.c | 4 +- sys/netinet/tcp_pcap.c | 2 + sys/netinet/tcp_stacks/rack.c | 132 +++++++++++++------------- sys/netinet/tcp_stacks/sack_filter.c | 2 + sys/netinet/tcp_subr.c | 118 ++++++++--------------- sys/netinet/tcp_timer.c | 123 ++++++++++++------------ sys/netinet/tcp_timer.h | 14 +-- sys/netinet/tcp_usrreq.c | 16 ++-- sys/netinet/tcp_var.h | 41 ++++---- sys/netinet6/in6_pcb.c | 1 - sys/netipsec/ipsec_input.c | 1 + sys/netipsec/ipsec_output.c | 1 + sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c | 2 +- sys/netpfil/pf/pf_syncookies.c | 1 + usr.bin/systat/netstat.c | 1 + 26 files changed, 264 insertions(+), 297 deletions(-) diff --git a/cddl/lib/libdtrace/tcp.d b/cddl/lib/libdtrace/tcp.d index afcfdfadaf1e..0ceb4021a16d 100644 --- a/cddl/lib/libdtrace/tcp.d +++ b/cddl/lib/libdtrace/tcp.d @@ -204,7 +204,7 @@ typedef struct tcpinfoh { #pragma D binding "1.6.3" translator translator csinfo_t < struct tcpcb *p > { cs_addr = NULL; - cs_cid = (uint64_t)(p == NULL ? 0 : p->t_inpcb); + cs_cid = (uint64_t)(p == NULL ? 0 : &p->t_inpcb); cs_pid = 0; cs_zoneid = 0; }; @@ -214,16 +214,16 @@ translator tcpsinfo_t < struct tcpcb *p > { tcps_addr = (uintptr_t)p; tcps_local = -1; /* XXX */ tcps_active = -1; /* XXX */ - tcps_lport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_lport); - tcps_rport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport); + tcps_lport = p == NULL ? 0 : ntohs(p->t_inpcb.inp_inc.inc_ie.ie_lport); + tcps_rport = p == NULL ? 0 : ntohs(p->t_inpcb.inp_inc.inc_ie.ie_fport); tcps_laddr = p == NULL ? "" : - p->t_inpcb->inp_vflag == INP_IPV4 ? - inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) : - inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr); + p->t_inpcb.inp_vflag == INP_IPV4 ? + inet_ntoa(&p->t_inpcb.inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) : + inet_ntoa6(&p->t_inpcb.inp_inc.inc_ie.ie_dependladdr.id6_addr); tcps_raddr = p == NULL ? "" : - p->t_inpcb->inp_vflag == INP_IPV4 ? - inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) : - inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr); + p->t_inpcb.inp_vflag == INP_IPV4 ? + inet_ntoa(&p->t_inpcb.inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) : + inet_ntoa6(&p->t_inpcb.inp_inc.inc_ie.ie_dependfaddr.id6_addr); tcps_state = p == NULL ? -1 : p->t_state; tcps_iss = p == NULL ? 0 : p->iss; tcps_irs = p == NULL ? 0 : p->irs; @@ -250,9 +250,9 @@ translator tcpsinfo_t < struct tcpcb *p > { tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ tcps_debug = p == NULL ? 0 : - p->t_inpcb->inp_socket->so_options & 1; + p->t_inpcb.inp_socket->so_options & 1; tcps_cookie = p == NULL ? -1 : - p->t_inpcb->inp_socket->so_user_cookie; + p->t_inpcb.inp_socket->so_user_cookie; tcps_dupacks = p == NULL ? -1 : p->t_dupacks; tcps_rtttime = p == NULL ? -1 : p->t_rtttime; tcps_rtseq = p == NULL ? -1 : p->t_rtseq; diff --git a/sys/conf/options b/sys/conf/options index e2720980f356..00019b1c2e5c 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -469,7 +469,7 @@ TCPDEBUG TCPPCAP opt_global.h SIFTR TCP_BLACKBOX opt_global.h -TCP_HHOOK opt_inet.h +TCP_HHOOK opt_global.h TCP_OFFLOAD opt_inet.h # Enable code to dispatch TCP offloading TCP_RFC7413 opt_inet.h TCP_RFC7413_MAX_KEYS opt_inet.h diff --git a/sys/dev/cxgbe/tom/t4_tom_l2t.c b/sys/dev/cxgbe/tom/t4_tom_l2t.c index 97a1e08bda58..e91d5c955758 100644 --- a/sys/dev/cxgbe/tom/t4_tom_l2t.c +++ b/sys/dev/cxgbe/tom/t4_tom_l2t.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include diff --git a/sys/netinet/cc/cc.h b/sys/netinet/cc/cc.h index 90c954faffa1..8047df0da499 100644 --- a/sys/netinet/cc/cc.h +++ b/sys/netinet/cc/cc.h @@ -70,7 +70,9 @@ VNET_DECLARE(int, cc_abe_frlossreduce); #define V_cc_abe_frlossreduce VNET(cc_abe_frlossreduce) /* Define the new net.inet.tcp.cc sysctl tree. */ +#ifdef _SYS_SYSCTL_H_ SYSCTL_DECL(_net_inet_tcp_cc); +#endif /* For CC modules that use hystart++ */ extern uint32_t hystart_lowcwnd; @@ -84,7 +86,9 @@ extern uint32_t hystart_bblogs; /* CC housekeeping functions. */ int cc_register_algo(struct cc_algo *add_cc); int cc_deregister_algo(struct cc_algo *remove_cc); +#endif /* _KERNEL */ +#if defined(_KERNEL) || defined(_WANT_TCPCB) /* * Wrapper around transport structs that contain same-named congestion * control variables. Allows algos to be shared amongst multiple CC aware @@ -124,7 +128,7 @@ struct cc_var { #define CC_DUPACK 0x0002 /* Duplicate ACK. */ #define CC_PARTIALACK 0x0004 /* Not yet. */ #define CC_SACK 0x0008 /* Not yet. */ -#endif /* _KERNEL */ +#endif /* defined(_KERNEL) || defined(_WANT_TCPCB) */ /* * Congestion signal types passed to the cong_signal() hook. The highest order 8 @@ -207,10 +211,10 @@ struct cc_algo { #define CC_MODULE_BEING_REMOVED 0x01 /* The module is being removed */ /* Macro to obtain the CC algo's struct ptr. */ -#define CC_ALGO(tp) ((tp)->cc_algo) +#define CC_ALGO(tp) ((tp)->t_cc) /* Macro to obtain the CC algo's data ptr. */ -#define CC_DATA(tp) ((tp)->ccv->cc_data) +#define CC_DATA(tp) ((tp)->t_ccv.cc_data) /* Macro to obtain the system default CC algo's struct ptr. */ #define CC_DEFAULT_ALGO() V_default_cc_ptr diff --git a/sys/netinet/cc/cc_cdg.c b/sys/netinet/cc/cc_cdg.c index 1bda96d33e65..a60339bf5d23 100644 --- a/sys/netinet/cc/cc_cdg.c +++ b/sys/netinet/cc/cc_cdg.c @@ -582,7 +582,7 @@ cdg_ack_received(struct cc_var *ccv, uint16_t ack_type) int congestion, new_measurement, slowstart; cdg_data = ccv->cc_data; - e_t = (struct ertt *)khelp_get_osd(CCV(ccv, osd), ertt_id); + e_t = (struct ertt *)khelp_get_osd(&CCV(ccv, t_osd), ertt_id); new_measurement = e_t->flags & ERTT_NEW_MEASUREMENT; congestion = 0; cdg_data->maxrtt_in_rtt = imax(e_t->rtt, cdg_data->maxrtt_in_rtt); diff --git a/sys/netinet/cc/cc_chd.c b/sys/netinet/cc/cc_chd.c index d8bd764a1cba..091aeb60f698 100644 --- a/sys/netinet/cc/cc_chd.c +++ b/sys/netinet/cc/cc_chd.c @@ -244,7 +244,7 @@ chd_ack_received(struct cc_var *ccv, uint16_t ack_type) struct ertt *e_t; int backoff, new_measurement, qdly, rtt; - e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); + e_t = khelp_get_osd(&CCV(ccv, t_osd), ertt_id); chd_data = ccv->cc_data; new_measurement = e_t->flags & ERTT_NEW_MEASUREMENT; backoff = qdly = 0; @@ -345,7 +345,7 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_type) struct chd *chd_data; int qdly; - e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); + e_t = khelp_get_osd(&CCV(ccv, t_osd), ertt_id); chd_data = ccv->cc_data; qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; diff --git a/sys/netinet/cc/cc_hd.c b/sys/netinet/cc/cc_hd.c index 9e910568e27c..1abca5fb29b7 100644 --- a/sys/netinet/cc/cc_hd.c +++ b/sys/netinet/cc/cc_hd.c @@ -70,7 +70,8 @@ __FBSDID("$FreeBSD$"); #include -#include +#include +#include #include #include #include @@ -146,7 +147,7 @@ hd_ack_received(struct cc_var *ccv, uint16_t ack_type) int qdly; if (ack_type == CC_ACK) { - e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); + e_t = khelp_get_osd(&CCV(ccv, t_osd), ertt_id); if (e_t->rtt && e_t->minrtt && V_hd_qthresh > 0) { qdly = e_t->rtt - e_t->minrtt; diff --git a/sys/netinet/cc/cc_vegas.c b/sys/netinet/cc/cc_vegas.c index 2056537a1df0..cbed488c2b96 100644 --- a/sys/netinet/cc/cc_vegas.c +++ b/sys/netinet/cc/cc_vegas.c @@ -133,7 +133,7 @@ vegas_ack_received(struct cc_var *ccv, uint16_t ack_type) struct vegas *vegas_data; long actual_tx_rate, expected_tx_rate, ndiff; - e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); + e_t = khelp_get_osd(&CCV(ccv, t_osd), ertt_id); vegas_data = ccv->cc_data; if (e_t->flags & ERTT_NEW_MEASUREMENT) { /* Once per RTT. */ diff --git a/sys/netinet/tcp_debug.c b/sys/netinet/tcp_debug.c index 0708d3ebb29d..e00dc095b01f 100644 --- a/sys/netinet/tcp_debug.c +++ b/sys/netinet/tcp_debug.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef INET6 diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index 57114706baa3..d3e923406784 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -1368,10 +1368,10 @@ again: if (error < 0) goto skip_pacing; inp->inp_hpts_calls = 0; - if (ninp && ninp->inp_ppcb) { + if (ninp) { /* * If we have a nxt inp, see if we can - * prefetch its ppcb. Note this may seem + * prefetch it. Note this may seem * "risky" since we have no locks (other * than the previous inp) and there no * assurance that ninp was not pulled while @@ -1399,8 +1399,11 @@ again: * TLB hit, and instead if occurs just * cause us to load cache with a useless * address (to us). + * + * XXXGL: with tcpcb == inpcb, I'm unsure this + * prefetch is still correct and useful. */ - kern_prefetch(ninp->inp_ppcb, &prefetch_tp); + kern_prefetch(ninp, &prefetch_tp); prefetch_tp = 1; } INP_WUNLOCK(inp); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e4f2663cafdc..96812afd3b37 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -283,7 +283,7 @@ hhook_run_tcp_est_in(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) hhook_data.to = to; hhook_run_hooks(V_tcp_hhh[HHOOK_TCP_EST_IN], &hhook_data, - tp->osd); + &tp->t_osd); } } #endif @@ -301,14 +301,14 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs, INP_WLOCK_ASSERT(tptoinpcb(tp)); - tp->ccv->nsegs = nsegs; - tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th); + tp->t_ccv.nsegs = nsegs; + tp->t_ccv.bytes_this_ack = BYTES_THIS_ACK(tp, th); if ((!V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd)) || (V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd) && (tp->snd_cwnd < (tcp_compute_pipe(tp) * 2)))) - tp->ccv->flags |= CCF_CWND_LIMITED; + tp->t_ccv.flags |= CCF_CWND_LIMITED; else - tp->ccv->flags &= ~CCF_CWND_LIMITED; + tp->t_ccv.flags &= ~CCF_CWND_LIMITED; if (type == CC_ACK) { #ifdef STATS @@ -316,7 +316,7 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs, ((int32_t)tp->snd_cwnd) - tp->snd_wnd); if (!IN_RECOVERY(tp->t_flags)) stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_ACKLEN, - tp->ccv->bytes_this_ack / (tcp_maxseg(tp) * nsegs)); + tp->t_ccv.bytes_this_ack / (tcp_maxseg(tp) * nsegs)); if ((tp->t_flags & TF_GPUTINPROG) && SEQ_GEQ(th->th_ack, tp->gput_ack)) { /* @@ -341,21 +341,21 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs, } #endif /* STATS */ if (tp->snd_cwnd > tp->snd_ssthresh) { - tp->t_bytes_acked += tp->ccv->bytes_this_ack; + tp->t_bytes_acked += tp->t_ccv.bytes_this_ack; if (tp->t_bytes_acked >= tp->snd_cwnd) { tp->t_bytes_acked -= tp->snd_cwnd; - tp->ccv->flags |= CCF_ABC_SENTAWND; + tp->t_ccv.flags |= CCF_ABC_SENTAWND; } } else { - tp->ccv->flags &= ~CCF_ABC_SENTAWND; + tp->t_ccv.flags &= ~CCF_ABC_SENTAWND; tp->t_bytes_acked = 0; } } if (CC_ALGO(tp)->ack_received != NULL) { /* XXXLAS: Find a way to live without this */ - tp->ccv->curack = th->th_ack; - CC_ALGO(tp)->ack_received(tp->ccv, type); + tp->t_ccv.curack = th->th_ack; + CC_ALGO(tp)->ack_received(&tp->t_ccv, type); } #ifdef STATS stats_voi_update_abs_ulong(tp->t_stats, VOI_TCP_LCWIN, tp->snd_cwnd); @@ -414,7 +414,7 @@ cc_conn_init(struct tcpcb *tp) tp->snd_cwnd = tcp_compute_initwnd(maxseg); if (CC_ALGO(tp)->conn_init != NULL) - CC_ALGO(tp)->conn_init(tp->ccv); + CC_ALGO(tp)->conn_init(&tp->t_ccv); } void inline @@ -473,8 +473,8 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) if (CC_ALGO(tp)->cong_signal != NULL) { if (th != NULL) - tp->ccv->curack = th->th_ack; - CC_ALGO(tp)->cong_signal(tp->ccv, type); + tp->t_ccv.curack = th->th_ack; + CC_ALGO(tp)->cong_signal(&tp->t_ccv, type); } } @@ -486,8 +486,8 @@ cc_post_recovery(struct tcpcb *tp, struct tcphdr *th) /* XXXLAS: KASSERT that we're in recovery? */ if (CC_ALGO(tp)->post_recovery != NULL) { - tp->ccv->curack = th->th_ack; - CC_ALGO(tp)->post_recovery(tp->ccv); + tp->t_ccv.curack = th->th_ack; + CC_ALGO(tp)->post_recovery(&tp->t_ccv); } /* XXXLAS: EXIT_RECOVERY ? */ tp->t_bytes_acked = 0; @@ -518,25 +518,25 @@ cc_ecnpkt_handler_flags(struct tcpcb *tp, uint16_t flags, uint8_t iptos) if (CC_ALGO(tp)->ecnpkt_handler != NULL) { switch (iptos & IPTOS_ECN_MASK) { case IPTOS_ECN_CE: - tp->ccv->flags |= CCF_IPHDR_CE; + tp->t_ccv.flags |= CCF_IPHDR_CE; break; case IPTOS_ECN_ECT0: /* FALLTHROUGH */ case IPTOS_ECN_ECT1: /* FALLTHROUGH */ case IPTOS_ECN_NOTECT: - tp->ccv->flags &= ~CCF_IPHDR_CE; + tp->t_ccv.flags &= ~CCF_IPHDR_CE; break; } if (flags & TH_CWR) - tp->ccv->flags |= CCF_TCPHDR_CWR; + tp->t_ccv.flags |= CCF_TCPHDR_CWR; else - tp->ccv->flags &= ~CCF_TCPHDR_CWR; + tp->t_ccv.flags &= ~CCF_TCPHDR_CWR; - CC_ALGO(tp)->ecnpkt_handler(tp->ccv); + CC_ALGO(tp)->ecnpkt_handler(&tp->t_ccv); - if (tp->ccv->flags & CCF_ACKNOW) { + if (tp->t_ccv.flags & CCF_ACKNOW) { tcp_timer_activate(tp, TT_DELACK, tcp_delacktime); tp->t_flags |= TF_ACKNOW; } diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 3ebf36196ac0..aa4bfef9a9ff 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -173,7 +173,7 @@ hhook_run_tcp_est_out(struct tcpcb *tp, struct tcphdr *th, hhook_data.tso = tso; hhook_run_hooks(V_tcp_hhh[HHOOK_TCP_EST_OUT], &hhook_data, - tp->osd); + &tp->t_osd); } } #endif @@ -187,7 +187,7 @@ cc_after_idle(struct tcpcb *tp) INP_WLOCK_ASSERT(tptoinpcb(tp)); if (CC_ALGO(tp)->after_idle != NULL) - CC_ALGO(tp)->after_idle(tp->ccv); + CC_ALGO(tp)->after_idle(&tp->t_ccv); } /* diff --git a/sys/netinet/tcp_pcap.c b/sys/netinet/tcp_pcap.c index 1faa1500ec5a..eb2af0c84a83 100644 --- a/sys/netinet/tcp_pcap.c +++ b/sys/netinet/tcp_pcap.c @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include #include diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 7105ce8bab83..c3aed32e02ea 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -587,16 +587,16 @@ rack_set_cc_pacing(struct tcp_rack *rack) return; tp = rack->rc_tp; - if (tp->cc_algo == NULL) { + if (tp->t_cc == NULL) { /* Tcb is leaving */ return; } rack->rc_pacing_cc_set = 1; - if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) { + if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0) { /* Not new-reno we can't play games with beta! */ goto out; } - ptr = ((struct newreno *)tp->ccv->cc_data); + ptr = ((struct newreno *)tp->t_ccv.cc_data); if (CC_ALGO(tp)->ctl_output == NULL) { /* Huh, why does new_reno no longer have a set function? */ goto out; @@ -615,7 +615,7 @@ rack_set_cc_pacing(struct tcp_rack *rack) sopt.sopt_dir = SOPT_SET; opt.name = CC_NEWRENO_BETA; opt.val = rack->r_ctl.rc_saved_beta.beta; - error = CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); + error = CC_ALGO(tp)->ctl_output(&tp->t_ccv, &sopt, &opt); if (error) { goto out; } @@ -623,10 +623,10 @@ rack_set_cc_pacing(struct tcp_rack *rack) * Hack alert we need to set in our newreno_flags * so that Abe behavior is also applied. */ - ((struct newreno *)tp->ccv->cc_data)->newreno_flags |= CC_NEWRENO_BETA_ECN_ENABLED; + ((struct newreno *)tp->t_ccv.cc_data)->newreno_flags |= CC_NEWRENO_BETA_ECN_ENABLED; opt.name = CC_NEWRENO_BETA_ECN; opt.val = rack->r_ctl.rc_saved_beta.beta_ecn; - error = CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); + error = CC_ALGO(tp)->ctl_output(&tp->t_ccv, &sopt, &opt); if (error) { goto out; } @@ -637,7 +637,7 @@ out: union tcp_log_stackspecific log; struct timeval tv; - ptr = ((struct newreno *)tp->ccv->cc_data); + ptr = ((struct newreno *)tp->t_ccv.cc_data); memset(&log.u_bbr, 0, sizeof(log.u_bbr)); log.u_bbr.timeStamp = tcp_get_usecs(&tv); if (ptr) { @@ -670,14 +670,14 @@ rack_undo_cc_pacing(struct tcp_rack *rack) return; tp = rack->rc_tp; rack->rc_pacing_cc_set = 0; - if (tp->cc_algo == NULL) + if (tp->t_cc == NULL) /* Tcb is leaving */ return; - if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) { + if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0) { /* Not new-reno nothing to do! */ return; } - ptr = ((struct newreno *)tp->ccv->cc_data); + ptr = ((struct newreno *)tp->t_ccv.cc_data); if (ptr == NULL) { /* * This happens at rack_fini() if the @@ -697,7 +697,7 @@ rack_undo_cc_pacing(struct tcp_rack *rack) union tcp_log_stackspecific log; struct timeval tv; - ptr = ((struct newreno *)tp->ccv->cc_data); + ptr = ((struct newreno *)tp->t_ccv.cc_data); memset(&log.u_bbr, 0, sizeof(log.u_bbr)); log.u_bbr.timeStamp = tcp_get_usecs(&tv); log.u_bbr.flex1 = ptr->beta; @@ -3700,7 +3700,7 @@ rack_exit_probertt(struct tcp_rack *rack, uint32_t us_cts) /* Clear all flags so we start fresh */ rack->rc_tp->t_bytes_acked = 0; - rack->rc_tp->ccv->flags &= ~CCF_ABC_SENTAWND; + rack->rc_tp->t_ccv.flags &= ~CCF_ABC_SENTAWND; /* * If configured to, set the cwnd and ssthresh to * our targets. @@ -4577,14 +4577,14 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint uint8_t labc_to_use, quality; INP_WLOCK_ASSERT(tptoinpcb(tp)); - tp->ccv->nsegs = nsegs; - acked = tp->ccv->bytes_this_ack = (th_ack - tp->snd_una); + tp->t_ccv.nsegs = nsegs; + acked = tp->t_ccv.bytes_this_ack = (th_ack - tp->snd_una); if ((recovery) && (rack->r_ctl.rc_early_recovery_segs)) { uint32_t max; max = rack->r_ctl.rc_early_recovery_segs * ctf_fixed_maxseg(tp); - if (tp->ccv->bytes_this_ack > max) { - tp->ccv->bytes_this_ack = max; + if (tp->t_ccv.bytes_this_ack > max) { + tp->t_ccv.bytes_this_ack = max; } } #ifdef STATS @@ -4611,19 +4611,19 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint } /* Which way our we limited, if not cwnd limited no advance in CA */ if (tp->snd_cwnd <= tp->snd_wnd) - tp->ccv->flags |= CCF_CWND_LIMITED; + tp->t_ccv.flags |= CCF_CWND_LIMITED; else - tp->ccv->flags &= ~CCF_CWND_LIMITED; + tp->t_ccv.flags &= ~CCF_CWND_LIMITED; if (tp->snd_cwnd > tp->snd_ssthresh) { - tp->t_bytes_acked += min(tp->ccv->bytes_this_ack, + tp->t_bytes_acked += min(tp->t_ccv.bytes_this_ack, nsegs * V_tcp_abc_l_var * ctf_fixed_maxseg(tp)); /* For the setting of a window past use the actual scwnd we are using */ if (tp->t_bytes_acked >= rack->r_ctl.cwnd_to_use) { tp->t_bytes_acked -= rack->r_ctl.cwnd_to_use; - tp->ccv->flags |= CCF_ABC_SENTAWND; + tp->t_ccv.flags |= CCF_ABC_SENTAWND; } } else { - tp->ccv->flags &= ~CCF_ABC_SENTAWND; + tp->t_ccv.flags &= ~CCF_ABC_SENTAWND; tp->t_bytes_acked = 0; } prior_cwnd = tp->snd_cwnd; @@ -4639,9 +4639,9 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint memset(&log.u_bbr, 0, sizeof(log.u_bbr)); log.u_bbr.timeStamp = tcp_get_usecs(&tv); log.u_bbr.flex1 = th_ack; - log.u_bbr.flex2 = tp->ccv->flags; - log.u_bbr.flex3 = tp->ccv->bytes_this_ack; - log.u_bbr.flex4 = tp->ccv->nsegs; + log.u_bbr.flex2 = tp->t_ccv.flags; + log.u_bbr.flex3 = tp->t_ccv.bytes_this_ack; + log.u_bbr.flex4 = tp->t_ccv.nsegs; log.u_bbr.flex5 = labc_to_use; log.u_bbr.flex6 = prior_cwnd; log.u_bbr.flex7 = V_tcp_do_newsack; @@ -4651,10 +4651,10 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint } if (CC_ALGO(tp)->ack_received != NULL) { /* XXXLAS: Find a way to live without this */ - tp->ccv->curack = th_ack; - tp->ccv->labc = labc_to_use; - tp->ccv->flags |= CCF_USE_LOCAL_ABC; - CC_ALGO(tp)->ack_received(tp->ccv, type); + tp->t_ccv.curack = th_ack; + tp->t_ccv.labc = labc_to_use; + tp->t_ccv.flags |= CCF_USE_LOCAL_ABC; + CC_ALGO(tp)->ack_received(&tp->t_ccv, type); } if (lgb) { lgb->tlb_stackinfo.u_bbr.flex6 = tp->snd_cwnd; @@ -4727,8 +4727,8 @@ rack_post_recovery(struct tcpcb *tp, uint32_t th_ack) rack = (struct tcp_rack *)tp->t_fb_ptr; /* only alert CC if we alerted when we entered */ if (CC_ALGO(tp)->post_recovery != NULL) { - tp->ccv->curack = th_ack; - CC_ALGO(tp)->post_recovery(tp->ccv); + tp->t_ccv.curack = th_ack; + CC_ALGO(tp)->post_recovery(&tp->t_ccv); if (tp->snd_cwnd < tp->snd_ssthresh) { /* * Rack has burst control and pacing @@ -4745,9 +4745,9 @@ rack_post_recovery(struct tcpcb *tp, uint32_t th_ack) memset(&log.u_bbr, 0, sizeof(log.u_bbr)); log.u_bbr.timeStamp = tcp_get_usecs(&tv); log.u_bbr.flex1 = th_ack; - log.u_bbr.flex2 = tp->ccv->flags; - log.u_bbr.flex3 = tp->ccv->bytes_this_ack; - log.u_bbr.flex4 = tp->ccv->nsegs; + log.u_bbr.flex2 = tp->t_ccv.flags; + log.u_bbr.flex3 = tp->t_ccv.bytes_this_ack; + log.u_bbr.flex4 = tp->t_ccv.nsegs; log.u_bbr.flex5 = V_tcp_abc_l_var; log.u_bbr.flex6 = orig_cwnd; log.u_bbr.flex7 = V_tcp_do_newsack; @@ -4871,8 +4871,8 @@ rack_cong_signal(struct tcpcb *tp, uint32_t type, uint32_t ack, int line) } if ((CC_ALGO(tp)->cong_signal != NULL) && (type != CC_RTO)){ - tp->ccv->curack = ack; - CC_ALGO(tp)->cong_signal(tp->ccv, type); + tp->t_ccv.curack = ack; + CC_ALGO(tp)->cong_signal(&tp->t_ccv, type); } if ((in_rec_at_entry == 0) && IN_RECOVERY(tp->t_flags)) { rack_log_to_prr(rack, 15, cwnd_enter, line); @@ -4897,7 +4897,7 @@ rack_cc_after_idle(struct tcp_rack *rack, struct tcpcb *tp) KMOD_TCPSTAT_INC(tcps_idle_estrestarts); #endif if (CC_ALGO(tp)->after_idle != NULL) - CC_ALGO(tp)->after_idle(tp->ccv); + CC_ALGO(tp)->after_idle(&tp->t_ccv); if (tp->snd_cwnd == 1) i_cwnd = tp->t_maxseg; /* SYN(-ACK) lost */ @@ -5910,7 +5910,7 @@ rack_timeout_rack(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) */ struct rack_sendmap *rsm; - if (tp->t_timers->tt_flags & TT_STOPPED) { + if (tp->tt_flags & TT_STOPPED) { return (1); } counter_u64_add(rack_to_tot, 1); @@ -6123,7 +6123,7 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t uint32_t out, avail; int collapsed_win = 0; - if (tp->t_timers->tt_flags & TT_STOPPED) { + if (tp->tt_flags & TT_STOPPED) { return (1); } if (TSTMP_LT(cts, rack->r_ctl.rc_timer_exp)) { @@ -6312,7 +6312,7 @@ out: static int rack_timeout_delack(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) { - if (tp->t_timers->tt_flags & TT_STOPPED) { + if (tp->tt_flags & TT_STOPPED) { return (1); } rack_log_to_event(rack, RACK_TO_FRM_DELACK, NULL); @@ -6337,7 +6337,7 @@ rack_timeout_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) struct tcptemp *t_template; int32_t retval = 1; - if (tp->t_timers->tt_flags & TT_STOPPED) { + if (tp->tt_flags & TT_STOPPED) { return (1); } if (rack->rc_in_persist == 0) @@ -6425,7 +6425,7 @@ rack_timeout_keepalive(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) struct tcptemp *t_template; struct inpcb *inp = tptoinpcb(tp); - if (tp->t_timers->tt_flags & TT_STOPPED) { + if (tp->tt_flags & TT_STOPPED) { return (1); } rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_KEEP; @@ -6654,7 +6654,7 @@ rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) int32_t retval = 0; bool isipv6; - if (tp->t_timers->tt_flags & TT_STOPPED) { + if (tp->tt_flags & TT_STOPPED) { return (1); } if ((tp->t_flags & TF_GPUTINPROG) && @@ -7859,7 +7859,7 @@ rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, us_rtt = 1; if (CC_ALGO(tp)->rttsample != NULL) { /* Kick the RTT to the CC */ - CC_ALGO(tp)->rttsample(tp->ccv, us_rtt, 1, rsm->r_fas); + CC_ALGO(tp)->rttsample(&tp->t_ccv, us_rtt, 1, rsm->r_fas); } rack_apply_updated_usrtt(rack, us_rtt, tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time)); if (ack_type == SACKED) { @@ -7956,7 +7956,7 @@ rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, us_rtt = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time) - (uint32_t)rsm->r_tim_lastsent[i]; else us_rtt = tcp_get_usecs(NULL) - (uint32_t)rsm->r_tim_lastsent[i]; - CC_ALGO(tp)->rttsample(tp->ccv, us_rtt, 1, rsm->r_fas); + CC_ALGO(tp)->rttsample(&tp->t_ccv, us_rtt, 1, rsm->r_fas); } if ((i + 1) < rsm->r_rtr_cnt) { /* @@ -12722,11 +12722,11 @@ rack_init(struct tcpcb *tp) rack_convert_rtts(tp); tp->t_rttlow = TICKS_2_USEC(tp->t_rttlow); if (rack_do_hystart) { - tp->ccv->flags |= CCF_HYSTART_ALLOWED; + tp->t_ccv.flags |= CCF_HYSTART_ALLOWED; if (rack_do_hystart > 1) - tp->ccv->flags |= CCF_HYSTART_CAN_SH_CWND; + tp->t_ccv.flags |= CCF_HYSTART_CAN_SH_CWND; if (rack_do_hystart > 2) - tp->ccv->flags |= CCF_HYSTART_CONS_SSTH; + tp->t_ccv.flags |= CCF_HYSTART_CONS_SSTH; } if (rack_def_profile) rack_set_profile(rack, rack_def_profile); @@ -13632,7 +13632,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack->r_ctl.current_round++; rack->r_ctl.roundends = tp->snd_max; if (CC_ALGO(tp)->newround != NULL) { - CC_ALGO(tp)->newround(tp->ccv, rack->r_ctl.current_round); + CC_ALGO(tp)->newround(&tp->t_ccv, rack->r_ctl.current_round); } } /* Setup our act_rcv_time */ @@ -14531,7 +14531,7 @@ do_output_now: rack->r_ctl.current_round++; rack->r_ctl.roundends = tp->snd_max; if (CC_ALGO(tp)->newround != NULL) { - CC_ALGO(tp)->newround(tp->ccv, rack->r_ctl.current_round); + CC_ALGO(tp)->newround(&tp->t_ccv, rack->r_ctl.current_round); } } if ((nxt_pkt == 0) && @@ -19661,7 +19661,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, break; case TCP_RACK_PACING_BETA: RACK_OPTS_INC(tcp_rack_beta); - if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) { + if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0) { /* This only works for newreno. */ error = EINVAL; break; @@ -19676,7 +19676,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, opt.name = CC_NEWRENO_BETA; opt.val = optval; if (CC_ALGO(tp)->ctl_output != NULL) - error = CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); + error = CC_ALGO(tp)->ctl_output(&tp->t_ccv, &sopt, &opt); else { error = ENOENT; break; @@ -19704,7 +19704,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, break; case TCP_RACK_PACING_BETA_ECN: RACK_OPTS_INC(tcp_rack_beta_ecn); - if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) { + if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0) { /* This only works for newreno. */ error = EINVAL; break; @@ -19719,7 +19719,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, opt.name = CC_NEWRENO_BETA_ECN; opt.val = optval; if (CC_ALGO(tp)->ctl_output != NULL) - error = CC_ALGO(tp)->ctl_output(tp->ccv, &sopt, &opt); + error = CC_ALGO(tp)->ctl_output(&tp->t_ccv, &sopt, &opt); else error = ENOENT; } else { @@ -20164,13 +20164,13 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, case TCP_RACK_ENABLE_HYSTART: { if (optval) { - tp->ccv->flags |= CCF_HYSTART_ALLOWED; + tp->t_ccv.flags |= CCF_HYSTART_ALLOWED; if (rack_do_hystart > RACK_HYSTART_ON) - tp->ccv->flags |= CCF_HYSTART_CAN_SH_CWND; + tp->t_ccv.flags |= CCF_HYSTART_CAN_SH_CWND; if (rack_do_hystart > RACK_HYSTART_ON_W_SC) - tp->ccv->flags |= CCF_HYSTART_CONS_SSTH; + tp->t_ccv.flags |= CCF_HYSTART_CONS_SSTH; } else { - tp->ccv->flags &= ~(CCF_HYSTART_ALLOWED|CCF_HYSTART_CAN_SH_CWND|CCF_HYSTART_CONS_SSTH); + tp->t_ccv.flags &= ~(CCF_HYSTART_ALLOWED|CCF_HYSTART_CAN_SH_CWND|CCF_HYSTART_CONS_SSTH); } } break; @@ -20590,7 +20590,7 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) * when you exit recovery. */ case TCP_RACK_PACING_BETA: - if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) + if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0) error = EINVAL; else if (rack->rc_pacing_cc_set == 0) optval = rack->r_ctl.rc_saved_beta.beta; @@ -20600,8 +20600,8 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) * I have previously set. Yeah it looks hackish but * we don't want to report the saved values. */ - if (tp->ccv->cc_data) - optval = ((struct newreno *)tp->ccv->cc_data)->beta; + if (tp->t_ccv.cc_data) + optval = ((struct newreno *)tp->t_ccv.cc_data)->beta; else error = EINVAL; } @@ -20615,7 +20615,7 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) */ case TCP_RACK_PACING_BETA_ECN: - if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) + if (strcmp(tp->t_cc->name, CCALGONAME_NEWRENO) != 0) error = EINVAL; else if (rack->rc_pacing_cc_set == 0) optval = rack->r_ctl.rc_saved_beta.beta_ecn; @@ -20625,8 +20625,8 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) * I have previously set. Yeah it looks hackish but * we don't want to report the saved values. */ - if (tp->ccv->cc_data) - optval = ((struct newreno *)tp->ccv->cc_data)->beta_ecn; + if (tp->t_ccv.cc_data) + optval = ((struct newreno *)tp->t_ccv.cc_data)->beta_ecn; else error = EINVAL; } @@ -20642,11 +20642,11 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) break; case TCP_RACK_ENABLE_HYSTART: { - if (tp->ccv->flags & CCF_HYSTART_ALLOWED) { + if (tp->t_ccv.flags & CCF_HYSTART_ALLOWED) { optval = RACK_HYSTART_ON; - if (tp->ccv->flags & CCF_HYSTART_CAN_SH_CWND) + if (tp->t_ccv.flags & CCF_HYSTART_CAN_SH_CWND) optval = RACK_HYSTART_ON_W_SC; - if (tp->ccv->flags & CCF_HYSTART_CONS_SSTH) + if (tp->t_ccv.flags & CCF_HYSTART_CONS_SSTH) optval = RACK_HYSTART_ON_W_SC_C; } else { optval = RACK_HYSTART_OFF; diff --git a/sys/netinet/tcp_stacks/sack_filter.c b/sys/netinet/tcp_stacks/sack_filter.c index 96728f360463..19b32acb2c7f 100644 --- a/sys/netinet/tcp_stacks/sack_filter.c +++ b/sys/netinet/tcp_stacks/sack_filter.c @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#include +#include #include #include #include diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 6e85d5a77340..a132d9cf7e96 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1121,24 +1121,6 @@ tcp_default_fb_fini(struct tcpcb *tp, int tcb_is_purged) #define TCBHASHSIZE 0 #endif -/* - * XXX - * Callouts should be moved into struct tcp directly. They are currently - * separate because the tcpcb structure is exported to userland for sysctl - * parsing purposes, which do not know about callouts. - */ -struct tcpcb_mem { - struct tcpcb tcb; - struct tcp_timer tt; - struct cc_var ccv; -#ifdef TCP_HHOOK - struct osd osd; -#endif -}; - -VNET_DEFINE_STATIC(uma_zone_t, tcpcb_zone); -#define V_tcpcb_zone VNET(tcpcb_zone) - MALLOC_DEFINE(M_TCPLOG, "tcplog", "TCP address and flags print buffers"); MALLOC_DEFINE(M_TCPFUNCTIONS, "tcpfunc", "TCP function set memory"); @@ -1148,7 +1130,7 @@ static struct mtx isn_mtx; #define ISN_LOCK() mtx_lock(&isn_mtx) #define ISN_UNLOCK() mtx_unlock(&isn_mtx) -INPCBSTORAGE_DEFINE(tcpcbstor, inpcb, "tcpinp", "tcp_inpcb", "tcp", "tcphash"); +INPCBSTORAGE_DEFINE(tcpcbstor, tcpcb, "tcpinp", "tcp_inpcb", "tcp", "tcphash"); /* * Take a value and get the next power of 2 that doesn't overflow. @@ -1471,14 +1453,6 @@ tcp_vnet_init(void *arg __unused) in_pcbinfo_init(&V_tcbinfo, &tcpcbstor, tcp_tcbhashsize, tcp_tcbhashsize); - /* - * These have to be type stable for the benefit of the timers. - */ - V_tcpcb_zone = uma_zcreate("tcpcb", sizeof(struct tcpcb_mem), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - uma_zone_set_max(V_tcpcb_zone, maxsockets); - uma_zone_set_warning(V_tcpcb_zone, "kern.ipc.maxsockets limit reached"); - syncache_init(); tcp_hc_init(); @@ -1643,7 +1617,6 @@ tcp_destroy(void *unused __unused) in_pcbinfo_destroy(&V_tcbinfo); /* tcp_discardcb() clears the sack_holes up. */ uma_zdestroy(V_sack_hole_zone); - uma_zdestroy(V_tcpcb_zone); /* * Cannot free the zone until all tcpcbs are released as we attach @@ -2198,29 +2171,28 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, } /* - * Create a new TCP control block, making an - * empty reassembly queue and hooking it to the argument - * protocol control block. The `inp' parameter must have - * come from the zone allocator set up in tcp_init(). + * Create a new TCP control block, making an empty reassembly queue and hooking + * it to the argument protocol control block. The `inp' parameter must have + * come from the zone allocator set up by tcpcbstor declaration. */ struct tcpcb * tcp_newtcpcb(struct inpcb *inp) { - struct tcpcb_mem *tm; - struct tcpcb *tp; *** 833 LINES SKIPPED ***