Commit graph

18329 commits

Author SHA1 Message Date
Benjamin Cabé a4c2b848c4 mgmt: fix bad SPDX-License-Identifier header
fix typo in SPDX header

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-05-08 09:23:16 -04:00
Morten Priess 425dcc4678 Bluetooth: controller: Sync ISO Establishment fixes
- Introduce variable in lll_sync_iso for sync establishment timeout
- Introduce estab_failed flag in event_done_extra struct to convey
  establishment failure from LLL.
- Fix ull_sync_iso_estab_done always sending success
- Return correct HCI error depending on prepare state

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-05-08 12:05:30 +02:00
Nithin Ramesh Myliattil 0d479a0091 Bluetoioth: CAP: Shell: Added qos config to unicast_start cmd
For cap_initiator unicast_start command, qos configuration is
added.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-05-08 12:01:29 +02:00
Philippe Schumacher 67db6f69f3 net: lwm2m: efficent cbor record data structure
The record data structure is better aligned. Each record saves
24 bytes.

Signed-off-by: Philippe Schumacher <philippe.schumacher@husqvarnagroup.com>
2024-05-08 12:00:57 +02:00
Johann Fischer 3eec2a56d5 usb: device: get rid of the partial initialization called by SYS_INIT
Part of the initialization is done in the static usb_device_init()
function called by SYS_INIT(). We can move part of it, which initialize
the descriptor and calls usb_set_config(), to usb_enable(). This allow
some usb_get_device_descriptor() dependencies called at application
desired point.

Also make sure that usb_fix_descriptor() is called only once.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-08 12:00:46 +02:00
Pieter De Gendt db8bb9ef56 cmake: linker: Use kconfig for iterable section subalign
Replace the hard-coded 4 with the Kconfig symbol
CONFIG_LINKER_ITERABLE_SECTION_SUBALIGN .

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-07 18:01:37 -04:00
Guennadi Liakhovetski 78a3aa7769 llext: add support for STT_OBJECT relocations
These relocations are needed e.g. when an LLEXT is built from
multiple files and they share data objects.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-07 17:56:19 -04:00
Tomasz Moń 3850c92570 usb: device_next: Properly store enumeration speed
Add missing break inside switch statement to allow UDC context to
indicate that current operating speed is High-Speed. Due to missing
break statement, the stack always assumed Full-Speed.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-05-07 15:20:13 -05:00
Seppo Takalo e2ab41b625 net: lwm2m: Fix pull-context on queue mode
Two issues fixed:
When pull-context is created, it does not have to wake up the RD
client context. Ignore the EPERM warning.

When new pull-context creates a new socket, sometimes socket-loop
gets to recvfrom() before we have set O_NONBLOCK on the socket.
So use ZSOCK_MSG_DONTWAIT on zsock_recvfrom() so it does not
block the socket loop.

Fixes #71450

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-05-07 15:10:09 -05:00
Bjarki Arge Andreasen 2e9279f369 modem_chat: Allow timeout script chat commands
Modem chat scripts should be able to add a script command which
is simply a delay. The validation of chat scripts currently
disallows chat script commands which only have a timeout set.

Update modem_chat to allow modem chat script commands which
only have a timeout. Additionally do a bit of cleanup to
remove duplicate code.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-07 15:09:21 -05:00
Jonathan Rico aa30d07563 Bluetooth: host: handle not getting a buffer
net_buf_alloc(K_FOREVER) can now fail (if run from the syswq). Propagate to
the caller instead of asserting.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-05-07 15:08:04 -05:00
Marcin Kajor b571e45d80 net: if: Extend the usage of rejoining the multicast groups
It may happen that the interface is up but not yet running
when we issue the rejoin_ipv6_mcast_groups(). This can be
fixed by calling this function again right after the iface
is set to 'running' state in the notify_iface_up handler.

Signed-off-by: Marcin Kajor <marcin.kajor@nordicsemi.no>
2024-05-07 15:07:14 -05:00
Fin Maaß 7d83a8a68a lib: smf: constant number of arguments for SMF_CREATE_STATE()
This sets the number of arguments for SMF_CREATE_STATE() to always
be the same, independent of the selected Kconfig options.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-07 17:46:21 +02:00
Théo Battrel b2e235d530 Bluetooth: Remove legacy debug symbols
The `BT_DEBUG_*` Kconfig symbols have been deprecated for more than 2
versions, remove them.

Update code that was still using them.

Remove the Bluetooth specific `Kconfig.template.log_config_bt` and use
`Kconfig.template.log_config_inherit` from the logging subsystem
instead, now that the legacy symbols can be removed.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-05-07 09:49:27 +02:00
Andries Kruithof 6a0cdb4eaa Bluetooth: CAP: Commander Reception start procedure
Add the CAP commander reception start procedure which starts reception
on one or more CAP acceptors

With the implementation of broadcast reception start procedure we also need
some mockups for unit testing

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-05-07 09:34:01 +02:00
Gerson Fernando Budke 94cd46d6ef mgmt: updatehub: Fix mark for update
This fixes compatibility with recent bootutils API.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2024-05-07 09:31:08 +02:00
Russ Webber 3d76e498e9 fs: fuse: fix fuse include path
This commit fixes the incorrect include path for the fuse library.
pkg_search_module populates the <XXX>_INCLUDE_DIRS cmake var.

Signed-off-by: Russ Webber <russ@rw.id.au>
2024-05-06 22:53:27 +01:00
Fin Maaß afff8a16dc net: config: correct dependency of NET_CONFIG*
Corrects the dependencies of NET_CONFIG*

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-06 22:51:19 +01:00
Fin Maaß 571ad19b0d mgmt: hawkbit: change the tls certificate tag
Be able to change the tls certicicate tag.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-06 22:50:44 +01:00
Jukka Rissanen 8d077ca66d net: if: Print warning if there are no network interfaces
When calling net_if_get_default(), print a warning if no
network interfaces are found. This helps debugging mysterious
crashes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 17f852f3cf net: if: ipv6: Do not crash if there are no network interfaces
When trying to get IPv6 prefix, if there are no network interfaces
then the net_if_get_default() will return NULL but we should not
crash at that point but return gracefully.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 2711e12039 net: ipv6: Tailor PE values for Zephyr
Making default preferred time much closer to default valid time
so that the served addresses are much shorter time in deprecated
state where they cannot be utilized. This is important in Zephyr
as there are limited number of IPv6 addresses that can be allocated
to the network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 39ab0bb002 net: sockets: Fix getsockname() for TCP
The local address used for established TCP socket needs to be
dig out from TCP internals and not from context->local.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen c6c021b1f8 net: context: Add helpers for figuring out local endpoint address
We usually cannot use context->local for established TCP connections
because the local address is not updated for TCP if we are bound to
any address. So create helper that try to figure out the end point
addresses.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen d47e0dd93e net: Add IPv6 source address selection support
Add support for IPv6 Source Address Selection defined in RFC 5014.
This commit does not add any address selection support to getaddrinfo()
as described in the RFC. The AI_EXTFLAGS symbol and also the ai_eflags
to hints is added but they are not used by the code.
The public/temporary address selection is only done internally by
the net_if_ipv6_select_src_addr_hint() according to flags set by
setsockopt().

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen bd496541d7 net: shell: Print ref count information for IPv4 and IPv6 addresses
When printing IPv4 and IPv6 address information in "net ipv4" and
"net ipv6" commands, print also reference count of the IP address.
This is useful for debugging purposes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen f96087e257 net: Add ref counting to net_if_addr struct
Add reference counting to network interface address (for both
IPv4 and IPv6) so that the address is not removed if there are
sockets using it. If the interface address is removed while there
are sockets using it, the connectivity will fail for the said
socket.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen c69357a8b4 net: if: Remove IPv6 address when it expires
No need to keep the expired addresses around, just remove it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen a7e332dc18 net: ipv6: Add Privacy Extension events to net_mgmt
Add events to be generated when privacy extension is enabled
or disabled, or when allow/deny filter is added or deleted.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen c741c524ae net: shell: Add information about IPv6 privacy extension
When executing "net iface" command, print current status of
IPv6 privacy extension if it is enabled in config file.

The "net ipv6 ..." command prints IPv6 privacy extension
information, and can add or delete IPv6 prefix filters.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 0d085d74c4 net: ipv6: Select proper IPv6 source address for privacy extension
If IPv6 privacy extension is enabled, then we need to select
proper public or temporary IPv6 source address when sending the
packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen ed9a983837 net: ipv6: Initial support for privacy extension
This creates support for IPv6 privacy extensions which is described
in RFC 8981. This will also add API that can be used to add IPv6
prefixes to a allow or deny list privacy extension filter.

The code will create temporary IPv6 addresses from prefixes that
are advertised by Router Advertisement messages. The temporary
IPv6 addresses are then expired according to lifetime and removed.

Fixes #9349

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen ce4a13ae79 net: ipv6: Generate an event for deprecated address
If IPv6 address expires and moves to deprecated state, then
send a mgmt event so that listeners can act on it.
One such action is to close a socket bound to that source address
so that the address can be released.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Konrad Derda 5c0d7390f1 net: ipv6: mcast_routing: send MLDv2 reports on changes
This commit adds transmission of MLDv2 reports whenever a multicast
routing entry is added or removed when suitable (it checks if the
given interface itself has joined the group).

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-06 22:50:01 +01:00
Konrad Derda 356a42587c net: ipv6: mld: add option to include multicast routes in MLDv2 reports
This commit introduces a new option CONFIG_NET_MCAST_ROUTE_MLD_REPORTS
which appends multiacst routes to MLDv2 reports. These records are
intended to inform reports' recipients about potential listeners on
the other interfaces.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-06 22:50:01 +01:00
Konrad Derda 486f895a54 net: ipv6: mld: allow to send unsolicited MLDv2 reports on demand
This commit exposes net_ipv6_mld_send_single() function to be used
by other modules.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-06 22:50:01 +01:00
Marcin Szymczyk 671bf6619e testsuite: interrupt_util: add trigger_irq for VPR CLIC
Enable triggering IRQs in tests for VPR CLIC.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-05-06 19:06:19 +02:00
Dong Wang 6a962fb50a pm: re-program timer HW only when the exit latency is not zero
Avoid re-programming timer unnecessarily.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-06 17:31:40 +01:00
Benjamin Lindqvist 0d14143926 net: coap_client: handle observe requests as intended
The coap_client lib only handled "one-shot" requests properly. This
patch allows it to keep listening for additional responses to a request,
if the request was made with the CoAP OBSERVE option appended.

An API for canceling such requests is also added.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2024-05-06 17:31:19 +01:00
Jukka Rissanen aecac68179 net: Do not directly use net_buf size field
The size field in net_buf should not be used directly as then
the optional headroom will not be taken into account.
There is the net_buf_max_len() API that should be used instead.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 17:31:09 +01:00
Ping Wang 1188305c1e Bluetooth: Audio: Shell: adds support for BIS index parameter
When calling bap_broadcast_assistant add_pa_sync, it should only
set the BIS index field as optional parameters and not to whatever
is in the BASE.

If setting BIS index which the BASE does not support, then the
command should be rejected.

This PR fixes https://github.com/zephyrproject-rtos/zephyr/issues/70835

Signed-off-by: Ping Wang <pinw@demant.com>
2024-05-06 17:30:04 +01:00
Ping Wang 6a027634cd Bluetooth: Audio: Shell: adds support for BIS index parameter
When calling bap_broadcast_assistant add_pa_sync, it should only
set the BIS index field as optional parameters and not to whatever
is in the BASE.

If setting BIS index which the BASE does not support, then the
command should be rejected.

This PR fixes https://github.com/zephyrproject-rtos/zephyr/issues/70835

Signed-off-by: Ping Wang <pinw@demant.com>
2024-05-06 17:30:04 +01:00
Troels Nilsson 5d44e36779 Bluetooth: Controller: Fix BIS target_event truncated to 8 bits
The target_event value is up to 39-bits but was put into a uint8_t

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-05-06 15:03:56 +01:00
Pieter De Gendt f147a5fec2 spelling: Replace occurrences of "iff" with "if and only if"
Spell checking tools do not recognize "iff", replace with "if and only if".
See https://en.wikipedia.org/wiki/If_and_only_if

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-06 14:58:08 +01:00
Seppo Takalo 553e5d2e0c net: lwm2m: Move one Kconfig to engine features submenu
Kconfig option to enable object version reporting should
be moved into sub section "Engine features" so
it does not clutter up the main LwM2M menu.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-05-06 14:55:42 +01:00
Chaitanya Tata 2277451e9a hostap: Increase the stack size for net_mgmt
Due to recent changes in hostap to move few buffers from heap->stack (to
improve the reliability of allocations) this has increased the stack
size and with another recent change to increase the max polling sockets
this puts over the 4096 stack size for net_mgmt causing stack overflow.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 14:55:09 +01:00
Tomasz Moń 2f24adbe0f usb: device: Do not claim to be USB 3.2 device
The bcdUSB value 0x0210 defined in USB 3.2 Specification indicates USB
3.2 device operating in one of the USB 2.0 modes. USB 2.0 Link Power
Management Addendum defines bcdUSB value 0x0201 to indicate that USB 2.0
device supports the request to read the BOS Descriptor.

The main difference between bcdUSB 0x0210 and 0x0201 is that the USB 3.2
device must support LPM, while USB 2.0 devices can (but are not required
to) support LPM.

The difference is respected by USB 3 Gen X Command Verifier (2.3.0.0)
Chapter 9 Tests [USB 2 devices], where the test behaves as follows:
  * For bcdUSB 0x0200:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.00.
      DUT is NOT compatible with LPM.
      LPM is NOT required for DUT
      LPM is only supported in USB version 2.01 and above.

  * For bcdUSB 0x0201:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.01.
      DUT IS compatible with LPM.
      LPM is NOT required for DUT
      USB 2.0 Extension Descriptor bmAttributes:
        LPM Capable = 0
        BESL and Alternate HIRD Supported = 0
        Baseline BESL Valid = 0
        Deep BESL Valid = 0
        Baseline BESL: 0d
        Deep BESL:  0d
      LPM is not supported

  * For bcdUSB 0x0210:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.10.
      DUT IS compatible with LPM.
      LPM IS required for DUT
      USB 2.0 Extension Descriptor bmAttributes:
        LPM Capable = 0
        BESL and Alternate HIRD Supported = 0
        Baseline BESL Valid = 0
        Deep BESL Valid = 0
        Baseline BESL: 0d
        Deep BESL:  0d
      (USB: 9.6.2.1.6) Bit 1 in Attributes field of a USB 2.0 Extension
      descriptor returned in response to a GetDescriptor(BOS) request
      must be 1 for LS/FS/HS devices that support LPM L1.

The test fails when LPM bit is not set in USB 2.0 Extension Descriptor
only when bcdUSB is 0x0210. The test failure was incorrectly fixed in
commit 312429be3c ("usb: samples: Add Extension descriptor to webUSB
sample."). Properly fix the issue by changing bcdUSB to 0x0201 and
removing the false LPM support claim.

The false LPM claim was leading to device ceasing to work after some
time if there was no traffic from host to device (when the host is
likely to have executed the LPM L1 transition that was not properly
handled by the device).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-05-06 14:54:23 +01:00
Markus Lassila dcb3704bc7 net: l2: ppp: Fix terminate requests
When PPP moves to the 'Closing' state it sends up to configured number
of 'Terminate-Request' packets. It only moves to the 'Initial' state,
after running out of retransmits or when it receives a 'Terminate-Ack'
packet.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2024-05-06 14:54:12 +01:00
Emil Gydesen 68ea1c4fe4 Bluetooth: CAP: Fix issue with parallel CAP discover
The bt_cap_common_discover function relied on a global variable
used to  indicate that a discovery was in process.
This global variable prevented multiple discoveries to take place
on multiple ACL connections, where the intention was to stop
multiple discoveries on the same ACL.
This has been fixed by moving the variable into the
struct bt_cap_common_client, so that it applies per
connection, rather than a global check.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-06 11:48:31 +02:00
Emil Gydesen d45b462f23 Bluetooth: CSIP: Set Coordinator move data to instances
Moved the busy flag and the GATT paramters to the
individual CSIP Set Coordinator instances.

This allows to use multiple instances in parallel,
and thus in turn allow CAP to do things in parallel.

This commit has been done with minimal amount of changes,
even if there are multiple pieces of code that could likely
be refactored to be better.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-06 11:48:31 +02:00
Jonathan Rico 28d7d14571 Bluetooth: ATT: add debug log for timeout override
Nice to know the stack's ain't having none of your timeouts.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-05-04 15:21:45 +01:00
Jonathan Rico 24c7ad344f Bluetooth: conn: check k_work_submit() retcode
We still don't know how to handle it but at least it's checked now.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-05-04 15:21:14 +01:00
Szymon Janc 9631cd14b0 Bluetooth: OTS: Fix calling obj_created callback with NULL conn
Callback was always called with NULL conn. Now it is called with proper
pointer or NULL conforming to description.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-05-04 13:23:34 +03:00
Rubin Gerritsen 44199f3a48 Bluetooth: Host: Fix auto-connect/sync establishment on Coded PHY
As documented in bt_le_scan_update(), the host may start scanning
automatically for various reasons.

Until now scanning was only done on 1M PHY, making it impossible
to use auto-connect/sync establishment if the advertiser was using
Coded PHY as its primary PHY.

Auto-connection would never work. Sync establishment would work if
the scanner was started by the application.

This commit fixes this by instructing the controller to scan on
both 1M and Coded PHY if the controller supports Coded PHY.
The application may see increased power consumption as a result
of this change as the controller may now spend 2*scan_window
listening for advertising packets.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-05-03 14:44:31 +01:00
Jeferson Fernando c0a17a9a5e lorawan: add channels mask configuration.
Add channels mask configuration for LoRaWAN, creating a request for
 LoRaMAC. This change is needed because using LoRaWAN with ABP
activation without configuring channels mask will provide no acceptable
 channels on data transmit, causing data loss.

Signed-off-by: Jeferson Fernando <jeferson.santos@edge.ufal.br>
2024-05-03 09:51:46 +02:00
Jose Alberto Meza 30eda2058b treewide: drivers: espi: Adjust terms per eSPI specification 1.5
1) Replace master/slave in API for new terms in eSPI spec 1.5
2) Reflect eSPI VW change and macro changes across eSPI drivers
3) Update terms in eSPI driver sample and eSPI test driver

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2024-05-02 13:56:46 -04:00
Fin Maaß fb3704665a mgmt: hawkbit: use shell macros
use short shell macros for printing.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 13:55:28 -04:00
Bogdan Marinescu da708e232a ipc_rpmsg_static_vrings: use names for WQ threads
This patch adds names to the threads created by `mbox_init` via
`k_work_queue_start`. The name of the thread is the same as the name in
the device instance.

The main reason for this has to do with how `mcumgr` reports [thread
information](https://docs.zephyrproject.org/latest/services/device_mgmt/smp_groups/smp_group_0.html#task-statistics-command).
Specifically, data about threads is sent in a CBOR encoded map where the
map keys are the thread names (at least in the default configuration). If
there's more than one IPC channel defined (one example of this being
`samples/subsys/logging/multidomain`), both threads would be created
with an empty name and `mcumgr` will only return the data associated
with the thread created by the last call to `mbox_init`.

Signed-off-by: Bogdan Marinescu <bogdan.marinescu@gmail.com>
2024-05-02 20:47:38 +03:00
Aleksander Wasaznik 2dd987713b Bluetooth: Coverity fix dereference before null check
https://scan9.scan.coverity.com/reports.htm#v45144/p12996/fileInstanceId=132890135&defectInstanceId=9972463&mergedDefectId=363710

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-05-02 16:59:08 +02:00
Aleksander Wasaznik 34f78b8fde Bluetooth: Coverity fix untrusted value
https://scan9.scan.coverity.com/reports.htm#v45144/p12996/fileInstanceId=132890129&defectInstanceId=9972487&mergedDefectId=330721

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-05-02 16:59:08 +02:00
Aleksander Wasaznik 2e702e3065 Bluetooth: Coverity fix dereference before null check
https://scan9.scan.coverity.com/reports.htm#v45144/p12996/fileInstanceId=132878471&defectInstanceId=9972432&mergedDefectId=330636

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-05-02 16:59:08 +02:00
Aleksander Wasaznik 272af07279 Bluetooth: Coverity fix dereference before null check
https://scan9.scan.coverity.com/reports.htm#v45144/p12996/fileInstanceId=132878471&defectInstanceId=9972464&mergedDefectId=330625

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-05-02 16:59:08 +02:00
Martin Jäger f3e41c6a25 lorawan: services: add Fragmented Data Block Transport
This service receives fragmented data (usually firmware images) and
stores them in the slot1_partition in the flash.

Also update CMakeLists.txt in loramac-node module to be able to use
FragDecoder.c

Signed-off-by: Martin Jäger <martin@libre.solar>
2024-05-02 16:54:43 +02:00
Vinayak Kariappa Chettimada 64f41309d1 Bluetooth: Controller: Use reschedule margin as minimum ticks_slot
Use reschedule margin as minimum ticks_slot when ticker with
reschedule expires. This will ensure not too many unreserved
tickers expire in close proximity that can lead of pile up
of CPU processing time and eventually causing timeout
callbacks to be delayed. This mitigate possible LL asserts
due to overhead in start of radio events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-02 12:18:49 +01:00
Vinayak Kariappa Chettimada 263357e042 Bluetooth: Controller: Enable ticker slot window yield for mesh
Enable use of ticker slow window yield feature under mesh
usecase. This is make sure scan window either slides within
is window or skips to next interval so that it does not
lead to advertising event being skipped.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-02 12:18:49 +01:00
Vinayak Kariappa Chettimada 7d1bc1789e Bluetooth: Controller: Fix short prepare preempt timeout start
Fix short prepare preempt timeout start, such that if there
are any normal prepare before a short prepare in the
pipeline, then find the short prepare and start its preempt
timeout.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-02 12:18:49 +01:00
Vinayak Kariappa Chettimada acc806889f Bluetooth: Controller: Add prepare pipeline assertion checks
Add prepare pipeline assertion checks to detect faults
like stopping preempt timeout without prior start. Also,
check if the preemptor param is correct when preemption
is performed. Check that the prepare pipeline is not
infinitely looping.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-02 12:18:49 +01:00
Vinayak Kariappa Chettimada 0e0cb3033a Bluetooth: Controller: Add assertion check for use of scan aux context
Add assertion check for use of scan aux context so that
scan aux context is not assigned again while there is
already an existing LLL scheduling in use by the scan
context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-02 12:18:49 +01:00
Vinayak Kariappa Chettimada 9383e4fbf8 Bluetooth: Controller: Fix BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE
Fix BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE to setup new
shorter preempt timeout irrespective of whether there
is a previous prepare enqueued in the prepare pipeline.

Relates to commit d573951f0d ("Bluetooth: Controller:
Revert back early abort of previous prepare").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-02 12:18:49 +01:00
Gerson Fernando Budke 5fb62ca960 mgmt: updatehub: Fix json arrays
After the changes introduced by #50816 the UpdateHub could not decode
anymore the JSON object. This introduce missing parsing definitions
to allow JSON parser undertood the correct UpdateHub probe object.

Fixes #69297

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2024-05-02 10:55:34 +02:00
Fin Maaß 0012e1ff76 mgmt: hawkbit: reset action id
Be able to reset the hawkBit action id.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 09:32:18 +01:00
Aurelien Jarno ea995f6378 lorawan/nvm: do not call settings_save() after writing individual settings
The lorawan subsystem do not use settings handler, and instead uses
individual calls to settings_save_one(). With this strategy there is no
need to call settings_save() at the end.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-01 22:56:34 +01:00
Aurelien Jarno e94fe44805 subsys/settings: add a function to save subtree
When running multiple subsystems or applications on a MCU, the usual
strategy is to use different settings subtrees.

The API provides a way to load or commit a subtree, to avoid adding
dependencies between subsystems or applications, but lacks the way to
save a subtree only. Fix that by adding a settings_save_subtree()
function.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-01 22:56:19 +01:00
Omkar Kulkarni 11eed84775 Bluetooth: Mesh: Update models metadata API
This commit updates models metadata API to simplify the usage and
removes the metadata pointer in health server model context.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-05-01 10:54:50 -04:00
Fabio Baltieri 4257fb6a3d shell: device_service: show the usage conter when pm runtime is enabled
Add an extra "usage=%d" to the device status to show the current usage
counter when PM runtime is enabled.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-05-01 10:31:03 +02:00
Fabio Baltieri df819a8609 pm: device_runtime: add an access function to get the usage counter
Add a pm_device_usage_get() to get the current usage counter.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-05-01 10:31:03 +02:00
Fabio Baltieri d5c773d373 pm: shell: filter out non PM enabled devices
Add a device lookup filter to only suggest devices that are PM enabled.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-30 19:30:15 -05:00
Fabio Baltieri 48e2f67869 shell: add a callback-filter variant of shell_device_lookup
Add a shell_device_filter variant of the shell device lookup helper that
takes a callback as an argument. This allows more complex filtering on
the device than the existing name prefix.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-30 19:30:15 -05:00
Emil Gydesen 353a05b116 Bluetooth: BAP: Unicast server depend on PACS
When in the BAP unicast server role, at least PAC sink
or PAC source shall be set.

In order to fulfill this new requirement, a few other Kconfig
options had to be changed to a `depends on` from `select` to
avoid recursive Kconfig requirements. This change may require
some applications to update their configurations according
to the migration guide.

The change from `select` to `depends on` is ideal anyhow
as that is the recommended way to add dependencies.

This can checked via the combined BT_PACS Kconfig value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-30 14:30:45 -04:00
Jonathan Rico 55154e226c Bluetooth: Classic: make SMP use L2CAP BR API
Make `l2cap_br_send_cb()` semi-public, and make SMP use it when it talks
over a BR channel.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-30 18:01:34 +02:00
Jonathan Rico f661773e2c Bluetooth: L2CAP: l2cap_send() -> l2cap_send_sig()
This function is only ever used to send on the signalling channel.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-30 18:00:52 +02:00
Jukka Rissanen 4b157b9099 net: lib: http_server: Initial HTTP server support
Original code developed as a GSoC 2023 project by Emna Rekik.

Code refactored in order to provide better bisectability
as the origical commits were not bisectable.

The server supports static and dynamic resources, managed by
HTTP_SERVICE/HTTP_RESOURCE macros.

Fixes #59685
Fixes #59686
Fixes #59688
Fixes #59690
Fixes #59670
Fixes #59700
Fixes #59684
Fixes #59693
Fixes #59693
Fixes #59694
Fixes #59699
Fixes #59696
Fixes #59688
Fixes #59690
Fixes #59670
Fixes #59700
Fixes #59685
Fixes #59686
Fixes #59688
Fixes #59691

Signed-off-by: Emna Rekik <emna.rekik007@gmail.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-30 13:25:22 +02:00
Robert Lubos 318dcb6336 net: lib: http_server: Add HPACK and Huffman code encoder/decoder
Add HTTP/2 helper libraries to encode and decode HPACK encoded headers,
according to RFC7541.

HPACK string encoding requires to support certain set of Huffman codes,
therefore implement Huffman encoder/decoder as well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-30 13:25:22 +02:00
Anas Nashif 0510e081a3 testsuite: ztress: fix doxygen command
Fix doxygen command.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-04-30 12:00:58 +02:00
Rubin Gerritsen ebae4b8cf7 Bluetooth: Controller: Default stream count based upon app configs
When building ISO applications on a device that has the host
and controller on the same core, the application developer
shouldn't have to set controller specific configurations.

Without this change the samples iso_receive and iso_broadcast
will fail to run on NRF52 series devices as the samples
try to set up two streams but the controller is configured
to support only one.

Controller unit tests that were previously only enabling the
controller specific ISO configurations now also enable the
top-level ISO configurations to ensure that the default
stream count is properly configured.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-30 11:45:47 +02:00
Chaitanya Tata 09048e0a16 net: ipv6: mld: Fix improper reference drop
In case of successful submission, the reference shouldn't be put down,
this only should done on error cases.

As reference is put down on success, during the buffer unref, no action
is taken due to an uint8 overflow (ref is now 255), so, the buf->frags
isn't cleared properly and the next time the frags is used and when L2
inserts a second frag, the first head frag and next frag are same (due
to buffer re-use) causing an infinite loop in either net_buf_frag_last
or net_pkt_get_len.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-04-30 11:45:38 +02:00
Flavio Ceolin a458d892e6 pm: device_runtime: Check busy status in runtime_enable
We can't enable device runtime power management in a device that is
set busy since it may suspend this device.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-04-30 08:53:18 +02:00
Troels Nilsson 9b7d176b70 Bluetooth: Controller: Minor cleanup of struct proc_ctx
Remove unused collision field

Change type of done to uint8_t and move it to avoid padding bytes

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-04-29 15:55:13 +02:00
Ajay Parida 1542140e4e net: wifi: Unicast frames statistics
Unicast RX stats
It represents total number of unicast (any type data, action or
any other unicast frames) frames received at firmware level.
The actual frames passed to host will be different as firmware
may drop packets or some packets may be dropped because of
errors.

Unicast TX stats
Transmission side the unicast packets count states the packets
handed over to firmware. The stats taken at firmware level.
Actual packets transmission may vary depending upon various factors.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-04-29 12:17:18 +03:00
Emil Gydesen 65e787be58 Bluetooth: BAP: Shell: Add USB out support for the BAP shell
Add USB out support for the BAP shell, so that decoded LC3
data can be sent to the host (e.g. a PC).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-29 11:04:09 +02:00
Emil Gydesen 55ea78f30b Bluetooth: VCP: Remove bad busy flag set for vol ctlr
The volume controller always set the busy flag in
bt_vcp_vol_ctlr_set_vol, where it should only set it
if the GATT operation succeeds.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-29 11:02:29 +02:00
Théo Battrel a0198fe420 Bluetooth: Host: Check max adv data len from ctrl
Send a `READ_MAX_ADV_DATA_LEN` command to the controller at the
initialization of the host to fetch the maximum advertising data length
the host can accept.

This is done because even if the Zephyr controller provide the
`CONFIG_BT_CTLR_ADV_DATA_LEN_MAX` Kconfig symbol, other controllers may
not have such Kconfig symbol. So this is a way for the host to be more
controller-agnostic and provide useful feedback to the users.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-29 11:02:02 +02:00
Johan Hedberg d590bcb5e0 Bluetooth: Remove BT_HCI_RESERVE and BT_HCI_RAW_RESERVE
In most cases these were defined as 1. Saving one byte for the rest
doesn't really justify the added complexity that comes with these
options. Removing them also simplifies the interface between HCI
transports/drivers and the host stack, which in turn helps pave the way
for having HCI as a proper Zephyr driver API.

Fixes #71907

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-04-29 11:01:27 +02:00
Aleksandr Khromykh dad7c31e7f Bluetooth: Mesh: use bt_rand instead of sys_rand
Commit adds using host\controller based random number
generator instead of zephyr driver.
No mesh dependency anymore on zephyr system
random driver.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-04-29 11:00:00 +02:00
Rubin Gerritsen 0a19c18f85 Bluetooth: Host: Document bt_le_scan_update()
This function is used in many places, but just by reading its
name it is not obvious why it is needed.
By adding some documentation it will hopefully become a bit more
clear that this function is mainly used for auto connection
establishment.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-29 10:59:28 +02:00
Johan Hedberg ac804c6211 Bluetooth: shell: Fix incorrect check for error return
This line was clearly intended to check for the value returned by
ad_init(). The ad_len is unsigned, so checking for a negative value
showed up in a recent Coverity run (no GitHub issue for it yet).

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-04-29 10:59:20 +02:00
Théo Battrel 83d6cd4710 Bluetooth: Controller: BT_CTLR_ADV_DATA_CHAIN doc
Update the documentation of `BT_CTLR_ADV_DATA_CHAIN` Kconfig symbol to
say that it's only supported in *non-connectable* extended advertising.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-28 17:23:10 +03:00
Jonathan Rico 6435262284 Bluetooth: L2CAP: Handle REJECT_RSP for ECRED
We can (and do) open multiple channels with a single L2CAP command. If the
remote doesn't support dynamic channels at all, then it sends back a
REJECT_RSP.

We only destroyed the first channel that matched the command PDU
identifier. Fix that and remove all channels that match.

Also add a test that verifies the patch.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-26 19:21:46 -04:00
Alberto Escolar Piedras b304c26c10 logging: Default to IMMEDIATE mode for native targets
Instead of having the boards override the default
in their Kconfig.defconfig
let's just default to IMMEDIATE logging mode in the main
definition if we are building for a ARCH POSIX board.

This avoid issues w dependencies being lost if not duplicated
correctly.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-26 19:48:49 +01:00
Aleksandr Khromykh 0015ab0f77 Bluetooth: Mesh: fix dfu srv applying phase
Commit fixes bug if dfu server failed to deliver
apply response it gets stuck in applying phase.
In this phase it skips all further client attempts
to apply image again.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-04-26 16:11:20 +02:00
Torsten Robitzki c1b07eda84 logging: fix backend index caluculation
Backend index must also be incremented, when backend is not an autostart
backend. Otherwise, the resulting bit field can not be used to address
a backend by index; autostart field would have to be taken into account.

Signed-off-by: Torsten Robitzki <Torsten@Robitzki.de>
2024-04-26 16:09:24 +02:00
Vinayak Kariappa Chettimada 8fa75e2ada Bluetooth: Controller: Ignore failure to Broadcast ISO remove data path
Ignore failure to Broadcast ISO remove data path when
terminating a BIG without a data path being setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:26 +02:00
Vinayak Kariappa Chettimada a1e8af0936 Bluetooth: Controller: Fix missing Broadcast ISO HCI reset
Fix missing Broadcast ISO implementation for HCI reset.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:26 +02:00
Vinayak Kariappa Chettimada ddce23b447 Bluetooth: Controller: Fix multiple advertiser assertion
When multiple advertisers overlap over time, the random
delay being applied need many ticker operation context.
This causes the ticker_update interface to return error
causing assertion in the Controller.

This is fixed by not applying random_delay value to the
overlapping advertiser that does not get to use the radio.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:14 +02:00
Vinayak Kariappa Chettimada fd15e89ae8 Bluetooth: Controller: Increase ull_sched ticker_next_slot_get retries
Increase retries for ull_sched use of ticker_next_slot_get.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:14 +02:00
Hang Fan 247ac7fce9 Bluetooth: Classic: Add SDP records for HFP
Add SDP records for HFP Hands-Free

Signed-off-by: Hang Fan <fanhang8@gmail.com>
2024-04-25 18:05:40 -04:00
Fabio Baltieri c5003e0eb1 pm: add device shell commands
Add support for a "pm" shell command to trigger suspend/resume as well
as runtime-get/put on devices. This is useful for testing during driver
development.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-25 18:00:05 -04:00
Flavio Ceolin ec83ab333d pm: policy: Fix event integer overflow
In the follow expression:

cyc_evt += UINT32_MAX + 1U

first it is evaluated (UINT32_MAX + 1U), since both types
interpreted as uint32_t, this operation causes an overflow resulting
in 0U.Then we have

cyc_evt = (uint64_t)cyc_evt + 0U

Fix it casting of the operands in the first operation to uint64_t.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-04-25 17:58:04 -04:00
Aleksander Wasaznik 2a7adae6c1 Bluetooth: Rename num_complete_pool -> sync_evt_pool
Refactor only. The surrounding ifdefs are intentionally not changed in
this patch. They will be in the near future.

Rename the pool and generalize the documentation to allow using this
pool for other events that fit the same criteria. This pool can be used
for any buffer that is processed synchronously, without negatively
affecting 'num complete' messages. E.g. 'cmd complete/status' can be put
in this pool already.

We will be working towards making the host process all event buffers
synchronously. This is because events have no dedicated flow control,
and discarding events in the driver without informing the host creates
problems. Discarding should instead happen in the host higher layers
when unavoidable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-25 15:10:50 +02:00
Szymon Janc e4747b28a8 Bluetooth: OTS: Fix checksum calculation support
There was a typo in Kconfig check (missing CONFIG_ prefix) which
resulted in not setting OACP_FEAT_BIT_CRC bit in features.

This also resulted in checksum feature being disabled due to check
in bt_ots_init().

This was affecting OTS/SR/OASP/BV-03-C qualificatio test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-04-25 07:44:08 -04:00
Jukka Rissanen 07599e3a53 net: vlan: Add a function to check if interface is VLAN one
We were missing a helper function that can be used to check
whether the given function is the virtual VLAN interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-25 11:06:23 +00:00
Nithin Ramesh Myliattil 92417967cf Bluetooth: BAP: Shell: Add BASS service data to ext-adv
As per the BAP spec, the scan delegator device should add the BASS service
data in the extended advertising data when it requests a broadcast
assistant to scan for it. For testing purposes that's usually the case
with the shell, extended advertising data shall be populated with the
BASS service data.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-04-25 09:56:25 +00:00
Galen Krulce 1cfe90d825 tracing: full reset during init
I am using the tracing module using the RAM backend on a system with
limited RAM & a buffer that can only store 300ms of tracing data. Current
tracing module starts recording during boot-up & we run out of memory prior
to executing code we actually want to trace.

By reseting buffer metadata here, I can call init() at an arbitrary point
of program execution & the tracing module will reset & start tracing.

I tested on E2E on an ARM M-class MCU by calling init & then reading
buffered tracing data via GDB

Signed-off-by: Galen Krulce <gkrulce@meta.com>
2024-04-24 17:08:24 -04:00
Al Semjonovs 0bca04635d shell: Allow extension of shell APIs
Similar to logging module, allow application specific extension of
shell fprintf APIs at a macro level.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2024-04-24 16:04:03 -04:00
Joakim Andersson 24264ad4af shell: Improve the default serial backend init level
Improve the default serial backend init level.
The documentation says to be bigger than the init level of the serial
device used. Since serial devices default to the kernel device init
level (50) then put this to default of application level drivers (90).

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2024-04-24 19:42:23 +00:00
Vinayak Kariappa Chettimada 2329a2f0a1 Bluetooth: Controller: Aux offset population assertion check
Add aux offset population assertion check, to ensure the
aux offset calculation is completed before the primary
PDU is setup for transmission.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-24 15:02:28 -04:00
Aleksandr Khromykh fe13209eb1 Bluetooth: Mesh: fix start rx transaction before tx is ended
Commit fixes behavior when provisioning protocol accepts
incoming transaction before ongoing tx transaction is
still active (device didn't receive acknowledgement yet).
Incoming data are ignored until ack is not received.

Specification:
5.3.3 Generic Provisioning behavior
...
If the sender receives a Transaction Acknowledgement
message, then the transaction has completed.
If the sender receives a message with other PDU types,
then the message shall be ignored.
...

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-04-24 15:01:43 -04:00
Tomi Fontanilles a986905df5 modem: chat: implement helper defines/structs
Those helpers allow to define some typical kinds of chat matches and
scripts with more ease/less boilerplate.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-04-24 15:00:10 -04:00
Dominik Ermel c007e717d4 mcumgr/img_mgmt: Fix zcbor logic in os_mgmt_bootloader_info
There have been to problems with the code where zcbor_bool_encode
has been fed value instead of expected pointer and the result
of previous zcbor_encode operations has not been taken to evaluate
value of ok status.
The change also replaces usage of  #if IS_ENABLED with #ifdef, as
IS_ENABLED should not be used outside if().

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-04-24 14:55:57 -04:00
Henrik Brix Andersen 7390740c29 canbus: isotp: use proper CAN ID masks
Use CAN ID masks matching the flags used in the CAN RX filter.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-04-24 09:53:06 +02:00
Ajay Parida 02f4e71633 net: l2: wifi: Fix for wrong return type
The function should return NULL instead of false in case of failure.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-04-24 09:52:48 +02:00
Ajay Parida b93002655e net: l2: wifi: Protect processing of nm data
Use lock while accessing nm data.
One of the use case is while setting regulatory, it accesses nm data,
while from some other place also it can be accessed same time.
Protected the nm data processing.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-04-24 09:52:48 +02:00
Jonathan Rico b08b1c21a0 net: buf: Disallow blocking allocation in syswq
Work items on the syswq should always run-to-completion.

Override the timeout value to always be K_NO_WAIT.

Allocating with K_FOREVER leads to deadlocks if the freeing also happens
from the syswq. Non-zero timeouts are also not nice for the other users
of the syswq.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 19:47:24 -04:00
Chaitanya Tata b29dff09fa net: wifi: Check for mandatory args
Even though we are passing mandatory args from the shell registration,
due to use of getopt the check can be bypassed without the hyphenated
options.

So, enforce and fail if mandatory parameters aren't passed through
getopt.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-04-23 19:46:57 -04:00
Chaitanya Tata ddf09c9f58 net: wifi: Add missing return code for failures
This is handy in debugging.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-04-23 19:46:57 -04:00
Vinayak Kariappa Chettimada dc56669c31 Bluetooth: Controller: Default to advertising coding in ACL connection
Change default to using advertising coding in ACL connection
when establishing connections on Coded PHY.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 21:29:10 +00:00
Vinayak Kariappa Chettimada a725931c11 Bluetooth: Controller: Add missing check for Coded PHY support
Add missing check for Coded PHY support when creating
extended advertising set.

Added a fallback in Controller for upper layers requesting
Coded PHY while Controller is implemented without Coded PHY.
In this case, 1M PHY will be used in extended advertising
for testing purposes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 21:29:10 +00:00
Aleksander Wasaznik 8714e3634e Bluetooth: Fix minor whitespace issue
Fix minor whitespace issue

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-23 21:27:35 +00:00
Andreas Rudolf f531afbd2c net: lwm2m: Add config to always report obj version
Adds a config that enables sending the object version for all objects.

According to LwM2M specification v1.0 and v1.1, non-core object versions
other than 1.0 'must' be provided, while all other versions 'may' be
provided. With specification v1.2, a client 'can always attach Object
Version Information'. Or in other words, it is OK to always report the
object version with all specifications.

Signed-off-by: Andreas Rudolf <andreas.rudolf@husqvarnagroup.com>
2024-04-23 21:26:39 +00:00
Vinayak Kariappa Chettimada 9bcf275d8b Bluetooth: Controller: Ignore bit 1 set in Initiating_PHYs
Ignore LE 2M PHY being set in Initiating_PHYs of the
LE Extended Create Connection command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 13:44:31 +00:00
Håvard Reierstad e56494634a bluetooth: mesh: Adapt BLOB IO to RRAM write size
Adapts flash writing for BLOB IO to RRAM. The previously used write
block alignment is not needed for RRAM.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-04-23 13:43:31 +00:00
Emil Gydesen e7ee26d5ed Bluetooth: BAP: Shell: Moved RX and TX fields into a union
An audio stream is unidirectional, so it's always either
TXing or RXing, so the fields can safely be moved to an
enum.

The struct now has both a is_rx and is_tx field. The reason
why two bools are being used, is that the both of them may
be false (we need 3 states).

All access to the rx and tx structs in the union shall be
guarded by these fields.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-23 15:36:39 +02:00
Jonathan Rico e4364413c2 Bluetooth: L2CAP: Don't try to send on disconnected channel
We could start executing the work item after the channel has been
disconnected or destroyed, due to a race condition.

Double-check we are connected before attempting to send data.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 15:34:48 +02:00
Jonathan Rico 57b94080b2 Bluetooth: L2CAP: don't use NULL buf
Allocation of `buf` can fail. It just very rarely happens in practice.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 15:34:42 +02:00
Aleksander Wasaznik df1e4aa70f Bluetooth: refactor add is_host_managed_ccc
This check is repeated many times in `gatt.c`, with various comments.
This patch refactors these occurrences into a named function.

Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/41789

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-23 15:34:25 +02:00
Jonathan Rico a5ae3b026b Bluetooth: conn: Don't wait for buf allocation in syswq
We can't just keep blocking the syswq, people be mad.
Override the timeout value so we always have K_NO_WAIT.
Also print a message to whomever's listening.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 15:34:10 +02:00
Szymon Janc baf3cc9fe0 bluetooth: OTS: Delay indications to system workqueue
OTS requires that indications about state change are sent after
response to ATT Write.

OTS Specification p.4.4.4.: "An OLCP or OACP operation is started
when the ATT Write Response is received from the Object Server as
a result of the Object Client writing an Op Code to a control point
to perform some desired action. The control point operation ends
when the Object Server sends an indication to the Object Client
 with the Op Code set to Response Code."

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-04-23 15:32:07 +02:00
Rubin Gerritsen 237c59585e Bluetooth: Host: Rename bt_conn_state_t states for clarity
To make it easier to understand the code, the following was done:
- Use INITIATING/ADV for state names that are exclusive to central
  or peripheral. Previously it was not necessarily clear that the state
  BT_CONN_CONNECTING was for central only by just looking at where
  it was used. The terms INITIATING/ADV were used in favor
  of central and peripheral as these terms also work for SCO connection
  establishment.
- BT_CONN_CONNECTING_SCAN -> BT_CONN_SCAN_BEFORE_INITIATING
  to make it more clear that we are not scanning and connecting at
  the same time. The new name should make it more clear why we are
  scanning - only with the intention to start the initiator later.
- BT_CONN_CONNECTING_AUTO -> BT_CONN_INITIATING_FILTER_LIST.
  This makes it clear that this state is something different than
  BT_CONN_AUTO_CONNECT.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-23 15:31:59 +02:00
Rubin Gerritsen 1c132c90aa Bluetooth: Host: Document flags used for connection establishment
When initially reading some of the host code it was unclear to me
why they were needed an how they are used.
By adding some documentation,
this can hopefully make it easier for others to understand these.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-23 15:31:59 +02:00
Carles Cufi a1dd9a5f6e bluetooth: host: Fix alignment of gatt_chrc
The following warning is issued by clang:

warning: field  within 'struct gatt_chrc' is less aligned than 'union
gatt_chrc::(anonymous at subsys/bluetooth/host/gatt.c:1859:2)' and
is usually due to 'struct gatt_chrc' being packed, which can lead
to unaligned accesses [-Wunaligned-access]

This is due to the fact that the uint16_t uuid field requires 2-byte
alignment but it is not marked as packed. Since the enclosing struct is
indeed packed, the required alignment is not guaranteed and so clang
complains. Fix it by ensuring that the union is marked as packed too.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-04-23 14:23:04 +03:00
Théo Battrel f461ae574f Bluetooth: Mesh: Remove usage of auto name in AD
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.

The Mesh files `proxy_srv.c` and `pb_gatt_srv.c` were using
BT_LE_ADV_OPT_USE_NAME. Add the device name in the advertising data
directly.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-23 12:42:24 +02:00
Théo Battrel 6c9010be9f Bluetooth: Shell: Remove usage of auto name in AD
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.

Update the Bluetooth shell and its documentation to not use those
options anymore.

The option of the legacy advertiser run with `bt advertise` and the
behavior hasn't changed. The code has been updated to no longer use the
advertiser option but the original behavior has been reproduced.

The option of the extended advertiser have been updated to be more
explicit. The options `name` and `name-ad` have been removed from the
`bt adv-create` and `bt adv-param`. The option `name` and `dev-name`
have been added to the `bt adv-data` command.

- `name <str>` will advertise the given name.
- `dev-name` will advertise the device name.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-23 12:42:24 +02:00
Johann Fischer 215b4ddf98 usb: device_next: rework USBD shell to take speed into account
Rework USBD shell to take speed arguments into account and revise
command help text. Rename some of the commands to better reflect what
they actually do.
Since most of the init code changes, rewrite the command to initialize
the default configuration in the shell to register all available
classes, but not to enable USB device support in a single command.
This will allow earlier notification in the future, if supported by the
controller, before the USB device controller is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 0cfc15da2e usb: device_next: rename usbd_class_iter to usbd_class_node
For the last dozen commits, the role of usbd_class_node has actually
been taken over by usbd_class_iter. After cleaning up and merging
usbd_class_node and usbd_class_data, we can rename usbd_class_iter to
usbd_class_node to better reflect its role.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 2bc55f17ec usb: device_next: rename usbd_class_node to usb_class_data
Since only usbd_class_node contains the class instance data, rename it
to usbd_class_data.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 9acd1e877d usb: device_next: temporarily remove struct usbd_class_data
With the latest change, there are two structures that actually contain
class instance related data. Merge them into usbd_class_dnode, because
there is already a handy macro that can be used in class instances.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer cc36727b95 usb: device_next: use helpers to get priv and device context
Some places have been overlooked, finally get rid of it. Use helpers to
get instance priv and device context.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 5144d0f65f usb: device_next: Introduce speed specific configurations
USB High-Speed devices must be able to operate at both High-Speed and
Full-Speed. The USB specification allows the device to have different
configurations depending on connection speed. Modify the API to reflect
USB Specification requirements on what can (e.g. configurations) and
what cannot (e.g. VID, PID) be speed dependent.

While the class configurations for different speeds are completely
independent, the actual class instances are shared between operating
speeds (because only one speed can be active at a time). Classes are
free to provide different number of interfaces and/or endpoints for
different speeds. The endpoints are assigned for all operating speeds
during initialization.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 99cd7ee991 usb: device_next: Fix uninitialized variable warning
Assign default value to prevent possible uninitialized variable warning.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 2470821dc2 usb: device_next: Allow class to return NULL descriptor set
Simply skip over the class if it returns NULL descriptor set for given
speed.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00