Commit Graph

19311 Commits

Author SHA1 Message Date
Martin Koehler 22a615b3e6 usb: cdc_acm: Fix tx false data drop logging
cdc_acm_fifo_fill() logged warnings about dropped data
when they in fact just couldn't be sent (due to connection
of filled buffer). Not being able to send (all) data is
a valid behaviour and data isn't dropped. Return value
shows how many data was accepted (which can be zero).

Logging will now instead only inform data can't be sent
due to the respective issue (connection not ready/ buffer full).

Signed-off-by: Martin Koehler <koehler@metratec.com>
2024-09-09 15:24:37 +03:00
Johan Hedberg 131a11e61e Bluetooth: Host: Add decoding for Bluetooth HCI version 6.0
Add decoding for version 6.0, now that the new core specification has been
released.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-09-09 15:23:25 +03:00
Johan Hedberg ceedf72c51 Bluetooth: shell: Use common HCI version decode function
There's a generally available bt_hci_get_ver_str() function, so use that
instead of defining our own.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-09-09 15:23:25 +03:00
Jukka Rissanen da97542a6e net: dhcpv6: Do not wait forever when allocating net_pkt
As the allocation is run in system workqueue context, it can
cause problems if waiting forever when allocating net_pkt.

Fixes #77935

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-09 09:28:21 +02:00
Jukka Rissanen 254e757539 net: dhcpv4: Do not wait forever when allocating net_pkt
As the allocation is run in system workqueue context, it can
cause problems if waiting forever when allocating net_pkt.

Fixes #77935

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-09 09:28:21 +02:00
Henrik Brix Andersen 159f7dbbb1 lib: net_buf: rename header file from zephyr/net/buf.h to zephyr/net_buf.h
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.

Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Henrik Brix Andersen ced80b13bf lib: net_buf: move the network buffer implementation to lib
Move the net_buf implementation from the networking subsystem to a library
as they have no dependency on the networking subsystem.

Network buffers are used in subsystems outside of networking
(e.g. Bluetooth, USB).

Fixes: #36374

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Jukka Rissanen 36137bc8cc net: vlan: Fix RX debug print
The interface index and tag prints were swapped.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 18:01:15 -04:00
Jukka Rissanen 25301ace0e net: virtual: Pass status to caller when starting/stopping interface
When virtual interface is being started or stopped so when the
interface is brought up or down, check the return code and pass
it to net_if_up() or net_if_down() calls.
This helps to avoid printing success status even if the interface
up/down failed at the virtual interface level.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 18:01:15 -04:00
Jukka Rissanen 6986b1ef71 net: bridge: Overhaul the code to use virtual interfaces
The legacy bridging code prevented normal IP traffic to the
bridged Ethernet interfaces. This is not intuitive and differs
how bridging setup works in Linux. This commit changes that and
creates a separate virtual interface that is doing the actual
bridging. This enables the bridged Ethernet interfaces to work
normally and provide IP connectivity.

How this works in practice:

* User needs to enable CONFIG_NET_ETHERNET_BRIDGE
* User needs to have a device with more than one Ethernet
  interface
* After booting, the net-shell or program API can be used
  to add interfaces to the bridge like this.
     net bridge addif 1 3 2
  where the 1 is the bridge interface index and
  2 and 3 are the Ethernet interface indices.
* The bridging is then finally enabled / started when the
  bridge interface 1 is taken up
     net iface up 1
* If bridged interfaces are removed from the bridge (minimum
  of two interfaces are needed there), then the bridging is
  disabled automatically. The bridge interface stays up in
  this case and can be taken down manually.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 18:01:15 -04:00
Krzysztof Chruściński adcb13d293 logging: log_frontend_stmesp: Add support for standalone mode
Add support for standalone mode where data written to STMESP is
decoded on chip to a human-readable strings.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:27 -04:00
Krzysztof Chruściński 5b26b21bad logging: Add demultiplexer for log_frontend_stmesp
Add module which demultiplexes stream of log message which are
encoded into STPv2 stream by log_frontend_stmesp. There are 3 types of
messages that can be present in the stream:
- Log message (starts with DMTS32, followed by Dx and closed by FLAG)
- Tracepoint (FLAGTS or DMTS32)
- STM HW event (DMTS8 on 0x80 master and 0x00 channel)

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:27 -04:00
Krzysztof Chruściński 89ef8a097b logging: Add Coresight STMESP dictionary-based frontend
Add frontend which is using Coresight STMESP for dictionary based
logging.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:27 -04:00
Krzysztof Chruściński 0fdf13c85c logging: Move frontends to the dedicated directory
As there are more frontends coming in the future move existing
frontend to the dedicated directory (like backends).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:27 -04:00
Krzysztof Chruściński fc162f74c0 debug: mipi_stp_decoder: Align naming to 2.4 standard
Align naming to STP v2.4. Changing Master to Major.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:27 -04:00
Krzysztof Chruściński dd38a2ccde logging: Fix string stripping Kconfig option dependency
Change to depend on LOG_DICTIONARY_DB which is broader than
LOG_DICTIONARY_SUPPORT which is set only when log_output
supports dictionary mode. However, it is possible that
log_output is not used when dictionary mode is used. Database
generation is always enabled when dictionary mode is used.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:27 -04:00
Adam Kondraciuk be523ad396 arch: arm: cortex_m: pm_s2ram: Minor typo fix
Fix typo in `PM_S2RAM_CUSTOM_MARKING` description.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2024-09-06 11:29:06 -04:00
Matt Rodgers 0c8bdbc45d net: lib: http_server: allow application to access request headers
Allow application to register certain HTTP request headers to be stored
by the server. These stored headers can then be accessed from a dynamic
resource callback.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-06 11:27:37 -04:00
Luca Burelli af302cd5fe llext: add bringup, teardown, and bootstrap APIs
llext_bringup() and llext_teardown() are intended to be used to call the
extension's own initialization and cleanup functions, respectively. They
are meant to be called by the developer after loading an extension and
before unloading it. The list of function pointers to be called is
obtained via the new llext_get_fn_table() syscall, so that they are
compatible with user mode.

llext_bootstrap() is intended to be used as the entry point for a thread
created to run an extension, in either user or kernel contexts. It will
call the extension's own initialization functions and then an additional
entry point in the same context (if desired). The same function can also
be called directly in the main thread, if only initialization is
required.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-09-06 11:27:15 -04:00
Luca Burelli 04d7e4f490 llext: add support for ELF init/fini arrays
Load the .preinit_array, .init_array and .fini_array sections in ELF
files. These sections are arrays of function pointers that are filled by
the compiler with the addresses of functions that need to be called at
startup or termination by the loader, such as C++ constructors and
destructors.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-09-06 11:27:15 -04:00
Vinayak Kariappa Chettimada 34b6b3d9eb Bluetooth: Controller: Support FAKE_ENTROPY_NATIVE_POSIX
Add support for use of FAKE_ENTROPY_NATIVE_POSIX as entropy
driver for the Controller on BOARD_NRF54L15BSIM.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-06 11:26:19 -04:00
Adam Wojasinski 420891cedb llext: Add shell command for loading LLEXT from a filesystem
This patch extends LLEXT shell commands with support for loading
LLEXT from a filesystem. Use of the command requires absolute path
to the llext file.

Example use:
`llext load_llext hello_world /lfs/hello_world.llext`

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-09-06 11:26:09 -04:00
Adam Wojasinski fc114e85dd llext: Add filesystem based extension loader
Added loader allowing to load extensions stored in a filesystem.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-09-06 11:26:09 -04:00
Adam Wojasinski 93ffeced6a llext: Add new methods to loader API
Introducing `llext_prepare()` and `llext_finalize()` APIs
that are invoked and the beginning and the end of the `llext_load()`
function.

The purpose of these functions is to bring possibility of initializing
loader before it is used and uninitialize or clean up when
it is no longer needed. Both functions are optional.

The buffer loader has been aligned to methods introduced in the patch.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-09-06 11:26:09 -04:00
Nicolas Pitre b5addc808a llext: adjust memory permissions on MMU systems
By default, normal memory is set readable+writable and not executable.
Adjust those permissions according to each region:

	LLEXT_MEM_TEXT                  --> K_MEM_PERM_EXEC
	LLEXT_MEM_DATA, LLEXT_MEM_BSS   --> K_MEM_PERM_RW
	LLEXT_MEM_RODATA                --> K_MEM_PERM_RO aka 0

This must be done only at the end of an LLEXT load operation as memory
needs to remain RW for reloc processing, etc.

And while at it, flush/invalidate the cache accordingly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-09-06 11:25:54 -04:00
Luca Arato 13eb7a1ee2 net: config: Fix sntp clock init Kconfig depends
Changed NET_CONFIG_CLOCK_SNTP_INIT depends on to require
POSIX_TIMERS instead of the deprecated POSIX_CLOCK

Signed-off-by: Luca Arato <luca.arato@secomind.com>
2024-09-06 10:01:22 -05:00
Jukka Rissanen 5480960fcf net: http_server: Turn off V6ONLY if IPv4-to-IPv6 mapping is enabled
Without this it is not possible to serve both IPv6 and IPv4
connections if service host is NULL.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 09:58:50 -05:00
Jukka Rissanen 3949873886 net: http_server: Allow service to be created with NULL host
Allow NULL host parameter when creating HTTP service. This means
that the socket is created without specifying binding address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 09:58:50 -05:00
Emil Gydesen fcdfdae95b Bluetooth: Audio: Add to_str functions for some assigned numbers
Add to_str functions for context, parental rating, active state,
codec cap freq, codec cap frame duration,
codec cap channel count and location.

The remaining values are just numeric values and does not
need a to_str function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 17:02:41 -04:00
Emil Gydesen 8f76cdd891 Bluetooth: TBS: Fix issues with lookup_inst_by_uri_scheme
The function took the uri as a `char *` but is in fact
not a null terminated string so change the type to uint8_t *.

Add a check fro uri_len == 0 before doing uri_len - 1

Changed the found check to just check the first octet rather
than the more costly strlen.

Fixed the type of the iterator

Add a break in the loop as we only need to find one ":"

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:51:44 -05:00
Fin Maaß fae1fe8c1f shell: kernel: do a cold reboot by standard
do a cold reboot by default if no option is provided
for `kernel reboot`, instead of requiring to
type `kernel reboot cold`.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-09-05 11:33:22 -05:00
Vinayak Kariappa Chettimada 2eafc826e3 Bluetooth: Host: Fix unable to start scanning after scan param failure
Fix scan_update() implementation for missing flags clear
that prevented starting scanning after previous attempt to
start failed due to parameters being rejected by the
Controller.

Example, attempting to start coded PHY scanning with a
Controller implementation that does not support it can fail,
but attempting again without coded PHY scanning should
succeed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-05 12:25:17 +01:00
Emil Gydesen 57b35e1047 Bluetooth: TBS: Allow multiple callbacks for client
The TBS client callbacks are just informative so we
provide the information to multiple listeners.

To support this for the long strings, the function
handle_string_long_read was refactored.

This also allows for multiple users of the TBS client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:47 +01:00
Emil Gydesen 94e548120b Bluetooth: BAP: SD: Added missing bad code when using mod_src
When the encrypt state was changed via
bt_bap_scan_delegator_mod_src then we didn't set the bad
broadcast code correctly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:34 +01:00
Emil Gydesen c49a058b9b Bluetooth: TBS: Fix type of uri in call_alloc
The function had marked the type as char *, but it was in fact
not a string but rather a uint8_t array.

Marked the type properly and added a cast when using it with
bt_tbs_remote_incoming.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:25 +01:00
Emil Gydesen f500f7c22f Bluetooth: CAP: Fix dependency on BT_BAP_STREAM
The CAP commander used bt_audio_valid_ltv which required
BT_BAP_STREAM to be enabled, but the CAP Commander does not
need BT_BAP_STREAM to be enabled.

Moved the function to audio.c which is always compiled for
the CAP Commander, thus removing the requirement for
BT_BAP_STREAM and the accompanying bt_bap_stream.c file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:16 +01:00
Emil Gydesen fff9c326c6 Bluetooth: TBS: Add UTF8 requirement to Kconfigs
The UTF8 implementions for both client and server
both use the utf8 API which require CONFIG_UTF8.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:07 +01:00
Emil Gydesen b250754f5b Bluetooth: TBS: Fix type of uri in bt_tbs_valid_uri
The function had marked the type as char *, but it was in fact
not a string but rather a uint8_t array.

Marked the type properly and added a cast when using it with
strings.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:23:24 +01:00
Emil Gydesen c37a48acbc Bluetooth: CAP: Revert order of CAP stream callbacks
Modify the CAP stream callbacks so that the application
callbacks are called before the CAP initiator.

This allows the application to abort/cancel a procedure
before we send out any future request.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 09:50:01 +02:00
Xudong Zheng 30c96a9943 logging: fix color for shell log backend
This allows CONFIG_LOG_BACKEND_SHOW_COLOR to be configured when logging
to shell.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2024-09-04 19:07:27 -04:00
Jordan Yates 652839aee0 mgmt: mcumgr: os_mgmt: fix millisecond return
Ensure that leading zeros are present in the milliseconds field,
otherwise a milliseconds count of 35 will appear as x.35, i.e. 350
milliseconds. With this fix, it will appear as x.035.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-04 07:22:05 -04:00
Attie Grande e6dc930322 bindesc: Add support for the build version values
This patch adds bindesc support for the build version values for the
kernel and application - BUILD_VERSION and APP_BUILD_VERSION.

The kernel's BUILD_VERSION can be overridden at build time.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2024-09-04 07:03:47 -04:00
Stine Åkredalen c89bca6f3f Bluetooth: Mesh: Logic fix for recvd unseg msgs
Fixed transport layer logic causing excessive processing of
some unsegmented messages

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2024-09-04 06:54:10 -04:00
Jordan Yates 1ed77cb50c zbus: remove unneeded `const` qualifiers
Remove `const` qualifiers on fields in structures that are only created
or instantiated as `const`.

This if primarily for consistency, in the same way that `struct device`
fields and `device->config` struct fields are not additionally marked as
`const`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-04 12:52:01 +02:00
Andrej Trnkóci 9ac8786bb2 fs: nvs: fix nvs static analysis error
There is asignment from size_t variable to uint8_t variable in
nvs_al_size function that can trigger static analysis error.
The problem is fixed by changing the variable to size_t type
instead of uint8_t.

Signed-off-by: Andrej Trnkóci <andrej.trnkoci@nxp.com>
2024-09-04 12:51:14 +02:00
Krzysztof Chruściński 5ac99428ea shell: backends: rtt: Set panic_mode flag
A bug was introduced when fb17d0e365 introduced host presence detection.
Panic_mode flag was added which indicates that RTT should work in
synchronous, blocking mode but it was not set when backend was switched
to panic mode.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-04 09:54:39 +02:00
Emil Gydesen b5ff2cc667 Bluetooth: AICS: Replace bools with atomic
Replace several bools in bt_aics_client with an atomic value.
Update how these values are modified so that we can better
prevent race conditions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-04 09:54:05 +02:00
Maciej Panek 532b279ef0 net: l2: ethernet: check if the dev->api not NULL
adds a check for Ethernet driver's API not being NULL
in ethernet_mcast_monitor_cb

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Maciej Panek a452aa5763 net: l2: ethernet: check if the dev->api->send method not NULL
adds a check for "send" method in Ethernet driver's API
not being NULL in ethernet_send

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Maciej Panek 62df6108c7 net: l2: ethernet: check if the dev->api->get_capabilities method not NULL
Adds missing checks for get_capabilities method not being NULL.
Fixes crash with netusb and possibly other drivers.

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00