Commit graph

22,555 commits

Author SHA1 Message Date
Robert Lubos
565a489fa9 net: tc: Ensure TC queueing works from ISR
Queueing packets should be possible from the ISR context, recent changes
prevented that. Therefore add extra checks in
net_tc_submit_to_tx/rx_queue() to make them ISR friendly again.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-24 15:36:32 +00:00
Adib Taraben
96526796d9 ptp: clock.c: revise offset calculation
cast differences to signed int to allow
negative numbers

Signed-off-by: Adib Taraben <theadib@gmail.com>
2025-02-21 18:35:34 +00:00
Ludvig Jordet
0460c9fdae Bluetooth: Mesh: Update Kconfig help about Mesh on System WQ
This updates the help text for the Kconfig option BT_MESH_WORKQ_SYS to
take into account the change made in PR #84282 which causes the host to
no longer return -ENOBUFS. Since the mesh will now instead block the
work queue, a note has been added about a potential consequence of this.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-02-21 18:02:50 +00:00
Vinayak Kariappa Chettimada
d382fca6ff Bluetooth: Controller: Fix HCI command buffer allocation failure
Fix HCI command buffer allocation failure, that can cause
loss of Host Number of Completed Packets command.

Fail by rejecting the HCI Host Buffer Size command if the
required number of HCI command buffers are not allocated in
the Controller implementation.

When Controller to Host data flow control is supported in
the Controller only build, ensure that BT_BUF_CMD_TX_COUNT
is greater than or equal to (BT_BUF_RX_COUNT + Ncmd),
where Ncmd is supported maximum Num_HCI_Command_Packets in
the Controller implementation.

Relates to commit 81614307e9 ("Bluetooth: Add workaround
for no command buffer available")'.

Relates to commit 297f4f481f ("Bluetooth: Split HCI
command & event buffers to two pools").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-21 11:30:38 +00:00
Vinayak Kariappa Chettimada
cc1b53445c Bluetooth: Host: Remove nested allocation of HCI command buffer
Remove nested allocation of HCI command buffer so that one
less HCI command buffer is needed starting extended
advertising with privacy enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-21 11:30:38 +00:00
Riadh Ghaddab
5f7cda5e06 fs: zms: multiple style fixes from previous PR review
This resolves some addressed comments in this PR zephyrproject-rtos#77930
as well as this PR zephyrproject-rtos#80407

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-02-21 11:29:50 +00:00
Tom Hughes
9838a03ad7 net: l2: ethernet: Fix unused function warning
Building with clang warns:

subsys/net/l2/ethernet/ethernet.c:178:18: error: unused function
'ethernet_check_ipv4_bcast_addr' [-Werror,-Wunused-function]
enum net_verdict ethernet_check_ipv4_bcast_addr(struct net_pkt *pkt,
                 ^

ethernet_check_ipv4_bcast_addr is called by ethernet_ip_recv, which only
exists when CONFIG_NET_IPV4 or CONFIG_NET_IPV6 is defined.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-21 04:46:26 +01:00
Tom Hughes
4aefbbe3a9 debug: gdbstub: Re-enable warning
The warning no longer seems to be needed. CI passes without it.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-21 04:46:12 +01:00
Jukka Rissanen
9ba79f009b net: arp: Fix ARP protocol handler to not use Ethernet hdr directly
The ARP protocol handler cannot directly access the Ethernet header
because the caller has removed the header already when the handler
is called. So change net_arp_input() and pass source and destination
MAC address there instead of bogus pointer that was pointing to ARP
header instead of Ethernet header. This requires changes to ARP tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-02-20 21:04:44 +01:00
Jens Rehhoff Thomsen
c44334374e Bluetooth: host: Fix bug in scan start
When scanning is started on bt_bap_broadcast_assistant_scan_start then
BAP_BA_FLAG_SCANNING flag for the broadcast assistant instance should
not be cleared.

Fixes #85937

Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
2025-02-20 14:55:56 +00:00
Zihao Gao
7e18f8060a Bluetooth: Shell: fix assert when print address.
This patch fix the assertion caused by null address pointer
that occurs when BR/EDR pairing completed.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2025-02-20 11:47:39 +01:00
Tom Hughes
74f6f7f94c tests: kernel: interrupt: Remove MS_TO_US
No files use MS_TO_US except tests/kernel/interrupt/src/nested_irq.c.
While the macro is convenient, we should put it in a more central
location and use it everywhere if we want to use it rather than just in
interrupt_util.h. For now, remove it and replace the two usages to match
how code is written in the rest of Zephyr.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-20 06:05:37 +01:00
Maochen Wang
2b2915bd98 net: ip: Fix low Zperf UDP throughput with -a
When run the Zperf UDP throughput with '-a' (Asynchronous call),
zperf_work_q thread will generate and send the packets to tx_q thread.
When zperf_work_q and tx_q threads have same priority, if zperf_work_q
fails to take the semaphore of fifo_slot, it will not wait and directly
drop the net_pkt. Then it will allocate new net_pkt, repeat, and always
occupy the CPU, which leads to extreme low throughput.
For TX, when take the semaphore of fifo_slot, setting a wait time of
K_FOREVER to let other thread to process and free these packets.
For RX, when failed to take the semaphore of fifo_slot, yield the CPU
to let the thread of data path with same priority to run to reduce
dropping packets.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-02-19 18:49:13 +01:00
Robert Lubos
008a7ca202 net: if: Setup DAD timer regardless of DAD query result
In rare occasions when sending DAD NS packet fails, we should still
setup the DAD timer, unless we implement some kind of more advanced
retry mechanism. If we don't do that, the IPv6 address added to the
interface will never be usable in such cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-19 18:48:52 +01:00
Robert Lubos
a09fd8e97f net: if: Clear neighbor cache when removing IPv6 addr with active DAD
DAD creates an entry in the neighbor cache for the queried (own)
address. In case the address is removed from the interface while DAD is
still incomplete, we need to remove the corresponding cache entry (just
like in case of DAD timeout) to avoid stale entries in the cache.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-19 18:48:52 +01:00
Benjamin Cabé
cc3fd97db0 net: ipv6: use inclusive terminology in net_ipv6_pe_filter_cb_t
Minor fix to use inclusive terminology for the is_blacklist flag.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-19 18:48:15 +01:00
Nick Brook
d0d3dd476b mgmt/mcumgr: Add error logs for all error cases
Errors were logged for some cases in zephyr_img_mgmt.c, but not all.
This commit adds error logs for all error cases.

Signed-off-by: Nick Brook <nrbrook@gmail.com>
2025-02-19 14:49:37 +00:00
Pavel Vasilyev
9757ffa5fa bluetooth: host: smp: fix deadlock when public key generation fails
When `bt_le_oob_get_local` or `bt_le_ext_adv_oob_get_local` is called
and SMP is enabled, `bt_smp_le_oob_generate_sc_data` is called to
generate a Random Number and a Confirmation Value needed for OOB data.
These values are based on the device's public key.

The public key is generated only once when `bt_smp_init` is called.
If public key generation fails, the callback passed to `bt_pub_key_get`
is called with `pkey` set to NULL. The `bt_smp_pkey_ready` callback
gets called, but it doesn't release the `sc_local_pkey_ready` semaphore
thus leaving `bt_smp_le_oob_generate_sc_data` wait for semaphore with
`K_FOREVER`.

This commit replaces the semaphore with a conditional variable and
requests a public key again if the key is NULL thus solving 2 issues:
- handling the case where the callback was triggered notifying about the
  completion of the public key request, but the key was not generated,
- handling the case where multiple threads trying to acquire the same
  sempahore.

The timeout is used instead of K_FOREVER to avoid cases when callback
has never been triggered.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-02-18 18:44:23 +01:00
Robert Lubos
7ccf870670 net: coap_client: Stop all socket activities when cancelling requests
Calling coap_client_cancel_requests() clears the internal request
context only for active requests (i. e. not replied yet). However,
if there are any pending request context monitoring ACK duplicates,
those would still make the corresponding client socket being monitored
by poll(). In result, when application closes the socket, the polling
thread will throw POLLNVAL error for the socket.

Fix this, by resetting all request contexts unconditionally. The request
callback will only be called for the active requests.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-18 13:31:15 +01:00
Lyle Zhu
3f81e81598 Bluetooth: AVDTP: Fix memory leak issue
In function `avdtp_send`, there is case that if the session->req is not
NULL, then the buf will be lost.

Release the allocated buffer by buffer allocated function when the buf
is failed to send.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-02-18 13:30:53 +01:00
Luis Ubieda
2ce2794987 rtio: workq: Select Early P4WQ threads init
Otherwise the RTIO Workqueue is not functional for devices during init.

An example of this issue is devices using SPI transfers with default
spi_rtio.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-02-18 05:32:58 +01:00
Emil Gydesen
1280f432f4 Bluetooth: ASCS: Missing cleanup of stream for idle state
When the stream enters the idle state, some values were not
properly reset (e.g. the stream->ep).

Use the bt_bap_stream_detach function to clean up the stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-17 21:16:10 +01:00
Vinayak Kariappa Chettimada
dcdd330895 Bluetooth: Controller: Fix redundant reset of sync aux association
Remove redundant reset of LLL sync aux context association.

Related to commit 3263729020 ("Bluetooth: Controller: Fix
assertion terminating Periodic Sync").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-17 15:47:36 +00:00
Vinayak Kariappa Chettimada
49642efa41 Bluetooth: Controller: Fix regression in scan aux release
Fix regression in scan aux release now that aux context is
retrieved from the node rx when supporting multiple chain
reception.

Relates to commit a8065926ac ("Bluetooth: Controller: Fix
to release aux context stored in node rx").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-17 15:47:36 +00:00
Aleksandr Khromykh
acc752fce4 Bluetooth: Mesh: remove weak attribute and rename functions
Commit removes weak attribute and renames some functions
in crypto_psa.c since there is no centralized distribution
of the PSA key ID in bsim tests and no necessity to
reimplement native mesh approach.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-02-17 08:09:28 +01:00
Emil Gydesen
94d5d59be7 Bluetooth: AICS: Fix check for BT_AICS_INPUT_TYPE
The check did not take the highest value into account.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-15 07:23:37 +01:00
Krzysztof Chruściński
d23e12ac45 logging: backends: rtt: Do not enable when shell logging is used
Typically, when shell logging backend is used user wants to get
logs on shell instances so do not enable raw RTT log backend in
that case. When raw backend is enabled then initial logs go to
RTT backend and they are not visible on shell which starts later
as it requires additional thread.

It can be assumed that when RTT backend is used it will be
explicitly enabled by the user.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-02-14 19:40:23 +00:00
Rex Chen
a296b4968b net: wifi: L2 shell cmd 11v BTM query support embedded supplicant
Remove the CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM macro in L2 shell level
to make 11v BTM query support embedded supplicant.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2025-02-14 19:40:09 +00:00
Emil Gydesen
907261b619 Bluetooth: BAP: Remove GATT_CACHING req for unicast server
The unicast server does not need GATT caching and it was likely
incorrectly added earlier as a dependency.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 19:15:57 +00:00
Emil Gydesen
9eaf232b57 Bluetooth: BAP: Fix notifications for scan delegator
Instead of providing NULL for bt_gatt_notify_uuid we
iterate on the connection objects and ensure that we
properly truncate the notification based on each
connection's GATT MTU.

This ensures that we send the right size for all
connections.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 19:15:42 +00:00
Emil Gydesen
7bcd1e78de Bluetooth: Audio: Add common bt_audio_get_max_ntf_size
Add a common function to get the maximum notification
size, instead of having multiple implementations of this.
Ideally this function should be moved to the GATT API,
but for now just implement it for LE audio and then move to
GATT later.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 19:15:42 +00:00
Emil Gydesen
317cc9d52e Bluetooth: CCP: Add missing documentation for CCP discover
Added missing documentation for
bt_ccp_call_control_client_discover.

Added missing handling of -ENOTCONN in the function as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 19:15:31 +00:00
Lyle Zhu
50a3a6ec7c Bluetooth: SDP: Check if frame len is consistent with attr list count
The total attributes list bytes count is only used to check the tail
room of response buffer. And the remaining frame length is used to
copy data from receiving buffer.

It does not check whether the remaining frame length is consistent with
the total attributes list bytes count.

Add the checking to make sure the attributes list is complete. And it
is used to make sure the response buffer can be accessed safety.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-02-14 19:15:02 +00:00
Zihao Gao
53bba45281 Bluetooth: AVRCP: implementation for passthrough commands
This patch alllows to send passthough command from CT to TG.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2025-02-14 17:13:23 +01:00
alperen sener
3fdb81cd1f bluetooth: mesh: Correct callback check mesh blob client
xfer_progress_complete should be checked instead of end callback

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2025-02-14 17:10:39 +01:00
Robert Lubos
02c153c8b1 net: ipv6: Fix Neighbor Advertisement processing w/o TLLA option
According to RFC 4861, ch. 7.2.5:

 "If the Override flag is set, or the supplied link-layer address
  is the same as that in the cache, or no Target Link-Layer Address
  option was supplied, the received advertisement MUST update the
  Neighbor Cache entry as follows

  ...

  If the Solicited flag is set, the state of the entry MUST be
  set to REACHABLE"

This indicates that Target Link-Layer Address option does not need to be
present in the received solicited Neighbor Advertisement to confirm
reachability. Therefore remove `tllao_offset` variable check from the
if condition responsible for updating cache entry. No further changes in
the logic are required because if TLLA option is missing,
`lladdr_changed` will be set to false, so no LL address will be updated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-14 17:10:07 +01:00
Robert Lubos
8cd213e846 net: ipv6: Send Neighbor Solicitations in PROBE state as unicast
According to RFC 4861, ch. 7.3.3:

 "Upon entering the PROBE state, a node sends a unicast Neighbor
  Solicitation message to the neighbor using the cached link-layer
  address."

Zephyr's implementation was not compliant with behavior, as instead of
sending a unicast probe for reachability confirmation, it was sending a
multicast packet instead. This commit fixes it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-14 17:10:07 +01:00
Robert Lubos
fce53922ef net: ipv6: Fix neighbor registration based on received RA message
When Router Advertisement with Source Link-Layer Address option is
received, host should register a new neighbor marked as STALE
(RFC 4861, ch. 6.3.4). This behavior was broken however, because
we always added a new neighbor in INCOMPLETE state before processing
SLLA option. In result, the entry was not updated to the STALE state,
and a redundant Neighbor Solicitation was sent.

Fix this by moving the code responsible for adding neighbor in
INCOMPLETE state after options processing, and only as a fallback
behavior if the SLLA option was not present.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-14 17:10:07 +01:00
Thomas Deppe
dcbcbe824d Bluetooth: Host: Add host support for Advertising Coding Selection
Extends the API for Advertising Coding Selection.

The API is extended to set the Advertising Coding Selection
(Host Support) bit. With this feature, the primary and
secondary PHY can now explicitly report S=2 or S=8 coding
in the extended advertising report. Previously, the report
only indicated LE Coded regardless of whether S=2 or S=8
data coding was used. The API now sets the host support bit
and ensures that the advertising PHY coding scheme is
conveyed to the application via the scan callback.

The support is enabled by CONFIG_BT_EXT_ADV_CODING_SELECTION,
and requires a controller that selects
CONFIG_BT_CTLR_ADV_EXT_CODING_SELECTION_SUPPORT.

Signed-off-by: Thomas Deppe <thomas.deppe@nordicsemi.no>
2025-02-14 17:08:23 +01:00
Christopher Clingerman
db9dccdc8a shell: rtt: increase bypass buffer size
If the RTT shell backend is selected and the "down" buffer size
has been selected, the shell bypass functionality should instead
use the buffer size specified by the configuration.

Signed-off-by: Christopher Clingerman <christopher.clingerman@sensorfy.ai>
2025-02-14 17:07:52 +01:00
Emil Gydesen
fe6f63f92d Bluetooth: PACS: Add missing break in switch for sup ctx get
Add a missing break in supported_context_get, as it was not
intended to fallthrough to BT_AUDIO_DIR_SOURCE or default.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-14 17:05:47 +01:00
Luca Burelli
c188dee334 llext-edk: add support for Zstd and Zip formats
This patch adds support for Zstd and Zip formats to the EDK generation
process. The user can now choose between XZ, Zstd, and Zip compression
and output formats for the EDK file.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-02-14 13:35:43 +01:00
Luca Burelli
d043a21426 llext-edk: add Kconfig option to enable EDK generation
Add a new Kconfig option to make the generation of an Extension
Development Kit (EDK) for the LLEXT subsystem optional. This
allows to cleanly separate EDK-related configuration and build
steps from the rest of the Zeprhyr build system.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-02-14 13:35:43 +01:00
Dominik Kilian
84a215aff8 ipc_service: icmsg: Add "unbound" functionality
In some cases, CPUs that may need to reset or
temporary stop communication. This commit adds "unbound"
functionality that provides a callback to IPC service user
when connection was interrupted for some reason, e.g.
expected or unexpected CPU reset, closing the
endpoint. The "unbound" callback is optional to implement
by endpoints. This commit implements it in the ICMsg
backend.

Signed-off-by: Dominik Kilian <Dominik.Kilian@nordicsemi.no>
2025-02-14 13:34:49 +01:00
Helge Juul
b7bbfbf1f2 net: dns: Log with debug level instead of error level when recv fails
This condition can happen if there is MDNS activity on the network that is
either not according to specifications or not supported by Zephyr.

Lowering the log level from ERR to DBG, since this does not indicate an
error in the Zephyr application.

Signed-off-by: Helge Juul <helge@fastmail.com>
2025-02-14 10:48:06 +01:00
Utsav Munendra
10c6b34800 portability: cmsis: Support static CMSIS-RTOSv2 control blocks
Do not use memory slabs for the control blocks when
the application provides the memory for it. This
implements manual user-defined allocation memory
management support in CMSIS-RTOSv2 API.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-02-14 03:13:35 +01:00
Utsav Munendra
ed2e557d4c portability: cmsis: CMSIS-RTOSv2 thread port to track dynamic cb
No functionality change, in preparation for allowing
threads with user provided stack and control block.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-02-14 03:13:35 +01:00
Utsav Munendra
11eb0ce4db portability: cmsis: Rename cmsis wrapper types
Namespace this types with `cmsis_rtos` instead of `cv2`

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-02-14 03:13:35 +01:00
Utsav Munendra
13ef44200e portability: cmsis: Move cmsis wrapper types to public header
This enables the cmsis wrapper types to be declared
statically and then passed along to CMSIS-RTOSv2 APIs,
enabling static allocation of RTOS control blocks
in the subsequent commits.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-02-14 03:13:35 +01:00
Utsav Munendra
6d490e9cf0 portability: cmsis: Run clang-format on CMSIS-RTOSv2
clang-format -i subsys/portability/cmsis_rtos_v2/*.h
clang-format -i subsys/portability/cmsis_rtos_v2/*.c

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-02-14 03:13:35 +01:00