netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "liujian (CE)" <liujian56@huawei.com>
To: John Fastabend <john.fastabend@gmail.com>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	"jakub@cloudflare.com" <jakub@cloudflare.com>,
	"lmb@cloudflare.com" <lmb@cloudflare.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"ast@kernel.org" <ast@kernel.org>,
	"andrii@kernel.org" <andrii@kernel.org>,
	"kafai@fb.com" <kafai@fb.com>,
	"songliubraving@fb.com" <songliubraving@fb.com>,
	"yhs@fb.com" <yhs@fb.com>,
	"kpsingh@kernel.org" <kpsingh@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"xiyou.wangcong@gmail.com" <xiyou.wangcong@gmail.com>
Subject: RE: [PATHC bpf v5 3/3] selftests, bpf: Add one test for sockmap with strparser
Date: Tue, 26 Oct 2021 08:20:47 +0000	[thread overview]
Message-ID: <da03f755b9b643a28ff35e10f5027880@huawei.com> (raw)
In-Reply-To: 6172d93e2a470_82a7f2083@john-XPS-13-9370.notmuch



> -----Original Message-----
> From: liujian (CE)
> Sent: Monday, October 25, 2021 6:17 PM
> To: 'John Fastabend' <john.fastabend@gmail.com>; daniel@iogearbox.net;
> jakub@cloudflare.com; lmb@cloudflare.com; davem@davemloft.net;
> kuba@kernel.org; ast@kernel.org; andrii@kernel.org; kafai@fb.com;
> songliubraving@fb.com; yhs@fb.com; kpsingh@kernel.org;
> netdev@vger.kernel.org; bpf@vger.kernel.org; xiyou.wangcong@gmail.com
> Subject: RE: [PATHC bpf v5 3/3] selftests, bpf: Add one test for sockmap with
> strparser
> 
> 
> 
> > -----Original Message-----
> > From: John Fastabend [mailto:john.fastabend@gmail.com]
> > Sent: Friday, October 22, 2021 11:31 PM
> > To: liujian (CE) <liujian56@huawei.com>; john.fastabend@gmail.com;
> > daniel@iogearbox.net; jakub@cloudflare.com; lmb@cloudflare.com;
> > davem@davemloft.net; kuba@kernel.org; ast@kernel.org;
> > andrii@kernel.org; kafai@fb.com; songliubraving@fb.com; yhs@fb.com;
> > kpsingh@kernel.org; netdev@vger.kernel.org; bpf@vger.kernel.org;
> > xiyou.wangcong@gmail.com
> > Cc: liujian (CE) <liujian56@huawei.com>
> > Subject: RE: [PATHC bpf v5 3/3] selftests, bpf: Add one test for
> > sockmap with strparser
> >
> > Liu Jian wrote:
> > > Add the test to check sockmap with strparser is working well.
> > >
> > > Signed-off-by: Liu Jian <liujian56@huawei.com>
> > > ---
> > >  tools/testing/selftests/bpf/test_sockmap.c | 33
> > > ++++++++++++++++++++--
> > >  1 file changed, 30 insertions(+), 3 deletions(-)
> >
> > Hi Liu,
> >
> > This is a good test, but we should also add one with a parser
> > returning a value that is not skb->len. This doesn't cover the case fixed in
> patch 1/3 correct?
> > For that we would need to modify the BPF prog itself as well
> > sockmap_parse_prog.c.
> >
> Hi John,
> This test patch use tools/testing/selftests/bpf/progs/test_sockmap_kern.c
> not sockmap_parse_prog.c.
> 
> If we set skb_use_parser to nonzero, the bpf parser program will return
> skb_use_parser not skb->len.
> In this test case, I set skb_use_parser to 10, skb->len to 20 (opt->iov_length).
> This can test 1/3 patch, it will check the recved data len is 10 not 20.
> 
Sorry, it will check the recved data length is 20 not 40.

> The parser prog in tools/testing/selftests/bpf/progs/test_sockmap_kern.h
> SEC("sk_skb1")
> int bpf_prog1(struct __sk_buff *skb)
> {
>         int *f, two = 2;
> 
>         f = bpf_map_lookup_elem(&sock_skb_opts, &two);
>         if (f && *f) {
>                 return *f;
>         }
>         return skb->len;
> }
> > For this patch though,
> >
> > Acked-by: John Fastabend <john.fastabend@gmail.com>
> >
> > Then one more patch is all we need something to break up the skb from
> > the parser. We really need the test because its not something we can
> > easily test otherwise and I don't have any use cases that do this so wouldn't
> catch it.
> >
> > Thanks!
> > John

      parent reply	other threads:[~2021-10-26  8:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  6:57 [PATHC bpf v5 1/3] skmsg: lose offset info in sk_psock_skb_ingress Liu Jian
2021-10-12  6:57 ` [PATHC bpf v5 2/3] selftests, bpf: Fix test_txmsg_ingress_parser error Liu Jian
2021-10-22 15:22   ` John Fastabend
2021-10-29  1:40     ` Alexei Starovoitov
2021-10-12  6:57 ` [PATHC bpf v5 3/3] selftests, bpf: Add one test for sockmap with strparser Liu Jian
2021-10-22 15:31   ` John Fastabend
2021-10-25 10:17     ` liujian (CE)
2021-10-26  8:20     ` liujian (CE) [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=da03f755b9b643a28ff35e10f5027880@huawei.com \
    --to=liujian56@huawei.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yhs@fb.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).