From: Daniel Borkmann <danborkmann@iogearbox.net>
To: pchavent <Paul.Chavent@onera.fr>
Cc: davem@davemloft.net, edumazet@google.com, xemul@parallels.com,
herbert@gondor.hengli.com.au, netdev@vger.kernel.org,
johann.baudy@gnu-log.net, uaca@alumni.uv.es
Subject: Re: [PATCH] Packet mmap : allow the user to choose the offset of the tx payload.
Date: Fri, 5 Oct 2012 21:37:58 +0200 [thread overview]
Message-ID: <CAD6jFURTMDL6WFGOJhMdnS3zuejYm0uaBPb1TYuNNdUS-7w89w@mail.gmail.com> (raw)
In-Reply-To: <7b317aa8fa2c96f3bf7ce916d18eb550@sybille.onecert.fr>
On Fri, Oct 5, 2012 at 9:21 PM, pchavent <Paul.Chavent@onera.fr> wrote:
> On Fri, 5 Oct 2012 16:17:12 +0200, Daniel Borkmann wrote:
>> On Fri, Oct 5, 2012 at 3:10 PM, Paul Chavent <Paul.Chavent@onera.fr>
>> wrote:
>>>
>>> The tx offset of packet mmap tx ring used to be :
>>> (TPACKET2_HDRLEN - sizeof(struct sockaddr_ll))
>>>
>>> The problem is that depending on the usage of SOCK_DGRAM or
>>> SOCK_RAW, the payload could be aligned or not.
>>>
>>> This patch allow to let the user give an offset for it's tx
>>> payload if he desires.
>>>
>>> Signed-off-by: Paul Chavent <paul.chavent@onera.fr>
>>
>> Can you provide an example when it doesn't hit TPACKET_ALIGNMENT?
>
> When we use tx ring, the user have to write at (TPACKET_HDRLEN -
> sizeof(struct sockaddr_ll))
>
> This adress is aligned on TPACKET_ALIGNMENT since
> TPACKET_HDRLEN = (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct
> sockaddr_ll))
>
> When we use the tx ring with SOCK_RAW option, the mac header is aligned on
> TPACKET_ALIGNMENT, but not the payload (14 bytes away).
Okay, I'm confused about your intentions, maybe I'm missing something.
The man-page of packet(7) clearly says:
The socket_type is either SOCK_RAW for raw packets *including* the
link level header or SOCK_DGRAM for cooked packets with the link
level header *removed*.
So this is perfectly intended behavior of PF_PACKET.
Cheers,
Daniel
next prev parent reply other threads:[~2012-10-05 19:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 13:10 [PATCH] Packet mmap : allow the user to choose the offset of the tx payload Paul Chavent
2012-10-05 14:17 ` Daniel Borkmann
2012-10-05 19:21 ` pchavent
2012-10-05 19:37 ` Daniel Borkmann [this message]
2012-10-06 7:43 ` pchavent
2012-10-07 10:50 ` Daniel Borkmann
2012-10-07 12:44 ` Daniel Borkmann
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=CAD6jFURTMDL6WFGOJhMdnS3zuejYm0uaBPb1TYuNNdUS-7w89w@mail.gmail.com \
--to=danborkmann@iogearbox.net \
--cc=Paul.Chavent@onera.fr \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.hengli.com.au \
--cc=johann.baudy@gnu-log.net \
--cc=netdev@vger.kernel.org \
--cc=uaca@alumni.uv.es \
--cc=xemul@parallels.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).