net: Start socket service thread by net core init

Do not depend on init level but start the socket service
already in net core init because DNS init code depends on
socket service API to be ready to serve. And we call DNS
init at the net core init.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2024-05-23 12:44:34 +03:00 committed by Henrik Brix Andersen
commit b305be037c
6 changed files with 13 additions and 11 deletions

View file

@ -549,6 +549,8 @@ static inline int services_init(void)
{
int status;
socket_service_init();
status = net_dhcpv4_init();
if (status) {
return status;

View file

@ -71,6 +71,12 @@ extern int net_icmp_call_ipv6_handlers(struct net_pkt *pkt,
extern struct net_if *net_ipip_get_virtual_interface(struct net_if *input_iface);
#if defined(CONFIG_NET_SOCKETS_SERVICE)
extern void socket_service_init(void);
#else
static inline void socket_service_init(void) { }
#endif
#if defined(CONFIG_NET_NATIVE) || defined(CONFIG_NET_OFFLOAD)
extern void net_context_init(void);
extern const char *net_context_state(struct net_context *context);

View file

@ -143,11 +143,6 @@ config NET_SOCKETS_SERVICE_STACK_SIZE
help
Set the internal stack size for the thread that polls sockets.
config NET_SOCKETS_SERVICE_INIT_PRIO
int "Startup priority for the network socket service"
default 90
depends on NET_SOCKETS_SERVICE
config NET_SOCKETS_SOCKOPT_TLS
bool "TCP TLS socket option support"
imply TLS_CREDENTIALS

View file

@ -314,4 +314,7 @@ static int init_socket_service(void)
return 0;
}
SYS_INIT(init_socket_service, APPLICATION, CONFIG_NET_SOCKETS_SERVICE_INIT_PRIO);
void socket_service_init(void)
{
(void)init_socket_service();
}

View file

@ -470,7 +470,7 @@ if SHELL_BACKEND_TELNET
config SHELL_TELNET_INIT_PRIORITY
int "Initialization priority"
default 95
range NET_SOCKETS_SERVICE_INIT_PRIO 99
range 0 99
help
Initialization priority for telnet shell backend. This must be higher
than socket service initialization priority, as socket service has to

View file

@ -787,10 +787,6 @@ static int enable_shell_telnet(void)
return shell_init(&shell_telnet, NULL, cfg_flags, log_backend, level);
}
BUILD_ASSERT(CONFIG_SHELL_TELNET_INIT_PRIORITY > CONFIG_NET_SOCKETS_SERVICE_INIT_PRIO,
"CONFIG_SHELL_TELNET_INIT_PRIORITY must be higher than "
"CONFIG_NET_SOCKETS_SERVICE_INIT_PRIO");
SYS_INIT(enable_shell_telnet, APPLICATION, CONFIG_SHELL_TELNET_INIT_PRIORITY);
const struct shell *shell_backend_telnet_get_ptr(void)