Commit graph

21541 commits

Author SHA1 Message Date
Jukka Rissanen
594fa24199 net: ethernet: Properly handle VLAN tag 0
Packets are forwarded to the native interface or in other words,
the vlan header is simply stripped and ignored. This feature is called
'priority tagging'.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-22 10:47:52 +01:00
Timothy Keys
614f55f8be ipc: ipc_service: Null terminate RPMsg endpoint names
This fixes the compiler warning -Wstringop-truncation in
version 13 of gcc.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2025-01-22 10:40:27 +01:00
Alberto Escolar Piedras
0c32349722 Bluetooth: Controller: Correct nrf54l15bsim timings
Correct the timings in the radio HAL for the simulated nRF54L15

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-01-22 10:40:17 +01:00
Jukka Rissanen
18cd2d83be net: pkt: Alloc headroom also for variable size data buffers
The headroom was not taken into account for variable size data
buffers when CONFIG_NET_L2_ETHERNET_RESERVE_HEADER was enabled.

Add a test case for it to make sure the reserve allocation works
properly.

Fixes #84053

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-22 10:39:23 +01:00
PENNORS Thomas
5165c911c9 Bluetooth: fix old-style warning gcc
fix GCC warning old-style-declaration on bluetooth host/att.c

Signed-off-by: PENNORS Thomas <t.pennors@lacroix.group>
2025-01-22 05:40:36 +01:00
Vinayak Kariappa Chettimada
f3e398d64c Bluetooth: Controller: Fix uninitialized is_aborted in conn done event
Fix uninitialized is_aborted in connection done event.

Relates to commit cadef5a64f ("Bluetooth: Controller:
Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 19:30:41 +01:00
Brandon Allen
e0173d9b8e zbus: assert when inside an ISR and time out is not zero
Currently various zbus functions silently change the timeout
to zero  when inside an ISR. If a developer is not aware
of this it could lead to unexpected behaviour or a
publish/read failing.

Also in the zbus docs it states to only use a timeout of
zero when inside a ISR multiple times.

Signed-off-by: Brandon Allen <brandon.allen@exacttechnology.com>
2025-01-21 19:30:20 +01:00
Robert Lubos
64e5a31b61 net: coap: Fix coap_packet_is_request() check for empty code
Empty code was incorrectly matched as a request, fix that.

Align coap_handle_request_len() function to behave as documented in the
API documentation - in case of invalid request code (which is also the
case for empty code) -ENOTSUP Should be returned.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-21 19:30:06 +01:00
Robert Lubos
13cd48a431 net: coap: Fix response matching algorithm
The algorithm for matching request with response was incorrect, which
could lead to false matches (for example if request had a token, and
piggybacked reply had no token but matching message ID only, that would
still be counted as a match).

This commit fixes it. The request/reply matching is implemented based on
RFC now, with separate conditions for piggybacked/separate responses.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-21 19:30:06 +01:00
Jukka Rissanen
ab9b85b199 net: Build assert issue with llvm
Remove the build assert from NET_L3_REGISTER() macro as that
is causing an issue with llvm. Add runtime check of the handler
pointer value.

subsys/net/l2/ethernet/arp.c:1044:1: error: static_assert expression
is not an integral constant expression

ETH_NET_L3_REGISTER(ARP, NET_ETH_PTYPE_ARP, arp_recv);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
        NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/net_core.h:190:2: note: expanded from
macro 'NET_L3_REGISTER'
        BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/toolchain/gcc.h:87:51: note: expanded from
macro 'BUILD_ASSERT'
define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
                                                  ^~~~~~
subsys/net/l2/ethernet/arp.c:1044:1: note: cast from 'void *' is not
allowed in a constant expression
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
        NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
        ^
include/zephyr/net/net_core.h:190:29: note: expanded from
macro 'NET_L3_REGISTER'
        BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
                                   ^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h:89:16: note: expanded
from macro 'NULL'
  define NULL ((void*)0)

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
04205ae24f net: Set the protocol type of fragmented packet
The fragmented packet should inherit the protocol type of the
original packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
3e680551b6 net: ipv6: Do not set ptype when preparing for sending
Trust that the protocol type is set correctly by functions
called before this one. We should not set the protocol type
blindly in this generic function.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
30ad29c2a3 net: ipv4: Do not change the protocol type when sending
The ARP code has set the protocol type of the packet to
0x806, so do not change it when preparing to send to 0x800
which is the IP protocol type. Lets trust the previously
called functions to set the ptype correctly and do not set
it here.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
4a796913cc net: arp: Enhance debug messages
Print more data / debug information for ARP messages.
Also remove unnecessary "&" when printing IPv4 address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
ed582c1374 net: ethernet: Only try ARP for IP packets
The work in Ethernet send in commit 2f10d7d816
("net: ethernet: Set the ptype by the caller in send")
introduced a bug because we could try to do ARP resolving
for ARP packets too. This is clearly a wrong thing to do.
So before trying to do ARP resolving, make sure the the
packet type is IP packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Vinayak Kariappa Chettimada
e09d629024 Bluetooth: Controller: Fix reset of drift_skip count
Fix reset of drift_skip count when an anchor point sync was
missed so that drift compensation is applied on the next
successful anchor point sync. This will improve connection
stability for short overlapping radio event intervals.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 19:29:45 +01:00
Stephan Gatzka
bda1970b33 modbus: initialize return variable.
Currently, when disabling CONFIG_MODBUS_FP_EXTENSIONS,return variable
'err'  is not initialized (at least not for debug builds) but later on
checked.

Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
2025-01-21 19:28:52 +01:00
Stephan Gatzka
3936470973 modbus: serial: check return value of uart_irq_callback_user_data_set
uart_irq_callback_user_data_set return non-zero if the callback function
can't be set. This might happen if you forgot to enable
CONFIG_UART_INTERRUPT_DRIVEN.

Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
2025-01-21 19:28:52 +01:00
Vinayak Kariappa Chettimada
5dffad061c Bluetooth: Controller: Fix regression in connection update
The connection event at the connection update instant was
skipped due to previous ticker node in use that is being
stopped was registering a relative occupied time that
overlapped with the new ticker node being started for
scheduling the connection with new interval.

Added mock interface for ticker_stop_abs() hence needed by
the Controller unit testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 15:13:16 +01:00
Jordan Yates
946f6b5c2e fs: allow enabling filesystems with FILE_SYSTEM_LIB_LINK
Update the Kconfig configuration to allow enabling the underlying
filesystems (e.g. exFAT), with only `FILE_SYSTEM_LIB_LINK` enabled.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-01-21 15:13:05 +01:00
Jordan Yates
c26656c83f fs: ext2: fix uninitialized variable
The compiler is unaware of the `block_size > 0` precondition, so it
outputs warnings of uninitialized `reclen`. Explicitly initialize the
variable to suppress this.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-01-21 15:13:05 +01:00
Jordan Yates
cd311380dd fs: ext2: update CONFIG_MAX_FILES name
Add the `EXT2` prefix to `config MAX_FILES` to more appropriately
namespace the symbol.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-01-21 15:13:05 +01:00
Jamie McCrae
c562cbc284 mgmt: mcumgr: grp: img_mgmt: Fix unused label warning
Fixes an issue with a warning when compiling for direct xip mode
without revert

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-01-21 11:11:51 +01:00
Maochen Wang
cfe91b8df1 net: ip: net_pkt: only reserve L2 header for TX case
Only reserve L2 header for TX case when allocating net buffer,
as for RX case, all the received headers are already in linear
buffer when the driver receives the data, and reserve extra L2
header for RX case may exceed the default buffer size.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-21 11:11:19 +01:00
Emil Gydesen
e4c5bb99b0 Bluetooth: GATT: Change get_handle function of find_by_uuid
bt_gatt_find_by_uuid used bt_gatt_attr_value_handle but that
function only works to get the value handle of a characteristic
declaration, i.e. if the UUID is not BT_UUID_GATT_CHRC then it
would always return handle = 0. This meant that
bt_gatt_find_by_uuid would always use handle = 0 as the starting
handle for non-BT_UUID_GATT_CHRC attributes, instead of the handle
of the provided attr.

This was not an issue for any UUIDs that may only exist once on a
GATT server, which is most UUIDs, but for UUIDs like the
BT_UUID_TBS_* UUIDs that may be multiple instances of, it would
always return the first attribute rather than the one starting
from the provided start attr.

This commit also ensures that we do not overflow the `end_handle`
when adding 2 uint16_t values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-21 11:11:09 +01:00
Andrzej Głąbek
6d9513ef35 mgmt: mcumgr: grp: os_mgmt: Fix compilation warning
This is a follow up to commit 770482a45a.

Add initialization of the `ok` variable to prevent the "may be
uninitialized" warning when `CONFIG_BOOTLOADER_MCUBOOT` is not
defined.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-01-20 20:56:52 +01:00
Joakim Andersson
a238e5c29d Bluetooth: audio: Fix byteorder in csip sef crypto function
Fix byteorder handling in csip sef crypto function.
On big-endian system we also need to convert the k array from
little-endian to big-endian. The Bluetooth protocol is always using
little-endian ordering.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2025-01-20 16:28:35 +01:00
Dawid Niedzwiecki
6f6f8bc931 mgmt: ec_host_cmd: uart: improve error handling
Add an array with the states names and use it while logging an error
messages.

Additionally unify the error message format. Do not add
"UART HOST CMD ERROR", because the LOG_ERR macro already informs that
it is an error message.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-01-20 11:27:06 +01:00
Maochen Wang
fed8e34a45 net: shell: mem: support getting max used buf and packet
When defined both CONFIG_NET_BUF_POOL_USAGE and
CONFIG_MEM_SLAB_TRACE_MAX_UTILIZATION, support using 'net mem' cmd
to get the maximum count of used buffers and net packets.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-20 11:16:18 +01:00
Jukka Rissanen
e658bc1b2b net: Extend the protocol handling in Ethernet
Allow user to specify protocol extensions when receiving data
from Ethernet network. This means that user can register L3
protocol handler using NET_L3_REGISTER() with the desired
protocol type. Ethernet code will then call the handler if
such a protocol type packet is received. This is currently
only implemented for Ethernet. The original IPv4 and IPv6
handling is left intact even if they can be considered to
be L3 layer protocol. This could be changed in the future
if needed so that IPv4 and IPv6 handling could be made
pluggable protocols.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-20 09:21:32 +01:00
Sylvio Alves
1f29980fcd drivers: bt: add additional TX power values
Adds additional custom TX power levels available in
Espressif's chips.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-01-19 19:21:52 +01:00
Dmitry Lukyantsev
d46546e2d8 sensing: Fix static assert in get_sensor_by_dev()
With assert condition set to true, assertion never happens.
Change __ASSERT(true) to __ASSERT(false).

Signed-off-by: Dmitry Lukyantsev <dmitrylu@meta.com>
2025-01-18 12:40:03 +01:00
Dominik Ermel
ac5cdcdb8a fs/littlefs: Log error code on failed flash_area_open
Log error code to make it easier to investigate problems.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-18 12:39:53 +01:00
Vinayak Kariappa Chettimada
750250f129 Bluetooth: Controller: BUILD_ASSERT ticker nodes exceed UINT8_MAX
Added BUILD_ASSERT to ensure ticker node count does not
exceed UINT8_MAX.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
4304640347 Bluetooth: Controller: Add NRF_CCM support in nRF54L15 SoC
Add NRF_CCM h/w based encryption support in nRF54L15 SoCs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
031a17c271 Bluetooth: Controller: Align DDPI usage with nRF54L power domains
Align DDPI usage with nRF54L series power domains and
available DDPI configurations.

Use indices below 4 when needing to bridge with GPIO,
use indices below 8 when needing to bridge with MCU domain
like CCM and AAR; and use indices above 7 to bridge with
Peripheral domain.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
439cd0b8bc Bluetooth: Controller: Minor fix defines and conditional compilations
Replace use of HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI with
HAL_TRIGGER_CRYPT_PPI; they have same value but use the
correctly named HAL_TRIGGER_CRYPT_PPI define now.

Fix conditional compile to correctly exclude reference of
NRF_CCM when CONFIG_BT_CTLR_PRIVACY=n.

Fix missing reference to CCM_TASKS_CRYPT_DELAY_BITS when
CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER=y.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
1508aa49a8 Bluetooth: Controller: Single timer use ISO Peripheral nRF54L support
Update ISO Peripheral for single timer use support required
for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
b6ce1a6ae0 Bluetooth: Controller: Single timer use ISO Central nRF54L support
Update ISO Central for single timer use support required
for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
980cc216a8 Bluetooth: Controller: Single timer use ISO Receive nRF54L support
Update ISO Sync Receiver for single timer use support
required for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
ccba18a32f Bluetooth: Controller: Single timer use Periodic Adv Sync nRF54L support
Update Periodic Advertising Sync implementation for single
timer use support required for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
88a73dd937 Bluetooth: Controller: Single timer use Conn Scheduling nRF54L support
Update advanced non-overlapping Central Connection Creation
scheduling for single timer use support required for nRF54L
Series SoCs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
c4a6651064 Bluetooth: Controller: Single timer use Extended Scanning nRF54L support
Update Extended Scanning for single timer use support
required for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
373dc0db71 Bluetooth: Controller: Single timer use Extended Advertising nRF54L support
Update Extended Advertising for single timer use support
required for nRF54L Series SoCs.

As the timer is reset on every radio end, add implementation
to accumulate the last_pdu_end_us.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
28f93157fd Revert "Bluetooth: Controller: Fix ext conn create when using single timer"
This reverts commit a7fff7445c.

The next commit will re-add back the fix to primary
advertising channel plus auxiliary advertising channel too.
This will help keep the fix together regarding use of
single timer for software tIFS switching implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
e4b6751bbc Bluetooth: Controller: Restrict ISO Sync Receiver subevent jitter
Restrict the jitter considered in the PDU reception in the
subevents of ISO Sync Receiver.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
06b7503e33 Bluetooth: Controller: Fix nRF5 radio and event timer abstractions
Fix nRF5 radio and event timer abstractions for some that
where hard coded compared to use of the ones defined in the
resources header file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
7e51788dd7 Bluetooth: Controller: Add radio_sim_nrf54l.h file
Add radio_sim_nrf54l.h file, which for now a copy of the
SoC radio_nrf54lx.h file. This is added for having separate
simulation model dependent timing values and specific
implementation details.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
dd95c22f50 Bluetooth: Controller: Fix single timer s/w switch base indices
Fix single timer s/w switch base indices from overlapping
with sample index.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
3bc24622d3 Bluetooth: Controller: Fix single timer s/w switch when using DPPI
Fix single timer s/w switch when using DPPI on nRF53/54L
where the previous compare register index is incorrect when
the base index is a odd numbered DPPI used.

The issue is discovered as failing ISO Receiver sample with
Coded PHY and single timer use, where the compare base is
configured to use the DPPI 3 (instead of 4).

Upstream samples do not use single timer for s/w switch, the
issue is discovered when adding support for nRF54L which has
to use single timer due to the radio only having a single
timer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00