[PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"

Geliang Tang posted 1 patch 2 years ago
Failed in applying to current master (apply log)
There is a newer version of this series
tools/testing/selftests/bpf/bpf_mptcp_helpers.h | 14 ++++++++++++++
tools/testing/selftests/bpf/bpf_tcp_helpers.h   |  5 -----
tools/testing/selftests/bpf/progs/mptcp_sock.c  |  2 +-
3 files changed, 15 insertions(+), 6 deletions(-)
create mode 100644 tools/testing/selftests/bpf/bpf_mptcp_helpers.h
[PATCH mptcp-next] Squash to "selftests: bpf: test bpf_skc_to_mptcp_sock"
Posted by Geliang Tang 2 years ago
Use dedicated bpf_mptcp_helpers.h for MPTCP tests, instead of sharing
with bpf_tcp_helpers.h.

This patch will conflict with the next three patches.

1. selftests: bpf: verify token of struct mptcp_sock

CONFLICT (content): Merge conflict in tools/testing/selftests/bpf/bpf_tcp_helpers.h

Drop these lines in bpf_tcp_helpers.h:

'''
<<<<<<< HEAD
=======
struct mptcp_sock {
	struct inet_connection_sock	sk;

	__u32		token;
} __attribute__((preserve_access_index));

>>>>>>> 81f7e2dd50fa (selftests: bpf: verify token of struct mptcp_sock)
'''

Merge it into bpf_mptcp_helpers.h:

'''
struct mptcp_sock {
	struct inet_connection_sock	sk;

	__u32		token;
} __attribute__((preserve_access_index));
'''

2. selftests: bpf: verify ca_name of struct mptcp_sock

CONFLICT (content): Merge conflict in tools/testing/selftests/bpf/bpf_tcp_helpers.h

Drop these lines in bpf_tcp_helpers.h:

'''
<<<<<<< HEAD
=======
struct mptcp_sock {
	struct inet_connection_sock	sk;

	__u32		token;
	char		ca_name[TCP_CA_NAME_MAX];
} __attribute__((preserve_access_index));

>>>>>>> dc3031fdfe35 (selftests: bpf: verify ca_name of struct mptcp_sock)
'''

Merge it into bpf_mptcp_helpers.h:

'''
struct mptcp_sock {
	struct inet_connection_sock	sk;

	__u32		token;
	char		ca_name[TCP_CA_NAME_MAX];
} __attribute__((preserve_access_index));
'''

3. selftests: bpf: verify first of struct mptcp_sock

CONFLICT (content): Merge conflict in tools/testing/selftests/bpf/bpf_tcp_helpers.h

Drop these lines in bpf_tcp_helpers.h:

'''
<<<<<<< HEAD
=======
struct mptcp_sock {
	struct inet_connection_sock	sk;

	__u32		token;
	struct sock	*first;
	char		ca_name[TCP_CA_NAME_MAX];
} __attribute__((preserve_access_index));

>>>>>>> afb45ac4de7f (selftests: bpf: verify first of struct mptcp_sock)
'''

Merge it into bpf_mptcp_helpers.h:

'''
struct mptcp_sock {
	struct inet_connection_sock	sk;

	__u32		token;
	struct sock	*first;
	char		ca_name[TCP_CA_NAME_MAX];
} __attribute__((preserve_access_index));
'''

Note: 'first' is inserted between 'token' and 'ca_name', to keep the order of
mptcp_sock in kernel.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/bpf_mptcp_helpers.h | 14 ++++++++++++++
 tools/testing/selftests/bpf/bpf_tcp_helpers.h   |  5 -----
 tools/testing/selftests/bpf/progs/mptcp_sock.c  |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/bpf_mptcp_helpers.h

diff --git a/tools/testing/selftests/bpf/bpf_mptcp_helpers.h b/tools/testing/selftests/bpf/bpf_mptcp_helpers.h
new file mode 100644
index 000000000000..18da4cc65e89
--- /dev/null
+++ b/tools/testing/selftests/bpf/bpf_mptcp_helpers.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2022, SUSE. */
+
+#ifndef __BPF_MPTCP_HELPERS_H
+#define __BPF_MPTCP_HELPERS_H
+
+#include "bpf_tcp_helpers.h"
+
+struct mptcp_sock {
+	struct inet_connection_sock	sk;
+
+} __attribute__((preserve_access_index));
+
+#endif
diff --git a/tools/testing/selftests/bpf/bpf_tcp_helpers.h b/tools/testing/selftests/bpf/bpf_tcp_helpers.h
index d71616873a3c..b1ede6f0b821 100644
--- a/tools/testing/selftests/bpf/bpf_tcp_helpers.h
+++ b/tools/testing/selftests/bpf/bpf_tcp_helpers.h
@@ -83,11 +83,6 @@ struct tcp_sock {
 	__u64	tcp_mstamp;	/* most recent packet received/sent */
 } __attribute__((preserve_access_index));
 
-struct mptcp_sock {
-	struct inet_connection_sock	sk;
-
-} __attribute__((preserve_access_index));
-
 static __always_inline struct inet_connection_sock *inet_csk(const struct sock *sk)
 {
 	return (struct inet_connection_sock *)sk;
diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
index a58cd24da777..5cfaec4e7245 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
+++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
@@ -3,7 +3,7 @@
 
 #include <linux/bpf.h>
 #include <bpf/bpf_helpers.h>
-#include "bpf_tcp_helpers.h"
+#include "bpf_mptcp_helpers.h"
 
 char _license[] SEC("license") = "GPL";
 __u32 _version SEC("version") = 1;
-- 
2.34.1