All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Anton Ivanov <anton.ivanov@kot-begemot.co.uk>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Network Development <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: BUG:af_packet fails to TX TSO frames
Date: Wed, 11 Oct 2017 17:05:19 -0400	[thread overview]
Message-ID: <CAF=yD-+gc5oQ=XT0+yw4Wt_h3rObETti3FvXm+V-nu=87zaMyA@mail.gmail.com> (raw)
In-Reply-To: <d6c1cda2-f7df-9132-304d-075c62d4d83d@kot-begemot.co.uk>

On Wed, Oct 11, 2017 at 3:39 PM, Anton Ivanov
<anton.ivanov@kot-begemot.co.uk> wrote:
> On 11/10/17 19:57, Willem de Bruijn wrote:
>> On Wed, Oct 11, 2017 at 2:39 PM, Anton Ivanov
>> <anton.ivanov@kot-begemot.co.uk> wrote:
>>> The check as now insists that the actual driver supports GSO_ROBUST, because
>>> we have marked the skb dodgy.
>>>
>>> The specific bit which does this check is in net_gso_ok()
>>>
>>> Now, lets's see how many Ethernet drivers set GSO_ROBUST.
>>>
>>> find drivers/net/ethernet -type f -name "*.[c,h]" -exec grep -H GSO_ROBUST
>>> {} \;
>>>
>>> That returns nothing in 4.x
>>>
>>> IMHO - af_packet allocates the skb, does all checks (and extra may be added)
>>> on the gso, why is this set dodgy in the first place?
>> It is set when the header has to be validated.
>>
>> The segmentation logic will validate and fixup gso_segs. See for
>> instance tcp_gso_segment:
>>
>>         if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
>>                 /* Packet is from an untrusted source, reset gso_segs. */
>>
>>                 skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
>>
>>                 segs = NULL;
>>                 goto out;
>>         }
>>
>> If the device would have the robust bit set and otherwise supports the
>> required features, fix up gso_segs and pass the large packet to the
>> device.
>>
>> Else it continues to the software gso path.
>>
>> Large packets generated with psock_txring_vnet.c pass this test. I
>
> That test is indeed a different path

The test can be run both with and without ring:

  psock_txring_vnet -l 8000 -s $src_ip -d $dst_ip -v
  psock_txring_vnet -l 8000 -s $src_ip -d $dst_ip -v -N

both with and without qdisc bypass ('-q').

>  - this goes via the tpacket_snd
> which allocs via sock_alloc_send_skb. That results in a non-fragged skb
> as it calls pskb after that with data_len = 0 asking for a contiguous one.

but attached the ring slot as fragments in tpacket_fill_skb.

> My stuff is using sendmmsg which ends up via packet_snd which allocs
> via  sock_alloc_send_pskb which is invoked in a way which always creates
> 2 segments - one for the linear section and one for the rest (and more
> if needed). It is faster than tpacket by the way (several times).
>
> As a comparison tap and other virtual drivers use sock_alloc_send_pskb
> with non-zero data length which results in multiple frags. The code in
> packet_snd is in fact identical with tap (+/- some cosmetic differences).
>
> That is the difference between the tests and that is why your test works
> and mine fails.

All the above test cases work for me, including those that build skbs
with fragments. Could you try those.

  parent reply	other threads:[~2017-10-11 21:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11  8:39 BUG:af_packet fails to TX TSO frames Anton Ivanov
2017-10-11 13:39 ` Willem de Bruijn
2017-10-11 13:50   ` Anton Ivanov
2017-10-11 15:54     ` Anton Ivanov
2017-10-11 16:26       ` Willem de Bruijn
2017-10-11 16:32         ` Anton Ivanov
2017-10-11 18:39         ` Anton Ivanov
2017-10-11 18:57           ` Willem de Bruijn
2017-10-11 19:39             ` Anton Ivanov
2017-10-11 21:02               ` [uml-devel] Fwd: " Anton Ivanov
2017-10-11 21:05               ` Willem de Bruijn [this message]
2017-10-11 21:55                 ` Anton Ivanov
2017-10-11 22:01                   ` Anton Ivanov
2017-10-12  0:19                     ` Willem de Bruijn
2017-10-12  6:11                       ` Anton Ivanov
2017-10-12  8:46                         ` Anton Ivanov
2017-10-12 13:39                           ` Willem de Bruijn
2017-10-12 14:12                             ` Anton Ivanov
2017-10-12 15:44                               ` Anton Ivanov
2017-10-12 15:57                                 ` Anton Ivanov
2017-10-12 15:57                                   ` [uml-devel] " Anton Ivanov
2017-10-12 16:30                                 ` Willem de Bruijn
2017-10-12 17:25                                   ` Willem de Bruijn
2017-10-12 17:58                                     ` Anton Ivanov
2017-10-12 18:41                                       ` Willem de Bruijn
2017-10-12 19:55                                         ` Anton Ivanov
2017-10-13  7:25   ` Not BUG, feature :) af_packet " Anton Ivanov

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='CAF=yD-+gc5oQ=XT0+yw4Wt_h3rObETti3FvXm+V-nu=87zaMyA@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=anton.ivanov@kot-begemot.co.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.