Commit graph

21541 commits

Author SHA1 Message Date
Utsav Munendra
12cba7addf portability: cmsis: Bugfix osThreadFlagsWait behavior
The osFlagsWaitAny option is not handled correctly.  It returns once any
flag at all is set, whereas it is supposed to only return once one of
the flags specified in flags is set.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-04-11 06:34:06 +02:00
Troels Nilsson
c3df8fcd92 Bluetooth: Controller: Add validation of received LL_CIS_REQ
Validate that a received LL_CIS_REQ is valid and reject if it is not

Fixes EBQ test failure in LL/CIS/PER/BI-07-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-04-10 15:51:54 +02:00
Triveni Danda
b20e87ae7a net: lib: wifi_credentials: Fix security type check while storing creds
Fix credential store corruption issue caused by missing
security type checks. Add support for all valid security
types to ensure credentials are parsed correctly.

Fixes #88261.

Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
2025-04-10 14:44:02 +02:00
Ying Zhang
ce771c57e6 bluetooth: host: fix hang issue caused by consecutive bt disable commands
- add BT_DEV_DISABLE flag to BT_DEV_PERSISTENT_FLAGS to
  protect consecutive bt disable from running

Signed-off-by: Ying Zhang <ying.zhang_2@nxp.com>
2025-04-10 13:02:41 +02:00
Tomasz Moń
d6a8bd5870 usb: device_next: Change speed selection Kconfig dependency
In my opinion, the user is supposed to configure the speed of the stack
and drivers ough to honor that choice. However current Zephyr USB
maintainer imposes that the dependency is the other way round, i.e.
that user first needs to disable High-Speed chirp at driver level and
only then can select Full-Speed only operation. Adhere to the
arbitrarily set up rule to allow this really necessary functionality to
enter Zephyr.

I consider this change to be harmful because it opens up a Kconfig trap
that allows configuring High-Speed capable stack with a device driver
limited to Full-Speed only operation.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-04-10 12:57:19 +02:00
Tomasz Moń
b3eb6f2d11 usb: device_next: Reduce code size on Full-Speed only configuration
Allow compiler optimizations to remove High-Speed handling code. Knowing
that maximum operating speed is Full-Speed allows to reduce bulk buffers
from 512 to 64 bytes. More RAM optimizations are possible but this
commit only gets the low hanging fruits.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-04-10 12:57:19 +02:00
Tomasz Moń
faeabc63c9 usb: device_next: Add Kconfig to set maximum speed
Two main ideas behind setting maximum speed are:
  * Allow code and RAM optimizations at compile time
  * Allow High-Speed capable drivers to limit operating speed to user
    choice.

This commit only introduces the necessary Kconfig options but does not
implement any code or RAM optimizations and does not modify any driver.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-04-10 12:57:19 +02:00
Tomasz Moń
35af7b88b3 usb: device_next: Unregister class according to speed
Fix a typo resulted in USBD_SPEED_HS unregistering Full-Speed class
instead of High-Speed.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-04-10 12:57:19 +02:00
Pisit Sawangvonganan
7abda99fe3 shell: mqtt: use ring_buf_reset to flush rx_rb
The `sh_mqtt_rx_rb_flush` function was intended to flush `rx_rb` when
get an error return from `mqtt_read_publish_payload_blocking`.
Instead of retrieving values from `rx_rb` one by one, calling
`ring_buf_reset` achieves the same result more efficiently.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-04-09 22:06:05 +02:00
Pisit Sawangvonganan
24dabdd5fb shell: mqtt: optimize module-scoped sh_mqtt variable access
Introduce a local pointer, `struct shell_mqtt *sh`, to minimize access
to the module-scoped `sh_mqtt` variable.
This allows `sh` to be stored in a CPU register, resulting in more
compact code and improved execution efficiency.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-04-09 22:06:05 +02:00
Nitin Pandey
0259bf56c8 driver: wifi: siwx91x: Add check for SAE password
- Modified conditions in WIFI_CONNECT()
  function to reject SAE password and
  PSK based on length parameter

Signed-off-by: Nitin Pandey <nitin.pandey@silabs.com>
2025-04-09 19:32:26 +02:00
Gerhard Jörges
9d0d7ad3b8 net: lib: http_server: implement concurrent
only accept new connections until the configured value for concurrent
connections is reached. Also set the backlog of the listening socket
to the configured value.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2025-04-09 17:32:50 +02:00
Emil Gydesen
a4f8744ccf Bluetooth: CCP: Client: Add get_bearers
Add bt_ccp_client_get_bearers that will return the bearers of
a client so that the application can always retrieve them if they
do not store them from the discovery callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-09 15:23:07 +02:00
Triveni Danda
b3ea4f8d5c net: Fix Kconfig check for enterprise mode
Fix the kconfig check for enterprise crypto support in AP mode.
Also, remove the unnecessary Hostapd enterprise crypto check in
credentials code.

Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
2025-04-09 12:37:29 +02:00
Robert Lubos
307694f3d9 net: sockets: Remove support for AF_PACKET/IPPROTO_RAW combination
IPPROTO_RAW is not a valid protocol type for AF_PACKET sockets, which
should only use IEEE 802.3 protocol numbers. Therefore remove support
for this type of sockets.

As an alternative, users can use AF_PACKET/SOCK_DGRAM or
AF_INET(6)/SOCK_RAW, depending on the actual use case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-09 12:36:34 +02:00
Robert Lubos
7c87aab783 net: sockets: Add SOCK_RAW support for AF_INET/AF_INET6 sockets
Introduce changes in the networking stack which allow to create raw IP
sockets, so that applications can send and receive raw IP datagrams.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-09 12:36:34 +02:00
Robert Lubos
a713d8ea60 net: connection: Register connection type
Register connection type along with family and protocol, so that it's
possible to differentiate between connection listening for raw IP
datagrams and TCP/UDP/other packets.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-09 12:36:34 +02:00
alperen sener
5b8b94e664 Bluetooth: Mesh: Stop Private NID advs upon subnet removal
Private Node Identity advertisement on a subnet should stop as soon as
the network is removed.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2025-04-09 11:43:29 +02:00
Lyle Zhu
979b088882 Bluetooth: Classic: Shell: Change acronyms to uppercase
Change `ag` of print message to `AG`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-09 08:06:04 +02:00
Lyle Zhu
3f7224a926 Bluetooth: Classic: HFP_AG: Update the callback sco_disconnected()
Change the arguments of HFP AG callback `sco_disconnected()` to SCO
conn and disconnection reason.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-09 08:06:04 +02:00
Krzysztof Chruściński
226c6ae17c pm: Optimize pre-wakeup in suspend procedure
When core is suspended and power mode has non zero exit_latency_us
a system timeout will be rescheduled to a point in time that is
earlier by exit_latency_us than request. It is to accommodate for
lengthy resuming procedure which would cause requested timeout to
be significantly late. However, setting additional wake up point
has cost, it is one more redundant core wake up and that impacts
performance and power consumption.

Add Kconfig option to chose what conversion method is used. It has
the biggest impact on small exit_latency_us where conversion may
result in 0 ticks (no pre-wake up) or 1 tick (wake up).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-08 19:26:57 +02:00
Robert Lubos
3449e224b4 net: openthread: Add missing error checks
Some OpenThread functions were called without verifying the return
value, which not only is not the best practice, but also could lead to
build warnings with llvm. This commit fixes it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-08 16:12:17 +02:00
Dereje Wassie
e1d2f09898 Bluetooth: pacs: Fixed pacs_get_available_context
Fixed the bt_pacs_get_available_context API to return values of type
bt_audio_context instead of an error type.

Signed-off-by: Dereje Wassie <deiw@demant.com>
2025-04-08 14:23:30 +02:00
Tomi Fontanilles
fd538dcb11 secure_storage: its: store: settings: allow using custom setting names
Allow replacing the default naming scheme of the stored settings by
providing a custom function that fills a name buffer based on the ITS
entry UID.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-04-08 14:22:59 +02:00
Tomi Fontanilles
09228de9a1 secure_storage: fix formatting of CMake ifs
The rule says there must not be spaces "between a command and the opening
parenthesis".

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-04-08 14:22:59 +02:00
Riadh Ghaddab
15cbe9fd18 zms: fix the detection of gc_done ATE
Previously, when detecting the GC_done ATE the gc_done_marker boolean
variable was not set.
Fix this by setting it to true if the GC_done ATE is found.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-04-08 10:48:17 +02:00
Lars-Ove Karlsson
76969f82a4 bluetooth: host: Avoid warning for unaligned access
Rewrote places in the bluetooth code that converts objects
larger than one byte by taking the address of an unaligned struct
member and changed it to a function that takes the value directly
and converts it to big endian.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
2025-04-08 08:58:06 +02:00
Krzysztof Chruściński
29d9405036 pm: Use fixed cpu id in single core case
When there are no multiple cores than fixing id to 0 saves few
cycles.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-08 08:57:57 +02:00
Pavel Vasilyev
fd4cc0e031 bluetooth: host: att: Remove meaningless check
`>= 0` was used when EATT support was implemented (#23199) because
`bt_l2cap_chan_send` could return number of bytes sent. After PR #67528,
`bt_l2cap_chan_send` doesn't return amount of bytes sent or any positive
value, but either 0 or negative value. Thus `>= 0` is not needed. It
also confusing when reading code, especially when the same check is not
implemented in other cases where underlying function `chan_send` is
used.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-07 09:59:29 +02:00
Pavel Vasilyev
e53e4cf0a2 bluetooth: host: att: Remove att_sent function
`att_sent` is removed as it does not provide any value. All checks are
already performed in `att_on_sent_cb`, and keeping it only increases
readability complexity.

`att_sent` is removed as doesn't give any value. All checks are done
already in `att_on_sent_cb`. It just increases readness complexity.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-07 09:59:29 +02:00
Pavel Vasilyev
18b85290cd bluetooth: host: att: Remove chan_req_send
The extra `bt_att_chan_req_send` does nothing but increases readability
complexity. All checks are already performed by the caller.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-07 09:59:29 +02:00
Emil Gydesen
707c518a92 Bluetooth: CAP: Add better active_proc checks
The existing checks were not thread safe at all.
Replace the checks by using atomic_test_and_set_bit
and then clearing the bit again on error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-07 09:59:08 +02:00
Mark Wang
28ba838cda bluetooth: classic: hfp: sco_conn is null in hfp sco_disconnected callback
In bt_sco_disconnected, chan->sco is set as NULL before callback. Then
hfp disconnection callback use it to callback to application in
hfp_hf_sco_disconnected.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-04-07 07:28:18 +02:00
Yuval Peress
ba9b4f3734 ztest: Fix confusing SKIP log
When CONFIG_ZTEST_FAIL_ON_ASSUME is set, a failed assumption will
cause the suite to fail, but the individual test will be marked as
SKIPPED. We should fail the test so it's clear what's going on.

Fixes #86611

Signed-off-by: Yuval Peress <peress@google.com>
2025-04-04 21:16:34 +02:00
Alberto Escolar Piedras
59b62243fa Bluetooth: HFP_AG: Initialize variable to avoid warning
gcc 11.4.0, seems to believe this variable may be used uninitialized,
and warns about it (causing a test build failure due to warnings
being treated as errors).
Let's just initialize the variable to 0 to avoid the issue, as the
cost is trivial.

subsys/bluetooth/host/classic/hfp_ag.c: In function
  ‘bt_hfp_ag_vts_handler’:
1095
subsys/bluetooth/host/classic/hfp_ag.c:3091:17: error: ‘code’ may be
  used uninitialized in this function [-Werror=maybe-uninitialized]
1096
 3091 |                 bt_ag->transmit_dtmf_code(ag, code);
1097
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1098

The issue can be reproduced for ex. with:
$ mkdir build ; cd build
$ cmake -GNinja -DBOARD=native_sim/native/64 ../tests/bluetooth/shell \
 -DCONF_FILE="prj_br.conf"
$ ninja

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-04-04 18:18:16 +02:00
Robert Lubos
cf0b6068d2 net: coap_client: Fix CoAP client thread priority
The default thread priority for the CoAP client thread is set to
NUM_PREEMPT_PRIORITIES which is not a valid thread priority, as the
lowest application thread priority is actually
NUM_PREEMPT_PRIORITIES - 1. Because of this, CoAP client library gave an
assert on boot if assertions were enabled.

Kconfig does not allow for arithmetics when setting integer defaults,
therefore handle this at the preprocessor stage by limiting the actual
priority assigned to the CoAP client thread to a valid range.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-04 18:17:30 +02:00
Emil Gydesen
2dbc10ab6b Bluetooth: BAP: Fix bad cast to void * instead of void for memcpy
The result of memcpy should be cast to (void) and not (void *).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-04 18:16:54 +02:00
Markus Lassila
392fda02b3 net: Add CONFIG_NET_CONN_PACKET_CLONE_TIMEOUT
Add CONFIG_NET_CONN_PACKET_CLONE_TIMEOUT to allow for longer
timeouts. This can be used to prevent dropping packets when
transmitting large amounts of data (with PPP).

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2025-04-04 14:57:06 +02:00
Eric Holmberg
84d3cafbce net: websocket: fix masked data when server sends close
When sending the close command as a server, the data is incorrectly
masked which violates RFC6455 section 5.1.

Use the is_client flag to avoid masking if the close is for a websocket
server.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2025-04-04 14:56:58 +02:00
Lars-Ove Karlsson
bf29b2a8d7 bluetooth: host: Fixed missing guard for BT_SETTINGS_DEFINE
While linking with the IAR linker using generated linker scripts,
and with errors if unhandled sections are encountered, many of the
bluetooth tests failed because CONFIG_SETTINGS was not set.

The section that was not handled was
'._settings_handler_static.static.settings_handler_bt_ccc_'

Now it's only set if CONFIG_SETTINGS is set.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
2025-04-04 14:56:10 +02:00
Jimmy Zheng
9349d54074 driver: interrupt_controller: intc_clic: rework to standard CLIC driver
Rework intc_clic to standard CLIC driver with Nuclei ECLIC extention.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2025-04-04 14:55:50 +02:00
Yakun Xu
eddb1af9aa openthread: map Thread network interface state
The current mapping gets the network interface into dormant state when
Thread is not attached. While the node is not capable of doing multi-hop
communication when it's not attached, it should be able to do link-local
communication. This commit changes the mapping to look at OpenThread's
own network interface state instead without further checking Thread's
device role, so that link-local communication is supported when a node
in detached state.

Signed-off-by: Yakun Xu <xyk@google.com>
2025-04-04 12:06:59 +02:00
Emil Gydesen
acd7080350 Bluetooth: BAP: Call bis_sync_req for all BIS sync state changes
Previously bis_sync_req was only called when requested_bis_sync
was changed. However that meant that there were cases where the
requested_bis_sync was the same as the new request, but where
the actual BIS sync state were different. This was mostly
the case when the scan delegator had autonousmly
added or modified the receive state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-04 12:06:19 +02:00
Emil Gydesen
f39feb8aa7 Bluetooth: BAP: Fix bad overwrite of requested_bis_sync
The scan_delegator_mod_src accidentally may have overwritten
the value of internal_state->requested_bis_sync before the
entire request had been verified, causing a mismatch between
what the application knows and what the stack stored.

Fixed by storing the request in a temporary value until
everything has been verified and accepted.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-04 12:06:19 +02:00
Vinayak Kariappa Chettimada
47c7918393 Bluetooth: Controller: Single recv thread for HCI-only builds
Updated implementation to use single receive thread to
enqueue HCI ISO data, ACL data and events towards Host when
building HCI-Only samples/applications, i.e. when building
hci_uart, hci_spi or hci_ipc samples (CONFIG_BT_HCI_RAW=y).

This implementation will serialize HCI events and data as
they occur corresponding to on-air timelines of their
occurrences which is how they are generated by the Link
Layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-04-04 09:35:16 +02:00
Julien Racki
6d1cb00627 arch: arm: Add Cortex-A7 support
Pass the correct -mfpu and -mcpu flags to the compiler when building
for the Cortex-A7.

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-04-04 09:35:03 +02:00
Anas Nashif
7c68855053 debug: thread_analyzer: move thread analyzer to own folder
Move to own directory to prepare for new related code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-04 07:42:20 +02:00
Mark Wang
891e457873 bluetooth: classic: Fix remote name resolving with multiple devices
The error occur when discoverying br devices and need to send request_name
for many found devices.
In system work queue task, bt_hci_inquiry_complete->
report_discovery_results is called, then request_name is called for all
the found devices. The controller gives HCI_Remote_Name_Request_Complete
event for every name request result and one buf is allocated from
hci_rx_pool to save HCI_Remote_Name_Request_Complete. When system work
queue task is blocked to call request_name for every device, many
HCI_Remote_Name_Request_Complete are received for the already sent
request_name, it uses up all the buf of hci_rx_pool, then the bt_rx_thread
task is blocked to get buf from hci_rx_pool when next
HCI_Remote_Name_Request_Complete is received, meanwhile the next
request_name send hci cmd and wait the result, but the hci status/complete
event can't be received because the bt_rx_thread is blocked and
bt_uart_isr is kept in the state to receive last
HCI_Remote_Name_Request_Complete, then bt_dev.ncmd_sem is not released,
then the next request_name send hci cmd again, but the bt_dev.ncmd_sem is
invalid, then bt_hci_cmd_send_sync fail and assert.

resolve it by requesting name one by one.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-04-03 17:48:04 +02:00
Troels Nilsson
c32bf58173 Bluetooth: Controller: Fix an error code in ll_adv_sync_ad_data_set
When an advertising set is not configured for periodic advertising,
the correct error to return is BT_HCI_ERR_CMD_DISALLOWED

Fixes EBQ test failure of HCI/DDI/BI-70-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-04-03 13:16:14 +02:00
Lyle Zhu
c09cf23844 Bluetooth: HFP_AG: Add ACL conn to the connected callback
If the AG works as Data Channel Acceptor, the ACL conn cannot be known
by the application of AG. Similar with HF, add ACL conn as the first
parameter to the `connected` callback of AG.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00