Add new tracing API which is called when core is exiting from idle.
Current implementation is using it to track CPU load. Implementation
in tracing_none is now weak so it can be used if given backend does
not support new API call.
When CONFIG_CPU_LOAD is enabled then sys_trace_idle also calls a
hook which stores the timing information when CPU entered idle.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add module which can measure CPU idle time. Idle time is measured in
the pre/post CPU idle hooks but they are not provided by this module.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Use Wi-Fi connecting to Qualcomm IPQ8074 AP, and run the UDP RX traffic
with Zperf, but zperf does not return the throughput number after
traffic completion nor any session started prints. After traffic
completion, ping from STA to AP and vice versa does not work. The
socket_service thread is found blocked forever at zsock_wait_data()
after dns_dispatcher_svc_handler() is called via trigger_work().
The root cause of this issue is:
STA received one DHCPv4 packet containing DHCPV4_OPTIONS_DNS_SERVER,
it will create DNS socket and registered to socket_service. Then STA
received another IPv6 router advertisement packet containing
NET_ICMPV6_ND_OPT_RDNSS, it will close socket and change the state of
poll_events to K_POLL_STATE_CANCELLED(8), then registered to
socket_service with same fd. In socket_service thread, zsock_poll()
called zsock_poll_update_ctx() when handled ZFD_IOCTL_POLL_UPDATE, and
it checked the state of poll_events was not K_POLL_STATE_NOT_READY(0),
then it will set pfd->revents to '|= ZSOCK_POLLIN'. Finally
trigger_work() can be called as 'ctx.events[i].revents > 0' is matched.
The fix of this issue is that, in zsock_poll_update_ctx(), it should
check the state of poll_events is neither K_POLL_STATE_NOT_READY nor
K_POLL_STATE_CANCELLED before setting revents as ZSOCK_POLLIN, to avoid
trigger_work be unexpectedly called.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
There is a case that if the local is a peripheral and a L2CAP server
with the security level 3,the mitm should be set to make sure the
security level can reach level 3.
But in current implementation, the MITM is not set because the MITM
of `Authentication_Requirements` parameter of remote is not set. And
the security level will be level 2 after the security pairing
procedure complete.
Add a function `bt_l2cap_br_get_max_sec_level` to
get the max level of the registered servers.
`
Force set the MITM bit if the max level is bigger than level 2 and
pairing method is not `just works`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The ethernet header size with VLAN tag is 18 bytes,
so the length check should accommodate this.
Signed-off-by: Christoph Seitz <christoph.seitz@infineon.com>
Do not update packet length for unsupported packet families.
AF_PACKET family used the IPv6 length update, which breaks the
packet length if there is a payload with bytes resembling a
IPv6 length field less then 6 or a IPv4 length field less
then 46.
Signed-off-by: Christoph Seitz <christoph.seitz@infineon.com>
Avoid a "defined but not used" warning on
`init_next_pending_timeseries_data` when
LWM2M_RESOURCE_DATA_CACHE_SUPPORT is enabled but not LWM2M_VERSION_1_1.
Signed-off-by: Etienne de Maricourt <edmecomemail@gmail.com>
Remove a kconfig dependency on BOARD_NATIVE_POSIX which
does not really exist anymore.
Replace a comment mention of native_posix with native_posix.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The config LOG_USE_VLA depends on that MISRA_SANE is not set.
Unfortunately the IAR toolchain can't handle vla:s inside a
statement, which the LOG_USE_VLA macro does.
I've added a new, hidden config to check if vla is ok inside
statements, SUPPORT_VLA_IN_STATEMENTS. Default is always y, but
a toolchain can override it so that VLA is not used by
Z_LOG_MSG_ON_STACK_ALLOC.
Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
The backend uses a new USB device stack and bulk endpoints. Only a
single instance of the backend function is currently supported. Both DAP
packet processing and the new backend are prepared to support multiple
instances, but require a user interface and minor modifications.
New backen has similar functionality to what is provided by the function
in the sample samples/subsys/dap.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
We need a way to update the value configured by option
CMSIS_DAP_PACKET_SIZE at runtime. For example, the USB backend may have
different values depending on the speed at which the device is being
enumerated.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If the ACL link has been encrypted and it has a authenticated link key,
it means the pairing procedure has been done. And the security level of
the link key can not be upgraded. In this case, if `conn->sec_level` is
less than the required security level of the L2CAP channel, reject the
L2CAP conn request.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Improves readability by removing the need to check the table
to figure out how many antennas devices A and B are using.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
Add a selection of interval values that are suitable for BAP,
which will allow better coexistence between ISO and ACL,
for both broadcast and unicast. Some of these are defined
by the BAP spec, and some are defined by Zephyr, since they
do have a suggested value from BAP.
Samples and tests have been updated to use these new values.
Peripheral samples have also been updated with
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS so that the connection
parameters from the centrals aren't updated to something else
shortly after.
The shell has also been updated to use the LE Audio (BAP) values
if audio is enabled, and the audio.conf file has disabled automatic
updating of the connection parameters as the peripheral, as we rarely
(if ever) want to do that.
Due to the connection interval change, CI hit an issue
with test_bass_broadcast_code in test_main_client_sync, where
the reading of the long receive state did not finish before we
attempted to do another procedure, so the function was updated to have
a retry.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In current implementation, the SDP discovery complete event is not
notified when the response data length is 0.
Notify the discovery complete event if the response length is 0.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Fix mistake in host implementation of Advertising Coding Selection.
The host should only try set the BT_LE_FEAT_BIT_ADV_CODING_SEL_HOST
when the observer role is enabled. If a broadcaster enables the
CONFIG_BT_EXT_ADV_CODING_SELECTION Kconfig option bluetooth will
fail to initialise.
Signed-off-by: Thomas Deppe <thomas.deppe@nordicsemi.no>
The pending discovery request will not be handled in some cases.
The cases include,
- The received data length is not aligned with frame length
- The continuation status length is more than maximum value
- Total length of the response is less than the frame length
- Unknown operation code is received
There is also a case where the current discovery result was not
notified when processing the pending discovery request.
The cases include,
- Fail to send SDP request
- No tail room of received buffer to save the response data
Fix the issue by using the following steps,
- Notify the application that the discovery is done
- Process the pending discovery request
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
If the remote is in bondable mode, but the local is in non-bondable
mode, the local host shall respond to an IO capability request with
a negative response.
In current implementation, it does not check the bonding flags of the
both sides are consistent.
Fix the issue by checking the consistency of bonding flags of the both
sides. If they are not consistent, send a negative IO capability
response with the reason pairing not allowed.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The `conn` is found by using function `bt_conn_lookup_addr_br()`, it
should be released by calling `bt_conn_unref()`. But `bt_conn_unref()`
is missing in the case that the pairing is not accepted.
Release the `conn` by calling `bt_conn_unref()` before exiting the
function `bt_hci_io_capa_req`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add fields `total_len` and `recv_len` to `struct bt_sdp_client`.
Save the total length of the response to `total_len`.
Save the received data length of the response to the `recv_len`.
Check the consistency between `total_len` and `recv_len` after all of
the response packets are received.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Split the fuse FS driver into 2 parts: A top built in the embedded side,
with the embedded libC, and a bottom built in the runner side with the
host libC.
The error returns are converted to match the host libC.
Also, before the host FUSE thread, which is asynchronous to Zephyr was
calling directly into the Zephyr filesystem code, which resulted quite
often if catastrophic failures or corruption of the Zephyr state.
This is now fixed by having the FUSE thread queue requests to a Zephyr
thread, which will be handled in the embedded side in a coherent way.
This adds a slightly noticeable overhead, but the performance is still
acceptable.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The ISO configs set defaults based upon BT_ISO_MAX_CHAN and other
configs defined in `bluetooth/Kconfig.iso`.
By adding these dependencies the error messages resulting from
adding `CONFIG_BT_CTLR_PERIPHERAL_ISO=y` to a project configuration
file will become less confusing.
Now the build will output:
```
warning: BT_CTLR_PERIPHERAL_ISO (
defined at subsys/bluetooth/controller/Kconfig:976,
subsys/bluetooth/controller/Kconfig:984) was assigned the value 'y' but
got the value 'n'. See ...
```
Previously we would get:
```
warning: default value 0 on BT_CTLR_CONN_ISO_STREAMS
(defined at subsys/bluetooth/controller/Kconfig:993)
clamped to 1 due to being outside the active range ([1, 64])
```
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
If mDNS resolver is enabled but mDNS responder is not, then
mDNS multicast address group is not joined. This would prevent
the mDNS resolver to receive the responses. Fix this by
joining the mDNS multicast group if mDNS responder is not
enabled (because the responder will join the group itself).
Fixes#86477
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
There is a deadlock issue when calling stop using address conflict
detection. This is due to the fact that some net_mgmt events are fired
and trigger the dhcpv4_acd_event_handler() with lock held even if they
are of no interest for this callback.
Therefore, before acquiring the lock, make sure the event we received
is one we are expecting.
Also, do the same for dhcpv4_iface_event_handler().
Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
The logging thread is usually woken up by a timer, if the timer
period is longer than 10ms, log_flush() can iterate multiple times
needlessly, while waiting for the next timer. Instead wake up the
logging thread to let it flush the queue immediately. Besides a
hard-coded polling period of 10ms is too long for some applications,
make it a Kconfig parameter.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Add compression support using the accept-encoding
header to the http server static filesystem resource.
Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
The response should not be handled if there is not a request has been
sent.
Ignore the response if the `session->param` is `NULL`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, if the UUID of request is unknown, the
local variable `u` will not be updated, and the unknown UUID `u`
is used as the target to search it in the SDP record list. It may
result in irrelevant record being replied to the requester.
Ignore the unsupported UUID to fix the issue.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
http_server_http2.c does not guard check if file system is available
or not before using file system api. This PR will add guard for that
Signed-off-by: bac phan <phanhaibac98@gmail.com>
When the continuation length is not 0, there is a reported error.
In current implementation, the total length is only valid only when
the frame is the first block of the SDP response. For following
continuous frame, the total length is 0.
So, change the condition to `(total != 0 && frame_len > total)`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Rename this driver to eth_native_tap, including renaming all its
options.
The old options remain until v4.4, but as deprecated.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The CONFIG_POSIX_C_LIB_EXT will get support for fnmatch() function.
The old CONFIG_FNMATCH is deprecated.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Update Kconfig to not select BT_TICKER_REMAINDER_SUPPORT for nrf54L
Add BSim tests to cover using a ticker without BT_TICKER_REMAINDER_SUPPORT
and expire info enabled
Signed-off-by: Troels Nilsson <trnn@demant.com>
A few things were not flagged by CONFIG_BT_TICKER_REMAINDER_SUPPORT
that should have been; This caused building without it to fail
Initialize remainder to 0 where used with ticker_next_slot_get_ext(),
since it may not get set if remainder support is off
Signed-off-by: Troels Nilsson <trnn@demant.com>
When we receive piggybacked Ack, it means that we have
received all information for this request.
There is no need to track exchange lifetime anymore.
Once we reset the internal request, it is free to be used
for the application. So if we only have few requests allocated,
it would be slow to send those as get_free_request() only
gives request structures that don't have a lifetime left.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
As to facilitate work items preemption, common for sensor read ops.
e.g:
- Sensor read (submitted through workqueue).
- SPI read (submitted through workqueue using default handler).
This requires at least 2 thread pools to allow SPI read to complete,
to then come back and complete sensor reading.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
In `db_hash_setup()` the state object for MAC operations was initialized
using `psa_mac_operation_init()`. This function was not always optimized
or inlined.
A way to reduce stack usage is to use `memset()` and set the object to
0. This is one of the option documented to initialize
`psa_mac_operation_t` object.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
- Add possibility to choose implementation of OpenThread L2 and
set it to Zephyr's by default
- Remove unused `OPENTHREAD_SECURITY_INTERNAL` Kconfig
- Add missing choice names for logging and coprocessor
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
Use the newly added timeout in various send functions from within
net_context_sendto.
Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
Allows to send with different timeouts to not block caller in some
situations. Stable API is kept and just calls `try`-variant with a timeout
of `K_FOREVER`.
Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
Use the recently added bt_le_get_local_features function as well
as bt_conn_get_remote_info to avoid using internal APIs to
check for PAST supported.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>