* Re: [MPTCP] [PATCH] mptcp:init: panic in case of error
@ 2019-06-05 18:14 Peter Krystad
0 siblings, 0 replies; 3+ messages in thread
From: Peter Krystad @ 2019-06-05 18:14 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 3694 bytes --]
Looks good to me Matthieu, thanks for the improvements.
Peter.
On Fri, 2019-05-31 at 17:18 +0200, Matthieu Baerts wrote:
> The idea is to mimic what is done in tcp_init() and not ignore errors
> from the init phase. It also simplifies the code as we don't have to
> manage exit parts anymore.
>
> Can be squashed in:
> - "mptcp: Add MPTCP socket stubs" (mptcp_init())
> - "mptcp: Associate MPTCP context with TCP socket" (subflow_init())
> - "mptcp: Create SUBFLOW socket for incoming connections" (subflow_ops)
>
> Signed-off-by: Matthieu Baerts <matthieu.baerts(a)tessares.net>
> ---
> net/mptcp/protocol.c | 20 ++++----------------
> net/mptcp/protocol.h | 3 +--
> net/mptcp/subflow.c | 27 +++++----------------------
> 3 files changed, 10 insertions(+), 40 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 4e809719dcfd..b342cd4115da 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -992,10 +992,8 @@ static struct inet_protosw mptcp_protosw = {
> .flags = INET_PROTOSW_ICSK,
> };
>
> -void mptcp_init(void)
> +void __init mptcp_init(void)
> {
> - int err;
> -
> mptcp_prot.h.hashinfo = tcp_prot.h.hashinfo;
> mptcp_stream_ops = inet_stream_ops;
> mptcp_stream_ops.bind = mptcp_bind;
> @@ -1008,22 +1006,12 @@ void mptcp_init(void)
>
> token_init();
> crypto_init();
> + subflow_init();
>
> - err = subflow_init();
> - if (err)
> - goto subflow_failed;
> -
> - err = proto_register(&mptcp_prot, 1);
> - if (err)
> - goto proto_failed;
> + if (proto_register(&mptcp_prot, 1) != 0)
> + panic("Failed to register MPTCP proto.\n");
>
> inet_register_protosw(&mptcp_protosw);
>
> return;
> -
> -proto_failed:
> - subflow_exit();
> -
> -subflow_failed:
> - return;
> }
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 258325e42fa4..c1a39e31f641 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -105,8 +105,7 @@ static inline struct socket *mptcp_subflow_tcp_socket(const struct subflow_conte
> return subflow->tcp_sock;
> }
>
> -int subflow_init(void);
> -void subflow_exit(void);
> +void subflow_init(void);
>
> extern const struct inet_connection_sock_af_ops ipv4_specific;
>
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 1b8ec517c687..19f36ba6841f 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -286,19 +286,11 @@ static int subflow_ops_init(struct request_sock_ops *subflow_ops)
> return 0;
> }
>
> -static void subflow_ops_exit(void)
> +void subflow_init(void)
> {
> - kmem_cache_destroy(subflow_request_sock_ops.slab);
> -}
> -
> -int subflow_init(void)
> -{
> - int ret;
> -
> subflow_request_sock_ops = tcp_request_sock_ops;
> - ret = subflow_ops_init(&subflow_request_sock_ops);
> - if (ret != 0)
> - return ret;
> + if (subflow_ops_init(&subflow_request_sock_ops) != 0)
> + panic("MPTCP: failed to init subflow request sock ops");
>
> subflow_request_sock_ipv4_ops = tcp_request_sock_ipv4_ops;
> subflow_request_sock_ipv4_ops.init_req = subflow_v4_init_req;
> @@ -309,15 +301,6 @@ int subflow_init(void)
> subflow_specific.sk_rx_dst_set = subflow_finish_connect;
> subflow_specific.rebuild_header = subflow_rebuild_header;
>
> - 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();
> + if (tcp_register_ulp(&subflow_ulp_ops) != 0)
> + panic("MPTCP: failed to register subflows to ULP");
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [MPTCP] [PATCH] mptcp:init: panic in case of error
@ 2019-06-06 15:03 Matthieu Baerts
0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2019-06-06 15:03 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
Hi Peter,
On 05/06/2019 20:14, Peter Krystad wrote:
>
> Looks good to me Matthieu, thanks for the improvements.
Thank you for your review!
> Peter.
>
> On Fri, 2019-05-31 at 17:18 +0200, Matthieu Baerts wrote:
>> The idea is to mimic what is done in tcp_init() and not ignore errors
>> from the init phase. It also simplifies the code as we don't have to
>> manage exit parts anymore.
>>
>> Can be squashed in:
>> - "mptcp: Add MPTCP socket stubs" (mptcp_init())
>> - "mptcp: Associate MPTCP context with TCP socket" (subflow_init())
>> - "mptcp: Create SUBFLOW socket for incoming connections" (subflow_ops)
- c99bd3897382: "squashed" in "mptcp: Add MPTCP socket stubs"
- 9e915dbce7e6: conflict
- 7cf2e6c94084 + 5c49d37d3a1a: "squashed" in "mptcp: Associate MPTCP
context with TCP socket"
- 5168793274d7: conflict
- 612ce5b15729: conflict
- a8115b9c533d: conflict
- 239f3baa2dc0: "squashed" in "mptcp: Create SUBFLOW socket for incoming
connections"
- 3016eb29bc0c: conflict
- fe95c134e25a: remove an useless 'return' after having applied this
full patch
- 4c9253e8e57e + 483f621c7151: add missing '\n' in the two new panic()
- 78190143f7fb..227976e0d2de: result
Cheers,
Matt
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
^ permalink raw reply [flat|nested] 3+ messages in thread
* [MPTCP] [PATCH] mptcp:init: panic in case of error
@ 2019-05-31 15:18 Matthieu Baerts
0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2019-05-31 15:18 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 3343 bytes --]
The idea is to mimic what is done in tcp_init() and not ignore errors
from the init phase. It also simplifies the code as we don't have to
manage exit parts anymore.
Can be squashed in:
- "mptcp: Add MPTCP socket stubs" (mptcp_init())
- "mptcp: Associate MPTCP context with TCP socket" (subflow_init())
- "mptcp: Create SUBFLOW socket for incoming connections" (subflow_ops)
Signed-off-by: Matthieu Baerts <matthieu.baerts(a)tessares.net>
---
net/mptcp/protocol.c | 20 ++++----------------
net/mptcp/protocol.h | 3 +--
net/mptcp/subflow.c | 27 +++++----------------------
3 files changed, 10 insertions(+), 40 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 4e809719dcfd..b342cd4115da 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -992,10 +992,8 @@ static struct inet_protosw mptcp_protosw = {
.flags = INET_PROTOSW_ICSK,
};
-void mptcp_init(void)
+void __init mptcp_init(void)
{
- int err;
-
mptcp_prot.h.hashinfo = tcp_prot.h.hashinfo;
mptcp_stream_ops = inet_stream_ops;
mptcp_stream_ops.bind = mptcp_bind;
@@ -1008,22 +1006,12 @@ void mptcp_init(void)
token_init();
crypto_init();
+ subflow_init();
- err = subflow_init();
- if (err)
- goto subflow_failed;
-
- err = proto_register(&mptcp_prot, 1);
- if (err)
- goto proto_failed;
+ if (proto_register(&mptcp_prot, 1) != 0)
+ panic("Failed to register MPTCP proto.\n");
inet_register_protosw(&mptcp_protosw);
return;
-
-proto_failed:
- subflow_exit();
-
-subflow_failed:
- return;
}
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 258325e42fa4..c1a39e31f641 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -105,8 +105,7 @@ static inline struct socket *mptcp_subflow_tcp_socket(const struct subflow_conte
return subflow->tcp_sock;
}
-int subflow_init(void);
-void subflow_exit(void);
+void subflow_init(void);
extern const struct inet_connection_sock_af_ops ipv4_specific;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 1b8ec517c687..19f36ba6841f 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -286,19 +286,11 @@ static int subflow_ops_init(struct request_sock_ops *subflow_ops)
return 0;
}
-static void subflow_ops_exit(void)
+void subflow_init(void)
{
- kmem_cache_destroy(subflow_request_sock_ops.slab);
-}
-
-int subflow_init(void)
-{
- int ret;
-
subflow_request_sock_ops = tcp_request_sock_ops;
- ret = subflow_ops_init(&subflow_request_sock_ops);
- if (ret != 0)
- return ret;
+ if (subflow_ops_init(&subflow_request_sock_ops) != 0)
+ panic("MPTCP: failed to init subflow request sock ops");
subflow_request_sock_ipv4_ops = tcp_request_sock_ipv4_ops;
subflow_request_sock_ipv4_ops.init_req = subflow_v4_init_req;
@@ -309,15 +301,6 @@ int subflow_init(void)
subflow_specific.sk_rx_dst_set = subflow_finish_connect;
subflow_specific.rebuild_header = subflow_rebuild_header;
- 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();
+ if (tcp_register_ulp(&subflow_ulp_ops) != 0)
+ panic("MPTCP: failed to register subflows to ULP");
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-06 15:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 18:14 [MPTCP] [PATCH] mptcp:init: panic in case of error Peter Krystad
-- strict thread matches above, loose matches on Subject: below --
2019-06-06 15:03 Matthieu Baerts
2019-05-31 15:18 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.