From nobody Fri Apr 7 19:21:39 2023 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 4PtSsc2k6Mz443fv; Fri, 7 Apr 2023 19:21:40 +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 4PtSsc0YDDz3jnv; Fri, 7 Apr 2023 19:21:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680895300; 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=078MuAaw+tcMuBgrBMHOqIs2m427WgXxpfGnfa+vFjM=; b=VxqT8tdmj35ZsA+SQEUnyCSj3RfTfoaViV3/fY6CILC2IX2TFyxoa61OBb+qApNYCMwc+x pI8/fRevonAtNsxS41dHGZpZJo37GbLW3s8KI4URFp+aKSJwDZxZw9nZk8PCp4Okpvg+sH aW6IGG1LYGEwppPN3nDX1Ha5wNLW0uMkRRCJBHi6rZ0nSbZJ52UuCBjeXyvDxHSte0LWG9 TNTaaO8S9+tS1R9pA0MUSCba3aRSDOdIBCcRQox5Jjl5RckdPtUYIbAm2BsULL22e0njal VS2kthIDQa+GaPBEgdBdfVAn50d5+8/s5RycvAq/D8IQXZPBgaCXNLBReGjHTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680895300; 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=078MuAaw+tcMuBgrBMHOqIs2m427WgXxpfGnfa+vFjM=; b=ha3x++iq7r+sirJw+0k5aSLrDYKKC+hPBsNUz4O0S7m9VXxL0yAWNMzG4ZCt0tdqLPsMir RjiazIk47o7Wn5SCqq8/kFCSGi4ynl0keKnL5ykjAwPwslCEvR/NEijb/39aVcNlOEZHyk ZlySkUB8U5CLbPuYpxfAnCmdczlG5g4mGmhFpt30s1ggLKGW14UPTNp0czhD13sVcEDUaC oq2uoRVaQF7DANa1Ta00OSsf2aE/nSaprlXVzaeu0TOEyulZ5Dl1Veihf/tmBXFNzUtzVU CNxexiCoILiDVWYs1fA9YgjTirXTl372jmGcNvcSiaxpmqoZZsskW4i83Ofbcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680895300; a=rsa-sha256; cv=none; b=Sgmox3b7t+bGLmVzdn4SCGJP8IpyOT4STFLbfrkjWTCVaTn7bnTJUgETlzmFhi27KK1IvK yw4zQQuJekc4tYcOSXzXKR9sE1fgBn+lPbjkVPwMmtEfsPEhtIUxyGEP+ewBb+Safuk2AQ 4Ly0erYEd2/hb9BuHnNucgr0OMC0fKrLw2FVbLeRBa5S3fr9kNhGMVyPZQtlyZj2KDQbVG eG7I74n4mzN9MBenwEu22E8K8OORtIvLa87bimuc76Ierz+Q/IgPgdWjMqrwGm1yKJLePh uX3GQDF8Zmda7DR6KaX768/nQP5x9J8grDEBTfec+j8UdNBrS9jOvPL/Cbx7sw== 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 4PtSsb3BQGzxK8; Fri, 7 Apr 2023 19:21:39 +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 337JLdle007615; Fri, 7 Apr 2023 19:21:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 337JLdVK007614; Fri, 7 Apr 2023 19:21:39 GMT (envelope-from git) Date: Fri, 7 Apr 2023 19:21:39 GMT Message-Id: <202304071921.337JLdVK007614@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: 66fbc19fbd7c - main - tcp: pass tcpcb in the tfb_tcp_ctloutput() method instead of inpcb 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: 66fbc19fbd7c75fae619ead787d90242d96cc002 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=66fbc19fbd7c75fae619ead787d90242d96cc002 commit 66fbc19fbd7c75fae619ead787d90242d96cc002 Author: Gleb Smirnoff AuthorDate: 2023-04-07 19:18:10 +0000 Commit: Gleb Smirnoff CommitDate: 2023-04-07 19:18:10 +0000 tcp: pass tcpcb in the tfb_tcp_ctloutput() method instead of inpcb Just matches rest of the KPI. Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D39435 --- sys/netinet/tcp_stacks/bbr.c | 27 ++++++++++++--------------- sys/netinet/tcp_stacks/rack.c | 26 ++++++++++++-------------- sys/netinet/tcp_usrreq.c | 8 ++++---- sys/netinet/tcp_var.h | 4 ++-- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index d95f0502755c..623b65f2c159 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -511,8 +511,7 @@ static void bbr_log_pacing_delay_calc(struct tcp_bbr *bbr, uint16_t gain, uint32_t len, uint32_t cts, uint32_t usecs, uint64_t bw, uint32_t override, int mod); -static int -bbr_ctloutput(struct inpcb *inp, struct sockopt *sopt); +static int bbr_ctloutput(struct tcpcb *tp, struct sockopt *sopt); static inline uint8_t bbr_state_val(struct tcp_bbr *bbr) @@ -14134,17 +14133,17 @@ struct tcp_function_block __tcp_bbr = { * option. */ static int -bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt) +bbr_set_sockopt(struct tcpcb *tp, struct sockopt *sopt) { struct epoch_tracker et; - struct tcpcb *tp; + struct inpcb *inp = tptoinpcb(tp); struct tcp_bbr *bbr; int32_t error = 0, optval; switch (sopt->sopt_level) { case IPPROTO_IPV6: case IPPROTO_IP: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); } switch (sopt->sopt_name) { @@ -14190,7 +14189,7 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt) case TCP_BBR_RETRAN_WTSO: break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } INP_WUNLOCK(inp); @@ -14202,7 +14201,6 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt) INP_WUNLOCK(inp); return (ECONNRESET); } - tp = intotcpcb(inp); if (tp->t_fb != &__tcp_bbr) { INP_WUNLOCK(inp); return (ENOPROTOOPT); @@ -14519,7 +14517,7 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt) } break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } tcp_log_socket_option(tp, sopt->sopt_name, optval, error); @@ -14531,13 +14529,12 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt) * return 0 on success, error-num on failure */ static int -bbr_get_sockopt(struct inpcb *inp, struct sockopt *sopt) +bbr_get_sockopt(struct tcpcb *tp, struct sockopt *sopt) { - struct tcpcb *tp; + struct inpcb *inp = tptoinpcb(tp); struct tcp_bbr *bbr; int32_t error, optval; - tp = intotcpcb(inp); bbr = (struct tcp_bbr *)tp->t_fb_ptr; if (bbr == NULL) { INP_WUNLOCK(inp); @@ -14676,7 +14673,7 @@ bbr_get_sockopt(struct inpcb *inp, struct sockopt *sopt) optval |= BBR_INCL_ENET_OH; break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } INP_WUNLOCK(inp); @@ -14688,12 +14685,12 @@ bbr_get_sockopt(struct inpcb *inp, struct sockopt *sopt) * return 0 on success, error-num on failure */ static int -bbr_ctloutput(struct inpcb *inp, struct sockopt *sopt) +bbr_ctloutput(struct tcpcb *tp, struct sockopt *sopt) { if (sopt->sopt_dir == SOPT_SET) { - return (bbr_set_sockopt(inp, sopt)); + return (bbr_set_sockopt(tp, sopt)); } else if (sopt->sopt_dir == SOPT_GET) { - return (bbr_get_sockopt(inp, sopt)); + return (bbr_get_sockopt(tp, sopt)); } else { panic("%s: sopt_dir $%d", __func__, sopt->sopt_dir); } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 48a422c1eb8a..4185b50737af 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -448,7 +448,7 @@ rack_cong_signal(struct tcpcb *tp, uint32_t type, uint32_t ack, int ); static void rack_counter_destroy(void); static int -rack_ctloutput(struct inpcb *inp, struct sockopt *sopt); +rack_ctloutput(struct tcpcb *tp, struct sockopt *sopt); static int32_t rack_ctor(void *mem, int32_t size, void *arg, int32_t how); static void rack_set_pace_segments(struct tcpcb *tp, struct tcp_rack *rack, uint32_t line, uint64_t *fill_override); @@ -473,7 +473,7 @@ rack_find_high_nonack(struct tcp_rack *rack, static struct rack_sendmap *rack_find_lowest_rsm(struct tcp_rack *rack); static void rack_free(struct tcp_rack *rack, struct rack_sendmap *rsm); static void rack_fini(struct tcpcb *tp, int32_t tcb_is_purged); -static int rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt); +static int rack_get_sockopt(struct tcpcb *tp, struct sockopt *sopt); static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack, int line, uint8_t quality); @@ -509,7 +509,7 @@ rack_proc_sack_blk(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, int *no_extra, int *moved_two, uint32_t segsiz); static void rack_post_recovery(struct tcpcb *tp, uint32_t th_seq); static void rack_remxt_tmr(struct tcpcb *tp); -static int rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt); +static int rack_set_sockopt(struct tcpcb *tp, struct sockopt *sopt); static void rack_set_state(struct tcpcb *tp, struct tcp_rack *rack); static int32_t rack_stopall(struct tcpcb *tp); static void rack_timer_cancel(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, int line); @@ -23364,21 +23364,20 @@ static struct tcp_function_block __tcp_rack = { * option. */ static int -rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt) +rack_set_sockopt(struct tcpcb *tp, struct sockopt *sopt) { + struct inpcb *inp = tptoinpcb(tp); #ifdef INET6 struct ip6_hdr *ip6; #endif #ifdef INET struct ip *ip; #endif - struct tcpcb *tp; struct tcp_rack *rack; struct tcp_hybrid_req hybrid; uint64_t loptval; int32_t error = 0, mask, optval, tclass; - tp = intotcpcb(inp); rack = (struct tcp_rack *)tp->t_fb_ptr; if (rack == NULL) { INP_WUNLOCK(inp); @@ -23514,7 +23513,7 @@ rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt) break; default: /* Filter off all unknown options to the base stack */ - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } @@ -23623,9 +23622,9 @@ rack_fill_info(struct tcpcb *tp, struct tcp_info *ti) } static int -rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) +rack_get_sockopt(struct tcpcb *tp, struct sockopt *sopt) { - struct tcpcb *tp; + struct inpcb *inp = tptoinpcb(tp); struct tcp_rack *rack; int32_t error, optval; uint64_t val, loptval; @@ -23637,7 +23636,6 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) * impact to this routine. */ error = 0; - tp = intotcpcb(inp); rack = (struct tcp_rack *)tp->t_fb_ptr; if (rack == NULL) { INP_WUNLOCK(inp); @@ -23903,7 +23901,7 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) optval = rack->r_ctl.timer_slop; break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } INP_WUNLOCK(inp); @@ -23917,12 +23915,12 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) } static int -rack_ctloutput(struct inpcb *inp, struct sockopt *sopt) +rack_ctloutput(struct tcpcb *tp, struct sockopt *sopt) { if (sopt->sopt_dir == SOPT_SET) { - return (rack_set_sockopt(inp, sopt)); + return (rack_set_sockopt(tp, sopt)); } else if (sopt->sopt_dir == SOPT_GET) { - return (rack_get_sockopt(inp, sopt)); + return (rack_get_sockopt(tp, sopt)); } else { panic("%s: sopt_dir $%d", __func__, sopt->sopt_dir); } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index f27810e14f0d..a613e5fbf2b7 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1770,7 +1770,7 @@ err_out: } /* Pass in the INP locked, callee must unlock it. */ - return (tp->t_fb->tfb_tcp_ctloutput(inp, sopt)); + return (tp->t_fb->tfb_tcp_ctloutput(tp, sopt)); } static int @@ -1820,7 +1820,7 @@ tcp_ctloutput_get(struct inpcb *inp, struct sockopt *sopt) } /* Pass in the INP locked, callee must unlock it. */ - return (tp->t_fb->tfb_tcp_ctloutput(inp, sopt)); + return (tp->t_fb->tfb_tcp_ctloutput(tp, sopt)); } int @@ -2000,9 +2000,9 @@ no_mem_needed: } int -tcp_default_ctloutput(struct inpcb *inp, struct sockopt *sopt) +tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt) { - struct tcpcb *tp = intotcpcb(inp); + struct inpcb *inp = tptoinpcb(tp); int error, opt, optval; u_int ui; struct tcp_info ti; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 75f5e01e5882..9e58c4c3576b 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -599,7 +599,7 @@ struct tcp_function_block { int (*tfb_do_segment_nounlock)(struct tcpcb *, struct mbuf *, struct tcphdr *, int, int, uint8_t, int, struct timeval *); int (*tfb_do_queued_segments)(struct tcpcb *, int); - int (*tfb_tcp_ctloutput)(struct inpcb *inp, struct sockopt *sopt); + int (*tfb_tcp_ctloutput)(struct tcpcb *, struct sockopt *); /* Optional memory allocation/free routine */ int (*tfb_tcp_fb_init)(struct tcpcb *, void **); void (*tfb_tcp_fb_fini)(struct tcpcb *, int); @@ -1390,7 +1390,7 @@ int find_tcp_function_alias(struct tcp_function_block *blk, struct tcp_function_ void tcp_switch_back_to_default(struct tcpcb *tp); struct tcp_function_block * find_and_ref_tcp_fb(struct tcp_function_block *fs); -int tcp_default_ctloutput(struct inpcb *inp, struct sockopt *sopt); +int tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt); int tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt); void tcp_log_socket_option(struct tcpcb *tp, uint32_t option_num, uint32_t option_val, int err);