Instead of incrementing and decrementing global counter,
just recompute the ready-count from scratch every time
conn_mgr_mon_handle_update is called.
This will simplify the introduction of additional ready count types.
This should have no externally observable impact on the behavior of
conn_mgr.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
In case of ACD Probe/Announcement, all we need is to generate ARP
packet, we don't really want any cache entries to be created or searched
for. There was a bug, that a cache entry was created for the
Announcement sent, resulting in skipped ARP packet generation and
malformed packet being sent by the ACD module.
Therefore, simplify all this, by simply returning early in case of
conflict detection packets.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The autoconf module can now reuse generic address conflict detection,
which was added for all address types.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case a conflict was detected on a DHCP-assigned address, send a
Decline message to the server and start over.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case IPv4 conflict detection is enabled, monitor network events to
determine whether IPv4 address is ready to use or not, so that the
library returns only after the network setup is fully complete.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Connection manager needs to monitor ACD events as well to determine
whether a preferred IPv4 address is available.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for IPv4 conflict detection, as specified in RFC 5227.
The new feature is optional and disabled by default.
Address conflict detection was implemented as a part of the IPv4
autoconf feature can be generalized to be available for all address
types.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The VDED was adding the channel information per clone. But it could be
done in the original buffer. This commit fixes that by adding the
channel information to the original buffer and not for each clone. As a
result, we have a more straightforward VDED execution with fewer copies.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Add a symbol to enable device power state constraints this
saves resources when this feature is not needed.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Declare power state constraints for a device in devicetree.
It allows a map between device instances and power states that disable
their power. This information is used by a new API
(pm_policy_device_power_lock_put/get) that automically set/release
pm state constraints.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Make call to de-initialize disk in fatfs_unmount(). This will permit the
disk to be reinitialized when it is mounted with fatfs_mount().
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add DISK_IOCTL_CTRL_DEINIT ioctl command to disk subsystem. When
disk_access_ioctl() is called with this command, the disk will be
de-initialized. After this IOCTL completes, the disk can safely be
reinitialized.
Fixes#60628
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add DISK_IOCTL_CTRL_INIT IOCTL to initialize a disk. This IOCTL is
intended to replace disk_access_init() for new applications, but
disk_access_init() is kept for legacy compatibility. The INIT IOCTL is
added to better match the path that will be used for disk
de-initialization. Like the disk_access_init() calls,
DISK_IOCTL_CTRL_INIT calls are reference counted
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Reference count initialization calls for disks. This changes the
behavior of the disk_access_init() function, such that disks will no
longer be initialized again if the first disk access init call
succeeds.
Disk access is reference counted in preparation for supporting disk
de-initialization, where a balanced number of disk de-initialization
calls with disk initialization calls will de-initialize the disk.
Also, remove code in disk drivers that was already checking against
duplicate disk_access_init() calls.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit moves ELF loading and linking code to separate files. This
is done to make the code more manageable and to make it easier to add
new features in the future.
No functional changes are introduced by this commit, except for a few
static functions now made public to allow this file split to occur.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Move all memory management code to a separate file, llext_mem.c, to
allow for better separation of concerns and to make the code more
readable.
No functional changes are introduced by this commit.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This patch moves the initial checks performed on the ELF file, that were
split between llext_load() and do_llext_load(), to the newly defined
llext_load_elf_data() function.
This way:
- only one function deals with ELF internal data checks;
- do_llext_load() is reduced to a list of tasks;
- llext_load() only focuses on the extension management.
One totally misplaced line initializing the number of symbols has been
moved to llext_count_export_syms().
No functional change except that the `struct llext` allocation may be
performed unnecessarily if the ELF file is not valid.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add llext_alloc(), llext_aligned_alloc() and llext_free() wrapper
functions to manage memory allocation and deallocation from the llext
heap. Also add a helper to free all memory regions allocated by an
extension.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Use the compatible kconfig option so that for the simulated
nRF54L15 we build the same code as for the real platform.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
For the Nordic HW, the BT_CTLR_DATA_LEN_UPDATE_SUPPORT
does not require CCM HW enabled, hence support Data Length
Update if Encryption Support is disabled.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In some nRF54 devices, DATAWHITEIV was renamed to
DATAWHITE,
and the CRCCNF SKIADDR field was renamed OFFSET.
The nrf HAL hid this change internally,
so let's use it so we don't need to ifdef these
in the Bluetooth Controller HAL code.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add preliminary support for nRF54L15 SoC. This commit does
not support Controller Random Number Generation and
Controller Cryptography (AES-128 encryption) commands, nor
does it support encrypted connections.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use NRF_RTC and NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk instead
to prepare towards using configurable use of RTC and Radio
hardware defines.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add unit tests to cover explicit LLCP error code check and
cover the same in the Controller implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
A Host shall consider any error code that it does not
explicitly understand equivalent to the error code
Unspecified Error (0x1F).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce BT_CTLR_CRYPTO_SUPPORT so that preliminary port to
support nRF54L15 SoC can be upstreamed without encryption
support.
ENTROPY_GENERATOR now selected when BT_CTLR_CRYPTO enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When CP has a secure channel active, it should never receive a
REPLY_CCRYPT or REPLY_RMAC_I. Since these responses change the SC state,
let's also make sure that they are accepted only when they are
expected: in response to commands CMD_CHLNG and CMD_SCRYPT respectively.
Reported-by: Eran Jacob <eran.jacob@otorio.com>
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
This commit adds host support for the Path Loss Monitoring
feature see Bluetooth Core specification, Version 5.4,
Vol 6, Part B, Section 4.6.32.
Limited logic is required, just adding a wrapper around the
HCI command and callback for HCI event.
Add new zone - BT_CONN_LE_PATH_LOSS_ZONE_UNAVAILABLE, to
convert 0xFF path loss to a useful zone.
Add new Kconfigs and functionality to the bt shell.
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
The existing code in the cap_stream.c that handled the
check before calling CAP initiator unicast functions
seemingly did not work for x86 targets such as native_sim
or native_posix.
Modified the check so that IS_ENABLED is used directly.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Introduced temporary variables `buf0_xor` and `buf1_xor` to store
XOR results and added an explicit cast to `uint16_t` for
the `*len` variable.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Correct the boundary condition in `fcb_put_len` function to
properly include `FCB_MAX_LEN` and change the #define to address
the potential flaw where `CHAR_MAX` might be treated as unsigned by
the compiler flag `-funsigned-char`, which would yield `FCB_MAX_LEN`
to 0x7fff instead of 0x3fff.
Fixes#73868
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
The assert was verifying that the current sensor address was greater
or equal than the start of the iterable section - 1 which isn't quite
right as the start is inclusive.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Moves the rtio_ prefixed lockfree queues to sys alongside existing
mpsc/spsc pbuf, ringbuf, and similar queue-like data structures.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Previously the schedule_next_timeout() function was feeding the hardware
watchdog irrespective of whether or not it was started. This is now
fixed.
Signed-off-by: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no>
The simulated targets support the same power levels as the
real targets. Let's correct the kconfig dependencies
accordingly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
When we receive CoAP packets, it is in input buffer
that is size of NET_IPV6_MTU.
So in reality, we can handle bigger Block-Wise writes
than CONFIG_LWM2M_COAP_BLOCK_SIZE.
So if parsing of CoAP packet has passed, continue
with the same block-size instead of going to default.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
PM_DEVICE is not attached to system managed device power management.
It is a very common use case targets with device runtime power
management that don't want system device power management enabled.
We introduce a new symbol (PM_DEVICE_SYSTEM_MANAGED) to explicit
control whether or not system device power management should be
globally enabled.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Remove device pm path when there is no is no power state in DT with
device pm enabled. This basically does the same thing that was done
by PM_DEVICE_RUNTIME_EXCLUSIVE.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Make it possible to disble device power management individually per
power state. This allows targets tuning which states should
(and which should not) trigger device power management.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
That is option has shown confusing on it is attempt to prevent
system pm doing device power management. Lets address this
problem properly.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Until recently, the posix api was purely a consumer of the
network subsystem. However, a dependency cycle was added as
a stop-gap solution for challenges with the native platform.
Specifically,
1. eventfd symbols conflict with those of the host
2. eventfd was excluded from native libc builds via cmake
If any part of the posix were then to select the network
subsystem (which is a legitimate use case, given that networking
is a part of the posix api), we would get a build error due to
the Kconfig dependency cycle.
As usual, with dependency cycles, the cycle can be broken
via a third, mutual dependency.
What is the third mutual dependency? Naturally, it is ZVFS
which was planned some time ago. ZVFS will be where we
collect file-descriptor and FILE-pointer APIs so that we can
ensure consistency for Zephyr users.
This change deprecates EVENTFD_MAX in favour of
ZVFS_EVENTFD_MAX.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The functions fnmatch(), getopt(), getentropy()
and others are grouped into the standard Option Group
POSIX_C_LIB_EXT.
The getentropy() function is currently in-draft for
Issue 8 as of 2021.
https://www.opengroup.org/austin/docs/austin_1110.pdf
Not surprisingly, the POSIX_C_LIB_EXT Option Group
also includes the highly debated strnlen() function.
Moving that function will be deferred until later.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The POSIX_MAX_FDS option does not correspond to any standard
POSIX option. It was used to define the size of the file
descriptor table, which is by no means exclusively used by
POSIX (also net, fs, ...).
POSIX_MAX_FDS is being deprecated in order to ensure that
Zephyr's POSIX Kconfig variables correspond to those defined in
the specification, as of IEEE 1003.1-2017. Namely,
POSIX_OPEN_MAX. CONFIG_POSIX_MAX_OPEN_FILES is being deprecated
for the same reason.
To mitigate any possible layering violations, that option is
not user selectable. It tracks the newly added
CONFIG_ZVFS_OPEN_MAX option, which is native to Zephyr.
With this deprecation, we introduce the following Kconfig
options that map directly to standard POSIX Option Groups by
simply removing "CONFIG_":
* CONFIG_POSIX_DEVICE_IO
Similarly, with this deprecation, we introduce the following
Kconfig options that map directly to standard POSIX Options by
simply removing "CONFIG":
* CONFIG_POSIX_OPEN_MAX
In order to maintain parity with the current feature set, we
introduce the following Kconfig options.
* CONFIG_POSIX_DEVICE_IO_ALIAS_CLOSE
* CONFIG_POSIX_DEVICE_IO_ALIAS_OPEN
* CONFIG_POSIX_DEVICE_IO_ALIAS_READ
* CONFIG_POSIX_DEVICE_IO_ALIAS_WRITE
Gate open(), close(), read(), and write() via the
CONFIG_POSIX_DEVICE_IO Kconfig option and move
implementations into device_io.c, to be conformant with the
spec.
Lastly, stage function names for upcoming ZVFS work, to be
completed as part of the LTSv3 Roadmap (e.g. zvfs_open(), ..).
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The POSIX_CLOCK option does not correspond to any standard
option. It was used to active features of several distinct
POSIX Options and Option Groups, which complicated API and
application configuration as a result.
POSIX_CLOCK is being deprecated in order to ensure that Zephyr's
POSIX Kconfig variables correspond to those defined in the
specification, as of IEEE 1003.1-2017.
Additionally, CONFIG_TIMER is being deprecated because it does
not match the corresponding POSIX Option (_POSIX_TIMERS).
With this deprecation, we introduce the following Kconfig
options that map directly to standard POSIX Option Groups by
simply removing "CONFIG_":
* CONFIG_POSIX_TIMERS
Similarly, we introduce the following Kconfig options that
map directly to standard POSIX Options by simply removing
"CONFIG":
* CONFIG_POSIX_CLOCK_SELECTION
* CONFIG_POSIX_CPUTIME
* CONFIG_POSIX_DELAYTIMER_MAX
* CONFIG_POSIX_MONOTONIC_CLOCK
* CONFIG_POSIX_TIMEOUTS
* CONFIG_POSIX_TIMER_MAX
In order to maintain parity with the current feature set, we
introduce the following Kconfig options that map directly to
standard POSIX Option Groups by simply removing "CONFIG_":
* CONFIG_POSIX_MULTI_PROCESS - sleep()
Similarly, in order to maintain parity with the current feature
set, we introduce the following additional Kconfig options that
map directly to standard POSIX Options by simply removing
"CONFIG":
* CONFIG_XSI_SINGLE_PROCESS - gettimeofday()
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Make `struct arch_esf` compulsory for all architectures by
declaring it in the `arch_interface.h` header.
After this commit, the named struct `z_arch_esf_t` is only used
internally to generate offsets, and is slated to be removed
from the `arch_interface.h` header in the future.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Fixes issue where PB GATT Server will drop
advertising device name if optional provisioning
URI is not provided.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
The control and data settings are set improperly for packet filter
operation for sniffer operation. The change sets them properly.
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
Adds, removes and modifies includes in all LE audio
files.
Fixes any found spelling mistakes as well.
Fixes a few places where incorrect types were used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This patch changes the way sections are mapped to memories. Instead of
looking at the section name, each section in the ELF file is mapped to
the llext_mem enum by looking at the section type and flags.
This allows for a more generic mapping that works for both the ARM and
Xtensa cases, and also allows for sections to be merged if they are
contiguous and non-overlapping in the ELF file.
This patch also fixes a number of corner cases, such as in the logging
test where a section with read-only data was being ignored (not copied
and not relinked).
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
The invocation of flash_area_erase, in boot_erase_img_bank,
has been replaced by flash_area_flatten.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit replaces flash_area_erase with flash_area_flatten.
The function is used in to places:
1) in image management commands IMG_MGMT_ID_UPLOAD
and IMG_MGMT_ID_ERASE: to erase an image in secondary slot
or to scramble trailer part of image, which could be misunderstood
by MCUboot as valid image operation request;
2) in command ZEPHYR_MGMT_GRP_BASIC_CMD_ERASE_STORAGE to
erase/scramble data partition.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The NVS currently requires explict erase capability of
a device to work, so usage of flash_erase has been replaced
with flash_flatten.
There has been additional LOG_WRN added to warn user that
NVS may not efficiently work with device that do not really
have erase.
Currently NVS relies on devices that require erase.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
LittleFS is based on program-erase devices and require that
characteristics to work; the commit replaces flash_area_erase
with flash_area_flatten to allow LFS work on devices that
do not provide erase callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Replace usage of flash_area_erase with flash_area_flatten to
allow code to work with devices that do not provide erase
callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Replace flash_area_erase with flash_area_flatten to allow FCB
Settings backend to work on devices that do not provide erase
callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The flash_area_erase has been replaced with flash_area_flatten,
allowing code to work with devices that do not provide
erase callback.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Add equivalent of flash_erase, from Flash API, to Flash Map API;
idea is the same: function tries to erase area if driver provides
erase function, otherwise writes erase_value across the defined
area.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
After the get_report() callback, we need to determine how many bytes the
HID device wrote to the report buffer. Use the callback return value to
do this, and modify the net_buf data length value if get_report was
successful.
Reported-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
APIs for enabling and disabling the scanner may take larger time than
expected and scheduling of the lpn state machine is affected by it.
Since these type of latencies are factored into timeouts and scheduling
times, we need to call scan enable/disable APIs after scheduling the
next event time for LPN state machine to be more accurate.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
The `Remote wakeup feature not enabled or not suspended` log is not
related to an actual error (connected host might not enable USB remote
wakeup feature). Use warning log level.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
PR #72475 disabled default enabling of many Mbed TLS features
including AES. This means that now it must be explicitly added
when required.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit introduces support for an alternate linking method in the
LLEXT subsystem, called "SLID" (short for Symbol Link Identifier),
enabled by the CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID Kconfig option.
SLID-based linking uses a unique identifier (integer) to identify
exported symbols, instead of using the symbol name as done currently.
This approach provides several benefits:
* linking is faster because the comparison operation to determine
whether we found the correct symbol in the export table is now an
integer compare, instead of a string compare
* binary size is reduced as symbol names can be dropped from the binary
* confidentiality is improved as a side-effect, as symbol names are no
longer present in the binary
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
Removes the CIS connection establishment from bt_bap_stream_start
and move the behavior to a new funciton bt_bap_stream_connect.
This has 2 advantages:
1) The behavior of bt_bap_stream_start is much more clear and more aligned
with the spec's behavior for the receiver start ready opcode.
2) It is possible to connect streams in both the enabling
and the QoS configured state with bt_bap_stream_connect as
per the spec. This allows us to pass additional PTS test cases.
To implement this new behavior, samples and tests have been updated.
The CAP Initiator implementation has also been updated
to accomodate for the change in BAP, but the CAP
initiator implementation should work the same for application, except
that it's now possible to do unicast start on ASEs in any order
(https://github.com/zephyrproject-rtos/zephyr/issues/72138).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When reading the error message:
"ASSERTION_FAIL: command opcode 0x0c03 timeout with err -11" it may not be
obvious what is wrong with their setup unless you are very familiar
with HCI.
This commit adds some more documentation to make this more obvious.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The chunked response was not sent properly. There were extra
"\r\n" before the chunk lenght and the length of the string
to be sent was calculated incorrectly.
Fixes#72887
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Explicitly initialize bNumDeviceCaps to 0 because the bos descriptor is
stored on stack.
Fixes: b0d7d70834 ("usb: device_next: add initial BOS support")
Coverity-CID: 368798
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When calculating the offset for blockwise writes,
we should not advance the block_ctx->current field
past the block boundary.
It causes CoAP layer to reply with the next NUM field
instead of the current one being processed.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The ring buffer API is explicitly not thread safe, with users needing to
implement their own locking. As `poll_out` and `fifo_fill` are operating
on the same ringbuffer, these locks are needed.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Removes the requirement that CAS is found on the remove
device for ad-hoc sets. This makes the CAP API more
versatile as it allows applications to use it with
remote non-CAP devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the dependencies of `CONFIG_EXCEPTION_STACK_TRACE`:
- Architecture-specific Kconfig, i.e.
`X86_EXCEPTION_STACK_TRACE`, will be enabled automatically
when all the dependencies are met.
- `EXCEPTION_STACK_TRACE` depends on architecture-specific
Kconfig to be enabled.
- The stack trace implementations should be compiled only if
user enables `CONFIG_EXCEPTION_STACK_TRACE`.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
The `DEBUG_INFO` in the `EXCEPTION_STACK_TRACE` is only
required by x86. Move that to `X86_EXCEPTION_STACK_TRACE`
instead.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
The `PRINTK` was required for `EXCEPTION_STACK_TRACE` because
it's initial implementation for x86 in #6653 uses `printk()`.
We are using `LOG_ERR()` now, so this is not required anymore.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
PR #72475 disabled default enabling of most Mbed TLS features.
This means that:
- CONFIG_MBEDTLS_CIPHER_AES_ENABLED needs to be manually enabled
when required;
- CONFIG_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC does not need to
be (almost) always added because there is no default RSA
key-exchange enabled, so PSA can be built without RSA support.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Instead of printing either A or AAAA resource query type,
print the correct query type value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Do not depend on init level but start the socket service
already in net core init because DNS init code depends on
socket service API to be ready to serve. And we call DNS
init at the net core init.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow mDNS resolver and responder to to be used at the same
time so that both can use the port 5353. This requires
a DNS traffic dispatcher which affects also the normal DNS
resolver.
Fixes#72553
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The function is useful for application to lookup set
members from bt_conn pointers, e.g. when iterating on
connected devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Supplicant create AF_PACKET proto ETH_P_PAE socket but receive other
frames like ICMP, UDP and causes following issues.
1. When frame len exceeds MTU, net_pkt_clone cannot clone pkt.
Thus dropped it and print warning log.
2. It will lower throughput performance as every packet is cloned.
Fix it by conn_raw_socket does not deliver pkts protocol not macted,
after l2 processed, unless conn is all packets.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
In the current implementation, the LLEXT linker will only apply
relocations targeting a given symbol if it has a specfic symbol type.
This is overzealous and causes issues on some platforms, as some symbols
that need to be relocated are skipped due to being of a "bad" type.
Ignore the symbol type when performing relocation to solve this problem,
but also add checks to ensure we don't attempt to relocate symbols with
an invalid section index. If such a relocation is found, return an error
instead of ignoring the relocation entry to ensure that it is impossible
to execute code from a (partially) unrelocated LLEXT.
Also remove all hacks added to circumvent this issue:
* qemu_cortex_r5 exclusion from test cases
* unnecessary exclusion of some flags when building with LLEXT EDK
Fixes#72832.
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
In an effort to shave off code size, remove out-of-the-box
enabling of crypto features (except SHA-256).
Configurations are adjusted to enable what they need.
Bonuses:
- When enabled, AES now defaults to using a smaller version
(`CONFIG_MBEDTLS_AES_ROM_TABLES` isn't default enabled anymore,
and if enabled, `CONFIG_MBEDTLS_AES_FEWER_TABLES` defaults to y).
- Conditions around Mbed TLS Kconfig options have been improved
to reflect the reality of the dependencies.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Some IPv4/IPv6 functions were ifdef-sliced internally, despite being
compiled in conditionally in top-level #ifdef block under the same
condition.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In some cases the comment after #endif did not match the opening #if, in
some cases it was missing.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Allow user to specify resource string using wildcard characters
so that multiple URL paths can be served with just one handler.
Fixes#73367
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Currently calls to these two functions fail unnecessarily when
CONFIG_BT_SMP is disabled. This fix allows identity resets
without having the BT_SMP stack enabled. The primary use case
is enabling random mac address rotation for privacy in memory
constrained SOCs. Fixes#73313
Signed-off-by: Patrick Patel <ppatel@micro-design.com>
Fix missing validation of Connection Update Ind PDU. Ignore
invalid connection update parameters and force a silent
local connection termination.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add a new shell backend implemented over a shared memory window
on the Intel audio DSPs. The implementation uses the Zephyr winstream
to manage the data streaming.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit has added new flag FS_O_TRUNC to support truncation
during file open. Modified fs_open to handle truncation based on
provided flags. Included unit tests for flag behavior with common
filesystems.
Signed-off-by: RAJAGOPALAN GANGADHARAN <g.raju2000@gmail.com>
Employs the same linkonce magic of sw_isr_table to fix the
multiple definition of the symtab variables issue that I
get in my application build that doesn't use `west`.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
`start_addr` is the address of the first symbol, rename it to
`first_addr` instead as it seems more intuitive and relatable
to the comments.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
The `symtab_find_symbol_name()` is using an adapted binary
search function to get the entry between 2 addresses, we need
to add a dummy entry at the end so that the search function
can remain simple and straightforward without doing
out-of-bound checks:
20 \
|
|
50 x
|
|
90 x
. |
. |
. |
dummy /
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Use an existing variable instead of re-calculating and fix swapped
space and a paranthesis.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When building partially linked / relocatable objects no ELF segments
are created and it becomes more difficult to predict which sections
the compiler will build and use. In this case a .data.rel.local
section is created by the compiler and it is needed to link .rodata
strings in a twister test. We can handle arbitrary sections at run-
time if .peek() is supported. If it isn't we need to allocate and
copy the section. For now we simply error out in such cases. Fixing
that would represent a larger change and can be done incrementally.
This also fixes the relocation calculation to point to the correct
symbol address instead of the memory location, where it's currently
residing, because that can be a temporary buffer as is the case with
SOF.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The cap_initiator unicast_stop shell command had the wrong
minimum parameter count (as it defaults to all).
Some indentation had also gone wrong for it in the
documentation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add option for setting a random MAC address to
the net iface set_mac command. With random option
a random MAC address can be assigned to an interface.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Rename the current sensor_read to sensor_read_async_pool and create a
new blocking sensor_read helper.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
The driver isn't currently buildable due to "west blobs" support never
having been added for hal_telink. Furthermore, even if the blob
dependency is manually made available it turns out the code has
bitrotten to the point where it doesn't build anymore. This situation
has continued for several years without anyone taking action, so I think
it's safe to assume this is unmaintained and should be removed.
Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
In order to be compatible with Linux AF_PACKET socket calls, the
protocol field needs to be in network byte order.
So for example, if user wants to receive all packets, then the
protocol field needs to be set as "htons(ETH_P_ALL)".
See Linux manual page at
https://www.man7.org/linux/man-pages/man7/packet.7.html
for details.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When tests control the LwM2M client entirely through
shell, we should be able to set the RD client context
from the application without causing RD client to
start registration.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
For default case it should print the option character provided by user.
Extra shell_help removed as it's being called in the caller function.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Support to set BSS parameter "max_num_sta" at compile and run time
Added support to configure `max_num_sta` BSS parameter.
Maximum number of stations allowed in station table. New stations will be
rejected after the station table is full.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Support for configuration of AP parameter "Skip inactivity poll".
Only build time setting is supported.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Support to set BSS parameter at compile and run time.
Added support to configure `max_inactivity` BSS parameter.
Station inactivity timeout is the period for which AP may keep a client
in associated state while there is no traffic from that particular client.
If a non-zero value is set, AP may choose to disassociate the
client after the timeout.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Return protocol error if bcdUSB is less than 0x0201. Fix typo in number
of capabilities.
Fixes: b0d7d70834 ("usb: device_next: add initial BOS support")
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Callbacks were a bit neglected in terms of test coverage, especially
when used in chains. It was clear from the code that chained callbacks
may not actually work, and callback ordering then was hard to verify.
Test callbacks chained to transactions work as expected.
The test iodev had built up some cruft over time and in the process
showed a few bugs once callback chaining was fixed so the test iodev now
better matches typical iodev implementations at this point.
Cancellation testing now includes an added case for cancelling a the
second submission in the chain prior to calling submit noting that no
completions notifications should be given back for those.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Remove the `_MAC` part because those Kconfig options enable only hash
algorithms, nothing MAC-related, and the `_ENABLED` part to align the
naming to the Mbed TLS defines (plus we don't need such a part).
As a bonus, enabling SHA-256 does not automatically enable SHA-224
anymore.
See the migration guide entries for more details on the practical
changes.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The commit caches write_block_size and erase_value to stream flash
context, at init, to avoid calling Flash API multiple times
to get these values at various stages of code exectuion,
at run-time.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
When channel range is configured in scan params, get the
channel count from `chan_idx` instead of taking a difference
of start and end of the channel range. The `difference` method
fails in case of 5GHz band since channels may not be consecutive
numbers.
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
SD IOCTL handling for DISK_IOCTL_CTRL_SYNC was falling through to the
default return statement, and returning an error when disk sync
succeeded. Fix this issue by properly breaking in IOCTL handler.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.
Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.
Updated the includes path of in-tree sources accordingly.
Most of the changes here are scripted, check the PR for more
info.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Generating separate log entry at INFO level for every single character
dropped is excessive and leads to log flood. Logging dropped character
in no way helps end user and is really a delayed performance killer that
triggers when CDC ACM buffer gets full.
If user does not want to lose outgoing characters then the solution is
to enable hardware flow control which properly blocks in the case the
output buffer is full.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When opaque resources have post-write callback set, but
the write is not a Block-Wise write, there is no block_ctx
and the code causes null pointer dereference when calculating
the offset of the data.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Before this commit, the following bugs were present:
- When `CONFIG_BT_FILTER_ACCEPT_LIST` was set, connection establishment
was cancelled upon RPA timeout. This required the application
to restart the initiator every RPA timeout.
- When `CONFIG_BT_FILTER_ACCEPT_LIST` was not set, the RPA was not updated
while the initiator was running.
This commit unifies the RPA timeout handling for both these cases.
Upon RPA timeout the initiator is cancelled and restarted when
the controller raises the LE Connection Complete event.
The workqueue state is checked when restarting the initiator to prevent
it being restarted when the timeout is hit.
Corresponding test cases have been added to ensure that this
feature works.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Expectation: After calling `bt_disable()` it is possible to
use the Bluetooth APIs as if `bt_enable()` was never called.
This was not the case for `bt_id_create()`, it was not possible
to set the default identity. This prevented an application
developer to restart the stack as a different identity.
Keys also need to be cleared to avoid the following pattern:
1. Pair two devices
2. Central calls `bt_disable()` and `bt_enable()`.
The central will now generate a new identity address.
3. Connect the two devices.
4. Re-establish encryption. Now the central will try to use
the previously used keys. The procedure will fail
because the peripheral does not have any keys associated
with the new central address.
The API documentation is updated accordingly.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Rename write() to telnet_write(), and read() to telnet_read() so
that if we enable CONFIG_POSIX_API, the compiler will not complain
about those two functions as they conflict with POSIX API ones.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add checks to make sure that we are not trying to use the socket
service library with eventfd if CONFIG_POSIX_API is not set and if
using native_sim based board. The reason is that we should always
use zephyr libc based eventfd implementation instead of host libc one.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This reverts commit b56297bf16
because it is causing problems when using native_sim and not
having CONFIG_POSIX_API set.
The proper fix is to set CONFIG_POSIX_API when using eventfd
and native_sim so that picolibc is used instead of host libc.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
According to RFC3927 and RFC5227, an ARP probe target HW address should
be set to all-zeroes:
"The 'target hardware address' field is ignored and
SHOULD be set to all zeroes."
Hence, we should allow the ARP probes to have all-zeroes target HW
address as well.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
implement a2dp.c and avdtp.c
add a2dp related Kconfig:
BT_AVDTP_RTP_VERSION, BT_A2DP_SOURCE and BT_A2DP_SINK
a2dp_codec_sbc.c/h are used to provide some APIs to get
A2DP SBC codec information. (like: channel num).
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
The notify handle in the BAP broadcast assistant did not handle
conn == NULL properly, and neither did delayed_bap_read_handler.
Add better NULL checks, which also fixes a coverity issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Increasing the adv latency range to the minimum valid
ReceiveDelay value, 10ms. 4ms might be small for some
target systems.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
Add APIs for changing the contents of modem chat matches
safely at runtime.
This allows for reusing a single modem_chat_match at the cost
of placing the match and its buffers in RAM.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
In order to prevent index out of bounds access of the sh->ctx->cmd_buff
array when sh->ctx->cmd_buff_pos is 0, it has been added a check for the
value of sh->ctx->cmd_buff_pos.
This ensures that the array will not be accessed beyond its boundaries.
Signed-off-by: Jungo Lin <jungolin.tw@gmail.com>
If CDC ACM uart side has TX enabled when the configuration gets enabled,
depending on fifo state following has to happen:
* if the fifo is empty - trigger TX ready interrupt
* if the fifo is not empty - queue TX data on IN endpoint
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Commit 2f31ee63b5 ("usb: device_next: convert ASCII7 strings to
UTF16LE on the fly") made string descriptors respond with twice as much
of the actual string data.
Fix the issue by taking into account that USB string descriptor length
is already multiplied by two. Additionally, make it possible to return
odd number of bytes if host requested so.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
The socket allocation count was incorrectly calculated as
we have only one socket per listened port.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If DNS_EAI_ALLDONE is returned, it indicates that the request
was done and should not be considered an error.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
pm_system_resume() can be called directly from ISR and because of this
devices should be resumed before calling pm_state_exit_post_ops().
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
There is no need to this function be defined inside the kernel since
all places using it are protecting the call under ifdef PM guards.
This way we can also remove the ifdef condition inside the implementation.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This allows a customized coredump_backend_other API to re-use the
COREDUMP_*_STR without re-defining the same strings.
Signed-off-by: Younghyun Park <younghyunpark@google.com>
The BR Keys cannot be scanned by function
bt_foreach_bond.
Add function bt_foreach_bond_br for br.
The function bt_foreach_bond_br will be
called by bt_foreach_bond if the BR is
enabled.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Implement a function bt_audio_get_chan_count that takes an enum
bt_audio_location and returns the number of channels in that value.
This PR fixes#69617
(https://github.com/zephyrproject-rtos/zephyr/issues/69617)
Signed-off-by: Babak Arisian <bbaa@demant.com>
Get the preferred QoS settings via bt_bap_ep_get_info()
Therefore no need to use the internal header file to get it.
This PR fixes https://github.com/zephyrproject-rtos/zephyr/issues/72359
Signed-off-by: Ping Wang <pinw@demant.com>
In some relatively rare conditions, the DFU detach/attach happens to
fast, which cause the host to not notice it. It seems to to be the case
for instance on STM32 when no endpoint are being used.
Adding a 1 ms delay (i.e. one SOF period) between the detach and the
attach fixes the issue.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Allocate the GPIOTE channels that the Bluetooth Controller needs to use
with the dedicated function provided by the nrfx_gpiote driver instead
of using hard-coded indexes of these channels, as now, when the driver
supports multiple GPIOTE instances, it would be much more difficult to
properly inform the driver which channels should be reserved.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
The BIG handle for an ISO sync receiver is provided by the host. The
valid range is [0x00..0xEF], and this requires the controller to allow
non-consecutive handle numbering. This means that even if only one sync
set is supported, a BIG handle of ex. value 2 must be supported.
As the code uses indexing and range checking directly by handle, this
needs to be changed. Introducing the handle index, which sequnces the
handles such that index = 0 is always the "first handle", regardless
of value.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Instead of selecting legacy MBEDTLS symbols, use corresponding
PSA_WANT ones when possible (note: some legacy symbols do not
have a PSA correspondance).
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Now that support for all PSA_WANT symbols is in place, we can
enable MBEDTLS_USE_PSA_CRYPTO when MBEDTLS_PSA_CRYPTO_C is
enabled as well.
Note: this commit also moves USE_PSA_CRYPTO out of CRYPTO_C
dependency in config-tls-generic.h because TLS/DTLS/X509 modules
of MbedTLS can rely on *any* implementation of PSA crypto APIs
not only the MbedTLS one. TFM is for example an alternative
to this.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Current on x86 & risc-v that implement stack trace, the
maximum depth of the stack trace is defined by a macro.
Introduce a new Kconfig:EXCEPTION_STACK_TRACE_MAX_FRAMES
so that this is configurable in software.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Selecting `CONFIG_EXCEPTION_STACK_TRACE_SYMTAB` will
enable the symtab generation which will be used in the
stack trace to print the function name of the return
address.
Updated the `stack_unwind` test to test the symbols in a
stack trace.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Use pyelftools to extract the symbol table from the
link stage executable. Then, filter out the function names
and sort them based on their offsets before writing into the
`symtab.c`, this is similar to how the `isr_tables` works.
To access the structure, simply include the new header:
```c
#include <zephyr/debug/symtab.h>
```
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is to fix a warning which is reported in Coverity scan
after device runtime pm is enabled.
Signed-off-by: Roger Wang <roger1.wang@intel.com>
When the interface goes down, the safest thing to do is to return to
the INIT state, as there is no guarantee that any state is preserved
upon the interface coming back up again.
This is particularly the case with WiFi.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Support for using Link Time Optimization (LTO) when
building application with open source Bluetooth Low
Energy Controller. This reduces code space usage.
Current Memory Usage at the time of this PR (hci_ipc):
BT_CTLR_OPTIMIZE_FOR_SPEED:
Memory region Used Size Region Size %age Used
FLASH: 260112 B 256 KB 99.22%
RAM: 60136 B 64 KB 91.76%
SRAM1: 0 B 64 KB 0.00%
IDT_LIST: 0 B 32 KB 0.00%
BT_CTLR_OPTIMIZE_FOR_SIZE:
Memory region Used Size Region Size %age Used
FLASH: 232292 B 256 KB 88.61%
RAM: 60128 B 64 KB 91.75%
SRAM1: 0 B 64 KB 0.00%
IDT_LIST: 0 B 32 KB 0.00%
BT_CTLR_OPTIMIZE_FOR_APP_DEFAULT:
Memory region Used Size Region Size %age Used
FLASH: 232292 B 256 KB 88.61%
RAM: 60128 B 64 KB 91.75%
SRAM1: 0 B 64 KB 0.00%
IDT_LIST: 0 B 32 KB 0.00%
BT_CTLR_LTO:
Memory region Used Size Region Size %age Used
FLASH: 221484 B 256 KB 84.49%
RAM: 60120 B 64 KB 91.74%
SRAM1: 0 B 64 KB 0.00%
IDT_LIST: 0 B 32 KB 0.00%
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove legacy LL optimize for speed dependency required to
support encryption feature in Controller where crypto was
performed in highest priority ISRs to setup encryption in 3
radio events (this now requires 5 radio events in split LL).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
There's such a case captured. When log immediate mode is enabled, each log
message is output per character. However, "log_output_flush()" function is
still called with zero data length at the end of "log_output_process()".
Better to make "buffer_write()" returns immediatley if buffer data
length is zero.
Signed-off-by: Dong Wang <dong.d.wang@intel.com>
If time aware system has more than 1 gptp port, because there is only
one boolean to handle callback registering, a race condition can occur
for instance in case 2 master ports are waiting for a timestamp following
sending of sync message. More in details, callback may be unregistered
by port 1 while port 2 is waiting for timestamp event.
The issue is solved by declaring as much as boolean and struct
net_if_timestamp_cb as the number of declared ports
(=CONFIG_NET_GPTP_NUM_PORTS).
Signed-off-by: Jean-Nicolas Graux <jean-nicolas.graux@st.com>
Setting a ration of 0 breaks the computation of scaled_rate_offset
in gptp_md_follow_up_prepare().
According to IEEE802.1AS 10.2.2.3.9, when sent by clock master
entity, rate_ratio shall be equal to gmRateRatio. But since
in gptp_md_follow_up_prepare(), in case we are the grand master
clock, we take the assumption that clock source is the local clock,
we may set this ratio to 1.0.
Signed-off-by: Jean-Nicolas Graux <jean-nicolas.graux@st.com>
Without this patch, in case time aware system is grand master capable
but is not the grand master clock and behave as a bridge so that it
shall ONLY relay SYNC and FUP messages from slave port to master port(s),
SYNC and FUP are mistakenly generated by ClockMasterSyncSend state
machine.
This patch only call ClockMasterSyncSend state machine in case a Grand
Master clock is present and is this time aware system.
This check is not described by IEEE802.1AS. Instead, according to
10.2.9.3, the SiteSyncSync state machine shall not take into account
information from ClockMasterSyncSend in case this time aware system is
not grand-master capable. Current implementation of ClockMasterSyncSend
state machine sends sync indication to the PortSync entities, instead of
sending it to the SiteSyncSync entity. And the SiteSyncSync state machine
does not make any check.
Signed-off-by: Jean-Nicolas Graux <jean-nicolas.graux@st.com>
Commit 413eceeddb ("net: gptp: fix follow_up message correction_field")
breaks computation of follow up correction field in case time aware system
is not the grand master clock but behave as a transparent clock which relay
sync and follow-up messages from one slave port to one or several master
port(s). In this case, according to IEEE802.AS 11.1.3 and 11.2.14.2.3,
md sync send state machine shall compute the sum of link propagation delay
and residence time, expressed in grand master time base. Then this quantity
shall be added to last received fup correction field to build value of
correction field. This patch checks whether time aware system is the grand
master clock or not, and computes value correction field accordingly.
Signed-off-by: Jean-Nicolas Graux <jean-nicolas.graux@st.com>
An earlier pull request implementing observe support was merged too
hastily. It had a few issues:
1. The predicate for whether a request should be marked not ongoing was
wrong (it checked ret != 0 instead of ret < 0)
2. Without observes in mind, MID-based deduplication is not a required
feature. Deduplication was handled implicitly - the exchange would get
dropped after the first response anyway, so duplicate responses would
not get matched to anything. But with observes, there are several
responses in an exchange. This commit adds this.
3. Using coap_request_is_observe(&internal_req->request) in the response
handler requires the whole request to stay in scope for the lifetime of
the observation, which I observed was not always the case. Adding an
is_observe bool to the internal struct improved stability significantly.
With these fixes, GETs with observe option works very well.
Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
These are safety checks to guard against silent data corruption. The
implementation currently does not clobber bufs, but soon it will. The
bufs will be zero-copy segmented and fragmented, which involves
overwriting already-sent contents with headers for the next fragment.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Changes the parsing of boolean input parameter "PolicyApply"
to DFD start command to use shell boolean parse library.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Adds a missing network include file which was causing an undefined
function build failure, likely caused by a recent change affecting
includes in other header files
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add a new option to split off the building of the HCI layer of the
controller. This layer is not needed by the controller unit tests, and
becomes problematic with the planned change to use devicetree for HCI
drivers.
Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
Add statistics module which tracks the usage of modem backend
transmit/receive buffers if implemented by a backend.
A modem backend may register itself to the modem backend
stat module, and advertise its transmit and receive buffer
sizes and momentary usage (length).
The modem backend module tracks the maximum usage, which can be
output to the shell using the "modem_stats buffer" shell command.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Changes the log level from ERR to DBG for element_model_recv for the
following cases:
- Element does not have the appkey for incoming message.
- Element does not have destination address for incoming meesage.
When the received message is for a group address, element_model_recv
is called for all elements on the device. One or more elements may contain
a model that is subscribing to this address. If more than one element
contains the same model. but they do not all share the same application
key as the incoming message is encrypted with, or they do not all
subscribe to the same group address, then the log will show error
message for these elements, which is misleading.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Filtering out received packets which source address matches one of our
own addresses has broken the duplicate address detection conflict
reporting.
In case Neighbor Advertisement is sent during DAD collision, the source
address of such packet might be set to the address that triggered the
collision. This address would also be set on our interface, marked as
tentative. Therefore in order to make duplicate address detection work,
we cannot filter out packets in case our own address is still in
tentative state.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
A support for RDNSS option should not force DNS subsystem being enabled
in the system, especially that the option is enabled by default. It
should work the other way around - the option is supported only if DNS
was enabled by the user.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Because of include file changes, we now need to include both
hostname.h and net_if.h in the syslog logging module directly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
With native_sim, this error is seen a lot when socket
service API is used.
<dbg> net_sock: get_sock_vtable: (net_socket_service):
Invalid access on sock 3 by thread 0x807a8e0 (net_socket_service)
If we just ignore the error, then we might get into forever
loop which is not good. So if this happens, mark the eventfd
fd as not pollable to basically ignore the eventfd support in
this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print also thread name when printing socket access error.
This helps debugging what thread caused it.
Lowering the Error to Debug as we could be missing vtable
for example for eventfd descriptors, this is easily seen when using
socket service API.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of using net_context API directly, the LLMNR responder is
changed to use the socket service API. This allows DNS access
for offloaded sockets and can lower overall memory consumption.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of using net_context API directly, the mDNS responder is
changed to use the socket service API. This allows DNS access
for offloaded sockets and can lower overall memory consumption.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of using net_context API directly, the DNS resolver is
changed to use the socket service API. This allows DNS access
for offloaded sockets and can lower overall memory consumption.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Ensure that in LLCP reference to node_rx is cleared when
retention is NOT used, to avoid corruption of node_rx later
re-allocated
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
In case a CPR is intiated but rejected due to CPR active on
other connection, rx nodes are leaked due to retained node not
being properly released.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
The ISO API and implementation have existed in Zephyr
for several years, and while not fully qualified, stable
or tested yet, it's not experimental anymore (and have
not been for a long time).
This commit removes any references to it being experimental
and instead defines it as unstable by setting the version to
> 0.1.0. 0.8.0 is being used as the initial version, as that
is what other unstable modules was defined to have as their
initial version if they were not stable (>= 1.0.0).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If bt_conn_set_state(conn, BT_CONN_DISCONNECTED) is called
while the connection is already disconnected, this triggers
a warning. This is likely to happen when bt_conn_cleanup_all
is called as part of bt_disable.
Added the state check to avoid unnecessary warnings in the log.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for bt_disable in the ISO implementation.
This involves clearing all information related to states
in the controller, such as the BIGs and CIGs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since the CSIP API expects a set member struct for nearly all
functionality, the reference to the full set member (along with
the CAS specific CSIS) should be given to the application.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The input address originates from an RX net_buf which may
be unaligned. Consequently, word access to this unaligned buffer
can trigger an unaligned access exception on certain platforms,
such as the ARMv7 Cortex-A9.
Signed-off-by: Taras Zaporozhets <zaporozhets.taras@gmail.com>
Use the same scheme as for string descriptors. Descriptors can be added
or removed using the existend interface.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
We could reuse the BOS header, but there are parts that are only needed
in the legacy device support or used internally and the tests. Move this
parts to the appropriate places.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
It simplifies the macros to create the string descriptors. We also no
longer need placeholders for the SerialNumber descriptor when it is
generated from hwid. In the future, we can store other descriptor types
in the same list.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Do not use application-provided placeholder buffers. Generate
SerialNumber just before ASCII string is converted to UTF16LE. Make
dependency on HWINFO optional, but enabled by default.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Move and rework string descriptor data to a separate structure so we can
share memory with another type. Also add description to the
USBD_DESC_STRING_DEFINE macro.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This is slower but should have no real effect. In the future we can
support more than ASCII7 format and store it in other memory areas.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add function to get string descriptor index and function
to remove linked descriptor from a device. This abstracts
it a bit so that the user does not need to know how it is
handled internally.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
A new Kconfig option which generates syscall stubs assuming that
extensions will always run on userspace, thus simplifying linking
them, as there's no need for z_impl_ stubs (used for direct syscalls),
CONFIG_LLEXT_EDK_USERSPACE_ONLY.
While defining __ZEPHYR_USER__ could have the same effect for optmised
builds, people building extensions on debug environments - thus
non-optimised - would suffer, as they'd need to somehow make the stubs
available (by either exporting the symbol or implementing dummy stubs).
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Loadable extensions need access to Zephyr (and Zephyr application)
includes and some CFLAGS to be properly built. This patch adds a new
target, `llext-edk`, which generates a tar file with those includes and
flags that can be loaded from cmake and make files.
A Zephyr application willing to expose some API to extensions it loads
only need to add the include directories describing such APIs to the
Zephyr ones via zephyr_include_directories() CMake call.
A new Kconfig option, CONFIG_LLEXT_EDK_NAME allows one to control some
aspects of the generated file, which enables some customization - think
of an application called ACME, willing to have a ACME_EXTENSION_KIT or
something.
All EDK Kconfig options are behind CONFIG_LLEXT_EDK, which doesn't
depend on LLEXT directly - so that EDK features can be leveraged by
downstream variations of loadable extensions.
Also, each arch may need different compiler flags for extensions: those
are handled by the `LLEXT_CFLAGS` cmake flag. An example is set for GCC
ARM.
Finally, EDK throughout this patch means Extension Development Kit,
which is a bad name, but at least doesn't conflict with SDK.
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
s2ram procedure used RAM magic word for marking suspend-to-RAM. This
method may not work in some cases, e.g. when global reset does not
reset RAM content. In that case resuming from s2ram is detected when
global reset occurred.
RAM magic word method is the default but with
CONFIG_PM_S2RAM_CUSTOM_MARKING a custom implementation can be provided.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit upgrades the LE audio API and implementation
from experimental to unstable.
LE Audio have existing for quite a few years in Zephyr
and is not going anywhere, but at the same time it still
has significant effort remaining before it can be
considered stable.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Improve coap_client_cancel_requests(). Ensure it can be
called from a callback. Report error to waiting callbacks.
Clear active flag.
This is useful when the network becomes unavailable
or prior to disconnecting in order to save power.
Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
Take card lock when running IOCTL command, to avoid race conditions that
could occur within the lower SDHC transfer implementations (as these
will be called by sdmmc_wait_ready)
Fixes#72368
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Apply the commit 21975231e2
("usb: device: cdc_acm: Prevent recursive logging loop")
to the new CDC ACM implementation.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
When CONFIG_USB_DEVICE_STACK=n then the sine wave
generator was enabled, which caused build errors.
This commit fixes those errors and also adds the
nRF5340 as a build target for the USB tests.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The mic_state is a guarded field in event_done_extra where it was
accessed outside of its guard.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
SD ops card_read() implementation does not need to unlock mutex, as this
is managed by the calling function card_write_blocks. Remove this stray
k_mutex_unlock() call.
Fixes#72287
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Reword frequency and timing selection logic for SDIO framework so that
the maximum supported timing mode between the card and host will be
selected, even if the maximum frequency supported by the host is not
equal to the maximum frequency for that mode.
Also, resolve an issue where a host and card combo only supporting HS
mode or worse would still use legacy timing mode, because the CCCR flags
were not being checked when checking if HS bus speed could be used.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
SDMMC framework frequency and timing selection logic has several
longstanding issues, including:
- requiring that SD hosts support the maximum frequency possible for a
given UHS mode in order to apply that timing
- selecting SDHC_TIMING_SDR25 for high speed mode, when SDHC_TIMING_HS
would be correct
Rework the frequency and timing selection logic within the SD framework
to resolve these issues.
Fixes#52589Fixes#67943
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
The default stack size of RFCOMM DLC is 256.
The default value is sufficient for basic operation.
If more stack space is used (such as call function printk)
in context of callback disconnected of RFCOMM DLC, the
default stack size is not sufficient.
Add a configuration BT_RFCOMM_DLC_STACK_SIZE to configure
the RFCOMM DLC stack size.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
To avoid the case that CONN_TX is available but RFCOMM_TX is
unavailable, set the default value of BT_RFCOMM_TX_MAX to
BT_CONN_TX_MAX.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The maximum data length of event packet is 255 for BR/EDR.
Such as the data length of event Remote Name Request
Complete is 255.
Set BT_BUF_EVT_RX_SIZE to 255 to avoid error "Not enough
space in buffer" from bt_hci driver.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>