Commit graph

21541 commits

Author SHA1 Message Date
Lyle Zhu
d5160f663a Bluetooth: BR: Improve bt_conn_set_bondable
In current, the bondable flag cannot be configured for each specific
BR connection.
But for LE conn, there is a function `bt_conn_set_bondable` for this
purpose.

Improve `bt_conn_set_bondable` to support BR conn.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Lyle Zhu
e772c45e6b Bluetooth: SSP: Support non-bondable mode
If the return value of function bt_get_bondable is false, clear the
bonding flag when controller requiring `Authentication_Requirements`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Lyle Zhu
c0ce5b419b Bluetooth: Host: smp: Add function to get bonding setting
Add a function bt_get_bondable to get the bonding setting.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Håvard Reierstad
0fe6d34f8a Bluetooth: Mesh: Remove duplicate brg declaration
Removes duplicate declaration of the bridging direction, keeping the
one in the public header file.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-10-02 14:54:13 +01:00
Håvard Reierstad
8049c24994 Bluetooth: Mesh: Add prefix to Subnet Bridge API
Adds the `bt_mesh_brg_cfg` prefix to the public Subnet Bridge API, and
aligns the function and callback naming with the rest of the Bluetooth
Mesh API.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-10-02 14:54:13 +01:00
Johann Fischer
f5a3f90a68 usb: device_next: respect bMaxPacketSize0 in control transfers
Only the device operating at high speed has bMaxPacketSize0 set to 64
bytes, the device operating at other speeds may have a different value.
For full speed, use the value from the full speed descriptor.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:54:04 +01:00
Jordan Yates
bf9584d6ba fs: add FILE_SYSTEM_LIB_LINK option
Add an option that links in the underlying file system libraries as
usual, but doesn't compile in the Zephyr file system abstraction layer.

This can be useful to avoid linking in the entire filesystem
implementation through the `fs_file_system_t` API struct if only a
subset of the functions are used.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-02 14:42:10 +01:00
Johann Fischer
b79ffe3582 usb: device: use irq_update in CDC ACM UART implementation
Move the TX/RX ready flag updates into irq_update() where they belong.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:42:02 +01:00
Johann Fischer
c5a31aec3c usb: device: cleanup CDC ACM UART rx_ready, tx_ready and is_pending
Align the irq_tx_ready and irq_rx_ready implementations and use them
from irq_rx_pending.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:42:02 +01:00
Johann Fischer
0f0322127d usb: device: avoid starving other threads in CDC ACM UART fifo_fill
The check for the device being configured or suspended in the fifo_fill
implementation can starve other threads, because the early return does
not change the state of the TX path, and fifo_fill is called again
from the callback loop. The ringbuffer that emulates the TX FIFO can be
filled and marked ready as long as the space is available.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:42:02 +01:00
Johann Fischer
fe4d8a678c usb: device_next: use delayable work for TX FIFO in CDC ACM
Use delayable work to reduce CPU load when there is no transfer flow in
the host direction. This also improves the performance of poll out, as
introduced in commit commit fed6bde788
("usb: device: cdc_acm: send more than 1 byte in poll out")
for the legacy CDC ACM implementation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer
4875aa3924 usb: device_next: limit CDC ACM OUT transfer size to the current MPS
When the controller is connected to a full speed bus, regardless of
whether the controller supports high speed or not, the transfer size for
the bulk OUT endpoint should be equal to the MPS in the current
configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer
ef89321160 usb: device_next: allow fifo_fill and poll_out be used simultaneously
As it is still accepted practice, allow fifo_fill and poll_out to be
used simultaneously. The lock around fifo_fill was already in place.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer
6cf27758d3 usb: device_next: align CDC ACM UART poll_out with legacy implementation
Apply changes in commit c152e0980c
("usb: device: cdc_acm: block in uart_poll_out() routine")
to the new CDC ACM UART poll_out implementation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer
64ee885950 usb: device_next: align CDC ACM UART with Interrupt-driven UART API
Align CDC ACM UART with Interrupt-driven UART API behavior description.
Use the same flags in uart_irq_rx_ready(), uart_irq_tx_ready(), and
uart_irq_is_pending(), which are updated after each uart_irq_update()
call. Allow TX FIFO to be filled if there is space.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Lyle Zhu
4c09f5cce3 Bluetooth: BR: Shell: Remove duplicated else statement
Remove duplicate `else` statement if the function is returned from
corresponding `if` statement.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu
0270f91c1c Bluetooth: BR: Shell: Return error if command is failed
Return error code if the command is failed instead of `0`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu
3b74ed3f54 Bluetooth: BR: shell: Rename int res to int err
Rename `int res` to `int err`. Make variable naming consistent.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu
17cfe36195 Bluetooth: BR: Return SHELL_CMD_HELP_PRINTED if calls shell_help
If the function `shell_help` is called, return SHELL_CMD_HELP_PRINTED
instead of `0`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu
0b6684d8e3 Bluetooth: l2cap_br: Comment on l2cap->info_fixed_chan
Comment on the l2cap->info_fixed_chan why the size of it is one octet.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:14:18 +02:00
Lyle Zhu
f1d9549a0c Bluetooth: BR: SMP: Check if remote supports CID 0x0007
Add a function bt_l2cap_br_get_remote_fixed_chan to get the remote fixed
channels.

If the fixed channel CID 0x0007 is unsupported, skip the LTK derivation.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:14:18 +02:00
Alberto Escolar Piedras
ca26820ac1 ipc: icmsg: Check return error of pbuf_rx_init()
When pbuf_rx_init() was added, this caller did not check for a possibly
returned error to not have more overhead than before using this
function.
Although unlikely let's check for a possible error (not configured Rx
pbuf cfg).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-10-02 10:09:18 +02:00
Lyle Zhu
ff39d41034 Bluetooth: ssp: correct pairing failed callback
Current, the callback `pairing_complete` is called
when the pairing is filed. But there is a callback
`pairing_failed` for pairing failed case.

Correct the callback calling if pairing failed.
Call `pairing_failed` instead of `pairing_complete`
if the pairing failed.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:09:00 +02:00
Lyle Zhu
f9c490b7e1 Bluetooth: LE: SMP: Set CT2 bit by default
Set CT2 bit to auth_req field by default if
the BR is enabled.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:44 +02:00
Lyle Zhu
c7db41dddb Bluetooth: BR: SMP: Set CT2 bit by default
Set CT2 bit by default.

If CT2 bit is set by both side, set the
CT2 flag `SMP_FLAG_CT2`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:44 +02:00
Lyle Zhu
8c8a21a04c Bluetooth: BR_SMP: Add a flag BT_CONN_BR_PAIRED
Due to the BT_CONN_BR_PAIRING is cleared when
receiving ssp pairing complete event. The LTK
key cannot be derived after the BR connection
encrypted.

Add a flag BT_CONN_BR_PAIRED that the pairing
has been done.

Use this flag to indicate whether the LTK
derivation needs to be applied if the BR ACL
connection is encrypted.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:34 +02:00
Lyle Zhu
91db52c431 Bluetooth: SSP: clear pairing flag if ssp pairing completed
When the ssp pairing event is notified, clear the pairing
flag.

It is used to support case that the authentication is
started by peer, the link will not be encrypted after
the pairing is completed without any err.
If the local device want to encrypt the link, it could
call `bt_conn_set_security` to start encrypt the link
after the pairing complete callback triggered.

In original implementation, the `bt_conn_set_security`
cannot be called if the authentication has been started.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:34 +02:00
Lyle Zhu
08ceb14299 Bluetooth: Host: SSP: Correct BR bonding type
Currently, the bonding type of Authentication
_Requirements parameter is always `Dedicated
Bonding` if the device is pairing initiator.

But if the bonding is performed during
connection setup or channel establishment as
a precursor to accessing a service, the
bonding type should be `General bonding`.

Add a flag BT_CONN_BR_GENERAL_BONDING.
Set the flag if the bonding is performed in
the L2CAP_BR/RFCOMM channel establishment.

Set bonding type depends on the flag when
receiving IO cap request.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:07:09 +02:00
Lyle Zhu
832753b80c Bluetooth: BR: Change the type of resolving to bool
The `resolving` is used to flag the status that the stack is requesting
remote device name.

It is better to use the type `bool` instead of the original type
`uint8_t`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu
b1dc7ff242 Bluetooth: BR: Optimize _priv of struct bt_br_discovery_result
Move `struct discovery_priv` to classic.h

Rename `struct discovery_priv` to `struct bt_br_discovery_priv`.

Modify the structure `struct bt_br_discovery_priv` with `@private`.

Change field `_priv` of `struct bt_br_discovery_result` from
`uint8_t _priv[4]` to `struct bt_br_discovery_priv _priv`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu
d92bc8ab30 Bluetooth: shell: BR: update device discovery
Due to the update of function bt_br_discovery_start,
register discovery callback by calling
bt_br_discovery_cb_register.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu
f670e3a52f Bluetooth: Classic: Remove callback from bt_br_discovery_start
Remove BR discovery callback from bt_br_discovery_start.

All discovery results will be notified through callback
registered by bt_br_discovery_cb_register.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu
d0f5b6c351 Bluetooth: BR: Add listener cb for discovery
The results of inquiry and extended inquiry
are only reported from application level
after the inquiry complete event notified.

While the event of inquiry result is notified
by controller in real time.

It is not a good user experience.

Just like scanning of LE, add a listener
cb for discovery.

When the event of inquiry result, extended
inquiry result, or remote name request
complete notified, call listener `recv`
cb to notify the upper layer.

When the event of inquiry complete
notified or no pending of remote name
request , call listener `timeout`
cb to notify the upper layer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Andrew Davis
df64d076d8 ipc: ipc_service: Inline libmetal_{setup,teardown}() for correct ordering
Currently metal_init() is called as part of libmetal_setup() which is
called after libmetal has already started being used (metal_io_init
called before). Same for metal_finish() but in reverse (metal_io_finish
called after). To fix this inline the content of libmetal_{setup,teardown}
into their one call-sites and move the init/finish calls to the correct
spot before/after all uses of the lib.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-02 10:04:59 +02:00
Andrew Davis
be4a4ee324 ipc: ipc_service: Remove intermediate metal generic device
A libmetal "generic" device is created, then opened and used for its IO
regions. Since we are adding these IO regions in the first place there
is no reason for this layer of indirection.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-02 10:04:59 +02:00
Andrew Davis
d58542fcc4 ipc: rpmsg_service: Remove virtual shared memory device
A virtual metal_device is created, next the needed IO regions are created
and added to this device. Immediately we extract these regions back out
and make use of them. There is no reason to create the metal_device and
add the IO regions to it, instead simply use the IO regions directly.

This is similar to what was already done to the openamp_rsc_table sample.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-02 10:04:59 +02:00
Armin Brauns
fa8d80a15b bluetooth: honor log panic mode in monitor
Once panic mode is entered, the log write functions are called from an ISR,
so must not try to acquire locks.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-10-02 10:00:26 +02:00
Andries Kruithof
8295deb966 Bluetooth: Audio: CAP implement broadcast reception stop
Implement the CAP broadcast reception stop procedures and
add unit tests

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-10-02 09:59:23 +02:00
Jordan Yates
81352d011f serial/usb: update struct ring_buf users
Update the interrupt driver UART drivers that use `struct ring_buf`
internally to report the number of bytes that can be pushed in
`uart_fifo_fill` without fragmentation.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-02 09:56:45 +02:00
Krzysztof Sychla
5d76b563ea arch: Add Cortex-R8 support
Enable Cortex R8 support, similar to Cortex-R5.

Signed-off-by: Krzysztof Sychla <ksychla@antmicro.com>
Signed-off-by: Marek Slowinski <mslowinski@antmicro.com>
Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
2024-10-01 09:58:22 +02:00
Emil Gydesen
fa4f2ffc47 Bluetooth: CAP: Add support for doing just disable for unicast stop
The unicast_stop function is changed to primarily do a
BAP disable instead of a release, with optional
support for releasing the streams once they have been disabled.

This also adds unittests for the procedure which also
allow us to remove the invalid param testing from the BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-01 09:54:04 +02:00
Jamie McCrae
18b20058a0 dfu: Add missing depends on for progressive erase
Adds a depends on that requires the underlying driver support
explicit erase

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-01 09:46:18 +02:00
Jukka Rissanen
2ff26674a2 net: dns: Check that dispatcher table is not overflowing
Add CHECKIF() checks that verify that dispatcher table is
not overflowing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-30 17:12:15 +01:00
Jukka Rissanen
077dd8f142 net: dns: Increase the size of dispatcher table
The dispatcher table needs to be large enough to have support
for all file descriptor values.

Fixes #79042

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-30 17:12:15 +01:00
Gerard Marull-Paretas
740eba1341 pm: device: allow optional support of TURN_ON action
Some devices, e.g. SoC level devices like I2C peripheral, can never be
powerd off as they are always energized. Such devices can only go from an
active state or to a low power state (suspended). Allow them to simply
return -ENOTSUP when called with TURN_ON (or TURN_OFF).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-09-30 17:11:20 +01:00
Dominik Lau
319d67f7d3 fs: ext2: add alignment for superblock
Reading superblock didn't work with DMAs that only support aligned reads
(e.g. STM32 DMA).

Co-authored-by: Maciej Sobkowski <msobkowski@antmicro.com>
Signed-off-by: Dominik Lau <dlau@internships.antmicro.com>
2024-09-30 17:10:56 +01:00
Reto Schneider
8fda052826 net: Give name to logging choice
This allows downstream modules to overwrite the default log level choice
using Kconfig.defconfig files.

For example, this becomes possible:

```
choice LWM2M_LOG_LEVEL_CHOICE
  default LWM2M_LOG_LEVEL_WRN
endchoice
```

In contrast to the configuration method, this then has an effect on all
applications stored in the downstream module.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-09-30 12:10:42 +01:00
Marek Pieta
88231b5583 usb: device_next: usbd_hid: Fix size in HID report get
Since UDC buffers are allocated with `UDC_BUF_GRANULARITY` granularity,
the `net_buf_tailroom` may no longer be equal to the HID report size.
Use `setup->wLength` instead to ensure that proper HID report size is
passed to the application's callback.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2024-09-30 10:49:20 +02:00
Pisit Sawangvonganan
c9f9d5cdda net: tcp: remove redundant null check for conn in net_tcp_put()
A null check for the TCP connection `conn` was added at the start of
the function, but the previous checks were not removed, leading to
a redundant null check, which is unnecessary.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-30 09:04:48 +02:00
Guennadi Liakhovetski
c6bf743df2 LLEXT: add support for detached sections
Some LLEXT objects can include sections, that should not be merged
with other sections of the same type. E.g. when such sections should
be placed into locations, other than the default. Add support for
such sections.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-29 21:21:24 +02:00