Received: from eggs.gnu.org ([2001:4830:134:3::10]:50019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXfcN-0001lr-Ea for qemu-devel@nongnu.org; Sun, 21 Feb 2016 20:48:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXfcK-0004SM-9Q for qemu-devel@nongnu.org; Sun, 21 Feb 2016 20:48:55 -0500 Received: from domu-toccata.ens-lyon.fr ([140.77.166.138]:47255 helo=sonata.ens-lyon.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXfcK-0004Rw-2W for qemu-devel@nongnu.org; Sun, 21 Feb 2016 20:48:52 -0500 Date: Mon, 22 Feb 2016 02:48:48 +0100 From: Samuel Thibault Message-ID: <20160222014848.GQ1957@var.home> References: <56C71C5B.1040805@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56C71C5B.1040805@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 , Dave Gilbert , Vasiliy Tolstov , qemu-devel@nongnu.org, Gonglei , Jan Kiszka , Huangpeng , Guillaume Subiron Hello, Thomas Huth, on Fri 19 Feb 2016 14:44:59 +0100, wrote: > > + m->m_data -= sizeof(struct tcpiphdr) - (sizeof(struct ip) > > + + sizeof(struct tcphdr)); > > + m->m_len += sizeof(struct tcpiphdr) - (sizeof(struct ip) > > + + sizeof(struct tcphdr)); > > I'm somewhat having a hard time to understand the "+ sizeof(struct > tcphdr))" here. > > In the tcp_output.c code, there is this: > > m->m_data += sizeof(struct tcpiphdr) - sizeof(struct tcphdr) > - sizeof(struct ip); > > So with my limited point of view, I'd rather expect this here in > tcp_input.c: > > m->m_data -= sizeof(struct tcpiphdr) - (sizeof(struct ip) > - sizeof(struct tcphdr)); > i.e. "-" instead of "+" here ----------------^ The parentheses and indentation were misleading actually, here is how it should actually looks like: > > + m->m_data -= sizeof(struct tcpiphdr) - ( sizeof(struct ip) > > + + sizeof(struct tcphdr)); I've now dropped the parentheses, so it looks like the tcp_output.c code: m->m_data -= sizeof(struct tcpiphdr) - sizeof(struct ip) - sizeof(struct tcphdr); Samuel