All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] mptcp: support SYSCTL only if enabled
@ 2021-04-29 14:59 Matthieu Baerts
  2021-04-30  0:07 ` Mat Martineau
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Baerts @ 2021-04-29 14:59 UTC (permalink / raw)
  To: mptcp; +Cc: Matthieu Baerts, kernel test robot

Since the introduction of the sysctl support in MPTCP with
commit 784325e9f037 ("mptcp: new sysctl to control the activation per NS"),
we don't check CONFIG_SYSCTL.

Until now, that was not an issue: the register and unregister functions
were replaced by NO-OP one if SYSCTL was not enabled in the config. The
only thing we could have avoid is not to reserve memory for the table
but that's for the moment only a small table per net-ns.

But the following commit is going to use SYSCTL_ZERO and SYSCTL_ONE
which are not be defined if SYSCTL is not enabled in the config. This
causes 'undefined reference' errors from the linker.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---

Notes:
    The "following" commit is "mptcp: restrict values of 'enabled' sysctl".
    
    The goal is to place this patch before this commit.

 net/mptcp/ctrl.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
index 08c152199b89..1ec4d36a39f0 100644
--- a/net/mptcp/ctrl.c
+++ b/net/mptcp/ctrl.c
@@ -4,7 +4,9 @@
  * Copyright (c) 2019, Tessares SA.
  */
 
+#ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
+#endif
 
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
@@ -15,7 +17,9 @@
 
 static int mptcp_pernet_id;
 struct mptcp_pernet {
+#ifdef CONFIG_SYSCTL
 	struct ctl_table_header *ctl_table_hdr;
+#endif
 
 	u8 mptcp_enabled;
 	unsigned int add_addr_timeout;
@@ -36,6 +40,13 @@ unsigned int mptcp_get_add_addr_timeout(struct net *net)
 	return mptcp_get_pernet(net)->add_addr_timeout;
 }
 
+static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
+{
+	pernet->mptcp_enabled = 1;
+	pernet->add_addr_timeout = TCP_RTO_MAX;
+}
+
+#ifdef CONFIG_SYSCTL
 static struct ctl_table mptcp_sysctl_table[] = {
 	{
 		.procname = "enabled",
@@ -57,12 +68,6 @@ static struct ctl_table mptcp_sysctl_table[] = {
 	{}
 };
 
-static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
-{
-	pernet->mptcp_enabled = 1;
-	pernet->add_addr_timeout = TCP_RTO_MAX;
-}
-
 static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
 {
 	struct ctl_table_header *hdr;
@@ -102,6 +107,17 @@ static void mptcp_pernet_del_table(struct mptcp_pernet *pernet)
 	kfree(table);
 }
 
+#else
+
+static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
+{
+	return 0;
+}
+
+static void mptcp_pernet_del_table(struct mptcp_pernet *pernet) {}
+
+#endif /* CONFIG_SYSCTL */
+
 static int __net_init mptcp_net_init(struct net *net)
 {
 	struct mptcp_pernet *pernet = mptcp_get_pernet(net);
-- 
2.30.2


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

* Re: [PATCH mptcp-next] mptcp: support SYSCTL only if enabled
  2021-04-29 14:59 [PATCH mptcp-next] mptcp: support SYSCTL only if enabled Matthieu Baerts
@ 2021-04-30  0:07 ` Mat Martineau
  2021-04-30 16:54   ` Matthieu Baerts
  0 siblings, 1 reply; 3+ messages in thread
From: Mat Martineau @ 2021-04-30  0:07 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: mptcp

On Thu, 29 Apr 2021, Matthieu Baerts wrote:

> Since the introduction of the sysctl support in MPTCP with
> commit 784325e9f037 ("mptcp: new sysctl to control the activation per NS"),
> we don't check CONFIG_SYSCTL.
>
> Until now, that was not an issue: the register and unregister functions
> were replaced by NO-OP one if SYSCTL was not enabled in the config. The
> only thing we could have avoid is not to reserve memory for the table
> but that's for the moment only a small table per net-ns.
>
> But the following commit is going to use SYSCTL_ZERO and SYSCTL_ONE
> which are not be defined if SYSCTL is not enabled in the config. This
> causes 'undefined reference' errors from the linker.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
>
> Notes:
>    The "following" commit is "mptcp: restrict values of 'enabled' sysctl".
>
>    The goal is to place this patch before this commit.
>
> net/mptcp/ctrl.c | 28 ++++++++++++++++++++++------
> 1 file changed, 22 insertions(+), 6 deletions(-)
>

Looks good to me, thanks Matthieu.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

--
Mat Martineau
Intel

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

* Re: [PATCH mptcp-next] mptcp: support SYSCTL only if enabled
  2021-04-30  0:07 ` Mat Martineau
@ 2021-04-30 16:54   ` Matthieu Baerts
  0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2021-04-30 16:54 UTC (permalink / raw)
  To: Mat Martineau; +Cc: mptcp

Hi Mat,

On 30/04/2021 02:07, Mat Martineau wrote:
> On Thu, 29 Apr 2021, Matthieu Baerts wrote:
> 
>> Since the introduction of the sysctl support in MPTCP with
>> commit 784325e9f037 ("mptcp: new sysctl to control the activation per
>> NS"),
>> we don't check CONFIG_SYSCTL.
>>
>> Until now, that was not an issue: the register and unregister functions
>> were replaced by NO-OP one if SYSCTL was not enabled in the config. The
>> only thing we could have avoid is not to reserve memory for the table
>> but that's for the moment only a small table per net-ns.
>>
>> But the following commit is going to use SYSCTL_ZERO and SYSCTL_ONE
>> which are not be defined if SYSCTL is not enabled in the config. This
>> causes 'undefined reference' errors from the linker.
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
>> ---
>>
>> Notes:
>>    The "following" commit is "mptcp: restrict values of 'enabled'
>> sysctl".
>>
>>    The goal is to place this patch before this commit.
>>
>> net/mptcp/ctrl.c | 28 ++++++++++++++++++++++------
>> 1 file changed, 22 insertions(+), 6 deletions(-)
>>
> 
> Looks good to me, thanks Matthieu.
> 
> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

Thank you for the review!

Now in our tree:

- 2c38407bd1c5: mptcp: support SYSCTL only if enabled
- Results: f937cef8ab9f..f6df9e9d3336

Builds and tests are now in progress:

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

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

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

end of thread, other threads:[~2021-04-30 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 14:59 [PATCH mptcp-next] mptcp: support SYSCTL only if enabled Matthieu Baerts
2021-04-30  0:07 ` Mat Martineau
2021-04-30 16:54   ` 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.