Commit graph

21541 commits

Author SHA1 Message Date
Dominik Ermel
b50dc43a26 storage: flash map: Add flash_area_sectors
The commit adds flash_area_sectors function that allows to get information
on sector/erase page layout by flash_area object pointer instead of
index.
The only difference between flash_area_sectors and flash_area_get_sectors
is that the later calls flash_area_open internally and as such requires
flash map to be compiled in.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-27 06:58:43 -05:00
Dominik Ermel
1f1dc372cd storage: flash map: Add FIXED_PARTITION(label) macro
The commit adds FIXED_PARTITION(label) macro that allows to obtain
struct flash_area object for partition of given label.
The macro allows instantiation of partition at point of usage
and will be replacing need for defining flash map with all partition
entries.
Area obtained with the macro should not be passed to open, instead
flash_area_device_is_ready, basically equivalent of device_is_ready
should be called on the obtained pointer to check if area is ready
for use.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-27 06:58:43 -05:00
Olivier Lesage
480f8aa887 bluetooth: host: Use LOG_WRN for failed CS procedures
These can indicate that something about the user configuration needs to
be changed.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-11-27 10:31:25 +01:00
Théo Battrel
66ff97e69b Bluetooth: Host: Deprecate BT_BUF_ACL_RX_COUNT symbol
Because the number of ACL RX buffers must be at least the number of
maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could
inadvertently lead to a build failure if the number of ACL RX buffers is
not also increased. This dependency may not be obvious to users.

To address this issue, this commit deprecates the
`CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in
`buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default
value and the minimum range value have been changed to 0 to "disable"
the option.

Additionally, to allow users to increase the number of ACL RX buffers,
this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig
symbol. The value of this symbol will be added to the computed value of
`BT_BUF_RX_COUNT`.

The configurations of tests and samples have been updated to reflect
these changes.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-11-27 10:30:59 +01:00
Mark Wang
fb811f1599 bluetooth: ssp: support pairing_accept for ssp
when receiving the io cap request from controller, call
pairing_accept to check whether application accept the
pairing. If no, reply BT_HCI_OP_IO_CAPABILITY_NEG_REPLY.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2024-11-27 10:29:36 +01:00
Luca Burelli
56fd854423 llext: fix minor Coverity issue #434586
The check combination of "is zero" and then "less than zero" leaves open
the theoretical possibility of a positive return value, which would
continue on with an uinitialized 'rela'.

Checking for "not zero" has the same effect and covers all situations.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-11-27 10:29:23 +01:00
Vinayak Kariappa Chettimada
478cace022 Bluetooth: Controller: Fix minimum offset for subsequent CISes
Fix CIS offset calculation by Central for subsequent CISes
such that when compensating for dissimilar ACL and ISO
intervals, ensure that minimum offset does not cause a
collision between the ACL and the CIS event at the instant.

Fixes commit 3b3d53f09e ("Bluetooth: Controller: Fix CIS
offset_min for dissimilar interval").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-27 08:17:50 +01:00
Pisit Sawangvonganan
08fe69cc3c net: wifi: shell: enhance consistency in __wifi_args_to_params
Several arguments were added but have not yet been aligned with others
in the same function. Hence, use `getopt_state` to access `optarg`,
offering a better alternative to direct global access.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-11-27 08:17:15 +01:00
Aleksander Wasaznik
5a8daffc32 Bluetooth: Tester: Use BT_L2CAP_SEG_RECV for L2CAP tests
This API gives better control on L2CAP COC credits and suits better
for Upper Tester implementation.

Co-authored-by: Szymon Janc <szymon.janc@codecoup.pl>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-11-27 08:16:18 +01:00
Szymon Janc
c002b1dc9e Bluetooth: Host: L2CAP: Fix seg_recv call on SDU overflow
This fix calling seg_recv() callback being called even though channel
is being disconnected due to SDU overflow.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-11-27 08:16:18 +01:00
Vinayak Kariappa Chettimada
7e74a046a1 Bluetooth: Controller: Fix ISO Sync Receiver is_abort_cb
Fix ISO Sync Receiver implementation to correctly prevent
subevent from pre-empted in the unreserve time space.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-27 08:15:32 +01:00
Vinayak Kariappa Chettimada
396692c723 Bluetooth: Controller: Fix ISO Sync Receiver time reservations
Fix ISO Sync Receiver time reservation calculation to use
peer broadcasted bis_spacing and sub_interval, instead of
incorrectly calculating using local implementation used
tMSS value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-27 08:15:32 +01:00
Vinayak Kariappa Chettimada
a7a199d6de Bluetooth: Controller: Fix ISO Sync Receiver skipped ISO SDU
Fix ISO Sync Receiver implementation to correctly reflect
the payload number and timestamp for the skipped SDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-27 08:15:32 +01:00
ZhongYao Luo
188a42b117 usb: device: fix unaligned memory access in Audio class
Use UNALIGNED_*, sys_get_* to fix unaligned memory
access issues

Signed-off-by: ZhongYao Luo <LuoZhongYao@gmail.com>
2024-11-26 15:44:45 -05:00
Emil Gydesen
c7ce8614b4 usb: shell: Remove use of ctx_shell
The ctx_shell was only used a single place and in a function
that already has a `sh` that would be better to use.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-26 15:43:29 -05:00
Krzysztof Chruściński
3b47ec6410 pm: device_runtime: Optimize pm_device_runtime_usage
There is no point in using lock or semaphore to read current
usage counter as it may change after unlocking or giving
back the semaphore. Value can only be trusted in the controlled
environment (e.g. test).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-11-26 15:43:21 -05:00
Emil Gydesen
e73bfb92c7 tests: Bluetooth: ASCS: Fix various issues in ASCS unit tests
The ASCS unit tests had various errors after adding support for
dynamic registration.
Several tests did not properly clean up after failure, causing other
tests to fail when they shouldn't.

Moved the register tests to their own file as they should not
do the register in the "before" function.

The test_ascs_unregister_with_ases_in_config_state test was also
removed, as it had both issues and the state that it wants to test
cannot be reached with the current API - It is not possible to
put an ASE in the configured state without callbacks,
and registered callbacks prevents us from calling
bt_bap_unicast_server_unregister to trigger the case as that can
only be done if callbacks are unregistered. Since unregistering
callbacks also puts all ASEs to the idle state, it is not possible
to call bt_bap_unicast_server_unregister for a non-idle ASE.

The testcase.yaml was also missing some Kconfig options to
properly enable the client tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-26 15:43:13 -05:00
Jukka Rissanen
34ed76b185 net: prometheus: Add way to format output by a metric
Instead of requiring one big buffer for formatting the output,
have a walk function that can be used to generate output by
one metric at a time.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
6803e343ef net: prometheus: collector: Add more debugging info
Print also metric name together with type when registering.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
7e881d22a1 net: stats: Add prometheus support
Allow user to update prometheus metrics from network statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
c7989b5747 net: prometheus: Add more parameters to metric macros
Add collector parameter to metric creation macros so that it
is possible to bind the metric to collector already at built
time.

Also add optional user_data to metric macro calls so that user
can add optional data there. This will be used by network statistics
Prometheus support in subsequent commits.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
8e83cf0797 net: prometheus: Configure max number of labels from Kconfig
Allow user to configure the label count from Kconfig.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
d3efcbd316 net: prometheus: Remove need to have separate metric struct
Embed "struct prometheus_metric" to individual metric like
counter, gauge, histogram and summary. This way we avoid having
a separate base pointer in specific metrict struct. We also do
not need to search the specific metric from base metric as
we can simply use CONTAINER_OF() macro to get the base metric.

This embedding means that the counter, gauge, histogram and summary
metric define macros are changed as user does not need to create a
separate "struct prometheus_metric".

Convert the tests and sample to use the new macros.

Remove also the static from metric creation macros so that user
can decide whether it needs collector to be static or not.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
90fb4b38ca net: prometheus: Use linked list for metrics
Save same memory and store metrics into a linked list inside
a collector entry.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
460e2f86d7 net: prometheus: summary: Add set function to summary metric
Add prometheus_summary_observe_set() function to summary metric.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
0ec8385bec net: prometheus: counter: Add function to set the counter value
This is similar function as add, but will add the difference of
previous value and the new one. This can be used if we want to
periodically update the value with a new one but don't want to
keep track of the old one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
d94bcd2566 net: prometheus: counter: Add function to add a value
Add function to increase the counter value with arbitrary value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Chen Xingyu
de1643d8fb net: mqtt: Fix error of size_t formatting with PRIu16
This addresses the following warning building with `CONFIG_64BIT=y`:

    error: format '%hu' expects argument of type 'int', but argument X has
    type 'size_t' {aka 'long unsigned int'}

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2024-11-26 10:37:20 +00:00
Ivan Iushkov
75fc0a0776 Bluetooth: Host: deprecate bt_le_set_auto_conn()
bt_le_set_auto_conn() function is not working as
expected. Also, it doesn't have any test coverage
and any usage in sample applications.
The function is deprecated
Fixes #81597

Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
2024-11-26 10:37:12 +00:00
Andries Kruithof
bb3bab7a34 Bluetooth: Audio: implement the distribute broadcast code procedure
Implemenation of the distribute broadcast code CAP procedure, as well
as unittesting

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-11-25 21:52:53 +01:00
Emil Gydesen
96b487186f Bluetooth: ISO: Removed unused pool and funcs/macros
The iso_tx_pool was unused because all the functions
and macros that used it were unused.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-25 17:42:59 +01:00
Emil Gydesen
83677f551f Bluetooth: Shell: Set conn to NULL before bt_conn_le_create
bt_conn_le_create logs a warning if the provided conn is
non-NULL which was the case here. Simply set it to
NULL as it is a local variable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-25 14:41:14 +01:00
Dino Li
40c95e34b8 it8xxx2/shi: wrap pm policy state get/put
When CONFIG_ASSERT is enabled, assertion for unbalanced state lock
get/put is triggered. This commit leverages shi drivers from other
SoCs to resolve the assertion.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2024-11-25 10:07:20 +01:00
Yong Cong Sin
b1def7145f arch: deprecate _current
`_current` is now functionally equals to `arch_curr_thread()`, remove
its usage in-tree and deprecate it instead of removing it outright,
as it has been with us since forever.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-11-23 20:12:24 -05:00
James Roy
72d34496dc subsystem: bluetooth: Fix uninitialized variable
Fix uninitialized sec_idx variables scanned by Coverity.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2024-11-23 15:29:03 +01:00
Rex Chen
b4035e83d4 net: wifi: shell: add enterprise support for sap
Add EAP-TLS, EAP-PEAP-MSCHAPv2, EAP-PEAP-GTC, EAP-TTLS-MSCHAPv2,
EAP-PEAP-TLS, EAP-TLS-SHA256 enterprise wpa2 and wpa3 suiteb
support for sap.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-11-22 13:03:53 -06:00
Fin Maaß
ef9cc18fcf mgmt: hawkbit: don't require HWINFO
don't require HWINFO, when HAWKBIT_CUSTOM_DEVICE_ID.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-11-22 13:02:29 -06:00
Maochen Wang
13f473d7eb hostap: add WPS PBC and PIN for AP mode
add WPS PBC and PIN for AP mode.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-11-22 17:44:08 +01:00
Vinayak Kariappa Chettimada
9df4b548ba Bluetooth: Controller: Ext Adv Auxiliary PDUs with ticks_slot_window
Add implementation for Extended Advertising Auxiliary PDUs
to use ticks slot window feature.

This will allow the periodic scheduling of AUX_ADV_IND PDUs
to drift upto 10 ms advertising delay minus the ticks_slot
time reservation of the AUX_ADV_IND PDU when overlapping
with other states/roles that cannot be moved around, to
avoid skipping them.

Having an active Extended Advertising simultaneously with
an ISO Synchronized Receiver or Connected ISO connection
will now have less ISO SDU loss when using 10 ms ISO
intervals.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-22 17:43:04 +01:00
Vinayak Kariappa Chettimada
b838b17755 Bluetooth: Controller: Introduce ticker reschedule with drift
Introduce ticker reschedule with drift so that role like
AUX_ADV_IND can start after overlapping states and roles
using time reservations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-22 17:43:04 +01:00
Vinayak Kariappa Chettimada
ec39d6257e Bluetooth: Controller: Fix to reschedule before overlap when yielding
Fix to reschedule before overlap and be collision resolved
in the next periodic interval for tickers using slot window
yield.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-22 17:43:04 +01:00
Jukka Rissanen
b0b20229b0 net: sockets: Add support for IP_LOCAL_PORT_RANGE socket option.
Add support for IP_LOCAL_PORT_RANGE socket option. The option
supports both IPv4 and IPv6 sockets although the type is IPPROTO_IP.

The option can be used to enforce the ephemeral port number selection
to be in certain range.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-22 17:42:08 +01:00
Dominik Kilian
81bb231fd0 ipc: icbmsg: Reduce block alignment to 32-bits
The ICBMsg backend divides its memory into
blocks. Each block is aligned to data cache
alignment. Is it not required, since adjacent
blocks has the same data flow direction (either
read-only or write-only). This commit changes
it to 32-bits making wasted memory significantly
reduced.

Signed-off-by: Dominik Kilian <Dominik.Kilian@nordicsemi.no>
2024-11-22 08:26:22 -05:00
Chen Xingyu
50f23500b8 net: Fix warning of size_t formatting with %.*s
This addresses the following warning building with `CONFIG_64BIT=y`:

    error: field precision specifier '.*' expects argument of type 'int',
    but argument X has type 'size_t' {aka 'long unsigned int'}

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2024-11-22 08:25:31 -05:00
Johan Hedberg
30d1d0e526 Bluetooth: Host: Remove deprecated HCI driver API
Remove the deprecated HCI driver API which was provided by the hci_driver.h
header file. The deprecation happened in Zephyr 3.7, so the API can now be
removed for Zephyr 4.1.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-11-22 11:37:12 +01:00
Johan Hedberg
3063f18942 Bluetooth: Host: Remove unnecessary hci_driver.h includes
None of these files actually use anything from the hci_driver.h header
file.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-11-22 11:37:12 +01:00
Jukka Rissanen
39889c0023 net: if: Do not report error if we are already in promisc mode
If we are already in promiscuous mode, then do not report error
in that case.

Fixes #81605

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-21 20:11:01 +01:00
Dominik Ermel
77ebf82b3e storage: flash_map: Don't generate flash area when no device
Change in default flash map generation, where partitions hanging of
disabled devices will not have flash area generated.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-21 14:48:44 +01:00
Emil Gydesen
b4f3763c31 tests: Bluetooth: Audio: Use same recv_cb for all tests
This commit changes the BSIM tests to use the same recv callback
for all tests. The purpose of this is to reduce code duplication
and make it easier to maintain the tests.

This also changes the recv_cb so that in case of any error we log
the most recently received SDU, which should provide more
information about why a test failed in case of RX error.

PBP had to be updated a bit to support the audio_stream
struct.

Also modifies a check and log in bap_stream that was less than
helpful to determine if it was the stream or the endpoint that
was NULL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 14:47:49 +01:00
Seppo Takalo
2066cf6a3d net: lib: coap_client: Release non-confirmable requests
Non-confirmable CoAP requests need lifetime tracking as well
so we can free the structure after a timeout.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-11-21 14:47:38 +01:00