From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Anton Ivanov (antivano)" <antivano@cisco.com>
Cc: "Qemu-devel@nongnu.org" <Qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Contribution - L2TPv3 transport
Date: Wed, 5 Mar 2014 10:07:04 +0100 [thread overview]
Message-ID: <20140305090704.GB18052@stefanha-thinkpad.muc.redhat.com> (raw)
In-Reply-To: <5315B9C8.1000300@cisco.com>
On Tue, Mar 04, 2014 at 11:32:26AM +0000, Anton Ivanov (antivano) wrote:
> > If you really *need* the page size, please use sysconf(_SC_PAGESIZE).
>
> I like to have it page aligned and if possible page sized so I can later
> extend to do jumbo frame support via a vector. If this is the wrong way
> of doing it, I am happy to fix.
Page size may be the best size unit but you need to express it in a
portable way. Not all host architectures use 4 KB pages so hardcoding a
constant is wrong.
> > + //vec->iov_len = PAGE_SIZE; /* reset for next read */
> > I think it *is* necessary to reset ->iov_len for both msgvec iovecs.
>
> mmsgsend does not return these modified. However better be safe than
> sorry - I am uncommenting these in the next revision.
Oh, I see. In that case feel free to drop the assignments. I now see
that msg_len contains the size when recvmmsg(2) returns.
> > Can you use C structs and unions instead of choosing an arbitrary
> > 256-byte size and calculating offsets at runtime?
>
> It is has now updated to be the correct size for the actual config.
>
> As far as structs - not really.
>
> I tried that once upon a time in an early version, I ended up with 8+
> different structs (cookies can vary in size so you cannot union-ize
> them, compiler will allocate the size for the "biggest option"). In
> addition to that the standard has slightly different headers on raw and
> udp. The linux kernel people have done the same - header offsets. It is
> an unfortunate necessity for code like this.
>
> Also, there is one nearly universal non-standard feature which I would
> like to put back. It is present in the linux kernel implementation and
> it is the "arbitrary offset after header" so you can stick extra
> metadata between header and packet. That will necessitate offset
> calculations anyway.
Okay, that's fine. I was hoping but agree it cannot be represented
properly with C structs.
> > Is there a way to disable the IP header included in received packets?
> > I haven't looked into how IP_HDRINCL works...
>
> It works the other way - you can get headers on v6 using that option,
> but v6 does not give you headers by default. AFAIK v4 raw always gives
> you the header do you like it or not. Makes the code very ugly
> unfortunately.
Okay.
prev parent reply other threads:[~2014-03-05 9:07 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 8:28 [Qemu-devel] Contribution - L2TPv3 transport Anton Ivanov (antivano)
2014-02-28 10:02 ` Paolo Bonzini
2014-02-28 11:17 ` Anton Ivanov (antivano)
2014-02-28 11:36 ` Paolo Bonzini
2014-02-28 12:59 ` Anton Ivanov (antivano)
2014-02-28 13:55 ` Anton Ivanov (antivano)
2014-03-04 15:19 ` Anton Ivanov (antivano)
2014-03-04 15:22 ` Anton Ivanov (antivano)
2014-03-04 15:53 ` Eric Blake
2014-03-04 16:05 ` Anton Ivanov (antivano)
2014-03-05 8:49 ` Anton Ivanov (antivano)
2014-03-05 11:38 ` Peter Maydell
2014-03-04 15:41 ` Eric Blake
2014-03-04 15:58 ` Anton Ivanov (antivano)
2014-03-04 16:04 ` Paolo Bonzini
2014-03-04 16:33 ` Eric Blake
2014-03-04 16:48 ` Anton Ivanov (antivano)
2014-03-04 16:55 ` Paolo Bonzini
2014-03-04 17:28 ` Anton Ivanov (antivano)
2014-03-04 17:30 ` Paolo Bonzini
2014-02-28 13:40 ` Eric Blake
2014-02-28 13:52 ` Anton Ivanov (antivano)
2014-02-28 13:57 ` Eric Blake
2014-02-28 14:03 ` Anton Ivanov (antivano)
2014-02-28 14:00 ` Paolo Bonzini
2014-02-28 15:06 ` Eric Blake
2014-02-28 15:20 ` Paolo Bonzini
2014-03-03 13:27 ` Stefan Hajnoczi
2014-03-03 14:01 ` Anton Ivanov (antivano)
2014-03-04 9:36 ` Stefan Hajnoczi
2014-03-04 9:47 ` Anton Ivanov (antivano)
2014-03-05 8:59 ` Stefan Hajnoczi
2014-03-05 9:13 ` Vincenzo Maffione
2014-03-03 14:53 ` Stefan Hajnoczi
2014-03-04 11:32 ` Anton Ivanov (antivano)
2014-03-05 9:07 ` Stefan Hajnoczi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140305090704.GB18052@stefanha-thinkpad.muc.redhat.com \
--to=stefanha@gmail.com \
--cc=Qemu-devel@nongnu.org \
--cc=antivano@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).