diff mbox series

[RFC,net-next,13/20] net/smc: embedded tcp sock into smc sock

Message ID 1708412505-34470-14-git-send-email-alibuda@linux.alibaba.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series Introduce IPPROTO_SMC | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches (and no cover letter)
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 16 this patch: 940
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang fail Errors and warnings before: 17 this patch: 957
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 16 this patch: 957
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

D. Wythe Feb. 20, 2024, 7:01 a.m. UTC
From: "D. Wythe" <alibuda@linux.alibaba.com>

For inet version of SMC, one of the key goals is to make
a fallbacked smc sock can be recognazied as a tcp sock by
net tools.

So, it is necessary to embedded the tcp sock into smc sock
and make the tcp sock as the first member of smc sock.

Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
---
 net/smc/smc.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/smc/smc.h b/net/smc/smc.h
index fce6a7a..932d61f 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -248,7 +248,11 @@  struct smc_connection {
 };
 
 struct smc_sock {				/* smc sock container */
-	struct sock		sk;
+	union {
+		struct tcp6_sock tp6sk;
+		struct tcp_sock tpsk;
+		struct sock sk;
+	};
 	struct socket		*clcsock;	/* internal tcp socket */
 	void			(*clcsk_state_change)(struct sock *sk);
 						/* original stat_change fct. */
@@ -388,6 +392,11 @@  static inline void smc_sock_set_flag(struct sock *sk, enum sock_flags flag)
 	set_bit(flag, &sk->sk_flags);
 }
 
+static __always_inline bool smc_sock_is_inet_sock(const struct sock *sk)
+{
+	return inet_test_bit(IS_ICSK, sk);
+}
+
 #define smc_sock_flag(sk, flag)	sock_flag(sk, flag)
 
 #endif	/* __SMC_H */