netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <danborkmann@iogearbox.net>
To: Paul Chavent <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 16:17:12 +0200	[thread overview]
Message-ID: <CAD6jFUTmNiRHdAkckkwcV2rEOf_kxjHmntTO+rG6ewLs-RhFfg@mail.gmail.com> (raw)
In-Reply-To: <1349442629-10960-1-git-send-email-paul.chavent@onera.fr>

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?

On the first look, could it be that your patch currently enforces the
use of your tp_net's offset for *all* TX_RING users, even if they
don't care about it? So in case off==0, you probably get a negative
offset in case of SOCK_RAW, thus it won't hit the second if-statement.
Sure, but this does not look intuitive in my opinion. Maybe, it's
better to only enter this path if the offset *is* used by someone.

Also, to my knowledge tp_net is currently only applied in receive
path. So, if for whatever reason people did not explicitly set tp_net
to 0, it might break their code, if there's a random offset in it,
right?

Best,
Daniel

  reply	other threads:[~2012-10-05 14:17 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 [this message]
2012-10-05 19:21   ` pchavent
2012-10-05 19:37     ` Daniel Borkmann
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=CAD6jFUTmNiRHdAkckkwcV2rEOf_kxjHmntTO+rG6ewLs-RhFfg@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).