All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [MPTCP] [PATCH] mptcp: Make mptcp initialization part of tcp initialization
@ 2019-05-25  9:14 Florian Westphal
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2019-05-25  9:14 UTC (permalink / raw)
  To: mptcp

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

Peter Krystad <peter.krystad(a)linux.intel.com> wrote:
>  static inline bool sk_is_mptcp(const struct sock *sk)
>  {
>  	return tcp_sk(sk)->is_mptcp;
> @@ -84,6 +86,10 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts);
>  
>  #else
>  
> +void mptcp_init(void)
> +{
> +}
> +

ITYM 'static inline void mptcp_init(void) {}'.

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

* Re: [MPTCP] [PATCH] mptcp: Make mptcp initialization part of tcp initialization
@ 2019-05-28 17:18 Peter Krystad
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Krystad @ 2019-05-28 17:18 UTC (permalink / raw)
  To: mptcp

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

On Sat, 2019-05-25 at 11:14 +0200, Florian Westphal wrote:
> Peter Krystad <peter.krystad(a)linux.intel.com> wrote:
> >  static inline bool sk_is_mptcp(const struct sock *sk)
> >  {
> >  	return tcp_sk(sk)->is_mptcp;
> > @@ -84,6 +86,10 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts);
> >  
> >  #else
> >  
> > +void mptcp_init(void)
> > +{
> > +}
> > +
> 
> ITYM 'static inline void mptcp_init(void) {}'.

Indeed I did.


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

* [MPTCP] [PATCH] mptcp: Make mptcp initialization part of tcp initialization
@ 2019-05-24 23:05 Peter Krystad
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Krystad @ 2019-05-24 23:05 UTC (permalink / raw)
  To: mptcp

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

Remove remnant module initialization of MPTCP and make it
part of the inet/tcp initialization sequence.

OK to squash but needs to be split up to do so.

Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
 include/net/mptcp.h  |  6 ++++++
 net/ipv4/tcp.c       |  2 ++
 net/mptcp/protocol.c | 22 +++-------------------
 net/mptcp/subflow.c  | 15 ++++++++++++---
 4 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index ed67b140af33..a927e65d5027 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -49,6 +49,8 @@ struct mptcp_out_options {
 
 #ifdef CONFIG_MPTCP
 
+void mptcp_init(void);
+
 static inline bool sk_is_mptcp(const struct sock *sk)
 {
 	return tcp_sk(sk)->is_mptcp;
@@ -84,6 +86,10 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts);
 
 #else
 
+void mptcp_init(void)
+{
+}
+
 static inline bool sk_is_mptcp(const struct sock *sk)
 {
 	return false;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index cb072dce81a7..ab242851da3f 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -275,6 +275,7 @@
 #include <net/icmp.h>
 #include <net/inet_common.h>
 #include <net/tcp.h>
+#include <net/mptcp.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
 #include <net/sock.h>
@@ -3947,4 +3948,5 @@ void __init tcp_init(void)
 	tcp_metrics_init();
 	BUG_ON(tcp_register_congestion_control(&tcp_reno) != 0);
 	tcp_tasklet_init();
+	mptcp_init();
 }
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 06312efc0b90..d1c617852e0f 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1009,7 +1009,7 @@ static struct inet_protosw mptcp_protosw = {
 	.flags		= INET_PROTOSW_ICSK,
 };
 
-static int __init mptcp_init(void)
+void mptcp_init(void)
 {
 	int err;
 
@@ -1036,26 +1036,10 @@ static int __init mptcp_init(void)
 
 	inet_register_protosw(&mptcp_protosw);
 
-	return 0;
-
+	return;
 proto_failed:
 	subflow_exit();
 
 subflow_failed:
-	return err;
-}
-
-static void __exit mptcp_exit(void)
-{
-	inet_unregister_protosw(&mptcp_protosw);
-	proto_unregister(&mptcp_prot);
-
-	subflow_exit();
+	return;
 }
-
-module_init(mptcp_init);
-module_exit(mptcp_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_NET_PF_PROTO(PF_INET, IPPROTO_MPTCP);
-MODULE_ALIAS_NET_PF_PROTO(PF_INET6, IPPROTO_MPTCP);
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index bc8e1a0658ec..e4ae5c5d177d 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -294,6 +294,12 @@ static int subflow_ops_init(struct request_sock_ops *subflow_ops)
 	return 0;
 }
 
+static void subflow_ops_exit(void)
+{
+	kfree(subflow_request_sock_ops.slab_name);
+	kmem_cache_destroy(subflow_request_sock_ops.slab);
+}
+
 int subflow_init(void)
 {
 	int ret;
@@ -312,12 +318,15 @@ int subflow_init(void)
 	subflow_specific.sk_rx_dst_set = subflow_finish_connect;
 	subflow_specific.rebuild_header = subflow_rebuild_header;
 
-	return tcp_register_ulp(&subflow_ulp_ops);
+	ret = tcp_register_ulp(&subflow_ulp_ops);
+	if (ret != 0)
+		subflow_ops_exit();
+
+	return ret;
 }
 
 void subflow_exit(void)
 {
 	tcp_unregister_ulp(&subflow_ulp_ops);
+	subflow_ops_exit();
 }
-
-MODULE_LICENSE("GPL");
-- 
2.17.2


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

end of thread, other threads:[~2019-05-28 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25  9:14 [MPTCP] [PATCH] mptcp: Make mptcp initialization part of tcp initialization Florian Westphal
  -- strict thread matches above, loose matches on Subject: below --
2019-05-28 17:18 Peter Krystad
2019-05-24 23:05 Peter Krystad

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.