Commit Graph

99233 Commits

Author SHA1 Message Date
Johan Hedberg
7378a05350 Bluetooth: Host: Fix incorrect build assert
We want to make sure `struct closure` fits in the user data, so a user data
size of `sizeof(struct closure)` is valid.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
(cherry picked from commit 5736b71193)
2024-08-31 06:51:32 -04:00
Daniel DeGrasse
cc62418d75 drivers: sdhc: imx_usdhc: assume card is present if no detection method
The imx USDHC driver previously queried the peripheral's internal card
detect signal to check card presence if no card detect method was
configured. However, some boards do not route the card detect signal and
do not work correctly with the DAT3 detection method supported by this
peripheral. As a fallback, assume the card is present in the slot but
log a warning to the user.

Fixes #42227

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
(cherry picked from commit 17f71e19f0)
2024-08-31 06:51:21 -04:00
Armando Visconti
d800ccea86 drivers/sensor/st: Fix wrong data byte swap for be
A 16-bit value built using byte shifts and ORs from a given
couple of lsb and msb bytes will result to be the same on both
little-endian and big-endian architectures, e.g.

    uint8_t lsb, msb;
    int16_t val;

    /* val is the same number on both le and be archs, but has
       different layout in memory */
    val = (msb << 8) | lsb;

All the xyz_raw_get() APIs of stmemsc sensor module build the sensor
data using the above method and DO NOT hence require (it actually leads
to wrong values on big-endian machines) to use any le/be swap routines,
such as sys_le16_to_cpu().

Fix #75758

Signed-off-by: Armando Visconti <armando.visconti@st.com>
(cherry picked from commit 9ea4cb96cd)
2024-08-31 06:51:05 -04:00
Anas Nashif
df9a905979 ci: rerun issue check on PR edit
Re-run issue check when a PR is updated, i.e. when someone adds
'Fixes...` to the PR body.

This is mostly for release branches and has no effect on main branch.

Also, add concurrency check in the workflow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
(cherry picked from commit 4077249cc7)
2024-08-27 21:33:23 -04:00
Dat Nguyen Duy
e84c516589 dts: nxp_rt1010: mark edma channel has separate interrupt entry
In SoC imxrt1010, edma channel has separate interrupt entry,
not like the rest of in-tree imxrt SoC series

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
(cherry picked from commit b7b17fa0eb)
2024-08-26 20:58:46 -04:00
Joel Guittet
57a0dbd729 net: websocket: fix undefined reference
Fix undefined reference to MSG_DONTWAIT while building websocket client.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
(cherry picked from commit 4c16ec1fba)
2024-08-26 20:58:31 -04:00
Peter van der Perk
9b58209b01 soc: rt11xx: Fix bus clocking
IMXRT117X bus clock should be 240MHz and IMXRT116X should be 200MHz

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
(cherry picked from commit d1a6b45345)
2024-08-26 20:58:09 -04:00
Anders Bjørn Nedergaard
abf93151c2 soc: rt11xx: Fix dual core ENET PLL
IMXRT11XX secondary core should not deinit ENET PLL
as it could be configured by primary core.

Signed-off-by: Anders Bjørn Nedergaard <abn@polytech.com>
(cherry picked from commit 29dc419ad2)
2024-08-26 20:57:47 -04:00
Jonathan Rico
afedbb419e Bluetooth: Host: Add missing bt_tx_irq_raise()
Trigger the TX processor on connection teardown.

When a disconnection happens before the controller has acknowledged some
ACL fragments the host has sent, we run `process_unack_tx()` to free
those unacknowledged buffers and their associated TX contexts.

The problem is that the TX processor still holds a reference to the conn
object. That reference is not released until the TX processor is
triggered again and figures out that the connection is invalid.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit 80a92f51a5)
2024-08-22 14:22:15 -04:00
Jonathan Rico
22877ed2ae Bluetooth: Host: Add disconnection during TX fragmentation test
Verifies that we don't leak connection references when the peer goes out
of range whilst we are fragmenting and sending data to the controller.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit 043de7da2a)
2024-08-22 14:22:15 -04:00
Ioannis Damigos
6c4a190a31 gpio_smartbond: Fix port_set_masked_raw
Writing directly to Px_DATA_REG modifies pins which are not
indicated by mask, causing gpio_basic_api test to fail.

Use Px_SET_DATA_REG and Px_RESET_DATA_REG to modify only
pins indicated by mask.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
(cherry picked from commit 782967a1e3)
2024-08-21 21:07:25 -04:00
Ioannis Damigos
da2d5e6fbe gpio_smartbond: Remove pdc entry only if it exists
Remove pdc entry only if index exists when CONFIG_PM
is set.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
(cherry picked from commit 82d17f1f2c)
2024-08-21 21:07:25 -04:00
Ioannis Damigos
7a24c590cf gpio_smartbond: Set pin to input when it is configured as GPIO_DISCONNECTED
Set pin to input with no resistors selected when it is configured as
GPIO_DISCONNECTED.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
(cherry picked from commit df86860319)
2024-08-21 21:07:25 -04:00
Ioannis Damigos
c0ed85cb60 entropy_smartbond: Clear pending interrupts after disabling TRNG
Clear pending interrupts after disabling TRNG to avoid
smartbond_trng_isr getting called with TRNG disabled

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
(cherry picked from commit bacd6c31d6)
2024-08-21 21:07:25 -04:00
Jonathan Rico
9584ac74d6 Bluetooth: Host: Free ACL RX fragments on disconnection
This function call frees the buffer kept by the host for reassembling L2CAP
PDUs into.

Without this call, the current buffer will eventually be
leaked, leading to a non-functional host due to lack of RX buffers.

The effect is worse when host flow control is not enabled, as the RX
buffer pool is shared with events, which means communication with the
controller is essentially dead.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit 8a2fe27c00)
2024-08-21 16:50:44 -04:00
Jonathan Rico
01dc4e1adc Bluetooth: hci_common: Add assert on buf allocation
`net_buf_alloc(K_FOREVER)` can now return NULL if running in the system
workqueue. `bt_hci_evt_create()` is called in that context in a few cases.

Since we can't really do anything about it, add a (default-on) assert.

This should ideally never fail. I saw it fail because of a leak in the ACL
buffer pool, which is also shared with events when host flow control is not
enabled.

In that particular case, the host is rendered non-functional, so trying to
recover using error handling is futile.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit 5a4fdfbf3e)
2024-08-21 16:50:44 -04:00
Jonathan Rico
fb270828a6 Bluetooth: L2CAP: Add re-assembly stress test
Add a test that verifies no resources are leaked when re-assembling L2CAP
PDUs over an unreliable channel (ie. lots of disconnects).

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit e489ec2b95)
2024-08-21 16:50:44 -04:00
Benjamin Cabé
25adea3428 fs: fuse: ensure S_IFxxx macros are available
set _XOPEN_SOURCE appropriately to avoid compilation errors
due to missing S_IFxxx macros on some systems.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
(cherry picked from commit 4458a05ec2)
2024-08-20 14:53:13 -04:00
Théo Battrel
4f0e8a80f3 Tests: Bluetooth: Add another ISO frag test
This test create a setup where an ISO broadcaster will send fragmented
data and get stopped after sending the first fragment and repeating that
operation multiple time to verify that buffers are not leaked.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
(cherry picked from commit f3dcaaee35)
2024-08-20 14:51:41 -04:00
Théo Battrel
7e17f1e4ed Bluetooth: Host: Unref ISO fragments after disconnection
When sending data using ISO and the data is fragmented, if the
connection is cut before all the fragments are sent, the data buffer
will be leaked.

Fix the issue by unref'ing the buffer when ISO is not in a connected
state.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
(cherry picked from commit 3a098c9f61)
2024-08-20 14:51:41 -04:00
Théo Battrel
5bd5bf8530 Bluetooth: Host: Free ISO TX context
When disconnected while sending data, if ISO doesn't get the number of
completed packets it will not call `process_unack_tx` and thus will leak
TX context.

Fix that by setting the connection state in ISO disconnection which will
trigger a call to `process_unack_tx`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
(cherry picked from commit 70696f5b0f)
2024-08-20 14:51:41 -04:00
Maxime Vincent
748ccc1661 soc: arm: nxp lpc55xx: fix nxp,ctimer-pwm init procedure (attach clock)
Add clock init for nxp-ctimer-pwm DTS nodes.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
(cherry picked from commit 3a895ecea8)
2024-08-19 17:23:02 -04:00
Robert Lubos
20e7ef389d net: lib: http_server: Clear http1_headers_sent flag on new request
http1_headers_sent flag has to be cleared when entering
HTTP_SERVER_REQUEST_STATE and not only on the client init. Otherwise,
serving multiple HTTP1 POST requests over the same connection does not
work as intended (headers were not sent for the second and further
requests).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 086faa56aa)
2024-08-18 16:00:45 -04:00
Henrik Brix Andersen
6c4d9e0b59 dts: arm: nxp: lpc55sxx: fix sram node address
Add missing "0" to the SRAM devicetree node addresses.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
(cherry picked from commit ec85b0b4ef)
2024-08-17 08:54:19 -04:00
Ryan Erickson
b421ca7b7e drivers: modem: cellular: hl7800 fix enter cmux
The OK response should be processed before entering CMUX mode.

Use UART ISR mode by default.

Fix warnings and errors produced by the sample.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
(cherry picked from commit bbcf23e95e)
2024-08-17 08:54:01 -04:00
Alberto Escolar Piedras
37cea05f5d Bluetooth: drivers: userchan: Fix gcc 13 overflow warning
gcc 13 produces a build warning (see below), as it seems to
believe the number of read bytes may overflow the frame_size
type.
Let's increase the frame_size bitwidth to avoid this.
(Any 32bit type, signed or unsigned, avoids this warning)

The build warning:
```
In file included from /usr/include/features.h:502,
                 from bits/libc-header-start.h:33,
                 from /usr/include/stdint.h:26,
                 from include/stdint.h:9,
                 from zephyr/include/zephyr/types.h:11,
                 from zephyr/include/zephyr/kernel_includes.h:21,
                 from zephyr/include/zephyr/kernel.h:17,
                 from zephyr/drivers/bluetooth/hci/userchan.c:9:
In function ‘read’,
    inlined from ‘rx_thread’ at drivers/bluetooth/hci/userchan.c:201:9:
/usr/include/i386-linux-gnu/bits/unistd.h:28:10: warning: ‘__read_alias’
specified size between 4294902273 and 4294967295 exceeds maximum object
size 2147483647
[-Wstringop-overflow=]
   28 |   return __glibc_fortify (read, __nbytes, sizeof (char),
      |          ^~~~~~~~~~~~~~~
drivers/bluetooth/hci/userchan.c: In function ‘rx_thread’:
drivers/bluetooth/hci/userchan.c:187:32: note: destination object allocated
  here
  187 |                 static uint8_t frame[512];
      |                                ^~~~~
/usr/include/i386-linux-gnu/bits/unistd-decl.h:29:16: note: in a call to
  function
‘__read_alias’ declared with attribute ‘access (write_only, 2, 3)’
   29 | extern ssize_t __REDIRECT_FORTIFY (__read_alias, (int __fd, void
      |                ^~~~~~~~~~~~~~~~~~
```

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
(cherry picked from commit ee08327b4c)
2024-08-16 14:08:00 -04:00
Vinayak Kariappa Chettimada
c823c550b0 Bluetooth: Controller: Relax radio packet pointer assignment deadline
Relax the radio packet pointer assignment deadline assertion
until access address being transmitted. The PDU buffer is
probably only needed just after access address is being
transmitted or received by the radio. This will give some
more breathing room for slow CPUs like in nRF51x SoCs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 4dbfb22a7e)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
dcc9255796 Bluetooth: Controller: Fix regression using speed optimization
Fix regression using speed optimization introduced in
commit 1b7fe792e0 ("Bluetooth: Controller: Support Link
Time Optimizations (LTO)").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 642d4be940)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
f5fd647605 Bluetooth: Controller: nRF51x: Fix regression in encrypted connection
Fix regression in encrypted connection introduced in
commit f3deccda91 ("Bluetooth: Controller: CCM read data
to early when DF enabled on PHY 1M").

Due to this nRF51x SoC hang waiting to encrypt and/or
check MIC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit b9a7a64563)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
17f0ec9900 Bluetooth: Controller: Fix PDU length in case of ISR latency issue
In case of ISR latencies, if packet pointer has not been
set on time then we do not want to check uninitialized
length in rx buffer that did not get used by Radio DMA.
This would help us in detecting radio ready event being
set? We can not detect radio ready if it happens twice
before Radio ISR executes after latency.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 40b71c9773)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
5e00ea9e4f Bluetooth: Controller: Fix empty PDU buffer overrun under ISR latency
Only 3 bytes (PDU_EM_LL_SIZE_MAX) is required for empty PDU
transmission, but in case of Radio ISR latency if rx packet
pointer is not setup then Radio DMA will use previously
assigned buffer which can be this empty PDU buffer. Radio
DMA will overrun this buffer and cause memory corruption.
Any detection of ISR latency will not happen if the ISR
function pointer in RAM is corrupted by this overrun.
Increasing ISR latencies in OS and CPU usage in the
ULL_HIGH priority if it is same as LLL priority in
Controller implementation then it is making it tight to
execute Controller code in the tIFS between Tx-Rx PDU's
Radio ISRs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit e36ddffa7a)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
3125273a78 Bluetooth: Controller: Fix ISR profiling for single timer use
Fix ISR profiling when using single timer for tIFS radio
switching wherein in the timer is cleared on every radio
end. Hence, the captured timer value is the latency and
does not required the radio end timestamp to be subtracted.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 8ef919a7a4)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
269c91850a Bluetooth: Controller: Verbose radio is ready assertion
Provide Radio ISR latency in microseconds when asserting due
to high ISR latency.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 53b6bc56fc)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
680779e5f5 Bluetooth: Controller: Add ISR profiling using ticker ticks
Add ISR profiling using ticker ticks, hence profile ISR
CPU use outside radio events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 409402f0cc)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
e06bbce3e7 Bluetooth: Controller: Use uint16_t to store ISR profiling value
Use uint16_t to store ISR profiling value to avoid overflow
in case of higher latencies.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 56ca9b873d)
2024-08-16 09:56:50 -04:00
Vinayak Kariappa Chettimada
efb3576a54 Bluetooth: Controller: Fix in-system ISR profiling for adv and conn
Fix in-system ISR profiling for advertiser and connection
role for the missing implementation when there is CRC error.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 90bc2b2064)
2024-08-16 09:56:50 -04:00
Erik Tamlin
6c454a6edc manifest: update percepio
Update the percepio module to use TraceRecorder v4.9.2.hotfix1

Signed-off-by: Erik Tamlin <erik.tamlin@percepio.com>
(cherry picked from commit 858a687052)
2024-08-16 09:56:37 -04:00
Jonathan Rico
a58f407367 Bluetooth: L2CAP: Set NULL callback for PDUs
It was not being set, and thus if the user_data contained garbage from
before, then conn.c would attempt to call that garbage.

Static channels don't have this issue, as every "SDU" fits into one PDU.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Huajiang Zheng <nxf88597@lsv051208.swis.nl-cdc01.nxp.com>
(cherry picked from commit 1c6510312d)
2024-08-09 08:39:09 -04:00
Jonathan Rico
fcc3a7e483 Bluetooth: remove forgotten TODO
It's already done.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit 8d7c1bc7bc)
2024-08-09 08:39:09 -04:00
Jonathan Rico
afb8c8922a Bluetooth: adapt l2cap/userdata test
Modify the test so it checks that user_data is used and then cleared by
the stack.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit 08706f98bc)
2024-08-09 08:39:09 -04:00
Jonathan Rico
45a6994f5c Bluetooth: L2CAP: Mark user_data as owned by the stack
Storing stuff in user_data? That's a paddlin'

We have been debugging issue after issue because ownership of this
"user" data is not clearly defined. Now it is. L2CAP owns the user_data
field entirely, as soon as `send()` is called.

Also add a warning and retval using CHECKIF.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit ea9449979b)
2024-08-09 08:39:09 -04:00
Jonathan Rico
e41c69a3c5 Bluetooth: allow compiling host with CONFIG_NO_RUNTIME_CHECKS
Werror fails the build on that function.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit 5c6cd27723)
2024-08-09 08:39:09 -04:00
Jonathan Rico
350f9fbc2e Bluetooth: host: add more info to conn.c log
Print user_data and callback pointers.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit d02a13d726)
2024-08-09 08:39:09 -04:00
Sylvio Alves
296983709a linker: esp32: fix cpp rom region
cplusplus-rom linker initialization was wrongly placed
in RAM area when it should be in ROM area.

Fixes #75853

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
(cherry picked from commit c374d3147b)
2024-08-07 08:26:49 -04:00
Armando Visconti
3cd429f0e0 drivers/sensor: lis2dux12: fix mode when setting odr
In lis2dux12_set_odr(), the call to stmemsc module lis2dux12_mode_set()
API is done with the .fs field left uninitialized, so setting the
underlying device regs in an unproper way.

Suggested-by: Luis Ubieda <luisf@croxel.com>
Signed-off-by: Armando Visconti <armando.visconti@st.com>
(cherry picked from commit 8bc00e1420)
2024-08-07 08:26:13 -04:00
Thales Bacelar
b8010bf19d logging: Trigger logging thread when we start to drop messages
Wake up logging thread when we start to drop messages.

Signed-off-by: Thales Bacelar <thalesbacelar@duck.com>
(cherry picked from commit d6429431d6)
2024-08-07 08:25:49 -04:00
Yong Cong Sin
2600eaf6de tests: gdbstub: add build-only test
Add build-only test for existing boards.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit 58f66623aa)
2024-08-06 13:04:37 -04:00
Yong Cong Sin
f9770bd48e tests: gdbstub: minor refactor to the testcase.yaml
Change the `platform_allow` to multi-line format so that newly
supported archs/boards can be added as a new line.

Refactor the tags out to `common`, and add
`CONFIG_ARCH_HAS_GDBSTUB` filter

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit b97d97ff17)
2024-08-06 13:04:37 -04:00
Yong Cong Sin
0299538a11 arm: debug: gdbstub: fix header
`exc.h` should be `exception.h` now, fix  it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit 79ed64909f)
2024-08-06 13:04:37 -04:00
Jukka Rissanen
5470dc3f62 net: context: Check null pointer in V6ONLY getsockopt
Make sure we are not accessing NULL pointer when checking
if the IPv4 mapping to IPv6 is enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit cf552905f4)
2024-08-06 13:02:10 -04:00