From: David Miller <davem@davemloft.net>
To: willemdebruijn.kernel@gmail.com
Cc: netdev@vger.kernel.org, maloneykernel@gmail.com, willemb@google.com
Subject: Re: [PATCH net-next] selftests/net: ignore background traffic in psock_fanout
Date: Fri, 23 Feb 2018 12:48:02 -0500 (EST) [thread overview]
Message-ID: <20180223.124802.1669012463834833697.davem@davemloft.net> (raw)
In-Reply-To: <20180223165620.136975-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Fri, 23 Feb 2018 11:56:20 -0500
> From: Willem de Bruijn <willemb@google.com>
>
> The packet fanout test generates UDP traffic and reads this with
> a pair of packet sockets, testing the various fanout algorithms.
>
> Avoid non-determinism from reading unrelated background traffic.
> Fanout decisions are made before unrelated packets can be dropped with
> a filter, so that is an insufficient strategy [*]. Run the packet
> socket tests in a network namespace, similar to msg_zerocopy.
>
> It it still good practice to install a filter on a packet socket
> before accepting traffic. Because this is example code, demonstrate
> that pattern. Open the socket initially bound to no protocol, install
> a filter, and only then bind to ETH_P_IP.
>
> Another source of non-determinism is hash collisions in FANOUT_HASH.
> The hash function used to select a socket in the fanout group includes
> the pseudorandom number hashrnd, which is not visible from userspace.
> To work around this, the test tries to find a pair of UDP source ports
> that do not collide. It gives up too soon (5 times, every 32 runs) and
> output is confusing. Increase tries to 20 and revise the error msg.
>
> [*] another approach would be to add a third socket to the fanout
> group and direct all unexpected traffic here. This is possible
> only when reimplementing methods like RR or HASH alongside this
> extra catch-all bucket, using the BPF fanout method.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Applied, thanks Willem.
Indeed, not being able to control hashrnd makes determinism in tests
like this quite difficult.
prev parent reply other threads:[~2018-02-23 17:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 16:56 [PATCH net-next] selftests/net: ignore background traffic in psock_fanout Willem de Bruijn
2018-02-23 17:48 ` David Miller [this message]
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=20180223.124802.1669012463834833697.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=maloneykernel@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
--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;
as well as URLs for NNTP newsgroup(s).