From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTTkh-0000fA-Ec for qemu-devel@nongnu.org; Wed, 10 Feb 2016 07:20:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTTke-0005oC-2J for qemu-devel@nongnu.org; Wed, 10 Feb 2016 07:20:11 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:25143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTTkd-0005nS-QP for qemu-devel@nongnu.org; Wed, 10 Feb 2016 07:20:07 -0500 Date: Wed, 10 Feb 2016 13:20:05 +0100 From: Samuel Thibault Message-ID: <20160210122005.GB6020@var.bordeaux.inria.fr> References: <56BAEF4C.6090400@redhat.com> <20160210092847.GC3423@var.bordeaux.inria.fr> <56BB0C37.2070300@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56BB0C37.2070300@redhat.com> Subject: Re: [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure with an union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: zhanghailiang , Li Zhijian , Stefan Hajnoczi , Jason Wang , qemu-devel@nongnu.org, Vasiliy Tolstov , Dave Gilbert , Gonglei , Jan Kiszka , Huangpeng , Guillaume Subiron Thomas Huth, on Wed 10 Feb 2016 11:08:55 +0100, wrote: > On 10.02.2016 10:28, Samuel Thibault wrote: > > Thomas Huth, on Wed 10 Feb 2016 09:05:32 +0100, wrote: > >>> -#define SLIRP_MSIZE (IF_MTU + IF_MAXLINKHDR + offsetof(struct mbuf, m_dat) + 6) > >>> +#define SLIRP_MSIZE\ > >>> + (offsetof(struct mbuf, m_dat) + IF_MAXLINKHDR + TCPIPHDR_DELTA + IF_MTU) > >> > >> I'm somehow having a hard time to understand why TCPIPHDR_DELTA is used > >> here. As far as I understand, TCPIPHDR_DELTA is the difference between > >> the size of struct tcpiphdr and the size of the IPv4 + TCP header. But > >> if it's just the difference, where does the base size of the headers > >> come from in this define, since the headers are stored in the mbuf, too, > >> aren't they? ... I've got the feeling that I miss something here, could > >> you enlighten me? > > > > TCP/IP headers are within IF_MTU. > > Ah, of course, that makes sense, thanks! ... so in the old definition of > SLIRP_MSIZE, the TCP/IP headers were counted twice, I guess? Something like this, yes. The formula was looking very magic (what is that 6 from?), so we rewrote it to make it clear for sure. Samuel