[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+WQbwtWUqK_dR5Chpfg3S9nbTNEi20YqSJkh10MVcaVSQeeJQ@mail.gmail.com>
Date: Tue, 17 May 2022 13:29:35 +0800
From: Geliang Tang <geliangtang@...il.com>
To: Martin KaFai Lau <kafai@...com>
Cc: Geliang Tang <geliang.tang@...e.com>,
Mat Martineau <mathew.j.martineau@...ux.intel.com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
MPTCP Upstream <mptcp@...ts.linux.dev>,
Matthieu Baerts <matthieu.baerts@...sares.net>
Subject: Re: [PATCH bpf-next v4 4/7] selftests/bpf: test bpf_skc_to_mptcp_sock
Martin KaFai Lau <kafai@...com> 于2022年5月17日周二 09:21写道:
>
> On Fri, May 13, 2022 at 03:48:24PM -0700, Mat Martineau wrote:
> [ ... ]
> > diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> > index bc09dba0b078..3feb7ff578e2 100644
> > --- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
> > +++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> > @@ -7,6 +7,7 @@
> > #include "bpf_tcp_helpers.h"
> >
> > char _license[] SEC("license") = "GPL";
> > +extern bool CONFIG_MPTCP __kconfig;
> >
> > struct mptcp_storage {
> > __u32 invoked;
> > @@ -24,6 +25,7 @@ SEC("sockops")
> > int _sockops(struct bpf_sock_ops *ctx)
> > {
> > struct mptcp_storage *storage;
> > + struct mptcp_sock *msk;
> > int op = (int)ctx->op;
> > struct tcp_sock *tsk;
> > struct bpf_sock *sk;
> > @@ -41,11 +43,24 @@ int _sockops(struct bpf_sock_ops *ctx)
> > return 1;
> >
> > is_mptcp = bpf_core_field_exists(tsk->is_mptcp) ? tsk->is_mptcp : 0;
> > - storage = bpf_sk_storage_get(&socket_storage_map, sk, 0,
> > - BPF_SK_STORAGE_GET_F_CREATE);
> > - if (!storage)
> > - return 1;
> > + if (!is_mptcp) {
> > + storage = bpf_sk_storage_get(&socket_storage_map, sk, 0,
> > + BPF_SK_STORAGE_GET_F_CREATE);
> > + if (!storage)
> > + return 1;
> > + } else {
> > + if (!CONFIG_MPTCP)
> hmm... how is it possible ? The above just tested "!is_mptcp".
Will drop this in v5, thanks.
>
> > + return 1;
> > +
> > + msk = bpf_skc_to_mptcp_sock(sk);
> > + if (!msk)
> > + return 1;
> >
> > + storage = bpf_sk_storage_get(&socket_storage_map, msk, 0,
> > + BPF_SK_STORAGE_GET_F_CREATE);
> > + if (!storage)
> > + return 1;
> > + }
> > storage->invoked++;
> > storage->is_mptcp = is_mptcp;
> >
> > --
> > 2.36.1
> >
>
Powered by blists - more mailing lists