From: John Fastabend <john.fastabend@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>,
John Fastabend <john.fastabend@gmail.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, andrii@kernel.org
Subject: Re: [PATCH bpf-next v2 3/4] bpf: sockmap, add a cork to force buffering of the scatterlist
Date: Fri, 26 Jan 2024 07:38:46 -0800 [thread overview]
Message-ID: <65b3d2066fa3a_154997208af@john.notmuch> (raw)
In-Reply-To: <87o7d8dv2f.fsf@cloudflare.com>
Jakub Sitnicki wrote:
> On Wed, Jan 24, 2024 at 10:54 AM -08, John Fastabend wrote:
> > By using cork we can force multiple sends into a single scatterlist
> > and test that first the cork gives us the correct number of bytes,
> > but then also test the pop over the corked data.
> >
> > Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> > ---
> > .../bpf/prog_tests/sockmap_msg_helpers.c | 81 +++++++++++++++++++
> > .../bpf/progs/test_sockmap_msg_helpers.c | 3 +
> > 2 files changed, 84 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_msg_helpers.c b/tools/testing/selftests/bpf/prog_tests/sockmap_msg_helpers.c
> > index e5e618e84950..8ced54fe1a0b 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/sockmap_msg_helpers.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_msg_helpers.c
> > @@ -21,6 +21,85 @@ struct msg_test_opts {
> >
> > #define POP_END -1
> >
> > +static void cork_send(struct msg_test_opts *opts, int cork)
> > +{
> > + struct test_sockmap_msg_helpers *skel = opts->skel;
> > + char buf[] = "abcdefghijklmnopqrstuvwxyz";
> > + size_t sent, total = 0, recv;
> > + char *recvbuf;
> > + int i;
> > +
> > + skel->bss->pop = false;
>
> Why reset it? Every subtest loads new program & creates new maps.
Agree I'lld elete it.
>
> > + skel->bss->cork = cork;
> > +
> > + /* Send N bytes in 27B chunks */
> > + for (i = 0; i < cork / sizeof(buf); i++) {
> > + sent = xsend(opts->client, buf, sizeof(buf), 0);
> > + if (sent < sizeof(buf))
> > + FAIL("xsend failed");
> > + total += sent;
> > + }
> > +
> > + recvbuf = malloc(total);
> > + if (!recvbuf)
> > + FAIL("cork send malloc failure\n");
> > +
> > + ASSERT_OK(skel->bss->err, "cork error");
> > + ASSERT_EQ(skel->bss->size, cork, "cork did not receive all bytes");
> > +
> > + recv = xrecv_nonblock(opts->server, recvbuf, total, 0);
> > + if (recv != total)
> > + FAIL("Received incorrect number of bytes");
> > +
> > + free(recvbuf);
> > +}
>
> [...]
next prev parent reply other threads:[~2024-01-26 15:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 18:53 [PATCH bpf-next v2 0/4] transition sockmap testing to test_progs John Fastabend
2024-01-24 18:54 ` [PATCH bpf-next v2 1/4] bpf: sockmap, add test for sk_msg prog pop msg helper John Fastabend
2024-01-26 11:48 ` Jakub Sitnicki
2024-01-26 15:37 ` John Fastabend
2024-01-24 18:54 ` [PATCH bpf-next v2 2/4] bpf: sockmap, add a sendmsg test so we can check that path John Fastabend
2024-01-26 12:17 ` Jakub Sitnicki
2024-01-26 14:24 ` Jakub Sitnicki
2024-01-26 15:38 ` John Fastabend
2024-01-24 18:54 ` [PATCH bpf-next v2 3/4] bpf: sockmap, add a cork to force buffering of the scatterlist John Fastabend
2024-01-26 14:19 ` Jakub Sitnicki
2024-01-26 15:38 ` John Fastabend [this message]
2024-01-24 18:54 ` [PATCH bpf-next v2 4/4] bpf: sockmap test cork and pop combined John Fastabend
2024-01-24 22:58 ` [PATCH bpf-next v2 0/4] transition sockmap testing to test_progs John Fastabend
2024-01-26 14:39 ` Jakub Sitnicki
2024-01-26 15:40 ` John Fastabend
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=65b3d2066fa3a_154997208af@john.notmuch \
--to=john.fastabend@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--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;
as well as URLs for NNTP newsgroup(s).