qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure wit


From: Samuel Thibault
Subject: Re: [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure with an union
Date: Wed, 10 Feb 2016 13:20:05 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]