pc_wifi_drv: dissolve user tasks interdependence

The 'uplink' task was created by the 'socketcall' task although both
may operate independently.

Issue #4506.
This commit is contained in:
Josef Söntgen 2022-05-13 13:07:28 +02:00 committed by Christian Helmuth
parent 0cffda3cfe
commit 913aec1667
7 changed files with 73 additions and 20 deletions

View File

@ -17,6 +17,7 @@ SRC_CC += time.cc
SRC_C += dummies.c
SRC_C += lx_emul.c
SRC_C += lx_user.c
SRC_C += uplink.c
CC_OPT_lx_socket_call += -DKBUILD_MODNAME='"lx_socket_call"'

View File

@ -13,26 +13,25 @@
/* DDE Linux includes */
#include "lx_socket_call.h"
#include "lx_user.h"
/* kernel includes */
#include <linux/socket.h>
#include <linux/net.h>
#include <net/sock.h>
struct task_struct *lx_socket_call_task;
void *lx_socket_call_task_args;
extern int run_lx_socket_call_task(void *p);
struct task_struct *socketcall_task_struct_ptr;
extern int socketcall_task_function(void *p);
extern struct net init_net;
void lx_user_init(void)
void socketcall_init(void)
{
int pid = kernel_thread(run_lx_socket_call_task,
lx_socket_call_task_args,
int pid = kernel_thread(socketcall_task_function,
NULL,
CLONE_FS | CLONE_FILES);
lx_socket_call_task = find_task_by_pid_ns(pid, NULL);
socketcall_task_struct_ptr = find_task_by_pid_ns(pid, NULL);
}

View File

@ -0,0 +1,28 @@
/**
* \brief Lx user definitions
* \author Josef Soentgen
* \date 2022-05-12
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* DDE Linux includes */
#include <lx_user/io.h>
/* local includes */
#include "lx_user.h"
void lx_user_init(void)
{
uplink_init();
socketcall_init();
}
void lx_user_handle_io(void) { }

View File

@ -0,0 +1,28 @@
/**
* \brief Lx user definitions
* \author Josef Soentgen
* \date 2022-05-12
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#ifdef __cplusplus
extern "C" {
#endif
struct task_struct;
extern struct task_struct *uplink_task_struct_ptr;
void uplink_init(void);
extern struct task_struct *socketcall_task_struct_ptr;
void socketcall_init(void);
#ifdef __cplusplus
}
#endif

View File

@ -22,6 +22,7 @@
#include <lx_kit/env.h>
/* local includes */
#include "lx_user.h"
#include "lx_socket_call.h"
#include "libc_errno.h"
@ -129,10 +130,6 @@ static int convert_errno_from_linux(int linux_errno)
static_assert((unsigned)Wifi::Msghdr::MAX_IOV_LEN == (unsigned)MAX_IOV_LEN);
extern "C" struct task_struct *lx_socket_call_task;
extern "C" void *lx_socket_call_task_args;
/* XXX move Wifi::Socket definition to better location */
struct Wifi::Socket
@ -410,7 +407,7 @@ class Lx::Socket
void _handle()
{
lx_emul_task_unblock(lx_socket_call_task);
lx_emul_task_unblock(socketcall_task_struct_ptr);
Lx_kit::env().scheduler.schedule();
}
@ -466,14 +463,12 @@ static Lx::Socket *_socket;
extern Genode::Blockade *wpa_blockade;
extern "C" void uplink_init(void);
extern "C" int run_lx_socket_call_task(void *)
extern "C" int socketcall_task_function(void *)
{
static Lx::Socket inst(Lx_kit::env().env.ep());
_socket = &inst;
uplink_init();
wpa_blockade->wakeup();
while (true) {
@ -490,7 +485,7 @@ void wifi_kick_socketcall()
/* ignore silently, the function might be called to before init */
if (!_socket) { return; }
lx_emul_task_unblock(lx_socket_call_task);
lx_emul_task_unblock(socketcall_task_struct_ptr);
Lx_kit::env().scheduler.schedule();
}

View File

@ -12,6 +12,8 @@
* version 2.
*/
#include "lx_user.h"
#include <linux/kthread.h>
#include <linux/netdevice.h>
#include <lx_user/init.h>

View File

@ -25,8 +25,8 @@
#include <lx_kit/init.h>
#include <lx_user/io.h>
extern "C" void lx_user_handle_io(void) { }
/* local includes */
#include "lx_user.h"
using namespace Genode;