From: pchavent <Paul.Chavent@onera.fr>
To: Daniel Borkmann <danborkmann@iogearbox.net>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] packet mmap : allow the user to choose tx data offset.
Date: Sat, 20 Oct 2012 19:13:02 +0200 [thread overview]
Message-ID: <535a652cffb4d52cbae20e06a95d724d@sybille.onecert.fr> (raw)
In-Reply-To: <CAD6jFURS6FXvZJttxEn-qPP5=sWCOHSx=BeSgiJM+ZemAkuKdQ@mail.gmail.com>
Hi Daniel
>>>> + switch (po->tp_version) {
>>>> + case TPACKET_V2:
>>>> + off = ph.h2->tp_mac;
>>>> + break;
>>>> + default:
>>>> + off = ph.h1->tp_mac;
>>>
>>>
>>> TPACKET_V1 as default is wrong since there's also TPACKET_V3. What
>>> about TPACKET_V3 in general in your patch? You simply ignore it.
>>
>>
>> I have reproduced the pattern found some lines above (1868-1875)
>>
>> switch (po->tp_version) {
>> case TPACKET_V2:
>> tp_len = ph.h2->tp_len;
>> break;
>> default:
>> tp_len = ph.h1->tp_len;
>> break;
>> }
>>
>> Do you suggest me to add a case TPACKET_V3 and get tp_len from
>> ph.h3->tp_len
>> ?
>
> If I'm not mistaken, with your current patch you can do the
> setsockopt(2) call on a tpacket v3 socket and then default to a
> tpacket v1 in your switch statement. This doesn't seem right. Thus,
> this should better be fixed in whatever way.
It seems that "Opening a Tx-ring is NOT supported in TPACKET_V3" (see
comment in packet_set_ring). So no one could be able to use the TX_OFF
feature with a TPACKET_V3.
The tpacket_snd function call some subroutines that call WARN and BUG
(like in __packet_set_status),
and other ones that simply ignore the tpacket v3 case (like in
tpacket_fill_skb).
What do you suggest ?
I add a case that call WARN and BUG like in {__packet_set_status,
__packet_get_status, packet_increment_rx_head} where we get tp_len in
the tpacket_fill_skb function ?
Or i let the code as is ?
Regards.
Paul.
next prev parent reply other threads:[~2012-10-20 17:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 7:21 [PATCH net-next] packet mmap : allow the user to choose tx data offset Paul Chavent
2012-10-19 11:36 ` Daniel Borkmann
2012-10-19 13:43 ` Paul Chavent
2012-10-20 12:39 ` Daniel Borkmann
2012-10-20 17:13 ` pchavent [this message]
2012-10-20 17:35 ` Daniel Borkmann
2012-10-19 13:50 ` Paul Chavent
2012-10-19 14:28 ` Paul Chavent
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=535a652cffb4d52cbae20e06a95d724d@sybille.onecert.fr \
--to=paul.chavent@onera.fr \
--cc=danborkmann@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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