[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240809161935.3129104-1-leitao@debian.org>
Date: Fri, 9 Aug 2024 09:19:33 -0700
From: Breno Leitao <leitao@...ian.org>
To: kuba@...nel.org,
davem@...emloft.net,
edumazet@...gle.com,
pabeni@...hat.com
Cc: thepacketgeek@...il.com,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Aijay Adams <aijay@...a.com>
Subject: [PATCH net-next] net: netconsole: Populate dynamic entry even if netpoll fails
Currently, netconsole discards targets that fail during initialization,
causing two issues:
1) Inconsistency between target list and configfs entries
* user pass cmdline0, cmdline1. If cmdline0 fails, then cmdline1
becomes cmdline0 in configfs.
2) Inability to manage failed targets from userspace
* If user pass a target that fails with netpoll (interface not loaded at
netcons initialization time, such as interface is a module), then
the target will not exist in the configfs, so, user cannot re-enable
or modify it from userspace.
Failed targets are now added to the target list and configfs, but
remain disabled until manually enabled or reconfigured. This change does
not change the behaviour if CONFIG_NETCONSOLE_DYNAMIC is not set.
CC: Aijay Adams <aijay@...a.com>
Signed-off-by: Breno Leitao <leitao@...ian.org>
---
drivers/net/netconsole.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 43c29b15adbf..41a61fa88c32 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1258,11 +1258,15 @@ static struct netconsole_target *alloc_param_target(char *target_config,
goto fail;
err = netpoll_setup(&nt->np);
- if (err)
+ if (!err)
+ nt->enabled = true;
+ else if (!IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC))
+ /* only fail if dynamic reconfiguration is set,
+ * otherwise, keep the target in the list, but disabled.
+ */
goto fail;
populate_configfs_item(nt, cmdline_count);
- nt->enabled = true;
return nt;
@@ -1304,8 +1308,6 @@ static int __init init_netconsole(void)
while ((target_config = strsep(&input, ";"))) {
nt = alloc_param_target(target_config, count);
if (IS_ERR(nt)) {
- if (IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC))
- continue;
err = PTR_ERR(nt);
goto fail;
}
--
2.43.5
Powered by blists - more mailing lists