Commit graph

91102 commits

Author SHA1 Message Date
Łukasz Duda 838f33494e net: tcp: Rate-limiting of neighbor reachability hints
This commit implements simple rate-limiting for Neighbor Reachability
Hints in TCP module to prevent the potentially costly process of
frequent neighbor searches in the table, enhancing system performance.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-02-09 16:26:10 -06:00
Flavio Ceolin 36a497b5e4 tests: dynamic_thread_stack: Fix problems in multicore
When running it in a multicore and with incoherent cache environment it
is possible that the thread allocating dynamic stacks is switched to a
different cpu. In this situation further access to that memory (like
when releasing resources) will be invalid.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-02-09 14:23:14 -05:00
Flavio Ceolin d622533ca7 kernel: thread: Allow stack in coherent memory
When allowing dynamic thread stack allocation the stack may come from
the heap in coherent memory, trying to use cached memory is over
complicated because of heap meta data and cache line sizes.
Also when userspace is enabled, stacks have to be page aligned and the
address of the stack is used to track kernel objects.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-02-09 14:23:14 -05:00
Andrei Emeltchenko eef605d6cc tests: lib: acpi: Add test verifying assert on devscope overflow
Add test verifying we catch assert() when subsctrucure is too big.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Andrei Emeltchenko a7afc87527 tests: lib: acpi: General header cleanup
Cleanup headers and definitions to make code more readable.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Andrei Emeltchenko d89a274e7a tests: lib: acpi: Verify assert() on invalid size
Catch assert() when invalid unit size is bigger then actual
table or subtable size.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Andrei Emeltchenko bffcd1de2a tests: lib: acpi: Add testing acpi_dmar_ioapic_get()
Add testing for acpi_dmar_ioapic_get() function.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Andrei Emeltchenko 9c7b952db5 tests: lib: acpi: Add testing for dmar_foreach_devscope()
Add unit testing for dmar_foreach_devscope() function.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Andrei Emeltchenko 9cf06173f7 tests: lib: acpi: Refactor DMAR structure and tests
Refactor DMAR structure to allow more tests. Use fake void function
for invalid size tests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Andrei Emeltchenko 80c8e9736b lib: acpi: Add asserts catching overflow
Add asserts catching sub-sctructure overflow.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Andrei Emeltchenko d90060aad7 lib: acpi: Add more ASSERT() in ACPI table parsing
Add more assert() to DMAR parsing functions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-02-09 13:16:33 -06:00
Johann Fischer 7e99579c6c usb: device_next: fix buffer count configuration in CDC ACM pool
Multiple CDC ACM instances can block each other because there are only
buffers for a single instance. Fix this by configuring the number of
buffers in the pool based on the number of CDC ACM instances.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-02-09 17:38:52 +00:00
Tobias Röhmel 20f173773c drivers: Fix signs in max31865 temperature calculation
The reference document says that the formula for negative
temperatures has two minus signs missing.

fixes #68710

Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2024-02-09 17:38:31 +00:00
Johann Fischer e3549ea28f usb: device_next: correct internal class API documentation
Correct documentation of the internal class API.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-02-09 10:52:16 -06:00
Markus Lassila ca7e69523c net: sockets: tls: Timeout DTLS with poll
Changed poll to perform incoming data check with connected
DTLS connections. This allows the CONFIG_NET_SOCKETS_DTLS_TIMEOUT
to timeout the connections to server socket if there is no
incoming data.

Previously, if the remote client closed the DTLS connection without
close notify, the timeout of the ongoing connection only happened
when next connection was taken to the server socket. Depending on
the timeouts, this could prevent the next connection from succeeding.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2024-02-09 10:25:46 -06:00
Laurentiu Mihalcea 41289dac06 drivers: dma: dma_nxp_edma: add function for channel filtering
The point of this commit is to allow users to request specific
channels. The following code snippet shows how this may now be
achieved:

	int requested_channel = 5;
	int ret = dma_request_channel(dev, &requested_channel);

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-02-09 16:20:34 +00:00
Laurentiu Mihalcea 4ff5e29cfe drivers: dma: dma_nxp_edma: switch to using DT_INST_IRQN_BY_IDX
After #63289, multi-level interrupts are now encoded using
macro magic. This means that using the generic DT_INST_IRQ_BY_IDX()
to fetch the INTID is no longer an option as the queried INTID
will be the one specified through the node's `interrupts`
properties. To fix this, switch to using DT_INST_IRQN_BY_IDX()
which will return the correctly encoded INTID.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-02-09 16:20:34 +00:00
Laurentiu Mihalcea c07d987431 drivers: dma: dma_nxp_edma: query channel number from HAL config
Currently, the number of channels supported by the controlled
is computed based on the size of the channel array. This
works well only if there's no gaps (i.e: "dma-channels" property
is used or "valid-channels" property is used with contiguous
channels) but will break if there are any gaps. For instance,
if the user wants to use channels 16 and 17 and specifies them
through the "valid-channels" property, they won't be allowed
to do so because dma_request_channels() will stop at channel 1.
As such, to fix this, simply use the number of channels from
the HAL configuration which is the maximum number of channels.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-02-09 16:20:34 +00:00
Emil Gydesen 7cfc8b3340 Bluetooth: BAP: Reset _prev_seq_num on ISO connection
Once an ISO channel has connected, the sequence number
always starts at 0. This reset was missing in the implementation,
and the _prev_seq_num from a previous connection may have
been kept.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-09 14:39:40 +01:00
Thomas Ebert Hansen b15452bd08 Bluetooth: controller: Fix Data Length Update
Before a LL_FEATURE_REQ is sent, verify that the Data Length Update
procedure is still supported as it could have been unmasked as the result
of a previously completed Feature Exchange procedure.

Add unit test to verify the case of enqueuing both a
Feature Exchange procedure and Data Length Update procedure, where the
Feature Exchange procedure would result in the unmasking of the Data
Length Update procedure.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2024-02-09 13:46:41 +01:00
Thomas Ebert Hansen 8c412971a9 Bluetooth: controller: Fix PHY Update TX Q
Resume the TX Data Q when a LL_UNKNOWN_RSP is recieved instead of a
LL_PHY_RSP.

Update PHY Update unit test with more coverage of the TX Data Q pause
state.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2024-02-09 13:46:41 +01:00
Grzegorz Chwierut 7fc0bcaa7c twister: pytest: update device id when testing with pytest harness
Updated the instance with the device id to have it in the summary
report also when using pytest harness.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-02-09 13:46:19 +01:00
Mike Szczys e81acafe53 docs: update Golioth URLs
Update outdated links. This includes a new repository address for the
Golioth OTA sample and an updated path for the OTA documentation.

Signed-off-by: Mike Szczys <mike@golioth.io>
2024-02-09 09:55:37 +01:00
Alberto Escolar Piedras 40b53d5d77 Kconfig LTO: Prevent with native simulator based targets
LTO cannot be really used with the native simulator based
targets neither today.

When doing a partial link as we do for these targets
the linker will complain if we are mixing LTO and non LTO
built code, and fall back to only produce non-LTO output.
(The link warning will cause twister to fail the test)

Today not all inputs to this partial link are built
with LTO enabled (offsets.c and the app library are not).

Even if they were, the native targets are mostly
a test and debugging facility, so optimizations like
these are not beneficial in general.

Let's just prevent selecting LTO for these targets.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-02-08 22:21:39 +01:00
Daniel DeGrasse 04156bccff doc: migration-guide-3.6: update MIPI DBI display migration note
Update MIPI DBI display migration note to match the correct display
configuration settings for reset and MIPI DBI command pins after ILI9xxx
display was transitioned to this API.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-02-08 19:42:38 +01:00
Daniel DeGrasse c73428062d drivers: mipi_dbi: mipi_dbi_spi: change reset pin polarity
Change reset pin polarity for MIPI DBI SPI controller, so that the board
devicetree is responsible for setting the GPIO to active low, and the
driver always sets the pin to a logic 1 to reset the display.

Fixes #68562

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-02-08 19:42:38 +01:00
TOKITA Hiroshi 801fbddfcc MAINTAINERS: Add myself as LED-strip collaborator
I am applying for Collaborator on the recommendation
of @simonguinot.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2024-02-08 17:35:05 +00:00
Peter Ujfalusi 84631ce17c drivers: dma: dma_dw_common: Disable channel even if draining times out
If the channel suspend with draining fails on stop because of reasons
outside of the scope of the DMA driver (the peripheral is powered off
before trying to drain for example) we must continue and disable the
channel.

The channel can be released by the client despite of it remained enabled.
A new DMA channel request can pick the channel (as it is released) but
re-configuration is going to be skipped and the use of the channel is going
to fail. Then we will see the same drain timeout on channel stop again
since the channel retained the configuration which resulted the first
timeout.

The drain timeout was made fatal by an earlier commit which fixed the
WAIT_FOR return value handling.

Fixes: 6226f9e6e4 ("dma: dw: fix the return value check")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-02-08 18:03:09 +01:00
Michal Smola d2001a6fab doc: add how to run application in QEMU on Windows
Documentation does not describe how to run QEMU on Windows.
Add description of steps needed to run QEMU and use QEMU
with Twister on Windows in Beyond the Getting Started
Guide. Add a reference to it in Aplication Development
section.
Tested using Windows 11 and QEMU installer from
https://qemu.weilnetz.de/w64/

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-02-08 13:57:15 +01:00
Thomas Stranger 505cc19941 drivers: w1: fix return check in bit_read for w1-gpio
The driver masked the return value of a pin read operation before
checking the error.
Thus not detecting a potential error and leading to logically
dead code, which was detected by coverity in CID 340853.
Anther instance XORs 1 before returning, resulting in an unexpected
return value;

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-02-08 12:14:36 +00:00
Alexander Svensen 199487be54 Bluetooth: Host: Send status for terminated directed adv
- Fix bug where status was only sent for legacy adv

Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
2024-02-08 10:11:34 +00:00
Pavel Vasilyev 30ccd55f4c tests: bsim: bluetooth: mesh: Add advertiser suspend test
Add a test that checks that both advertisers, the legacy and the
extended behaves identically when the stack is suspended, in particular:
- `bt_mesh_send_cb.end` callback is called with error code `0` for the
  advertisement that the advertiser already pushed to the ble host
  (called `bt_mesh_send_cb.start`),
- `bt_mesh_send_cb.start` callback with error `-ENODEV` is called for
  every advertisement that was pushed to the mesh advertiser using
  `bt_mesh_adv_send` function before the stack was suspended,
- `bt_mesh_adv_create` returns NULL when attempting to create a new
  advertisement while the stack is suspended.

The `bt_mesh_adv_disable` is called from the work because calling it
from the `bt_mesh_send_cb.start` callback will cause a deadlock.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-08 10:11:19 +00:00
Pavel Vasilyev 9171ee24da Bluetooth: Mesh: Warn if trying to send adv while suspended
This will warn if any of the mesh module will try to send anything while
the stack is suspended. Not clear what to do here as both advertisers
(legacy and ext) behaves differently. The legacy advertiser has a
thread which is stopped after the `bt_mesh_adv_disable` call and any
sent advs after suspending the stack will stay in the pool until the
advertiser is resumed. The extended advertiser will schedule its work,
but then fail because `ext_adv->instance` value is NULL, but will call
`bt_mesh_send_cb.start` with error `-ENODEV`. What to do with these 2
behaviors is unclear at the moment. Ideally none of the mesh stack
modules should call `bt_mesh_adv_send` after the stack was suspended, so
if this warning appears, the faulty module wasn't stopped properly and
this should be fixed. If not to add the adv to the pool, then it kind
of gets lost as the implementation probably expects one
of `bt_mesh_send_cb` callbacks which will never be called. Leaving the
warning until clear customer request comes.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-08 10:11:19 +00:00
Pavel Vasilyev b352301d80 tests: bsim: bluetooth: mesh: Change error code on timeout
This commit changes error code returned by `k_sem_take` when it times
out from `-EAGAIN` to `-ETIMEDOUT` because `bt_le_scan_start` also
returns `-EAGAIN` if bt device is not ready, which may lead to invalid
test behavior.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-08 10:11:19 +00:00
Diego Herranz 7551b85f22 doc: usb_device.rst: add PID for DFU in DFU mode
By default, the DFU sample uses 0x0005 as PID in the Run-Time descriptors,
and when detached to the "proper" DFU mode, it uses 0xFFFF (one of the
values suggested by the DFU 1.1 spec).

So, 0xFFFF added to the table as well as indications of Run-Time and
DFU mode on both DFU entries.

Signed-off-by: Diego Herranz <diegoherranz@diegoherranz.com>
2024-02-08 09:52:22 +00:00
Kapil Bhatt 2207fedbc8 net: l2: wifi: Fix Print of SSID in WIFI scan result
WIFI scan result shows junk character in SSID because of
the length of ssid is maximum(32 character) which leads
to buffer overflow. It required one character for null
terminator ‘\0’.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-02-08 09:49:10 +00:00
Ivan Iushkov a3cbf8e2ac Bluetooth: fixing null-pointer dereference in l2cap channel destroyer
During local testing with UBSAN enabled, warning was reported:
bluetooth/host/l2cap.c:980:25: runtime error: member access
within null pointer of type 'struct k_work_q'

It turned out that le_chan->rtx_work.queue can be NULL.
Since null-pointer dereference is a UB, additional check
was added to ensure we don't access
`le_chan->rtx_work.queue->thread` when
`le_chan->rtx_work.queue == NULL`

The same changes applied to l2cap_br.c

Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
2024-02-08 09:48:02 +00:00
Ivan Iushkov e8d090011b Bluetooth: fixing UBSAN warnings related to Codec Configuration
During local testing with UBSAN enabled, warning was reported:
bluetooth/host/iso.c:237:2: runtime error: null pointer passed
as argument 2, which is declared to never be null

It turned out that when datapath doesn't contain
codec information, cc_len is 0 and cc is NULL

In order to avoid UB,
now we call memcpy only when cp->codec_config_len > 0

Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
2024-02-08 09:48:02 +00:00
Ivan Iushkov b1e9f86378 Bluetooth: Fixing UBSAN warning in CTE field parsing in adv.c/scan.c
during local testling, UBSAN reported the following warnings:
- bluetooth/host/adv.c:2067:19: runtime error: shift exponent
255 is too large for 32-bit type 'long unsigned int'
- bluetooth/host/scan.c:828:18: runtime error: shift exponent
255 is too large for 32-bit type 'long unsigned int'

It turned out that we can't use BIT() macro directly on
bt_hci_evt_le_per_advertising_report::cte_type field.
According to Core Spec, `cte_type = 0xFF` corresponds
to `No contstant tone extension`.

Added separate function to convert CTE bit field from
HCI format to bt_df_cte_type

Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
2024-02-08 09:48:02 +00:00
Flavio Ceolin b30d088d37 xtensa: irq: Remove CURR_CPU
Use _current_cpu->id instead of CURR_CPU since that works
with/without multicore and contains additional checks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-02-08 09:05:14 +01:00
Pavel Vasilyev 548851ac7a Bluetooth: Mesh: Fix solicitation PDU tx dep on proxy
If `CONFIG_BT_MESH_GATT_SERVER` is disabled or the advertising set
doesn't support proxy adv, the solicitation PDU will not be sent.
However, solicitation PDU transmission doesn't depend on the proxy
feature of the device it sends. Therefore, solicatation PDU should be
sent regradless of `CONFIG_BT_MESH_GATT_SERVER` option and advertiser
tag.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-08 09:04:48 +01:00
Piotr Kosycarz c8716f2793 tests: drivers: spi: wait more when polling
Extend timeout to perform coverage analysis when testing on HW.
Coverage mode makes execution slower.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-02-08 09:02:59 +01:00
Piotr Kosycarz 4f6fe99cdf tests: drivers: spi: allow to configure thread stack size
Used to perform coverage analysis when testing on HW.
Gathering coverage data require more stack,
so its needs to configurable.
There is used CONFIG_TEST_EXTRA_STACK_SIZE for that.
(with value depending on used HW).

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-02-08 09:02:59 +01:00
Håkon Amundsen 6e6f8ee846 doc: kernel: interrupts: remove concept of 'interrupt handler function'
This is an alias of ISR, which should be used instead.

Signed-off-by: Håkon Amundsen <haakon.amundsen@nordicsemi.no>
2024-02-08 09:01:50 +01:00
Thomas Stranger cbc75f8504 drivers: modem: ublox-sara-r4: freeaddrinfo mark unused param
The res param in offload_freeaddrinfo is not used.
Mark it as unused, to avoid static analysis complaining about
Parse warning (PW.PARAM_SET_BUT_NOT_USED)
Fixes CID 316235

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-02-08 07:03:48 +01:00
Ryan Erickson b65ab5fe88 modem: hl7800: check sem take in event handler
Only execute event callbacks if the semaphore is successfully taken.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2024-02-08 07:03:30 +01:00
Ryan Erickson 34ec42b8f3 modem: hl7800: sock_read len arg is not used
The static function sock_read does not need a length arg, remove it.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2024-02-08 07:03:12 +01:00
Anas Nashif df87e78dab tests: dma: rename DT node label for tested device
Use tst_dma0 to avoid conflict with how twister and ztest deal with
testcase names.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-02-07 18:51:38 -05:00
Patryk Kuniecki 52fd66bdfa tests: kernel/interrupt skip on ITE
After discussion in #63114 we should skip this test on ITE board.

Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
2024-02-07 22:08:22 +00:00
Luis Ubieda f59eb2f1e9 Tests: Bluetooth: Host: Add ext-adv test to iterate reconnections
Where advertisement, connection and disconnection is iterated over 5
times, to verify the reestablishment of extended advertisements when
iterating over multiple times. Additionally, the connection
unreferencing has been decoupled from the disconnect event on both
sides, to demonstrate the dependency of the recycle event.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-02-07 22:50:16 +01:00