From nobody Wed Aug 17 18:52:22 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 4M7HFM2KPWz4Yxkh; Wed, 17 Aug 2022 18:52:23 +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 4M7HFM1PsVz4Cyr; Wed, 17 Aug 2022 18:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660762343; 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=EB5uCTUzLK9WFtGDRTv7f0YkzGrVApsbxQ1MqjZtdAA=; b=VPlbr5Y9dGZe7ZFOzb+33ImbdEAKbkA5kAbQBy9SCBsxF/paT/srs6wLKBHZc8vGKXO4OM 2JxBWr4tpaa7HFLUq5cwWEAr2J++uRSguRAs27vUGpO/XW3D2Vgb0jYjCNR2uFmNOc8eGc OSHcPN5NRJBr6TAuDjNXvAiHnQgQzZsIHAA1HEGU8TMdKPn9ethSh6Ui5iVmhzGG1sYdZW aqOLL+2G1KaMlnSuMpSKVWWbqlTN3iefneQNWClwRAEEawvamQivGp87Dhpwa6k4JTbuvp kHvb8pHxDUDy5sK2tshHOe0lYcIOMHWE3RuyarYSByyeslUP4w83R+G32vpyIw== 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 4M7HFM0Jh1z11J2; Wed, 17 Aug 2022 18:52:23 +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 27HIqMo4013138; Wed, 17 Aug 2022 18:52:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27HIqMYI013137; Wed, 17 Aug 2022 18:52:22 GMT (envelope-from git) Date: Wed, 17 Aug 2022 18:52:22 GMT Message-Id: <202208171852.27HIqMYI013137@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: a6b982e265fd - main - tcp: move tcp_drain() verbatim before tcp_init() 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: a6b982e265fd37be58bb3a5c3345a63cecad5b57 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660762343; 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=EB5uCTUzLK9WFtGDRTv7f0YkzGrVApsbxQ1MqjZtdAA=; b=J5xDCzRHyJ7hXUo0n7ucrwfNyADS7GHXs6C+70qKUnDETcd0lKUxXNqYfgxrH79JN+EtkC brym7hgdU0yf8pQ2byJmNiDqdVzVAyMmkcD3tROJiguklG0xutlTJCnLWsA73Uo4cXffLd z8bL7aCOUdu0ualCdDV+QMQ59vvqVp/oC5WVWGqHUY7scMDJkjpBjw/yUQevn57bL9RY5/ zstJfBYrsxvVRKk4Eu5jbxISR6XscXwLbTiJnw2DDc6M90x86RGbS9+jf7QaMZTYOGDegS r4is7LCd/UgIvpXkluljtUuzqJWWKkZ3Hv1WI/RfH44RRa0Y6bbvDhavZ6B+ZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660762343; a=rsa-sha256; cv=none; b=UcysyvUzLixodtdn7VSVMGEmubDIk83/B0TiPC28jTguzrLZi+cLWkLz3OX4pBN5vRRPiQ g4pFwbHDmQZIIIhcoHli2Z1PGGjBxv60cOVPa+egRQVVUfGZTDZ8qV7M7J+QMf/BXJ3d3y KJP6bUgs+tbWgfyOCD9f16Xf/OrAu0hS851pwBoqjxdwzLjF8kl0WFy2ebecXqDvXghZkN PEFxpMYoeWJgHQngOlMPzhS0mOoGq5iGZ+nQdYNnPrfgiMoFAVA9FcPtXVhBd0+TN+DSuw uEDZuZ26iqbERqB2Un68FioP7yb5fyLOoFRh+sRm7uA19fxYrXl+PwuYLf40zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a6b982e265fd37be58bb3a5c3345a63cecad5b57 commit a6b982e265fd37be58bb3a5c3345a63cecad5b57 Author: Gleb Smirnoff AuthorDate: 2022-08-17 18:50:31 +0000 Commit: Gleb Smirnoff CommitDate: 2022-08-17 18:50:31 +0000 tcp: move tcp_drain() verbatim before tcp_init() --- sys/netinet/tcp_subr.c | 102 ++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index e26fe0ec247e..51a2e23db6ef 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1402,6 +1402,56 @@ deregister_tcp_functions(struct tcp_function_block *blk, bool quiesce, return (0); } +static void +tcp_drain(void) +{ + struct epoch_tracker et; + VNET_ITERATOR_DECL(vnet_iter); + + if (!do_tcpdrain) + return; + + NET_EPOCH_ENTER(et); + VNET_LIST_RLOCK_NOSLEEP(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo, + INPLOOKUP_WLOCKPCB); + struct inpcb *inpb; + struct tcpcb *tcpb; + + /* + * Walk the tcpbs, if existing, and flush the reassembly queue, + * if there is one... + * XXX: The "Net/3" implementation doesn't imply that the TCP + * reassembly queue should be flushed, but in a situation + * where we're really low on mbufs, this is potentially + * useful. + */ + while ((inpb = inp_next(&inpi)) != NULL) { + if (inpb->inp_flags & INP_TIMEWAIT) + continue; + if ((tcpb = intotcpcb(inpb)) != NULL) { + tcp_reass_flush(tcpb); + tcp_clean_sackreport(tcpb); +#ifdef TCP_BLACKBOX + tcp_log_drain(tcpb); +#endif +#ifdef TCPPCAP + if (tcp_pcap_aggressive_free) { + /* Free the TCP PCAP queues. */ + tcp_pcap_drain(&(tcpb->t_inpkts)); + tcp_pcap_drain(&(tcpb->t_outpkts)); + } +#endif + } + } + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK_NOSLEEP(); + NET_EPOCH_EXIT(et); +} + static void tcp_vnet_init(void *arg __unused) { @@ -1448,8 +1498,6 @@ tcp_vnet_init(void *arg __unused) VNET_SYSINIT(tcp_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH, tcp_vnet_init, NULL); -static void tcp_drain(void); - static void tcp_init(void *arg __unused) { @@ -2517,56 +2565,6 @@ tcp_close(struct tcpcb *tp) return (tp); } -static void -tcp_drain(void) -{ - struct epoch_tracker et; - VNET_ITERATOR_DECL(vnet_iter); - - if (!do_tcpdrain) - return; - - NET_EPOCH_ENTER(et); - VNET_LIST_RLOCK_NOSLEEP(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo, - INPLOOKUP_WLOCKPCB); - struct inpcb *inpb; - struct tcpcb *tcpb; - - /* - * Walk the tcpbs, if existing, and flush the reassembly queue, - * if there is one... - * XXX: The "Net/3" implementation doesn't imply that the TCP - * reassembly queue should be flushed, but in a situation - * where we're really low on mbufs, this is potentially - * useful. - */ - while ((inpb = inp_next(&inpi)) != NULL) { - if (inpb->inp_flags & INP_TIMEWAIT) - continue; - if ((tcpb = intotcpcb(inpb)) != NULL) { - tcp_reass_flush(tcpb); - tcp_clean_sackreport(tcpb); -#ifdef TCP_BLACKBOX - tcp_log_drain(tcpb); -#endif -#ifdef TCPPCAP - if (tcp_pcap_aggressive_free) { - /* Free the TCP PCAP queues. */ - tcp_pcap_drain(&(tcpb->t_inpkts)); - tcp_pcap_drain(&(tcpb->t_outpkts)); - } -#endif - } - } - CURVNET_RESTORE(); - } - VNET_LIST_RUNLOCK_NOSLEEP(); - NET_EPOCH_EXIT(et); -} - /* * Notify a tcp user of an asynchronous error; * store error as soft error, but wake up user