Commit Graph

179 Commits

Author SHA1 Message Date
Josef Söntgen
d4e4b8bf60 driver/wifi: rework CTRL interface manager
This commit streamlines the interaction between the Wifi::Manager
and the wpa_supplicant's CTRL interface.

As user-facing changes it alters some default settings and introduces
new features:

* Every configured network now needs to explicitly have its
  'auto_connect' (to be considered an option for joining) attribute
  set to 'true' whereas this was previously the default value if the
  attribute was not set at all.

* The 'log_level' attribute is added and configures the supplicant's
  verbosity. Valid values correspond to levels used by the supplicant
  and are as follows 'excessive', 'msgdump', 'debug', 'info', 'warning'
  and 'error'. The default value is 'error' and configures the least
  amount of verbosity.

* The 'bgscan' attribute may be used to configure the way the
  supplicant performs background-scanning to steer or rather optimize
  roaming decision within the same network. The default value is set
  to 'simple:30:-70:600'. It can be disabled by specifying an empty
  value, e.g. 'bgscan=""'.

* The 'verbose_state' attribute was removed alltogether and similar
  functionality is now coverted by 'verbose' attribute.

Implementation-wise the internals changed significantly and are
outlined in the following paragraphs.

Formerly the interaction between the manager and the supplicant
was handled in an apparent way where the internal state of each
interaction was in plain sight. This made the flow cumbersome to
follow and therefor each interaction is now confined to its own
'Action' object that encapsulates the ping-pong of commands and
responses between the manager and the supplicant. All actions are
processed in an sequential way and thus there is no longer any
need to defer pending actions depending on the interal state of
the current interaction. Configuration changes as well as events
issued by the supplicant where new actions can be created are
handled in this fashion. Of note are both signal-handlers,
'_handle_cmds' and '_handle_events' respectively.

The state report, which provides the information about the current
state of connectivity to a given wireless network, was dealt with
in the same vein and its handling was spread across the manager
implementation. Again, to make it easier to follow, the generation
of the state report is now purely driven by the 'Join_state' object.
This object encapsulates the state of connectivity and is normally
updated by events issued from the supplicant (see '_handle_events').
It is also incorporated when handling command responses (see
'_handle_cmds').

Handling of timed-actions, like scan and signal quality
update requests, was done by setting a timeout at the Timer session
directly and thus only one timed-action could be pending at any time.
This excluded dealing with timed-actions like connected-scanning
and signal quality polling concurrently. This was changed and now
a One_shot_timeout is used to programm each concurrent timed-action.

For implementing the communication channel for the CTRL interface the
manager and supplicant use a shared memory buffer, the Msg_buffer.
Since the CTRL interface for Genode was implemented using C, some
shenanigans were performed to access the memory buffer. Now the
CTRL interface implementation uses C++ and only exports the functions
required by the supplicant as C. This simplifies the usage of the
Msg_buffer and allows for removing the global functions needed for
synchronizing the Msg_buffer access as those are now part of the
object itself via the 'Notify_interface'.

Fixes #5341.
2024-10-08 09:09:22 +02:00
Josef Söntgen
6b474e059c wpa_supplicant: update to version 2.11
Issue #5341.
2024-10-07 15:54:59 +02:00
Josef Söntgen
42dae6e570 lib/wifi: make errno conversion function public
The 'convert_errno_from_linux' function was already used internally to
convert the Linux errno values to the matching FreeBSD libc ones when
calling socket functions.

It will now also be used to convert the error values included in
netlink messages as those, naturally, also correspond to the Linux
ones.

Issue #5341.
2024-10-07 15:54:59 +02:00
Josef Söntgen
e363af476b pc_wifi: update to Linux 6.6.47
Issue #5264
2024-08-27 15:33:32 +02:00
Sebastian Sumpf
2014046f77 lxip: update to 6.6.47
Now, we schedule before unblocking the rx_task. This is done in order to
execute a potentially ready ksoftirqd before unblocking the rx_task,
which in turn may execute soft-interrupt handlers through bottom half
code leading to double lock attempts of the socket spinlock.

Issue #5264
2024-08-27 15:33:31 +02:00
Sebastian Sumpf
bb214af3eb virt_linux: update to 6.6.47
Issue #5264
2024-08-27 15:33:31 +02:00
Sebastian Sumpf
4a7a4cfac5 dde_linux: move linux.port to legacy_linux.port
This is prerequisite for the Linux update. All dependencies relying on
the 'linux' have been adjusted to use 'legacy_linux'.

Issue #5264
2024-08-27 15:33:31 +02:00
Christian Helmuth
044d8bca44 dde_linux: improve handling of IRQ masking and ack
Unmasking of a pending interrupt did not lead to immediate IRQ handler
execution in all cases.

This commit also addresses some style concerns risen during the issue
discussion.

- Replace multi-boolean IRQ state by state enum
- EOI and ACK should be same in DDE context
- Unify x86 and ARM irqchip.c
- Remove Pending_irq type
- Remove dde_irq_set_wake()

Fixes #5164
2024-08-27 15:26:51 +02:00
Christian Helmuth
a441bdf59a lx_emul: enable SLUB allocator (pc, virt)
The use of the Linux-internal SLUB allocator is supported by lx_emul and
drivers may now decide between the Linux implementation or our emulation
of kmem_cache. Drivers for pc and virt already use SLUB, while other
drivers still use the emulation and may be adapted step-by-step incl.
the testing on the devices.

Fixes #5236
2024-08-27 15:26:51 +02:00
Christian Helmuth
c0f6d9ba7e lx_emul: cache_line_size and cpufeature on arm64
Issue #5236
2024-08-27 15:24:20 +02:00
Christian Helmuth
791dd38160 wireguard: clean up build order/structure
- Move C++ sources from lib/wireguard to app/wireguard, which require
  Genode include paths (that conflict with linux)
- Rename lib/wireguard_lx_inc_dirs to lib/wireguard, which builds linux
  sources with linux include paths
2024-06-20 12:54:30 +02:00
Christian Helmuth
09ef478838 wireguard: cleanup jiffies symbol (alias to jiffies_64)
Issue #5236
2024-06-20 12:54:30 +02:00
Josef Söntgen
191306531c dde_linux: generate proper KBUILD_MODNAME
This commit remedies the somewhat lazy attempt to address unique names
for drivers where the name is directly derived from KBUILD_MODNAME,
e.g. rtlwifi, and also modifies the name accordingly to the rules
of Linux' build-system. The last part becomes necessary as driver
matching tables may rely on that as has already happend with the
ti-sn65dsi86 driver.
2024-06-20 12:54:30 +02:00
Sebastian Sumpf
b30bacf86e lxip: shadow asm-generic/access_ok.h
The IP stack checks "user" pointer access, for example, for iov's using
'access_ok' which in turn calls '__access_ok'. The function checks if the
pointer is below TASK_SIZE_MAX, which is usually a big value on 64 bit
systems, but 3GB on 32 bit systems. Because the IP stack is mostly used with
Genode's libc, where pointers on some kernels (base-linux) can be >3GB and we
don't want to make an additional copy of each buffer/iov interacting with the
IP stack, we short circuit the function

issue #5165
2024-04-12 15:02:45 +02:00
Norman Feske
1866520d6c dde_linux: build initcall_table.c after objects
The added hook 'OBJ_POSTPROC_SRC' gives us a way to post-process object
files for generating supplemental code. By using this hook, the
initcall_table.c generated by import-lx_emul_common.inc gets reliably
executed after all object files are built.

Fixes #5159
2024-04-12 15:00:44 +02:00
Norman Feske
891f933863 import-lx_emul_common.inc: don't use 'nm -U'
The option is used during the generation of initcall_table.c.
However, it happens to strip the first argument following the option.
The long option --defined-only works as expected.

Issue #5155
2024-04-12 15:00:44 +02:00
Sebastian Sumpf
ecd7b0568b lx_emul: adjust import to lx_kit remove
'src/include/spec/x86' does no longer exist

issue #5104
2024-02-26 08:59:09 +01:00
Sebastian Sumpf
8aa3967201 dde_linux: remove legacy_lxip
Because legacy_lxlip is the last entry in dde_linux.port, remove the
port as well.

issue #5104
2024-02-26 08:59:09 +01:00
Sebastian Sumpf
8755993123 dde_linux: remove vfs_legacy_lxip
issue #5104
2024-02-26 08:59:09 +01:00
Sebastian Sumpf
b6baf3fe1e dde_linux: remove 'import-usb_arch_include.mk'
This seems to be an artifact left over from the legacy USB drivers.

issue #5104
2024-02-26 08:59:09 +01:00
Christian Helmuth
6a94b8d153 Remove obsolete lx_kit_setjmp library
Issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
7e8661f8bf virt_linux: disable SMP for arm_v7 and change to tiny rcu
When SMP is enabled multicore specific instructions (e.g., pldw) are
generated. These are not supported and lead to invalid instruction
faults on uni-processor systems (like Cortex-A8). Therefore, we disable
SMP for arm_v7 in Linux code. This requires also a switch from the RCU
tree implementation to RCU tiny, which we shadow and dummy implemented.

issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
561a9e7a72 vfs_lxip: adapt to 'genode_socket' C-API
Adjust the plugin to use the socket C-API found under
dde_linux/src/lib/lxip/include/genode_c_api/socket.h'.

This is the first minor step in generalizing the plugin.

isse #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
701856b06a dde_linux: copy vfs_lxip -> vfs_legacy_lxip
Make a copy of vfs_lxip so it can be revived easily. The plugin can now
be used like

! <legacy_lxip dhcp="yes"/>

issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
42d9640443 lxip: update to Linux 6.1.20
This commit updates lxip from version 4.4.3 to 6.1.20. It uses the
current lx_kit approach and is a shared library again. The stack has
been tested for x86_32/x86_64/arm_v6/arm_v7/arm_8.

The C-interface of the IP stack can be found under
lxip/include/genode_c_api/socket.h.

issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
5dc4ee6524 wireguard: adjust to virt_linux config changes
* remove dummies for '__alloc_pages'
* adjust arm_64 -> arm_v8
* remove IPv6 dummies (disabled in virt_linux)

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
7395f24423 virt_lx_emul: add shadow 'page_alloc.c'
Add suspport for '__alloc_pages' in virt_linux

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
360d38c36d dde_linux: move lxip -> legacy_lxip
move lxip stack to 'legacy_lxip' so it can be revived easily.

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
f19cd8416e lx_kit: split includes and setjmp into arm_v(6|7|8)
Move 'arch_execute.h' headers and 'setjmp/longjmp' implementation from
arm/arm_64 to arm_v(6|7|8).

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
d191c376f7 dde_linux: add libnl for arm_v6
This was covered before by SPEC 'arm'.
2024-02-26 08:31:06 +01:00
Sebastian Sumpf
1b4f7ae0d3 lx_emul: generate initcalls during build
Functions registered with 'module_init' (i.e., '__define_initcalls'),
'OF_DECLARE', and 'DECLARE_PCI_FIXUP_CLASS_FINAL' used to be static
constructors and had be explicitly registered using
'exec_static_constructors' before executing any Linux code.

With this commit we remove the constructor attributes from these
functions and create a global function pointer in the form of

__initptr_<name>_<id>_<counter>_<line number of macro>

'import-lx_emul_common.inc' will collect these '__initptr' symbols after
the compile step and generate a 'lx_emul_register_initcalls' function
that executes the functions pointed to. This step is now automatically
performed in 'lx_emul_start_kernel'. This way a call to
'exec_static_constructors' can be omitted in case there are no other
constructors in place.

issue #5096
2024-02-26 08:31:05 +01:00
Sebastian Sumpf
f9bff3bc7c dde_linux: remove library mk for usb_host_include
This library does not exist anymore.

issue #5095
2024-02-26 08:31:05 +01:00
Sebastian Sumpf
a67bc59686 virt_linux: add arm_v6
also split into arm_v(6|7|8)

issue #5095
2024-02-26 08:31:05 +01:00
Sebastian Sumpf
bb06e8451a dde_linux: split lib/mk into arm_v6/7/8
Split 'arm' and 'arm_64' into 'arm_v(6|7|8)'

issue #5095
2024-02-26 08:31:05 +01:00
Christian Helmuth
b80fd10a70 wireguard: don't shadow lx_emul memory backend
Issue #4809
2023-12-13 12:33:05 +01:00
Christian Helmuth
1e7116fcc1 lx_emul: manage page structs per buffer range
The management of Linux page structs is now tied to the life time of DMA
buffers. Thus, page structs are created when a buffer is allocated and
deallocated only when a buffer is freed - not on lx_emul_mem_free()
because DMA buffers are cached. Page struct refcounting was entirely
reworked in lx_emul/shadow/mm/page_alloc.c.

Fixes #4809
2023-12-13 12:33:05 +01:00
Pirmin Duss
37a7119eb3 wireguard: initialize timekeeping with RTC
This commit fixes the "Invalid handshake initiation" error when the
client restarts.

Fixes genodelabs/genode#4957
2023-11-28 14:24:23 +01:00
Pirmin Duss
f66a7db87f lx_emul: allow setup of the persistent clock
This commit adds support to initialize the timekeeping for
the Linux subsystem with the value from the RTC.

Only the seconds part of timespec64 is supported.

Issue genodelabs/genode#4957
2023-11-28 14:24:23 +01:00
Sebastian Sumpf
798fb709a2 dde_linux: remove usb_modem driver
The driver is superseded by the USB network driver (usb_net) which also
contains MBIM support for LTE modems previously provided by this
driver.

issue #4958
2023-09-29 12:17:45 +02:00
Sebastian Sumpf
7e823f7c19 dde_linux: remove legacy_usb_net
issue #4958
2023-09-29 12:17:45 +02:00
Sebastian Sumpf
cd2910eb2c dde_linux: remove usb_hid_legacy
issue #4958
2023-09-29 12:17:45 +02:00
Sebastian Sumpf
f4d7455a9f recipe: wireguard use virt_linux api
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
5bce4dac81 recipe: virt_linux api
for x86_32, x86_64, arm, arm_64

issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
d27e0a8fe6 virt_lx_emul: add shadow 'vmalloc.c'
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
22231c0604 virt_lx_emul: adjust dummies for usb_hid/net
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
71c32f2923 virt_linux: add init calls for USB HID/NET
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
9a6423b4ef dde_linux: move usb_net -> legacy_usb_net
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
8f34c27ca5 dde_linux: move usb_hid -> usb_hid_legacy
issue #4958
2023-09-29 12:15:05 +02:00
Josef Söntgen
dd1b8a106f drivers/wifi: perform multi-staged construction
Since the wireless LAN driver is actually a 'Libc::Component' due to
its incorporation of the 'wpa_spplicant' application, we have to
intercept its construction because we have to initialize the Lx_kit
environment before any static ctors are executed. Most Linux initcalls
are implemented as ctors that will be otherwise implicitly executed
before the controll is given to us in 'Libc::Component::construct'.

Issue #4927.
2023-07-14 12:06:32 +02:00
Josef Söntgen
fc24ffcdb8 wifi: use mac address reporter
Remove the handcrafted MAC address reporter in favour the Genode
C API utility (cf. #4918).

Issue #4927
Issue #4918
2023-07-14 12:06:32 +02:00