From owner-svn-src-head@freebsd.org Wed Oct 14 11:39:03 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4762A12F35 for ; Wed, 14 Oct 2015 11:39:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 41D27D3; Wed, 14 Oct 2015 11:39:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.15.2/8.15.2) with ESMTPS id t9EBcxVB033011 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 14 Oct 2015 14:38:59 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.15.2/8.15.2/Submit) id t9EBcxZr033010; Wed, 14 Oct 2015 14:38:59 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 14 Oct 2015 14:38:59 +0300 From: Gleb Smirnoff To: Hiren Panchasara , Jonathan Looney Cc: svn-src-head@freebsd.org Subject: Re: svn commit: r289276 - in head/sys: conf kern netinet sys Message-ID: <20151014113859.GS1023@FreeBSD.org> References: <201510140035.t9E0ZbXS030094@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201510140035.t9E0ZbXS030094@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2015 11:39:03 -0000 Hi, On Wed, Oct 14, 2015 at 12:35:37AM +0000, Hiren Panchasara wrote: H> Author: hiren H> Date: Wed Oct 14 00:35:37 2015 H> New Revision: 289276 H> URL: https://svnweb.freebsd.org/changeset/base/289276 H> H> Log: H> There are times when it would be really nice to have a record of the last few H> packets and/or state transitions from each TCP socket. That would help with H> narrowing down certain problems we see in the field that are hard to reproduce H> without understanding the history of how we got into a certain state. This H> change provides just that. Thanks, Hiren for handling that, and thanks Jonathan for the patch. I have a tiny stylistic suggestion: H> Modified: head/sys/netinet/tcp_var.h H> ============================================================================== H> --- head/sys/netinet/tcp_var.h Wed Oct 14 00:23:31 2015 (r289275) H> +++ head/sys/netinet/tcp_var.h Wed Oct 14 00:35:37 2015 (r289276) H> @@ -37,6 +37,7 @@ H> H> #ifdef _KERNEL H> #include H> +#include H> H> /* H> * Kernel variables for tcp. H> @@ -204,7 +205,17 @@ struct tcpcb { H> H> uint32_t t_ispare[8]; /* 5 UTO, 3 TBD */ H> void *t_pspare2[4]; /* 1 TCP_SIGNATURE, 3 TBD */ H> - uint64_t _pad[6]; /* 6 TBD (1-2 CC/RTT?) */ H> +#if defined(_KERNEL) && defined(TCPPCAP) H> + struct mbufq t_inpkts; /* List of saved input packets. */ H> + struct mbufq t_outpkts; /* List of saved output packets. */ H> +#ifdef _LP64 H> + uint64_t _pad[0]; /* all used! */ H> +#else H> + uint64_t _pad[2]; /* 2 are available */ H> +#endif /* _LP64 */ H> +#else H> + uint64_t _pad[6]; H> +#endif /* defined(_KERNEL) && defined(TCPPCAP) */ H> }; What if we write it down this way (thanks C11): struct tcpcb { ... union { #ifdef TCPPCAP struct { struct mbufq t_inpkts; struct mbufq t_outpkts; }; #endif uint64_t _pad[6]; } }; So, compiler cares about pointer size, not us. And more readable, IMHO. -- Totus tuus, Glebius.