The connection object is, and should not, be modified by the function.
Making it const makes it possible to do this simple operation
in functions that also won't change the conn object (i.e.
that uses `const`).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function supports reading multiple controller-based values.
It is effectively a copy of struct bt_dev_le but in a more
application-oriented definition.
It was chosen to keep the features as an array rather than a
64-bit value, as the comparison macros work on arrays and that
there already exists new bits > 64 in the core spec which is not
yet supported by Zephyr.
It is being smoke tested in a generic GATT client test,
as the individual values may depend on several Kconfig options.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The coap_client has a static/internal function, has_ongoing_exchange(),
which can be an useful addition to the public API. This would provide
a mechanism to determine when it is safe to close a socket gracefully.
Signed-off-by: Povilas Selevicius <povilas.selevicius@quadigi.com>
Bugfix previous `osThreadJoin()` implementation where a thread which
exited with `osThreadExit()` could not be joined upon by other threads.
Signed-off-by: Utsav Munendra <utsavm@meta.com>
Add a variant of the SNTP API that does not block while waiting for a
response from the SNTP server. Instead it takes advantage of
`CONFIG_NET_SOCKETS_SERVICE` to read the response asynchronously when
the response is received.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Extract the SNTP query send logic out of `sntp_query` so that it can be
used by functions that don't synchronously wait for the response.
Signed-off-by: Jordan Yates <jordan@embeint.com>
When a TCP connection is refused during zsock_connect, errno is set
to -ENOTCONN, but errno should be set to -ECONNREFUSED. This change
causes the ECONNREFUSED status to be propagated from tcp_in to
net_tcp_connect, which eventually causes errno to be set
to -ECONNREFUSED.
Signed-off-by: Noah Olson <noah@wavelynx.com>
In order to support new toolchains that are not compatible with
gcc/clang (e.g., IAR), we need to add a level of indirection for
the name of warnings.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Add a Kconfig BT_LIMITED_DISCOVERABLE_DURATION to set the timeout for
limited discoverable mode.
Add a argument `limited` to function `bt_br_set_discoverable()` to
support the limited discoverable mode.
When enabling discoverable mode with `limited` is true, both write
LIAC and GIAC to controller and set the bit 13 of COD in function
`bt_br_set_discoverable()`. And start a delay worker with the timeout
CONFIG_BT_LIMITED_DISCOVERABLE_DURATION to disable the discoverable
mode.
When disabling discoverable mode, only set GIAC to controller and
clear bit 13 of COD.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
if saving buf to another variable, usually the ref/unref
needs to be used. change to pass the buf as one parameter
of callback
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
memset already clean the `buf`, don't need to set as NULL.
`avdtp_set_status` already set `req->status` based on `msg_type`,
don't need to check `msg_type` again.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
bt_a2dp_ep_info is used in bt_a2dp_discover, and the max
discovered endpoints' info are already given in seps_info
of bt_a2dp_discover_param, so use pointer to point to the
seps_info of bt_a2dp_discover_param.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
use two handler array to process cmd and response separately,
make the functions shorter and codes more readable.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
The RISC-V port of llext requires additional parameters for
handling non-adjacent HI20/LO12 relocations in arch_elf_relocate():
the current extension (struct llext), the current extension loader
(struct llext_loader), the current section header (elf_shdr_t) and
the current symbol (elf_sym_t).
This changes the signature of arch_elf_relocate accordingly.
Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
This commit refactors logic in llext_link.c that resolves
a symbol to be imported by an llext into a utility function.
Thereby, the logic can be re-used in other functions if
needed, e.g., when resolving symbols for indirect relocations.
Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
allow the application to decide whether to keep going with the fuota
process by setting a callback that exposes the descriptor field
whenever `FragSessionSetupReq` is sent to the device.
Signed-off-by: Kiara Navarro <sophiekovalevsky@fedoraproject.org>
The root cause of this issue is a modification of `struct ring_buf` in
3075a7d9. Even though all the fields of the struct are marked as
internal, the LwM2M code is using some of them to roll back the state of
the ring buffer on failure.
Signed-off-by: Etienne de Maricourt <edmecomemail@gmail.com>
To avoid collisions between IDs used by settings and IDs used directly
by subsystems using ZMS API, the MSB is always set to 1 for Setting's
name ID written to ZMS backend
Add as well a recovery path if the hash linked list is broken.
Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
In order to avoid any mutex deadlocks between iface->lock and
TX lock, release the interface lock before calling a function
that will acquire TX lock. See previous commit for similar issue
in RS timer handling. So here we create a separate list of ACD
addresses that are to be started when network interface comes up
without iface->lock held.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
In order to avoid any mutex deadlocks between iface->lock and
TX lock, release the interface lock before calling a function
that will acquire TX lock. See previous commit for similar issue
in RS timer handling. So here we create a separate list of multicast
addresses that are to be rejoined when network interface comes up
and then rejoin the groups without iface->lock held.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
In order to avoid any mutex deadlocks between iface->lock and
TX lock, release the interface lock before calling a function
that will acquire TX lock. See previous commit for similar issue
in RS timer handling.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The net_if.c:rs_timeout() is sending a new IPv6 router solicitation
message to network by calling net_if_start_rs(). That function will
then acquire iface->lock and call net_ipv6_start_rs() which will try
to send the RS message and acquire TX send lock.
During this RS send, we might receive TCP data that could try to
send an ack to peer. This will then in turn cause also TX lock
to be acquired. Depending on timing, the lock ordering between
rx thread and system workq might mix which could lead to deadlock.
Fix this issue by releasing the iface->lock before starting the
RS sending process. The net_if_start_rs() does not really need to
keep the interface lock for a long time as it is the only one sending
the RS message.
Fixes#86499
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Correct Mutex ctr_lock defination as the wrong defination lead to
sysworkq task not acquiring this mutex during bt init, which lead to
BLE didn't work as described in issue https://github.com/zephyrproject-rtos/zephyr/issues/86444
Signed-off-by: Ying Zhang <ying.zhang_2@nxp.com>
Add missing Copyright from derived files and fix the Copyright year for
some files to keep the original Copyright notice
Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
Fix end time capture be on radio event end irrespective of
direction finding support. Let the timer clear use radio
end or radio phy end, for no direction finding or direction
finding support, respectively.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix single timer use end time capture from being disabled
as end time and timer clear use the same PPI.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix active mode extended scanning assert raised when calling
radio_tmr_start_us() due to stale radio_tmr_end_get() value.
Active mode extended scanning did not drop reception of
ADV_EXT_IND PDU when setup to receive ADV_SCAN_RSP PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix BT_CTLR_LOW_LAT_ULL dependency after changes in
commit 5119896c7d ("Bluetooth: Controller: Fix
BT_CTLR_LOW_LAT_ULL conditional code").
BT_CTLR_LOW_LAT_ULL is independent of BT_CTLR_LOW_LAT, where
the later prevents any ULL execution inside a radio event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
We need to track the self-powered status of the device independently of
the D6 bit in the bmAttributes value of the configuration descriptor
because the Get Status request about the self-powered status is valid in
address state and we support multiple configurations.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit alignes the timeout value for allocating buffers within att
on the BT RX thread, making it consistent within att.c, see
bt_att_req_alloc.
We are inferring in many bt_gatt_* functions that if called from a BT RX
thread (which is inherently the case if called from a callback when
running a Bluetooth application), we don't block and instead return
-ENOMEM when the ATT request queue is full, avoiding a deadlock.
This promise is fulfilled within bt_att_req_alloc, where the timeout for
allocation of the request slab is set to K_NO_WAIT if we are on the BT
RX thread. Unfortunately, we break this promise in
bt_att_chan_create_pdu, where the timeout for allocation of the att pool
is still K_FOREVER and deadlocks can (and do) occur when too many
requests are sent yet the pool is depleted.
Note: Both req_slab and att_pool sizes are defined by
CONFIG_BT_ATT_TX_COUNT. If applications start getting -ENOMEM with this
change, they were at risk of such a deadlock, and may increase
CONFIG_BT_ATT_TX_COUNT to allocate the att pool for their requests.
Note: This possible deadlock has been flying under the radar, as
att_pools are freed when the HCI driver has sent it to the controller
(instead of when receiving the response, as it happens with req_slabs)
and due to the att_pool and the req_slab being both sized by
CONFIG_BT_ATT_TX_COUNT, and req_slab being allocated before and
returning -ENOMEM already if there is no space, it takes a more specific
situation to deplete the att_pool but not the req_slab pool at this
point.
Note: Ideally, we don't want functions to behave differently depending
on which thread they are running, and while this commit makes it more
consistent, it should be considered a workaround solution.
Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
Fix handling of poll setting socket error flag.
In this case errno is no set, so should not be the return value either.
Instead retrieve the socket error for SOCKERR and return EBADF for
SOCKNVAL.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Mixing `select` and `depends on` is a common source of Kconfig
dependency loops and should be avoided. Both `ZMS` and `SETTINGS` are
more commonly used with `depends on` rather than `select`.
The usage here also contradicts the Zephyr best practices guide for
`select`:
* Avoid selecting symbols with prompts or dependencies.
Prefer depends on.
Signed-off-by: Jordan Yates <jordan@embeint.com>
`SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS` does not use either
the `FLASH_MAP` or `NVS` APIs, only `SETTINGS`.
Similarly, `SECURE_STORAGE_ITS_STORE_MODULE` does not consist of any
code itself and therefore should not select or imply any options.
Signed-off-by: Jordan Yates <jordan@embeint.com>
`FLASH_PAGE_LAYOUT` has a hardware dependency on `FLASH_HAS_PAGE_LAYOUT`
which is not present for all boards. Forcing this symbol to `y` when
the hardware doesn't support it results in build errors at the Kconfig
stage.
`FLASH_PAGE_LAYOUT` is enabled by default when `FLASH_HAS_PAGE_LAYOUT`
is true, so this change will not require any user changes.
Signed-off-by: Jordan Yates <jordan@embeint.com>
As part of the MMC card initialization sequence, CMD1 command send
multiple times to the card, first time to identify the card type and
second time to check the requested voltage window is supported or not.
There is a chance that after issuing the CMD1 for first time, card will
move to the ready state before issuing the CMD1 for second time. In this
case, card will not respond to the CMD1 send for the second time as card
is already moved to ready state and this leads to failures. Hence remove
the separate card identification logic and call mmc_send_op_cond only
once to check both supported voltage window and card type
identification.
Signed-off-by: Paul Alvin <alvin.paulp@amd.com>
`imply` should only be used if the code can still operate without the
symbol, which is not the case. Move the ID source to a choice symbol,
which depends on `HWINFO` when required.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Reset semaphore if USB transfer failed or was canceled and prevent
cdc_acm_send_notification() from blocking forever.
Signed-off-by: Martin Gysel <me@bearsh.org>
The buffer allocation in conn.c will trigger warnings if we try to use
anything else than K_NO_WAIT for the timeout when called from within the
system workqueue.
The calls in l2cap.c and att.c which may pass non-zero timeouts already
have proper handling for failed allocations, so make sure we use K_NO_WAIT
to avoid unnecessary warnings from conn.c.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Simplify the defines calculating the minimum required ISO
PDU length and the buffer count.
Co-authored-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Tx PDU buffer count required when SDU fragmentation
is used.
Rename BT_CTLR_CONN_ISO_SDU_LEN_MAX to
BT_CTLR_ISO_TX_SDU_LEN_MAX so the value is common to both
Broadcast and Connected ISO transmissions.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename the internal BT_CTLR_ISO_TX_BUFFERS to
BT_CTLR_ISO_TX_PDU_BUFFERS correct represent the number
of actual ISO PDU buffers allocated in the Controller.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
* This variable default value has to be true, so that the
application can return false in the expired callback
Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>