All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
@ 2022-04-26  4:26 Geliang Tang
  2022-04-26  4:26 ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Geliang Tang
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Geliang Tang @ 2022-04-26  4:26 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Update as Daniel suggested.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 include/linux/bpf.h      | 1 +
 include/net/mptcp.h      | 2 +-
 kernel/bpf/verifier.c    | 1 +
 kernel/trace/bpf_trace.c | 2 ++
 net/core/filter.c        | 3 ++-
 net/mptcp/Makefile       | 2 --
 6 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index bdb5298735ce..2493f9601842 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2249,6 +2249,7 @@ extern const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto;
 extern const struct bpf_func_proto bpf_skc_to_tcp_request_sock_proto;
 extern const struct bpf_func_proto bpf_skc_to_udp6_sock_proto;
 extern const struct bpf_func_proto bpf_skc_to_unix_sock_proto;
+extern const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto;
 extern const struct bpf_func_proto bpf_copy_from_user_proto;
 extern const struct bpf_func_proto bpf_snprintf_btf_proto;
 extern const struct bpf_func_proto bpf_snprintf_proto;
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 6b07011c060d..4d761ad530c9 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -284,7 +284,7 @@ static inline int mptcpv6_init(void) { return 0; }
 static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
 #endif
 
-#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL)
+#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
 struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
 #else
 static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 9c1a02b82ecd..40602ec20c6a 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -517,6 +517,7 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id)
 		func_id == BPF_FUNC_skc_to_tcp_sock ||
 		func_id == BPF_FUNC_skc_to_tcp6_sock ||
 		func_id == BPF_FUNC_skc_to_udp6_sock ||
+		func_id == BPF_FUNC_skc_to_mptcp_sock ||
 		func_id == BPF_FUNC_skc_to_tcp_timewait_sock ||
 		func_id == BPF_FUNC_skc_to_tcp_request_sock;
 }
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index b26f3da943de..c7bf10cf2fa5 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1685,6 +1685,8 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
 		return &bpf_skc_to_udp6_sock_proto;
 	case BPF_FUNC_skc_to_unix_sock:
 		return &bpf_skc_to_unix_sock_proto;
+	case BPF_FUNC_skc_to_mptcp_sock:
+		return &bpf_skc_to_mptcp_sock_proto;
 	case BPF_FUNC_sk_storage_get:
 		return &bpf_sk_storage_get_tracing_proto;
 	case BPF_FUNC_sk_storage_delete:
diff --git a/net/core/filter.c b/net/core/filter.c
index 4bcf13b1d0e2..a0dd6f6b17f8 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -11282,10 +11282,11 @@ const struct bpf_func_proto bpf_skc_to_unix_sock_proto = {
 
 BPF_CALL_1(bpf_skc_to_mptcp_sock, struct sock *, sk)
 {
+	BTF_TYPE_EMIT(struct mptcp_sock);
 	return (unsigned long)bpf_mptcp_sock_from_subflow(sk);
 }
 
-static const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
+const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
 	.func		= bpf_skc_to_mptcp_sock,
 	.gpl_only	= false,
 	.ret_type	= RET_PTR_TO_BTF_ID_OR_NULL,
diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
index 4004347db47e..6e7df47c9584 100644
--- a/net/mptcp/Makefile
+++ b/net/mptcp/Makefile
@@ -11,6 +11,4 @@ mptcp_crypto_test-objs := crypto_test.o
 mptcp_token_test-objs := token_test.o
 obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o
 
-ifeq ($(CONFIG_BPF_JIT),y)
 obj-$(CONFIG_BPF_SYSCALL) += bpf.o
-endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
  2022-04-26  4:26 [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Geliang Tang
@ 2022-04-26  4:26 ` Geliang Tang
  2022-04-26  6:16   ` Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock": Tests Results MPTCP CI
                     ` (2 more replies)
  2022-04-26  6:17 ` Squash to "bpf: add bpf_skc_to_mptcp_sock_proto": Tests Results MPTCP CI
  2022-04-27  0:17 ` [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Mat Martineau
  2 siblings, 3 replies; 16+ messages in thread
From: Geliang Tang @ 2022-04-26  4:26 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Add CONFIG_MPTCP check.

When CONFIG_MPTCP is not enabled, we'll get a clearer error message:

libbpf: extern CONFIG_MPTCP (strong) not resolved
libbpf: failed to load object './mptcp_sock.o'

The message before is like this:

libbpf: prog '_sockops': BPF program load failed: Invalid argument
libbpf: prog '_sockops': -- BEGIN PROG LOAD LOG --

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/progs/mptcp_sock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
index 5cfaec4e7245..7b6a25e37de8 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
+++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
@@ -7,6 +7,7 @@
 
 char _license[] SEC("license") = "GPL";
 __u32 _version SEC("version") = 1;
+extern bool CONFIG_MPTCP __kconfig;
 
 struct mptcp_storage {
 	__u32 invoked;
@@ -46,6 +47,9 @@ int _sockops(struct bpf_sock_ops *ctx)
 		if (!storage)
 			return 1;
 	} else {
+		if (!CONFIG_MPTCP)
+			return 1;
+
 		msk = bpf_skc_to_mptcp_sock(sk);
 		if (!msk)
 			return 1;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock": Tests Results
  2022-04-26  4:26 ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Geliang Tang
@ 2022-04-26  6:16   ` MPTCP CI
  2022-04-27  0:20   ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Mat Martineau
  2022-04-27 16:33   ` Matthieu Baerts
  2 siblings, 0 replies; 16+ messages in thread
From: MPTCP CI @ 2022-04-26  6:16 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Success! ✅:
  - Task: https://cirrus-ci.com/task/6067994064322560
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/6067994064322560/summary/summary.txt

- KVM Validation: debug:
  - Unstable: 1 failed test(s): selftest_diag 🔴:
  - Task: https://cirrus-ci.com/task/5505044110901248
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5505044110901248/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/5bfdc296d0ab


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Squash to "bpf: add bpf_skc_to_mptcp_sock_proto": Tests Results
  2022-04-26  4:26 [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Geliang Tang
  2022-04-26  4:26 ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Geliang Tang
@ 2022-04-26  6:17 ` MPTCP CI
  2022-04-27  0:17 ` [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Mat Martineau
  2 siblings, 0 replies; 16+ messages in thread
From: MPTCP CI @ 2022-04-26  6:17 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Unstable: 1 failed test(s): selftest_simult_flows 🔴:
  - Task: https://cirrus-ci.com/task/5696628827881472
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5696628827881472/summary/summary.txt

- KVM Validation: debug:
  - Unstable: 2 failed test(s): selftest_diag selftest_simult_flows 🔴:
  - Task: https://cirrus-ci.com/task/5133678874460160
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5133678874460160/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/a16226877702


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-04-26  4:26 [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Geliang Tang
  2022-04-26  4:26 ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Geliang Tang
  2022-04-26  6:17 ` Squash to "bpf: add bpf_skc_to_mptcp_sock_proto": Tests Results MPTCP CI
@ 2022-04-27  0:17 ` Mat Martineau
  2 siblings, 0 replies; 16+ messages in thread
From: Mat Martineau @ 2022-04-27  0:17 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On Tue, 26 Apr 2022, Geliang Tang wrote:

> Update as Daniel suggested.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>

Looks good to squash, thanks. The 'base' bpf tests pass, which is what 
Daniel noted as failing.

- Mat


> ---
> include/linux/bpf.h      | 1 +
> include/net/mptcp.h      | 2 +-
> kernel/bpf/verifier.c    | 1 +
> kernel/trace/bpf_trace.c | 2 ++
> net/core/filter.c        | 3 ++-
> net/mptcp/Makefile       | 2 --
> 6 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index bdb5298735ce..2493f9601842 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -2249,6 +2249,7 @@ extern const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto;
> extern const struct bpf_func_proto bpf_skc_to_tcp_request_sock_proto;
> extern const struct bpf_func_proto bpf_skc_to_udp6_sock_proto;
> extern const struct bpf_func_proto bpf_skc_to_unix_sock_proto;
> +extern const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto;
> extern const struct bpf_func_proto bpf_copy_from_user_proto;
> extern const struct bpf_func_proto bpf_snprintf_btf_proto;
> extern const struct bpf_func_proto bpf_snprintf_proto;
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index 6b07011c060d..4d761ad530c9 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -284,7 +284,7 @@ static inline int mptcpv6_init(void) { return 0; }
> static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
> #endif
>
> -#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL)
> +#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
> struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
> #else
> static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 9c1a02b82ecd..40602ec20c6a 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -517,6 +517,7 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id)
> 		func_id == BPF_FUNC_skc_to_tcp_sock ||
> 		func_id == BPF_FUNC_skc_to_tcp6_sock ||
> 		func_id == BPF_FUNC_skc_to_udp6_sock ||
> +		func_id == BPF_FUNC_skc_to_mptcp_sock ||
> 		func_id == BPF_FUNC_skc_to_tcp_timewait_sock ||
> 		func_id == BPF_FUNC_skc_to_tcp_request_sock;
> }
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index b26f3da943de..c7bf10cf2fa5 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -1685,6 +1685,8 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> 		return &bpf_skc_to_udp6_sock_proto;
> 	case BPF_FUNC_skc_to_unix_sock:
> 		return &bpf_skc_to_unix_sock_proto;
> +	case BPF_FUNC_skc_to_mptcp_sock:
> +		return &bpf_skc_to_mptcp_sock_proto;
> 	case BPF_FUNC_sk_storage_get:
> 		return &bpf_sk_storage_get_tracing_proto;
> 	case BPF_FUNC_sk_storage_delete:
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 4bcf13b1d0e2..a0dd6f6b17f8 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -11282,10 +11282,11 @@ const struct bpf_func_proto bpf_skc_to_unix_sock_proto = {
>
> BPF_CALL_1(bpf_skc_to_mptcp_sock, struct sock *, sk)
> {
> +	BTF_TYPE_EMIT(struct mptcp_sock);
> 	return (unsigned long)bpf_mptcp_sock_from_subflow(sk);
> }
>
> -static const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
> +const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
> 	.func		= bpf_skc_to_mptcp_sock,
> 	.gpl_only	= false,
> 	.ret_type	= RET_PTR_TO_BTF_ID_OR_NULL,
> diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
> index 4004347db47e..6e7df47c9584 100644
> --- a/net/mptcp/Makefile
> +++ b/net/mptcp/Makefile
> @@ -11,6 +11,4 @@ mptcp_crypto_test-objs := crypto_test.o
> mptcp_token_test-objs := token_test.o
> obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o
>
> -ifeq ($(CONFIG_BPF_JIT),y)
> obj-$(CONFIG_BPF_SYSCALL) += bpf.o
> -endif
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
  2022-04-26  4:26 ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Geliang Tang
  2022-04-26  6:16   ` Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock": Tests Results MPTCP CI
@ 2022-04-27  0:20   ` Mat Martineau
  2022-04-27  0:22     ` Mat Martineau
  2022-04-27 15:27     ` Geliang Tang
  2022-04-27 16:33   ` Matthieu Baerts
  2 siblings, 2 replies; 16+ messages in thread
From: Mat Martineau @ 2022-04-27  0:20 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On Tue, 26 Apr 2022, Geliang Tang wrote:

> Add CONFIG_MPTCP check.
>
> When CONFIG_MPTCP is not enabled, we'll get a clearer error message:
>
> libbpf: extern CONFIG_MPTCP (strong) not resolved
> libbpf: failed to load object './mptcp_sock.o'
>
> The message before is like this:
>
> libbpf: prog '_sockops': BPF program load failed: Invalid argument
> libbpf: prog '_sockops': -- BEGIN PROG LOAD LOG --
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> tools/testing/selftests/bpf/progs/mptcp_sock.c | 4 ++++
> 1 file changed, 4 insertions(+)
>

Looks like this also requires CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC, 
can you also add those to tools/testing/selftests/bpf/config? Maybe that 
should be a separate commit, since other bpf test progs appear to rely on 
this undocumented config requirement.

- Mat

> diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> index 5cfaec4e7245..7b6a25e37de8 100644
> --- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
> +++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> @@ -7,6 +7,7 @@
>
> char _license[] SEC("license") = "GPL";
> __u32 _version SEC("version") = 1;
> +extern bool CONFIG_MPTCP __kconfig;
>
> struct mptcp_storage {
> 	__u32 invoked;
> @@ -46,6 +47,9 @@ int _sockops(struct bpf_sock_ops *ctx)
> 		if (!storage)
> 			return 1;
> 	} else {
> +		if (!CONFIG_MPTCP)
> +			return 1;
> +
> 		msk = bpf_skc_to_mptcp_sock(sk);
> 		if (!msk)
> 			return 1;
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
  2022-04-27  0:20   ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Mat Martineau
@ 2022-04-27  0:22     ` Mat Martineau
  2022-04-27 15:27     ` Geliang Tang
  1 sibling, 0 replies; 16+ messages in thread
From: Mat Martineau @ 2022-04-27  0:22 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On Tue, 26 Apr 2022, Mat Martineau wrote:

> On Tue, 26 Apr 2022, Geliang Tang wrote:
>
>> Add CONFIG_MPTCP check.
>> 
>> When CONFIG_MPTCP is not enabled, we'll get a clearer error message:
>> 
>> libbpf: extern CONFIG_MPTCP (strong) not resolved
>> libbpf: failed to load object './mptcp_sock.o'
>> 
>> The message before is like this:
>> 
>> libbpf: prog '_sockops': BPF program load failed: Invalid argument
>> libbpf: prog '_sockops': -- BEGIN PROG LOAD LOG --
>> 
>> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
>> ---
>> tools/testing/selftests/bpf/progs/mptcp_sock.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>> 
>
> Looks like this also requires CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC, can 
> you also add those to tools/testing/selftests/bpf/config? Maybe that should 
> be a separate commit, since other bpf test progs appear to rely on this 
> undocumented config requirement.
>

I hit 'send' too soon... We should still squash this, and add that second 
commit for the config information.

- Mat

>
>> diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c 
>> b/tools/testing/selftests/bpf/progs/mptcp_sock.c
>> index 5cfaec4e7245..7b6a25e37de8 100644
>> --- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
>> +++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
>> @@ -7,6 +7,7 @@
>> 
>> char _license[] SEC("license") = "GPL";
>> __u32 _version SEC("version") = 1;
>> +extern bool CONFIG_MPTCP __kconfig;
>> 
>> struct mptcp_storage {
>> 	__u32 invoked;
>> @@ -46,6 +47,9 @@ int _sockops(struct bpf_sock_ops *ctx)
>> 		if (!storage)
>> 			return 1;
>> 	} else {
>> +		if (!CONFIG_MPTCP)
>> +			return 1;
>> +
>> 		msk = bpf_skc_to_mptcp_sock(sk);
>> 		if (!msk)
>> 			return 1;
>> -- 
>> 2.34.1
>> 
>> 
>> 
>
> --
> Mat Martineau
> Intel
>
>

--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
  2022-04-27  0:20   ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Mat Martineau
  2022-04-27  0:22     ` Mat Martineau
@ 2022-04-27 15:27     ` Geliang Tang
  2022-04-27 21:47       ` Mat Martineau
  1 sibling, 1 reply; 16+ messages in thread
From: Geliang Tang @ 2022-04-27 15:27 UTC (permalink / raw)
  To: Mat Martineau; +Cc: Geliang Tang, MPTCP Upstream

Hi Mat,

Mat Martineau <mathew.j.martineau@linux.intel.com> 于2022年4月27日周三 08:20写道:
>
> On Tue, 26 Apr 2022, Geliang Tang wrote:
>
> > Add CONFIG_MPTCP check.
> >
> > When CONFIG_MPTCP is not enabled, we'll get a clearer error message:
> >
> > libbpf: extern CONFIG_MPTCP (strong) not resolved
> > libbpf: failed to load object './mptcp_sock.o'
> >
> > The message before is like this:
> >
> > libbpf: prog '_sockops': BPF program load failed: Invalid argument
> > libbpf: prog '_sockops': -- BEGIN PROG LOAD LOG --
> >
> > Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> > ---
> > tools/testing/selftests/bpf/progs/mptcp_sock.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
>
> Looks like this also requires CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC,
> can you also add those to tools/testing/selftests/bpf/config? Maybe that
> should be a separate commit, since other bpf test progs appear to rely on
> this undocumented config requirement.

In my test, this bpf base test still works without CONFIG_IKCONFIG and
CONFIG_IKCONFIG_PROC:

> ls /proc/config.gz
ls: cannot access '/proc/config.gz': No such file or directory
> sudo ./test_progs -n 103
#103 mptcp:OK
Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED

Thanks,
-Geliang




>
> - Mat
>
> > diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> > index 5cfaec4e7245..7b6a25e37de8 100644
> > --- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
> > +++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> > @@ -7,6 +7,7 @@
> >
> > char _license[] SEC("license") = "GPL";
> > __u32 _version SEC("version") = 1;
> > +extern bool CONFIG_MPTCP __kconfig;
> >
> > struct mptcp_storage {
> >       __u32 invoked;
> > @@ -46,6 +47,9 @@ int _sockops(struct bpf_sock_ops *ctx)
> >               if (!storage)
> >                       return 1;
> >       } else {
> > +             if (!CONFIG_MPTCP)
> > +                     return 1;
> > +
> >               msk = bpf_skc_to_mptcp_sock(sk);
> >               if (!msk)
> >                       return 1;
> > --
> > 2.34.1
> >
> >
> >
>
> --
> Mat Martineau
> Intel
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
  2022-04-26  4:26 ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Geliang Tang
  2022-04-26  6:16   ` Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock": Tests Results MPTCP CI
  2022-04-27  0:20   ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Mat Martineau
@ 2022-04-27 16:33   ` Matthieu Baerts
  2 siblings, 0 replies; 16+ messages in thread
From: Matthieu Baerts @ 2022-04-27 16:33 UTC (permalink / raw)
  To: Geliang Tang, mptcp

Hi Geliang, Mat,

On 26/04/2022 06:26, Geliang Tang wrote:
> Add CONFIG_MPTCP check.
> 
> When CONFIG_MPTCP is not enabled, we'll get a clearer error message:
> 
> libbpf: extern CONFIG_MPTCP (strong) not resolved
> libbpf: failed to load object './mptcp_sock.o'
> 
> The message before is like this:
> 
> libbpf: prog '_sockops': BPF program load failed: Invalid argument
> libbpf: prog '_sockops': -- BEGIN PROG LOAD LOG --

Thank you for the two patches and reviews!

Now in our tree:

- f456d87ca214: "squashed" in "bpf: add bpf_skc_to_mptcp_sock_proto"
- 8aa57e042f44: "squashed" in "selftests: bpf: test bpf_skc_to_mptcp_sock"
- Results: c2a1191f33d3..440ea2eff5af (export)

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220427T162930
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
  2022-04-27 15:27     ` Geliang Tang
@ 2022-04-27 21:47       ` Mat Martineau
  2022-04-28  2:51         ` Geliang Tang
  0 siblings, 1 reply; 16+ messages in thread
From: Mat Martineau @ 2022-04-27 21:47 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Geliang Tang, MPTCP Upstream

[-- Attachment #1: Type: text/plain, Size: 3127 bytes --]

On Wed, 27 Apr 2022, Geliang Tang wrote:

> Hi Mat,
>
> Mat Martineau <mathew.j.martineau@linux.intel.com> 于2022年4月27日周三 08:20写道:
>>
>> On Tue, 26 Apr 2022, Geliang Tang wrote:
>>
>>> Add CONFIG_MPTCP check.
>>>
>>> When CONFIG_MPTCP is not enabled, we'll get a clearer error message:
>>>
>>> libbpf: extern CONFIG_MPTCP (strong) not resolved
>>> libbpf: failed to load object './mptcp_sock.o'
>>>
>>> The message before is like this:
>>>
>>> libbpf: prog '_sockops': BPF program load failed: Invalid argument
>>> libbpf: prog '_sockops': -- BEGIN PROG LOAD LOG --
>>>
>>> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
>>> ---
>>> tools/testing/selftests/bpf/progs/mptcp_sock.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>
>> Looks like this also requires CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC,
>> can you also add those to tools/testing/selftests/bpf/config? Maybe that
>> should be a separate commit, since other bpf test progs appear to rely on
>> this undocumented config requirement.
>
> In my test, this bpf base test still works without CONFIG_IKCONFIG and
> CONFIG_IKCONFIG_PROC:
>
>> ls /proc/config.gz
> ls: cannot access '/proc/config.gz': No such file or directory
>> sudo ./test_progs -n 103
> #103 mptcp:OK
> Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED
>

Huh, I wonder what's going on? It fails for me:

$ sudo ./test_progs -v -a mptcp
bpf_testmod.ko is already unloaded.
Loading bpf_testmod.ko...
Successfully loaded bpf_testmod.ko.
libbpf: failed to open system Kconfig
libbpf: failed to load object './mptcp_sock.o'
run_test:FAIL:165
test_base:FAIL:227
libbpf: failed to open system Kconfig
libbpf: failed to load object './mptcp_sock.o'
run_test:FAIL:165
test_base:FAIL:244
#103/1 mptcp/base:FAIL
(cgroup_helpers.c:146: errno: Device or resource busy) Removing cgroup: /mnt/cgroup-test-work-dir831/mptcp
(cgroup_helpers.c:146: errno: Device or resource busy) Removing cgroup: /mnt/cgroup-test-work-dir831
#103 mptcp:FAIL

All error logs:
#103 mptcp:FAIL

Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED

This is with Fedora 35. I'll check the BPF CI to see if there's any 
information about their configuration that might explain the difference.


- Mat

>
>
>>
>> - Mat
>>
>>> diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
>>> index 5cfaec4e7245..7b6a25e37de8 100644
>>> --- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
>>> +++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
>>> @@ -7,6 +7,7 @@
>>>
>>> char _license[] SEC("license") = "GPL";
>>> __u32 _version SEC("version") = 1;
>>> +extern bool CONFIG_MPTCP __kconfig;
>>>
>>> struct mptcp_storage {
>>>       __u32 invoked;
>>> @@ -46,6 +47,9 @@ int _sockops(struct bpf_sock_ops *ctx)
>>>               if (!storage)
>>>                       return 1;
>>>       } else {
>>> +             if (!CONFIG_MPTCP)
>>> +                     return 1;
>>> +
>>>               msk = bpf_skc_to_mptcp_sock(sk);
>>>               if (!msk)
>>>                       return 1;
>>> --
>>> 2.34.1
>>>
>>>
>>>
>>
>> --
>> Mat Martineau
>> Intel
>>
>

--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
  2022-04-27 21:47       ` Mat Martineau
@ 2022-04-28  2:51         ` Geliang Tang
  0 siblings, 0 replies; 16+ messages in thread
From: Geliang Tang @ 2022-04-28  2:51 UTC (permalink / raw)
  To: Mat Martineau; +Cc: Geliang Tang, MPTCP Upstream

Hi Mat,


Mat Martineau <mathew.j.martineau@linux.intel.com> 于2022年4月28日周四 05:47写道:
>
> On Wed, 27 Apr 2022, Geliang Tang wrote:
>
> > Hi Mat,
> >
> > Mat Martineau <mathew.j.martineau@linux.intel.com> 于2022年4月27日周三 08:20写道:
> >>
> >> On Tue, 26 Apr 2022, Geliang Tang wrote:
> >>
> >>> Add CONFIG_MPTCP check.
> >>>
> >>> When CONFIG_MPTCP is not enabled, we'll get a clearer error message:
> >>>
> >>> libbpf: extern CONFIG_MPTCP (strong) not resolved
> >>> libbpf: failed to load object './mptcp_sock.o'
> >>>
> >>> The message before is like this:
> >>>
> >>> libbpf: prog '_sockops': BPF program load failed: Invalid argument
> >>> libbpf: prog '_sockops': -- BEGIN PROG LOAD LOG --
> >>>
> >>> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> >>> ---
> >>> tools/testing/selftests/bpf/progs/mptcp_sock.c | 4 ++++
> >>> 1 file changed, 4 insertions(+)
> >>>
> >>
> >> Looks like this also requires CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC,
> >> can you also add those to tools/testing/selftests/bpf/config? Maybe that
> >> should be a separate commit, since other bpf test progs appear to rely on
> >> this undocumented config requirement.
> >
> > In my test, this bpf base test still works without CONFIG_IKCONFIG and
> > CONFIG_IKCONFIG_PROC:
> >
> >> ls /proc/config.gz
> > ls: cannot access '/proc/config.gz': No such file or directory
> >> sudo ./test_progs -n 103
> > #103 mptcp:OK
> > Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED
> >
>
> Huh, I wonder what's going on? It fails for me:
>
> $ sudo ./test_progs -v -a mptcp
> bpf_testmod.ko is already unloaded.
> Loading bpf_testmod.ko...
> Successfully loaded bpf_testmod.ko.
> libbpf: failed to open system Kconfig
> libbpf: failed to load object './mptcp_sock.o'
> run_test:FAIL:165
> test_base:FAIL:227
> libbpf: failed to open system Kconfig
> libbpf: failed to load object './mptcp_sock.o'
> run_test:FAIL:165
> test_base:FAIL:244
> #103/1 mptcp/base:FAIL
> (cgroup_helpers.c:146: errno: Device or resource busy) Removing cgroup: /mnt/cgroup-test-work-dir831/mptcp
> (cgroup_helpers.c:146: errno: Device or resource busy) Removing cgroup: /mnt/cgroup-test-work-dir831
> #103 mptcp:FAIL
>
> All error logs:
> #103 mptcp:FAIL
>
> Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED
>
> This is with Fedora 35. I'll check the BPF CI to see if there's any
> information about their configuration that might explain the difference.

I figure it out. libbpf reads /boot/config-* first, then /proc/config.gz:

 1840 static int bpf_object__read_kconfig_file(struct bpf_object *obj,
void *data)
 1841 {
 1842         char buf[PATH_MAX];
 1843         struct utsname uts;
 1844         int len, err = 0;
 1845         gzFile file;
 1846
 1847         uname(&uts);
 1848         len = snprintf(buf, PATH_MAX, "/boot/config-%s", uts.release);
 1849         if (len < 0)
 1850                 return -EINVAL;
 1851         else if (len >= PATH_MAX)
 1852                 return -ENAMETOOLONG;
 1853
 1854         /* gzopen also accepts uncompressed files. */
 1855         file = gzopen(buf, "r");
 1856         if (!file)
 1857                 file = gzopen("/proc/config.gz", "r");

So we do need to add CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC in
config. I'll send a v2 as a dedicated patch.

Thanks,
-Geliang


>
>
> - Mat
>
> >
> >
> >>
> >> - Mat
> >>
> >>> diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> >>> index 5cfaec4e7245..7b6a25e37de8 100644
> >>> --- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
> >>> +++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> >>> @@ -7,6 +7,7 @@
> >>>
> >>> char _license[] SEC("license") = "GPL";
> >>> __u32 _version SEC("version") = 1;
> >>> +extern bool CONFIG_MPTCP __kconfig;
> >>>
> >>> struct mptcp_storage {
> >>>       __u32 invoked;
> >>> @@ -46,6 +47,9 @@ int _sockops(struct bpf_sock_ops *ctx)
> >>>               if (!storage)
> >>>                       return 1;
> >>>       } else {
> >>> +             if (!CONFIG_MPTCP)
> >>> +                     return 1;
> >>> +
> >>>               msk = bpf_skc_to_mptcp_sock(sk);
> >>>               if (!msk)
> >>>                       return 1;
> >>> --
> >>> 2.34.1
> >>>
> >>>
> >>>
> >>
> >> --
> >> Mat Martineau
> >> Intel
> >>
> >
>
> --
> Mat Martineau
> Intel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
@ 2022-05-17  7:43 Geliang Tang
  0 siblings, 0 replies; 16+ messages in thread
From: Geliang Tang @ 2022-05-17  7:43 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Drop EXPORT_SYMBOL. (Martin)

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/bpf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index 535602ba2582..5a0a84ad94af 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -19,4 +19,3 @@ struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
 
 	return NULL;
 }
-EXPORT_SYMBOL(bpf_mptcp_sock_from_subflow);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-03-30 14:22   ` Geliang Tang
@ 2022-03-30 14:51     ` Matthieu Baerts
  0 siblings, 0 replies; 16+ messages in thread
From: Matthieu Baerts @ 2022-03-30 14:51 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On 30/03/2022 16:22, Geliang Tang wrote:
> On Wed, Mar 30, 2022 at 03:29:06PM +0200, Matthieu Baerts wrote:
>> Hi Geliang,
>>
>> On 30/03/2022 09:08, Geliang Tang wrote:
>>> Fix the build breaks reported by kernel test robot:
>>>
>>> [mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
>>> [mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'
>>>
>>> - add defined(CONFIG_BPF_JIT) too.
>>
>> Thanks for the fix!
>>
>>> - move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.
>>
>> Should we add an explicit #include <net/mptcp.h> in filter.c.
>>
>> But maybe it is enough to have net/mptcp.h in net/tcp.h?
> 
> Yes, net/mptcp.h is included in net/tcp.h already. So no need to add it
> in filter.c explicitly. No build errors for this occurred in my test.

Yes but I don't know if the recommendation is to add mptcp.h directly
just in case instead of "indirectly" via tcp.h. But that's more a
question for BPF maintainers, easy to fix later if needed!

So good for me to apply this and avoid issues reported by Intel's KBuild!

Now in our tree:

- 3b9cc9f027bf: "squashed" in "bpf: add bpf_skc_to_mptcp_sock_proto"
- Results: d2b06f03e554..ccc95f7c14d9 (export)

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220330T145030
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-03-30 13:29 ` Matthieu Baerts
@ 2022-03-30 14:22   ` Geliang Tang
  2022-03-30 14:51     ` Matthieu Baerts
  0 siblings, 1 reply; 16+ messages in thread
From: Geliang Tang @ 2022-03-30 14:22 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: mptcp

On Wed, Mar 30, 2022 at 03:29:06PM +0200, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 30/03/2022 09:08, Geliang Tang wrote:
> > Fix the build breaks reported by kernel test robot:
> > 
> > [mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
> > [mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'
> > 
> > - add defined(CONFIG_BPF_JIT) too.
> 
> Thanks for the fix!
> 
> > - move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.
> 
> Should we add an explicit #include <net/mptcp.h> in filter.c.
> 
> But maybe it is enough to have net/mptcp.h in net/tcp.h?

Yes, net/mptcp.h is included in net/tcp.h already. So no need to add it
in filter.c explicitly. No build errors for this occurred in my test.

Thanks,
-Geliang

> 
> Cheers,
> Matt
> -- 
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-03-30  7:08 Geliang Tang
@ 2022-03-30 13:29 ` Matthieu Baerts
  2022-03-30 14:22   ` Geliang Tang
  0 siblings, 1 reply; 16+ messages in thread
From: Matthieu Baerts @ 2022-03-30 13:29 UTC (permalink / raw)
  To: Geliang Tang, mptcp; +Cc: kernel test robot

Hi Geliang,

On 30/03/2022 09:08, Geliang Tang wrote:
> Fix the build breaks reported by kernel test robot:
> 
> [mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
> [mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'
> 
> - add defined(CONFIG_BPF_JIT) too.

Thanks for the fix!

> - move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.

Should we add an explicit #include <net/mptcp.h> in filter.c.

But maybe it is enough to have net/mptcp.h in net/tcp.h?

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
@ 2022-03-30  7:08 Geliang Tang
  2022-03-30 13:29 ` Matthieu Baerts
  0 siblings, 1 reply; 16+ messages in thread
From: Geliang Tang @ 2022-03-30  7:08 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang, kernel test robot

Fix the build breaks reported by kernel test robot:

[mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
[mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'

- add defined(CONFIG_BPF_JIT) too.
- move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.

base-commit: export/20220329T195411

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 include/linux/bpf.h | 9 ---------
 include/net/mptcp.h | 6 ++++++
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 117ae3f9451e..bdb5298735ce 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2372,15 +2372,6 @@ static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
 }
 #endif /* CONFIG_INET */
 
-#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
-struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
-#else
-static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
-{
-	return NULL;
-}
-#endif /* defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL) */
-
 enum bpf_text_poke_type {
 	BPF_MOD_CALL,
 	BPF_MOD_JUMP,
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 8b1afd6f5cc4..877077b53200 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -284,4 +284,10 @@ static inline int mptcpv6_init(void) { return 0; }
 static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
 #endif
 
+#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL)
+struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
+#else
+static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
+#endif
+
 #endif /* __NET_MPTCP_H */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-05-17  7:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  4:26 [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Geliang Tang
2022-04-26  4:26 ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Geliang Tang
2022-04-26  6:16   ` Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock": Tests Results MPTCP CI
2022-04-27  0:20   ` [PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock" Mat Martineau
2022-04-27  0:22     ` Mat Martineau
2022-04-27 15:27     ` Geliang Tang
2022-04-27 21:47       ` Mat Martineau
2022-04-28  2:51         ` Geliang Tang
2022-04-27 16:33   ` Matthieu Baerts
2022-04-26  6:17 ` Squash to "bpf: add bpf_skc_to_mptcp_sock_proto": Tests Results MPTCP CI
2022-04-27  0:17 ` [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Mat Martineau
  -- strict thread matches above, loose matches on Subject: below --
2022-05-17  7:43 Geliang Tang
2022-03-30  7:08 Geliang Tang
2022-03-30 13:29 ` Matthieu Baerts
2022-03-30 14:22   ` Geliang Tang
2022-03-30 14:51     ` Matthieu Baerts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.