From nobody Thu Mar 14 17:23:12 2024 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 4TwZ363XQvz5DSNt; Thu, 14 Mar 2024 17:23:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TwZ361hDfz4DR3; Thu, 14 Mar 2024 17:23:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710436994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fNbfguqjjfaWuFQaFbo3+YYZZOA/452mUOrIZ03ZGoA=; b=bEn5wbeVwcJ0G34z+6FfzgOBAygY7vzRPBubfAdFP/5ELDINEN7Un5ofgmuQ/dQNc7cBkU 35gjGA6kanbjPbU9+l8Y3hizkcpL3y7Q4WOqH6Uo9dAp3lDTzW/8mJybxbBVDNLwgYhhqR kzuZi9uGFuk3KVS2lnSNnFnkO3IHHkC/lTNhYh1JtlgLAtKtbq+4PrZuR1Z1OR0OUvTKjO Z/JEO52aO2zUEcdNCsoamZye8zcoHLcQG7PM7OTlnJKLMUIESuE23PG6DuOysPxcdcRI9u E/jL9Xi8ncKSPsfQQNcllFHYUeGu3WZ0diUl5ln5Oq1cWwfYpwv66j14i8i8wQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710436994; a=rsa-sha256; cv=none; b=X2Us50zeVXKavkQ5Xr29z/KJSdlO3djmt7hVJvv5a8jUODusLjZM+Hk9VMo03Y5uSYreXl 9GR34PuoXkpPJKlzstGqHWxquhN+CmLjCziyuhROVSDJBnPKkdUAxNoZ2tWzREH4F53E4z NdbKe+NEyIC5NfJHyAZiz5co2ANgFGpTdBNKpmXf8CBsu63ux45Wb+LraZvZX6MwiK/BIM MSYyZg8ShxVbdk2eiXgnPtUjrv7JKV208XlSHjd4bqQq7foUQGrvvSkJincIe+5lplNYQT 1ZuJstJPEY0Hw3dJmmeVFz+ToEg7KRmb2nyn1pGGgstKAkYgF14ANjiDNvRJiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710436994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fNbfguqjjfaWuFQaFbo3+YYZZOA/452mUOrIZ03ZGoA=; b=gkdEji7Ye0cvGXF86nKhvjrfyv/9r9WoPb5Uts4M675w2d+qxE5jh/VkMk5kjIfXwlL5LU Q7z0p3HRhANdgUATgq7HQigRVuONc+57ye267C48OPN+d7Zy9xDOY5txBgUUJhEnf1iY1D bYt1xUUfC2e0z/nDycRYRM0K34ggMyXHb76lgP8RdMYuqy/vLr47esi+j9b2GY6TrPpIiG Ax+lucpXbcFkNMKkZpfVQmzvSAcKmzAej/tOjUOKwPZmEnIrdtaj6q1yH+OtEiwC0dqQgv 0C2oUvc/CaPZ6TUG1n0+uKxq/s76CGSiKa1h8ZS7SiGdox6CbAm/lkBcANDd7g== Received: from [IPV6:2601:644:937f:4c50:9159:2009:aff7:887a] (unknown [IPv6:2601:644:937f:4c50:9159:2009:aff7:887a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4TwZ354jkDzMMJ; Thu, 14 Mar 2024 17:23:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <56f538f1-d406-4095-972a-2022d48ffc73@FreeBSD.org> Date: Thu, 14 Mar 2024 10:23:12 -0700 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 User-Agent: Mozilla Thunderbird Subject: Re: git: 220ee18f1964 - main - netinet/tcp_var.h: always define IS_FASTOPEN() for kernel compilation env Content-Language: en-US To: Gleb Smirnoff , Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202403132321.42DNLNIX087785@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/13/24 5:24 PM, Gleb Smirnoff wrote: > On Wed, Mar 13, 2024 at 11:21:23PM +0000, Konstantin Belousov wrote: > K> diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h > K> index 6f7f7115c2f4..7b5c57d39213 100644 > K> --- a/sys/netinet/tcp_var.h > K> +++ b/sys/netinet/tcp_var.h > K> @@ -812,11 +812,13 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack) > K> #define ENTER_RECOVERY(t_flags) t_flags |= (TF_CONGRECOVERY | TF_FASTRECOVERY) > K> #define EXIT_RECOVERY(t_flags) t_flags &= ~(TF_CONGRECOVERY | TF_FASTRECOVERY) > K> > K> -#if defined(_KERNEL) && !defined(TCP_RFC7413) > K> +#if defined(_KERNEL) > K> +#if !defined(TCP_RFC7413) > K> #define IS_FASTOPEN(t_flags) (false) > K> #else > K> #define IS_FASTOPEN(t_flags) (t_flags & TF_FASTOPEN) > K> #endif > K> +#endif > K> > K> #define BYTES_THIS_ACK(tp, th) (th->th_ack - tp->snd_una) > > I know Konstantin in doing that to clear path for IPSEC changes, and the patch > does improve code. So the message isn't addressed to him, rather it is for > other src-committers. > > Using ifdefs that come from the kernel config inside include files that are not > ephemeral opt_foo.h is laying out a minefield for the future. Best case - for > yourself, worst case - for somebody else. +100 > In the best case this ends in cryptic kernel failure builds, where your custom > kernel doesn't build, but GENERIC builds and it is not clear why. In the worst > case this creates runtime failures even more cryptic in their nature. > > In this particular case TCP_RFC7413 comes via opt_inet.h. Thus, if you got a > userland tool, e.g. netstat(1) using IS_FASTOPEN() it will always be false. > Again, netstat would be a best case. A worst case would be netinet6 kernel > compilation unit that does not include opt_inet.h, but uses IS_FASTOPEN(). > > Other than that, we got 32 flags for t_flags and only one is obfuscated via a > macro. I'd really like to remove the macro and test the flag directly. Any > objections? +1 -- John Baldwin