Queueing packets should be possible from the ISR context, recent changes
prevented that. Therefore add extra checks in
net_tc_submit_to_tx/rx_queue() to make them ISR friendly again.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This updates the help text for the Kconfig option BT_MESH_WORKQ_SYS to
take into account the change made in PR #84282 which causes the host to
no longer return -ENOBUFS. Since the mesh will now instead block the
work queue, a note has been added about a potential consequence of this.
Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
Fix HCI command buffer allocation failure, that can cause
loss of Host Number of Completed Packets command.
Fail by rejecting the HCI Host Buffer Size command if the
required number of HCI command buffers are not allocated in
the Controller implementation.
When Controller to Host data flow control is supported in
the Controller only build, ensure that BT_BUF_CMD_TX_COUNT
is greater than or equal to (BT_BUF_RX_COUNT + Ncmd),
where Ncmd is supported maximum Num_HCI_Command_Packets in
the Controller implementation.
Relates to commit 81614307e9 ("Bluetooth: Add workaround
for no command buffer available")'.
Relates to commit 297f4f481f ("Bluetooth: Split HCI
command & event buffers to two pools").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove nested allocation of HCI command buffer so that one
less HCI command buffer is needed starting extended
advertising with privacy enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This resolves some addressed comments in this PR zephyrproject-rtos#77930
as well as this PR zephyrproject-rtos#80407
Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
Building with clang warns:
subsys/net/l2/ethernet/ethernet.c:178:18: error: unused function
'ethernet_check_ipv4_bcast_addr' [-Werror,-Wunused-function]
enum net_verdict ethernet_check_ipv4_bcast_addr(struct net_pkt *pkt,
^
ethernet_check_ipv4_bcast_addr is called by ethernet_ip_recv, which only
exists when CONFIG_NET_IPV4 or CONFIG_NET_IPV6 is defined.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
The ARP protocol handler cannot directly access the Ethernet header
because the caller has removed the header already when the handler
is called. So change net_arp_input() and pass source and destination
MAC address there instead of bogus pointer that was pointing to ARP
header instead of Ethernet header. This requires changes to ARP tests.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When scanning is started on bt_bap_broadcast_assistant_scan_start then
BAP_BA_FLAG_SCANNING flag for the broadcast assistant instance should
not be cleared.
Fixes#85937
Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
No files use MS_TO_US except tests/kernel/interrupt/src/nested_irq.c.
While the macro is convenient, we should put it in a more central
location and use it everywhere if we want to use it rather than just in
interrupt_util.h. For now, remove it and replace the two usages to match
how code is written in the rest of Zephyr.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
When run the Zperf UDP throughput with '-a' (Asynchronous call),
zperf_work_q thread will generate and send the packets to tx_q thread.
When zperf_work_q and tx_q threads have same priority, if zperf_work_q
fails to take the semaphore of fifo_slot, it will not wait and directly
drop the net_pkt. Then it will allocate new net_pkt, repeat, and always
occupy the CPU, which leads to extreme low throughput.
For TX, when take the semaphore of fifo_slot, setting a wait time of
K_FOREVER to let other thread to process and free these packets.
For RX, when failed to take the semaphore of fifo_slot, yield the CPU
to let the thread of data path with same priority to run to reduce
dropping packets.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
In rare occasions when sending DAD NS packet fails, we should still
setup the DAD timer, unless we implement some kind of more advanced
retry mechanism. If we don't do that, the IPv6 address added to the
interface will never be usable in such cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
DAD creates an entry in the neighbor cache for the queried (own)
address. In case the address is removed from the interface while DAD is
still incomplete, we need to remove the corresponding cache entry (just
like in case of DAD timeout) to avoid stale entries in the cache.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Errors were logged for some cases in zephyr_img_mgmt.c, but not all.
This commit adds error logs for all error cases.
Signed-off-by: Nick Brook <nrbrook@gmail.com>
When `bt_le_oob_get_local` or `bt_le_ext_adv_oob_get_local` is called
and SMP is enabled, `bt_smp_le_oob_generate_sc_data` is called to
generate a Random Number and a Confirmation Value needed for OOB data.
These values are based on the device's public key.
The public key is generated only once when `bt_smp_init` is called.
If public key generation fails, the callback passed to `bt_pub_key_get`
is called with `pkey` set to NULL. The `bt_smp_pkey_ready` callback
gets called, but it doesn't release the `sc_local_pkey_ready` semaphore
thus leaving `bt_smp_le_oob_generate_sc_data` wait for semaphore with
`K_FOREVER`.
This commit replaces the semaphore with a conditional variable and
requests a public key again if the key is NULL thus solving 2 issues:
- handling the case where the callback was triggered notifying about the
completion of the public key request, but the key was not generated,
- handling the case where multiple threads trying to acquire the same
sempahore.
The timeout is used instead of K_FOREVER to avoid cases when callback
has never been triggered.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Calling coap_client_cancel_requests() clears the internal request
context only for active requests (i. e. not replied yet). However,
if there are any pending request context monitoring ACK duplicates,
those would still make the corresponding client socket being monitored
by poll(). In result, when application closes the socket, the polling
thread will throw POLLNVAL error for the socket.
Fix this, by resetting all request contexts unconditionally. The request
callback will only be called for the active requests.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In function `avdtp_send`, there is case that if the session->req is not
NULL, then the buf will be lost.
Release the allocated buffer by buffer allocated function when the buf
is failed to send.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Otherwise the RTIO Workqueue is not functional for devices during init.
An example of this issue is devices using SPI transfers with default
spi_rtio.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
When the stream enters the idle state, some values were not
properly reset (e.g. the stream->ep).
Use the bt_bap_stream_detach function to clean up the stream.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix regression in scan aux release now that aux context is
retrieved from the node rx when supporting multiple chain
reception.
Relates to commit a8065926ac ("Bluetooth: Controller: Fix
to release aux context stored in node rx").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Commit removes weak attribute and renames some functions
in crypto_psa.c since there is no centralized distribution
of the PSA key ID in bsim tests and no necessity to
reimplement native mesh approach.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Typically, when shell logging backend is used user wants to get
logs on shell instances so do not enable raw RTT log backend in
that case. When raw backend is enabled then initial logs go to
RTT backend and they are not visible on shell which starts later
as it requires additional thread.
It can be assumed that when RTT backend is used it will be
explicitly enabled by the user.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Remove the CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM macro in L2 shell level
to make 11v BTM query support embedded supplicant.
Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
The unicast server does not need GATT caching and it was likely
incorrectly added earlier as a dependency.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of providing NULL for bt_gatt_notify_uuid we
iterate on the connection objects and ensure that we
properly truncate the notification based on each
connection's GATT MTU.
This ensures that we send the right size for all
connections.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a common function to get the maximum notification
size, instead of having multiple implementations of this.
Ideally this function should be moved to the GATT API,
but for now just implement it for LE audio and then move to
GATT later.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added missing documentation for
bt_ccp_call_control_client_discover.
Added missing handling of -ENOTCONN in the function as well.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The total attributes list bytes count is only used to check the tail
room of response buffer. And the remaining frame length is used to
copy data from receiving buffer.
It does not check whether the remaining frame length is consistent with
the total attributes list bytes count.
Add the checking to make sure the attributes list is complete. And it
is used to make sure the response buffer can be accessed safety.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
According to RFC 4861, ch. 7.2.5:
"If the Override flag is set, or the supplied link-layer address
is the same as that in the cache, or no Target Link-Layer Address
option was supplied, the received advertisement MUST update the
Neighbor Cache entry as follows
...
If the Solicited flag is set, the state of the entry MUST be
set to REACHABLE"
This indicates that Target Link-Layer Address option does not need to be
present in the received solicited Neighbor Advertisement to confirm
reachability. Therefore remove `tllao_offset` variable check from the
if condition responsible for updating cache entry. No further changes in
the logic are required because if TLLA option is missing,
`lladdr_changed` will be set to false, so no LL address will be updated.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
According to RFC 4861, ch. 7.3.3:
"Upon entering the PROBE state, a node sends a unicast Neighbor
Solicitation message to the neighbor using the cached link-layer
address."
Zephyr's implementation was not compliant with behavior, as instead of
sending a unicast probe for reachability confirmation, it was sending a
multicast packet instead. This commit fixes it.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When Router Advertisement with Source Link-Layer Address option is
received, host should register a new neighbor marked as STALE
(RFC 4861, ch. 6.3.4). This behavior was broken however, because
we always added a new neighbor in INCOMPLETE state before processing
SLLA option. In result, the entry was not updated to the STALE state,
and a redundant Neighbor Solicitation was sent.
Fix this by moving the code responsible for adding neighbor in
INCOMPLETE state after options processing, and only as a fallback
behavior if the SLLA option was not present.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Extends the API for Advertising Coding Selection.
The API is extended to set the Advertising Coding Selection
(Host Support) bit. With this feature, the primary and
secondary PHY can now explicitly report S=2 or S=8 coding
in the extended advertising report. Previously, the report
only indicated LE Coded regardless of whether S=2 or S=8
data coding was used. The API now sets the host support bit
and ensures that the advertising PHY coding scheme is
conveyed to the application via the scan callback.
The support is enabled by CONFIG_BT_EXT_ADV_CODING_SELECTION,
and requires a controller that selects
CONFIG_BT_CTLR_ADV_EXT_CODING_SELECTION_SUPPORT.
Signed-off-by: Thomas Deppe <thomas.deppe@nordicsemi.no>
If the RTT shell backend is selected and the "down" buffer size
has been selected, the shell bypass functionality should instead
use the buffer size specified by the configuration.
Signed-off-by: Christopher Clingerman <christopher.clingerman@sensorfy.ai>
Add a missing break in supported_context_get, as it was not
intended to fallthrough to BT_AUDIO_DIR_SOURCE or default.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This patch adds support for Zstd and Zip formats to the EDK generation
process. The user can now choose between XZ, Zstd, and Zip compression
and output formats for the EDK file.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add a new Kconfig option to make the generation of an Extension
Development Kit (EDK) for the LLEXT subsystem optional. This
allows to cleanly separate EDK-related configuration and build
steps from the rest of the Zeprhyr build system.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
In some cases, CPUs that may need to reset or
temporary stop communication. This commit adds "unbound"
functionality that provides a callback to IPC service user
when connection was interrupted for some reason, e.g.
expected or unexpected CPU reset, closing the
endpoint. The "unbound" callback is optional to implement
by endpoints. This commit implements it in the ICMsg
backend.
Signed-off-by: Dominik Kilian <Dominik.Kilian@nordicsemi.no>
This condition can happen if there is MDNS activity on the network that is
either not according to specifications or not supported by Zephyr.
Lowering the log level from ERR to DBG, since this does not indicate an
error in the Zephyr application.
Signed-off-by: Helge Juul <helge@fastmail.com>
Do not use memory slabs for the control blocks when
the application provides the memory for it. This
implements manual user-defined allocation memory
management support in CMSIS-RTOSv2 API.
Signed-off-by: Utsav Munendra <utsavm@meta.com>
No functionality change, in preparation for allowing
threads with user provided stack and control block.
Signed-off-by: Utsav Munendra <utsavm@meta.com>
This enables the cmsis wrapper types to be declared
statically and then passed along to CMSIS-RTOSv2 APIs,
enabling static allocation of RTOS control blocks
in the subsequent commits.
Signed-off-by: Utsav Munendra <utsavm@meta.com>