mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 01:08:55 +00:00
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:
committed by
Christian Helmuth
parent
0cffda3cfe
commit
913aec1667
@ -17,6 +17,7 @@ SRC_CC += time.cc
|
|||||||
|
|
||||||
SRC_C += dummies.c
|
SRC_C += dummies.c
|
||||||
SRC_C += lx_emul.c
|
SRC_C += lx_emul.c
|
||||||
|
SRC_C += lx_user.c
|
||||||
SRC_C += uplink.c
|
SRC_C += uplink.c
|
||||||
|
|
||||||
CC_OPT_lx_socket_call += -DKBUILD_MODNAME='"lx_socket_call"'
|
CC_OPT_lx_socket_call += -DKBUILD_MODNAME='"lx_socket_call"'
|
||||||
|
@ -13,26 +13,25 @@
|
|||||||
|
|
||||||
/* DDE Linux includes */
|
/* DDE Linux includes */
|
||||||
#include "lx_socket_call.h"
|
#include "lx_socket_call.h"
|
||||||
|
#include "lx_user.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <linux/socket.h>
|
#include <linux/socket.h>
|
||||||
#include <linux/net.h>
|
#include <linux/net.h>
|
||||||
#include <net/sock.h>
|
#include <net/sock.h>
|
||||||
|
|
||||||
|
struct task_struct *socketcall_task_struct_ptr;
|
||||||
struct task_struct *lx_socket_call_task;
|
extern int socketcall_task_function(void *p);
|
||||||
void *lx_socket_call_task_args;
|
|
||||||
extern int run_lx_socket_call_task(void *p);
|
|
||||||
|
|
||||||
|
|
||||||
extern struct net init_net;
|
extern struct net init_net;
|
||||||
|
|
||||||
void lx_user_init(void)
|
|
||||||
|
void socketcall_init(void)
|
||||||
{
|
{
|
||||||
int pid = kernel_thread(run_lx_socket_call_task,
|
int pid = kernel_thread(socketcall_task_function,
|
||||||
lx_socket_call_task_args,
|
NULL,
|
||||||
CLONE_FS | CLONE_FILES);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
28
repos/pc/src/lib/wifi/lx_user.c
Normal file
28
repos/pc/src/lib/wifi/lx_user.c
Normal 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) { }
|
28
repos/pc/src/lib/wifi/lx_user.h
Normal file
28
repos/pc/src/lib/wifi/lx_user.h
Normal 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
|
@ -22,6 +22,7 @@
|
|||||||
#include <lx_kit/env.h>
|
#include <lx_kit/env.h>
|
||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
|
#include "lx_user.h"
|
||||||
#include "lx_socket_call.h"
|
#include "lx_socket_call.h"
|
||||||
#include "libc_errno.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);
|
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 */
|
/* XXX move Wifi::Socket definition to better location */
|
||||||
struct Wifi::Socket
|
struct Wifi::Socket
|
||||||
@ -410,7 +407,7 @@ class Lx::Socket
|
|||||||
|
|
||||||
void _handle()
|
void _handle()
|
||||||
{
|
{
|
||||||
lx_emul_task_unblock(lx_socket_call_task);
|
lx_emul_task_unblock(socketcall_task_struct_ptr);
|
||||||
Lx_kit::env().scheduler.schedule();
|
Lx_kit::env().scheduler.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,14 +463,12 @@ static Lx::Socket *_socket;
|
|||||||
|
|
||||||
|
|
||||||
extern Genode::Blockade *wpa_blockade;
|
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());
|
static Lx::Socket inst(Lx_kit::env().env.ep());
|
||||||
_socket = &inst;
|
_socket = &inst;
|
||||||
|
|
||||||
uplink_init();
|
|
||||||
wpa_blockade->wakeup();
|
wpa_blockade->wakeup();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -490,7 +485,7 @@ void wifi_kick_socketcall()
|
|||||||
/* ignore silently, the function might be called to before init */
|
/* ignore silently, the function might be called to before init */
|
||||||
if (!_socket) { return; }
|
if (!_socket) { return; }
|
||||||
|
|
||||||
lx_emul_task_unblock(lx_socket_call_task);
|
lx_emul_task_unblock(socketcall_task_struct_ptr);
|
||||||
Lx_kit::env().scheduler.schedule();
|
Lx_kit::env().scheduler.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
* version 2.
|
* version 2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lx_user.h"
|
||||||
|
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
#include <lx_user/init.h>
|
#include <lx_user/init.h>
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include <lx_kit/init.h>
|
#include <lx_kit/init.h>
|
||||||
#include <lx_user/io.h>
|
#include <lx_user/io.h>
|
||||||
|
|
||||||
|
/* local includes */
|
||||||
extern "C" void lx_user_handle_io(void) { }
|
#include "lx_user.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
Reference in New Issue
Block a user