The sensing subsystem currently calls fetch and get from a timer ISR
context. A TODO had been previously added to move this to the runtime
thread context, which has been done in this fix.
Signed-off-by: Brandon Edmonds <bedmonds91@gmail.com>
Adds sys_mem_blocks as an alternative implementation
for the heap. Users have reported that k_heap allocating
additional bytes for bookkeeping data when allocating e.g.
a LLEXT_PAGE for an extension region causes them to skip
an entire page for the next allocation. This also causes
problems RE: MPU slot usage. sys_mem_blocks stores bookkeeping
data outside of the memory it allocates from and does not
have this issue.
Note that sys_mem_blocks is only used to allocate extension
regions. Metadata is still stored in a k_heap.
Note also that tracking data for sys_mem_blocks must be stored
per extension, as unlike k_heap it can't deallocate with just
a pointer to the memory.
Further limitations:
* sys_mem_blocks is statically allocated, so this option
cannot be used with CONFIG_LLEXT_HEAP_DYNAMIC
* A minimum of 1 block must be allocated per region
regardless of size.
* If using the MPU / MMU where small allocations are
rounded up to LLEXT_PAGE regardless, this penalty
is not quite as noticeable.
* sys_mem_blocks does not support aligned allocations. However,
by selecting a sufficiently large power of 2 for the
block size and aligning the backing buffer to the block size,
any allocation will be automatically aligned for the block size
and smaller powers of 2. For LLEXT, this means users must select
a block size equal to or a multiple of the largest
requested region alignment of regions going on the heap
* If your MPU selects CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT,
large regions may cause unreasonably large maximum requested
region alignments
* Block size must also be equal to or a multiple of
LLEXT_PAGE_SIZE so each allocation is LLEXT page aligned
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
Adds a Kconfig option to select LLEXT heap implementation.
Another choice, sys_mem_blocks, will be introduced in the
following commit.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
Set the FCS option to BT_L2CAP_BR_FCS_16BIT for enhanced retransmission
mode in both L2CAP accept and connect paths to work around an
interoperability issue with iPhone devices.
The issue occurs when connecting to iPhone for PBAP or MAP profiles,
where the iPhone expects the 'No FCS' option to be applied but does
not include the 'No FCS' option in its L2CAP_CONFIGURATION_REQ packet.
Forcing 16-bit FCS ensures proper configuration negotiation.
Changes include:
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in goep_l2cap_accept()
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in
bt_goep_transport_l2cap_connect()
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When a fatal error occurs before the kernel is fully initialized
(e.g., during early boot), the ztest fatal error handler would call
k_current_get() which now contains an assertion that fails if called
pre-kernel (added in commit 5ce408b647 ("kernel: assert if
k_current_get is called pre-kernel")). This assertion failure
triggers another panic, creating an infinite recursion that floods
the console with nonsensical values.
Check k_is_pre_kernel() to decide which method to use: _current
directly when pre-kernel (to avoid the k_current_get assertion), or
k_current_get() otherwise for proper userspace and TLS support.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Move state retrieval before error handling to ensure it's always
available for subsequent checks. Add a check to prevent executing
the callback when the AG connection is in a disconnected state.
This prevents potential use-after-free or invalid state access when
the callback is invoked after the AG has been disconnected, improving
the robustness of the notification work handler.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
log_backend_net supports both tcp and udp. If no tcp support is
compiled in, line_out will return an invalid number of consumed
bytes (-EINVAL). This patch removes the is_tcp flag if tcp support
is not compiled in and moves the error check into init_net.
Signed-off-by: Paul Wedeck <paulwedeck@gmail.com>
filter automount durring build.
Also add the automaticly enabled Kconfig option
CONFIG_FS_LITTLEFS_FSTAB_AUTOMOUNT, similar
to the fat fs and ext2 fs.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
If automount is enabled in the devicetree for
a fatfs, then enable the Kconfig option by default.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Sender address and address length were not set in recvfrom() when called
for TCP socket. Fix this by reusing the code used to set source address
on accept().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The return value greater than 0 from `i3c_target_tx_write()`
indicates the number of bytes written. This patch fixes
the incorrect check.
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
settings_zms_dst() and settings_zms_src() never reports errors and
always returns 0.
The error check at the call site is therefore dead code.
Make the function void and drop the unused error handling.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Setting the prompt to the empty string allows it to be hidden. This is the
intent of the shell command 'shell prompt off'. However, in the most recent
change to the prompt handling, this functionality was lost. Presumably,
the check for 'prompt_length == 0' was to avoid a NULL prompt. However,
NULL is already checked for. Remove the zero-length check and restore the
ability to set the prompt to the empty string.
Signed-off-by: Ryan Smith <elryno@elryno.com>
Increasing FD count in the system for the network stack (native sockets)
only makes sense if native network stack is enabled. Otherwise, just
make it 0. This makes a difference for example when socket offloading is
used and the offloaded implementation makes its own reservation.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The bypass mode in shell.c transfers data in a loop and doesn't need
a large buffer. The previous code conditionally used
CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN which unnecessarily tied the bypass
buffer size to RTT configuration and could increase stack usage when
RTT buffer is configured larger.
This adds CONFIG_SHELL_BYPASS_READ_BUF_SIZE with a default of 16 bytes,
which is sufficient for the iterative read loop. A build-time assert
ensures the buffer doesn't exceed SHELL_STACK_SIZE.
Fixes: db9dccdc8a
Signed-off-by: Karel Blavka <karel.blavka@hardwario.com>
This commits splits the border router services initialization by
separating the ipv6 related services from ipv4 ones.
As there are cases in which a DHCPv4 server is not present in the
network setup, there is no reason to wait for an IPV4 address before
starting the border router. In this case, only IPV6 functionalities
would be exposed.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
The length is an input parameter, which tells the kernel how big the
storage is. Depending on the socket implementation in use, not setting this
properly can (and should) fail depending on the value of the stack
variable.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
5f5db5bf3c added support for IPV6_MULTICAST_HOPS by adding both IPv4 and
IPv6 variants in place where they are used. This made the code a bit
complicated, though. This commit introduces helper functions to solve this.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
There's a method to enable RX (`mctp_uart_start_rx`), but not one to
stop it. This patch adds `mctp_uart_stop_rx` to do so.
It will be handy at least for tests, as it allows two MCTP endpoints to
share a single UART device - as long as only one has RX enabled - and
"ping-pong" messages between them.
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Arm the first OUT transfer when class is enabled
so the host's first write can complete.
On disable, cancel worker, drain FIFO, reset RX parser,
and unblock tx_lock if disconnect occurs mid-transfer.
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
Add optional ZLP after an IN transfer that is an exact multiple of the
endpoint MaxPacketSize. Track outstanding IN completions via in_pending
to release tx_lock exactly once.
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
Switch RX handling to enqueue completed OUT buffers into a FIFO
and parse them in a worker.
Re-arm BULK OUT immediately to avoid host-side stalls.
Drop zero-length OUT completions without scheduling the worker
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
The -test command line option can be used to filter tests for execution
on native_sim targets, but if ZTEST_SHELL is enabled this filtering can
be done via the shell itself, so the option loses its purpose and can be
disabled.
Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
On POSIX targets, TC_END_POST calls posix_exit(), which terminates the
process after test execution. When tests are run via the ztest shell,
this behavior is undesirable, as the shell session is expected to remain
active for further interaction.
Change TC_END_POST to expand to an empty statement when CONFIG_ZTEST_SHELL
is enabled, preventing premature process termination.
Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
When CONFIG_ZTEST_SHELL=y, the system failed to compile due unsatisfied
references to ztest_set_test_args and ztest_reset_test_args. This commit
fixes the issue by copying these functions from ztest_shell and
modifying libc calls to their nsi_host_* equivalents, fixing
compilation.
Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
The whole TCP Kconfig options block is already behind "if NET_TCP",
therefore "depends on NET_TCP" on certain options was redundant.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Zephyr by default closes all TCP contexts associated with a given
network interface when the interface goes down. This leads to
reporting an error on the associated network socket, allowing the
application to reopen sockets (for example in case of a network or
an IP address change).
It's been reported however that in certain cases this behavior is
undesirable. If this option is enabled, the TCP stack won't
close any TCP contexts when the network interface is going down.
Therefore, it is the application's responsibility to monitor the IP
address or network interface state changes, and restart the TCP
sockets when needed. Enable this option only if you can guarantee
that the application handles that properly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Contexts bound to any address are not associated with any specifc IP
address (sockets not connected yet or listening sockets bound to any),
therefore there's no need to shut down the connection context on the
interface down event. Hence, check the local address binding before
shutting down the context.
Note, that there's some extra logic involved when reading the TCP local
address, implemented in net_tcp_endpoint_copy(), therefore I've simply
reused that function for the purpose.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Moved forward decision debug messages ahead of interface TX/RX
operations. That's proper to see forward decision debug messages
first, and then interface TX/RX debug messages.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Added FDB (Forward Database) table support for bridge.
Implemented very basic functions for adding/deleting
static <MAC + iface> FDB entry.
The dynamic FDB entry and hardware FDB configuration is
still TODO work.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Add check for ACL connection before submitting recycled.
Since ISO and SCO connections do not trigger the disconnected
callback, nor affects e.g. advertising, they should not
trigger the recycled callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
On qemu_x86, the size of a coverage report entry for certain testcases can
exceed 32KiB, resulting in the "No memory available to continue dump" error
message in the gcov data output and the subsequent twister error in parsing
the data:
ERROR - General exception: non-hexadecimal number found in fromhex()
arg at position 0
This commit increases the gcov heap size to 64KiB to work around the above
issue.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Failure to clear ct->ct_notify[event_id] when avrcp_prepare_vendor_pdu
fails, leading to an error return if ct->ct_notify[event_id].cb != NULL
during the next notification registration.
Signed-off-by: Lu Jia <jialu@xiaomi.com>
Use the same HAL header for the simulated 54LM20 as for the 54L15,
just like we do for real targets.
Note this ifdef is the last one, and therefore the real targets
have already been caught before.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Fix address resolution wait to not be infinite loop and
instead exit with a reasonable count down value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
struct dns_header is packed therefore it fields need to be accessed with
respective helper macro to avoid warnings with clang.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
for example:
l2cap_br_encrypt_change() calls l2cap_br_conn_pend(chan, hci_status) first,
which may trigger l2cap_br_chan_cleanup(chan). This clears chan->conn and
makes the channel invalid. The subsequent callback to
chan->ops->encrypt_change(chan, hci_status) then dereferences a NULL conn
in rfcomm_encrypt_change, causing a crash.
Signed-off-by: Zhijie Zhong <zhongzhijie1@xiaomi.com>
Returning negative values which are not -1, isn't what POSIX would do and
the API is specifically designed to behave like recvfrom.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
- gw_id is an uint8_t in the protocol, so neither char, nor uint16_t are
the correct type to use.
- addr is an array of bytes, not a string (of characters).
This also corrects related log messages and makes them more consistent, by
using hex for all gw_id's.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
The address is only used for gateway discovery, but using a truncated
`struct sockaddr` can lead to out of bounds reads.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>