From: Anton Ivanov <anton.ivanov@cambridgegreys.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Anton Ivanov <anton.ivanov@kot-begemot.co.uk>,
Network Development <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>
Subject: Re: BUG:af_packet fails to TX TSO frames
Date: Thu, 12 Oct 2017 07:11:54 +0100 [thread overview]
Message-ID: <2f973588-e193-86c1-a645-7a158b17ebdc@cambridgegreys.com> (raw)
In-Reply-To: <CAF=yD-+YUZdCCLXdQEG5AA0Pkrf-OrWGwySWf7mqH5BhO-Vr+g@mail.gmail.com>
On 12/10/17 01:19, Willem de Bruijn wrote:
> On Wed, Oct 11, 2017 at 6:01 PM, Anton Ivanov
> <anton.ivanov@cambridgegreys.com> wrote:
>> [snip]
>>
>>> This will be tomorrow though, it is late here.
>>>
>>> The only obvious difference I can see at this point is that I am using
>>> iovs and sending the vnet header as iov[0] and the data in pieces after
>>> that while your code is doing a send() for the whole frame. This should
>>> not make any difference though - it all ends up as an iov internally in
>>> the kernel.
>> Spoke too soon. It is not reporting any errors, but there is nothing
>> coming out on the actual Ethernet.
Different issue - switch was blacklisting the fake dst MAC after the
first packet as a suspected flood attack.
It worked after I changed the mac in the source to a "real" one. In
fact, an argument for that
would be nice :)
I will go through it step by step now and figure out exactly what and
where is wrong with the framing on my side.
Thanks for your help.
A.
> It works for me on various platforms. On the receiver, drop these fake
> tcp packets in iptables and read them with tcpdump
>
> iptables -A PREROUTING -t raw -p tcp --dport 9 -j DROP
> tcpdump src $src_ip
>
> Note that not all combinations of flags are supported by the kernel
> and that some flags have non-obvious behavior (disable a feature, in
> place of enable it).
>
> Specifically, mtu sized packets either must not pass a vnet_hdr or
> must pass one with gso explicitly disabled ('-G').
>
> psock_txring_vnet -s $src_ip $dst_ip -l 1400
> psock_txring_vnet -s $src_ip $dst_ip -l 1400 -v -G
> psock_txring_vnet -s $src_ip $dst_ip -l 1400 -N
> psock_txring_vnet -s $src_ip $dst_ip -l 1400 -N -v -G
>
> Conversely, packets that exceed mtu have to have the gso flags in the
> virtio_net_hdr:
>
> psock_txring_vnet -s $src_ip $dst_ip -l 4400 -v
> psock_txring_vnet -s $src_ip $dst_ip -l 4400 -N -v
>
> When sending a large packet, but not passing a virtio_net_hdr along
> ('-v'), the test fails with
>
> psock_txring_vnet: send: Message too long
>
> When passing a header along, but not disabling gso, the packet is
> indeed dropped silently.
>
> I verified correct segmentation with three modes of ethtool
>
> ethtool -K eth0 tso off gso off
> ethtool -K eth0 tso off gso on
> ethtool -K eth0 tso on gso on
>
> by reading tcpdump on the sender.
>
> The receive side results are the same with dev_queue_xmit and
> packet_direct_xmit ('-q') mode. With direct_xmit, the packets are not
> observed on the send side.
>
--
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
next prev parent reply other threads:[~2017-10-12 6:12 UTC|newest]
Thread overview: 25+ 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:05 ` Willem de Bruijn
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 [this message]
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 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=2f973588-e193-86c1-a645-7a158b17ebdc@cambridgegreys.com \
--to=anton.ivanov@cambridgegreys.com \
--cc=anton.ivanov@kot-begemot.co.uk \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=willemdebruijn.kernel@gmail.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