An audio stream is unidirectional, so it's always either
TXing or RXing, so the fields can safely be moved to an
enum.
The struct now has both a is_rx and is_tx field. The reason
why two bools are being used, is that the both of them may
be false (we need 3 states).
All access to the rx and tx structs in the union shall be
guarded by these fields.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We could start executing the work item after the channel has been
disconnected or destroyed, due to a race condition.
Double-check we are connected before attempting to send data.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This check is repeated many times in `gatt.c`, with various comments.
This patch refactors these occurrences into a named function.
Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/41789
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
We can't just keep blocking the syswq, people be mad.
Override the timeout value so we always have K_NO_WAIT.
Also print a message to whomever's listening.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
OTS requires that indications about state change are sent after
response to ATT Write.
OTS Specification p.4.4.4.: "An OLCP or OACP operation is started
when the ATT Write Response is received from the Object Server as
a result of the Object Client writing an Op Code to a control point
to perform some desired action. The control point operation ends
when the Object Server sends an indication to the Object Client
with the Op Code set to Response Code."
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
To make it easier to understand the code, the following was done:
- Use INITIATING/ADV for state names that are exclusive to central
or peripheral. Previously it was not necessarily clear that the state
BT_CONN_CONNECTING was for central only by just looking at where
it was used. The terms INITIATING/ADV were used in favor
of central and peripheral as these terms also work for SCO connection
establishment.
- BT_CONN_CONNECTING_SCAN -> BT_CONN_SCAN_BEFORE_INITIATING
to make it more clear that we are not scanning and connecting at
the same time. The new name should make it more clear why we are
scanning - only with the intention to start the initiator later.
- BT_CONN_CONNECTING_AUTO -> BT_CONN_INITIATING_FILTER_LIST.
This makes it clear that this state is something different than
BT_CONN_AUTO_CONNECT.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
When initially reading some of the host code it was unclear to me
why they were needed an how they are used.
By adding some documentation,
this can hopefully make it easier for others to understand these.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The following warning is issued by clang:
warning: field within 'struct gatt_chrc' is less aligned than 'union
gatt_chrc::(anonymous at subsys/bluetooth/host/gatt.c:1859:2)' and
is usually due to 'struct gatt_chrc' being packed, which can lead
to unaligned accesses [-Wunaligned-access]
This is due to the fact that the uint16_t uuid field requires 2-byte
alignment but it is not marked as packed. Since the enclosing struct is
indeed packed, the required alignment is not guaranteed and so clang
complains. Fix it by ensuring that the union is marked as packed too.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.
The Mesh files `proxy_srv.c` and `pb_gatt_srv.c` were using
BT_LE_ADV_OPT_USE_NAME. Add the device name in the advertising data
directly.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.
Update the Bluetooth shell and its documentation to not use those
options anymore.
The option of the legacy advertiser run with `bt advertise` and the
behavior hasn't changed. The code has been updated to no longer use the
advertiser option but the original behavior has been reproduced.
The option of the extended advertiser have been updated to be more
explicit. The options `name` and `name-ad` have been removed from the
`bt adv-create` and `bt adv-param`. The option `name` and `dev-name`
have been added to the `bt adv-data` command.
- `name <str>` will advertise the given name.
- `dev-name` will advertise the device name.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Rework USBD shell to take speed arguments into account and revise
command help text. Rename some of the commands to better reflect what
they actually do.
Since most of the init code changes, rewrite the command to initialize
the default configuration in the shell to register all available
classes, but not to enable USB device support in a single command.
This will allow earlier notification in the future, if supported by the
controller, before the USB device controller is enabled.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
For the last dozen commits, the role of usbd_class_node has actually
been taken over by usbd_class_iter. After cleaning up and merging
usbd_class_node and usbd_class_data, we can rename usbd_class_iter to
usbd_class_node to better reflect its role.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Since only usbd_class_node contains the class instance data, rename it
to usbd_class_data.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
With the latest change, there are two structures that actually contain
class instance related data. Merge them into usbd_class_dnode, because
there is already a handy macro that can be used in class instances.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Some places have been overlooked, finally get rid of it. Use helpers to
get instance priv and device context.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
USB High-Speed devices must be able to operate at both High-Speed and
Full-Speed. The USB specification allows the device to have different
configurations depending on connection speed. Modify the API to reflect
USB Specification requirements on what can (e.g. configurations) and
what cannot (e.g. VID, PID) be speed dependent.
While the class configurations for different speeds are completely
independent, the actual class instances are shared between operating
speeds (because only one speed can be active at a time). Classes are
free to provide different number of interfaces and/or endpoints for
different speeds. The endpoints are assigned for all operating speeds
during initialization.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Introduce usbd_class_iter for keeping endpoint assignment variables
and the single-linked list node. No functional changes right now, but
this paves the way for independent speed specific configurations.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When device is not configured, any class or endpoint request must result
in request error. Do not try to find transfer owner because there cannot
be one.
Make sure that the actual handling code path does not depend on the
configured log level because it is absolutely not desired for log level
to affect actual handling.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Do not require nil descriptor at the end of descriptor set because it
serves no other purpose than a sentinel. Just end processing on first
NULL pointer within descriptor set.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add necessary macros and convert UAC2 descriptor test from descriptor
blob to descriptor set. Currently there is only Full-Speed descriptor
set.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
For specification-compliant high-speed support, we need to support
device quilifiers and other-speed-configuration descriptor requests. We
also need to store different configurations of the class/function
descriptors, which typically only affect the endpoint descriptors. With
this change, the stack expects class/function descriptors to be passed
as an array of struct usb_desc_header pointers to e.g. interface,
interface-specific, and endpoint descriptors, with the last element of
the array pointing to a nil descriptor. And also passed for a specific
speed, for now we support full and high speed configurations.
During instantiation, the class/function implementation must choose the
correct configuration in the full-speed and high-speed descriptor sets
for values such as maximum packet size and bInterval values of interrupt
and isochronous endpoints.
During initialization, the stack reads the highest speed supported by
the controller and uses it to get the appropriate descriptors set
from the instance. If the controller supports only full speed, the stack
configures the class/function descriptor for full speed only, if the
controller supports high speed, the stack configures the descriptors for
high speed only, and a class/function must update the full speed
descriptor during the init callback processing.
During device operation, the class/function implementation must check
the actual speed of the device and use the correct configuration, such
as the endpoint address or maximum packet size.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Save actual device speed in the device context and add helpers to get
highest supported and actual speed.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The class implementations should not access the members of the struct
usbd_class_node directly.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This implementation is WIP and has mostly been used to test interface
and endpoint configuration by the stack. For future changes, make the
interfaces more compliant with the USB specification.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If compiling with optimizations (-O2/-Ofast) gcc emits a
maybe-uninitialized warning for `size`.
As far as I can tell, `size` will always be initialized in the cases
where it is used and only left uninitialized in error cases.
Reproduced on main with the multi_endpoint sample on
nrf5340dk/nrf5340/cpuapp.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
When initially reading some of the host code it was unclear
to me why they were needed an how they are used.
By adding some documentation, this can hopefully make it
easier for others to understand these.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Updates the linker script fragments under 'subsys' to use
Z_LINK_ITERABLE_SUBALIGN for the subalignment instead of
a hardcoded value of 4.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
The IPv6 address lifetime timers are kept in a slist, but
the code that adds the entry to the list does not check
whether the item is already in the list. This will cause
problems when trying to remove the address from the list.
Normally this is not causing issues, but if the function
net_if_ipv6_addr_update_lifetime() is called multiple times
before the address expires, then the item was added to the
slist multiple times.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Applications need to run a scan to identify the security
mode before attempting the connection which adds to the time
taken for connection to be established.
To avoid the initial scan, support auto security mode which will
enable STA to choose between WPA, WPA2 and WPA3, based on the
network configuration.
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
In situations, where the address, the port and the auth token of the
hawkbit server are not known during build, it should be possible to set
it during runtime.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit fixes removing indirect blocks (marking them as 0)
in the inode structure. Previous version of the code was removing
the top-level blocks only when the first removed block was
one of the first 12 direct blocks. However, when the first removed
block is the first block in the referenced block list, its parent
(indirect block) should also be removed.
Signed-off-by: Franciszek Pindel <fpindel@antmicro.com>
Since `NONE` is a valid option for key management in `connect`
command, we should remove the part in help text which says:
"valid only for secure SSIDs".
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
UBSan was showing the following error:
```
runtime error: left shift of 137 by 24 places cannot be represented in
type 'int'
```
Cast the value to `uint32_t` to make UBSan happy.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The comment states the reason for this requirement is to detect
violations by a remote peer. The ATT version of this was removed in
ea04fd95f9. TLDR: It's neither possible
for, nor the job of the host to police the remote device.
We remove this requirement to be more flexible about the number of
priority levels in the system, and to avoid the temptation of using
priorities as a synchronization mechanism.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The remote domain may send unsolicited Z_LOG_MULTIDOMAIN_ID_DROPPED IPC
messages, which are not handled in log_multidomain_link_on_recv_cb().
With CONFIG_ASSERT=y, this will cause an assertion failure. With asserts
disabled, this message would be treated as a reply to any in progress
request and cause getter_msg_process() to return early. In turn, this
can cause various kinds of memory corruption when the real reply arrives
and the callback reads/writes stack variables that are no longer valid.
Fix this by explicitly ignoring Z_LOG_MULTIDOMAIN_ID_DROPPED, and also
don't treat unrecognized message types as replies.
Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
This fixes warnings when building with icbmsg
backend for IPC service by defining
_POSIX_C_SOURCE 200809L in source file.
Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
In hawkbit there are currently a lot of values send to the server, that
are not required or even optional. This commit corrects that.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit change a method of printing multicast routes by showing
all interfaces per entry instead of aggregating them by interface.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
In order to save memory, a single multicast routing entry now
contains configurable number of network interfaces.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
This commit adds a check to determine if the packet wasn't already
forwarded to a given interface.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
This commmit changes the way of iterating over multicast routing
entries from explicit for-loop to ARRAY_FOR_EACH_PTR().
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
The log message header "source" field for messages received from a
remote domain contains the source ID, rather than a pointer to the
source data (which would not be valid in the local domain).
msg_filter_check() did not handle this case and obtained a garbage source
ID for remote log messages. This caused an assertion failure in
filter_get().
Consistently handle this by adding a log_msg_get_source_id() function
that returns the source ID for both local and remote messages. This
function was implemented based on code factored out of
log_output_msg_process().
Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
Add support for decoding incoming LC3 data. At this point
we only instantiate a single LC3 decoder, so only one frequency
and duration is supported.
To accomodate for the increased RAM usage, the number of unicast
streams support have been decreased.
Further more, the LC3 handling in the shell has overall been
improved, also for encoding.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Returned values are copies, so trying to "const" return values cannot
have any effect.
Fixes the following compiler warning:
```
llext.h:165: warning: type qualifiers ignored on function return type
```
Fixes commit 41e0a4a371 ("llext: Linkable loadable extensions")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
`ret` is the amount sent from the current buffer. `sent` contains the
total amount that was transferred in the while loop.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Modifies the audio configuration (ac) commands for CAP
and GMAP to use the default presets instead of supplying
the preset as arguments. This will allow the user to
use the `bap preset` command to configure everything in the
codec configuration before the AC commands are issued.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When creating a broadcast sink using the auto scan feature,
the call to bt_le_per_adv_sync_create would use a local
PA sync pointer, instead of one from the per_adv_syncs
array, making it impossible to stop the PA sync afterwards.
This commit modifed the auto_scan so that it properly uses
the per_adv_syncs array, while still assigning the PA sync
in the shell broadcast sink struct.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The print_codec_cfg_chan_allocation did not take the case where
chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO into account,
in which case it should print "Mono".
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The commit 8256d02d3a introduced
getopt parsing for the wifi connect command
This needs to be updated for the wifi ap enable since ap
enable also uses the same parsing as connect.
The use of getopt removes the parameter ordering restrictions
Signed-off-by: Brad Kemp <brad@beechwoods.com>
In case FIN packet included data bytes, Zephyr would ignore the
data. It wasn't passed to the application, and it wasn't considered
when bumping the ACK counter. This ended out in connection timing out,
instead of being properly terminated.
Fix this, by refactoring FIN processing in TCP_ESTABLISHED state.
Instead of handling FIN/FIN,ACK/FIN,ACK,PSH cases separately, have a
common handler when FIN flag is present, and when ACK flag is present
along with FIN. When FIN is present, take any potentially incoming data
into account.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
`bt_recv` is invoked from the BT long work queue, which is preemptible.
The host uses cooperative scheduling to ensure thread safety.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Allow changing the CoAP Block-wise transfers block-size
for subsequent GET requests.
It looks like Leshan switches block size back to its
configured value, if it is smaller.
So even when we send block N=0 with size of 512, Leshan
seem to handle that properly but still asks N=2 with
block size 256(if that is configured).
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Implement test version of the LE Create BIG command ll_big_test_create
(BT_HCI_OP_LE_CREATE_BIG_TEST) in the controller.
This enables use of CONFIG_BT_ISO_ADVANCED, which supports use of
the following BIG/QoS configuration parameters (otherwise derived):
- ISO_Interval
- NSE
- Max_PDU
- BN
- IRC
- PTO
Signed-off-by: Morten Priess <mtpr@oticon.com>
Fix regression in BT_RX_STACK_SIZE use due to
commit b91728619c ("Bluetooth: host: remove
`CONFIG_BT_RECV_BLOCKING`").
Profiling of Controller Rx thread has been mentioned in
commit 586ba9fd13 ("Bluetooth: Controller: Increase
BT_RX_STACK_SIZE for BT_HCI_RAW enabled").
Also, move the TX_STACK_SIZE value as default in Kconfig
from the explicit value being set in hci_ipc sample.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Minor improvements to usage of zperf_shell upload.
Added common defaults for the upload commands arguments.
Print defaults in cmd help.
Throw warning when user sets baud rate for TCP upload.
Signed-off-by: Adam Matus <adam.matus@nxp.com>
The network interface parameter for net_eth_get_vlan_tag() should
be the VLAN interface so use the search loop properly.
Earlier the main interface could be checked.
Add also test cases for this so that we can catch that the func
works properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add more error logs in case of (mostly) mbed TLS errors, so it's easier
to get an initial idea of what went wrong based on logs only. Getting
an information on an actual mbed TLS error code is quite helpful in such
cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Generic node_rx_hdr struct contains data not used for done event, so this
pdu specific data is moved to node_rx_pdu to minimize memory usage for
MFIFO_done alloc.
This however calls for a considerable write-through replacing the generic
node_rx_hdr with node_rx_pdu when relevant and needed.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Use CONFIG_BT_CTLR_CENTRAL_ISO instead of CONFIG_BT_CENTRAL in
declaring central CIS CREATE procedure context data. In some configs the
size of this data structure is bound by central CIS CREATE, so doing it
correctly will save memory in the procedure context allocation.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
This commit adds support for building relocatable (partially linked)
ELF files as the binary object type for the llext subsystem.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add a new Kconfig option to select the binary object type for the llext
subsystem. This will allow to fully decouple the architecture type from
the kind of binary object that is expected by the loader.
The defaults have been chosen to match the current behavior of the ARM
and Xtensa architectures, but developers can now more easily experiment
with other object types.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
If central initiates incompatible procedure after having replied (with
_IND), peripheral fails to disconnect as spec'ed.
Fix by correctly setting the INCOMPAT flag to reserved on IND receipt to
enforce the disconnect.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Block size is a 3-bit value mapping values [0, 6] to powers of 2 in the
range [16, 1024]. Value 7 is invalid.
The previous formula was not working in case the client's preferred size
was 4 (or more) times bigger than the server's.
This commit takes into account also the case the client's preferred size
is smaller than the server's.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
It's needless complexity, and the terminology clashes with
Bluetooth (HCI frags).
It has one user, IPSP, that is going away soon.
Removing frag support will allow a future optimization, removing the
need for HCI and L2CAP fragment buffer pools, saving memory.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Remove IPSP support from the tree.
It has no maintainers, and is regularly broken. The fact that it's
nontrivial to set-up in linux makes it hard to fix reported issues.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
By exposing the underlying iso channel, the application can retrieve
properties of the iso channel.
This can be useful in case the application wants to use the connection
handle for vendor specific HCI commands or to retrieve the particular
parameters used for the given channel.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
First sector starts at CONFIG_EXT2_DISK_STARTING_SECTOR.
This commit fixes calculating free space, based on that value.
Signed-off-by: Franciszek Pindel <fpindel@antmicro.com>
Adds support for all relocation type produced by GCC
on ARM platform using partial linking (-r flag) or
shared link (-fpic and -shared flag).
Signed-off-by: Cedric Lescop <cedric.lescop@se.com>
This extends the thread abort hook to support memory mapped
stack. The calculation to find out to which instance of thread
pools the outgoing thread belongs requires physical address.
So find the physical address via the memory mapped stack for
that.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The "struct sockaddr" should only be used in casts and never
as a standalone variable because it might not have enough
space allocated for all the protocol specific fields.
So refactor the port_in_use() function to reflect that.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
errno values are positive, therefore they should be negated when
assigned as return values for net_dhcpv4_server_start().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The commit adds dependency on Kconfig FLASH_PAGE_LAYOUT to subsystems
that really require it:
FCB, NVS, LittleFS
and removes direct selection from '*.conf' files where no longer
needed.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
`setsockopt` is enabled by `CONFIG_POSIX_API`, use
`zsock_setsockopt` instead, otherwise there will be a
compilation error if `CONFIG_NET_SOCKETS_SOCKOPT_TLS` is
enabled.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Check if the interface is down before joining IPv4 mDNS multicast
group. This avoids warning later when the network packet cannot be sent.
Fixes#71121
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This API is not widely used and it is actually broken since device
runtime power management is not checking it when suspending and
resuming.
On top of that, this API is very close to pm_device_busy* API,
close enough to consolidate in only one API.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Commit e99b5228a1 changed the default
networking behavior on qemu platforms, as the SLIP_TAP driver no longer
selected Ethernet L2. In results, qemu platforms in default
configuration had no network interface to work with.
Fix this, by restoring select for NET_L2_ETHERNET, but this time in
NET_SLIP_TAP. The difference is that SLIP_TAP is a generic driver
config, which could be enabled on any platform, so not changing the
behavior here, while NET_SLIP_TAP is a config dedicated for qemu only,
so it's reasonable to enable all that's needed to get SLIP to work with
qemu by default.
As there were circular Kconfig dependencies, move the respective qemu
configs outside of NET_RAW_MODE if block (as this caused the circular
dependency with ETH_DRIVER_RAW_MODE). Also, remove dependency to
NET_L2_BT, as it made little sense there, and also caused dependency
problems.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There is no limitations for dwell time. Just add
valid condition for positive value. So , it's better
to remove those constraints.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
The bt_debug_dump_recv_state did not care if the receive
state being dumped to log was active or not, and if it was
not actice, then it may just contain random data.
Added a check to see if it was active.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Running out of connection contexts is most likely due to app
misconfiguration, therefore it's useful to get an explicit information
that context allocation failed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The cap_initiator unicast_stop command will now stop
all streams by default, without supplying the "all" argument.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some part of the descriptions were wrong. Also, the description of
`BT_BUF_ACL_RX_SIZE` was too verbose and no longer needed with the
updated L2CAP documentation.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The buffers for the PBP advertising data as well as the
buffers for the BASE periodic advertising data were
not cleared, so calling the functions multiple times
would simply append the data rather than just setting
the new data.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There are devices that will send empty SDUs instead of
empty PDUs, and while that should be harmless, it is nice
to know what is going on, and we may want to deal with
empty SDUs and empty PDUs differently.
This also modifies the state for TS and PSN to only be
applied for valid ISO packets.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
It is a common occurance that a specific type is not
found in the codec configuration, and the main way of
knowing that is by calling the function.
The debug log does not help debug anything (as it does also
return a specific error code), but rather just clutters up
the log if enabled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When returning an error code directly to an application
in the API, it should not log as a warning or error.
The lack of PAC records is also reported directly to the
application, and is not an error (in fact it is valid not to have
e.g. sink or source pacs).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add printing of the broadcast ID and whether an existing PA
sync was found in the bap_broadcast_assistant_recv_state_cb
function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bap_broadcast_assistant mod_src command can now take "unknown"
as a value to supply BT_BAP_PA_INTERVAL_UNKNOWN to the scan
delegator.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The documentation for the command
bap_broadcast_assistant broadcast_code
was incorrect and has been fixed.
Additionally, and example of the command has been added
in the shell documentation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When a PA is synced via PAST, the receive state does not
have a PA sync object, and the address and SID must be
used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The audio configuration 5 is defined to have 2 sink channels
per stream and 1 source channel per stream.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If pa_sync_past returns 0 then that means we are ready to
sync to past, and the BT_BAP_PA_STATE_INFO_REQ state should be set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some toolchains cannot create shared objects for Xtensa, with them we
have to use relocatable objects. Add support for them to llext.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Correct various small edge-case behaviors that have been accidentally
introduced in the http_client.
- http_client_req no longer incorrectly returns -ETIMEDOUT on NULL HTTP
resonse. -ETIMEDOUT is now only returned when the underlying TLS
socket times out.
- http_client_req now returns -ECONRESET upon incomplete (but non-NULL)
HTTP response. The request callback is no longer called in this case
(as with any other error state).
- http_wait_data has been refactored slightly to increase clarity.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
If the packet cloning fails (can easily happen when working with
loopback interface and when having low net_buf count), then
print a warning to the user. Error could also be possible but
as the situation might correct itself in this case, the warning
should be enough.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Adds the CAP Commander Change Microphone Mute procedure.
This procedure changes the microphone mute state on one or more
CAP Acceptors.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If we fail to join all nodes or solicit node multicast groups
when the interface is down, then there is no need to print an
error message. The groups are automatically re-joined when the
interface comes up.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
remove unnecessary condition for CONFIG_HAWKBIT_POLL_INTERVAL,
changes poll_sleep to be in seconds,
change type of sleep_time in hawkbit_update_sleep(), so the return
value of hawkbit_time2sec() is interpreted correctly.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
In addition to flushing the dcache, to ensure that the new code is
actually read by the CPU when loading an extension, the icache must
be invalidated as well.
Without this, some tests are failing in hardware because the CPU is
executing stale code from its instruction cache.
Fixes#70906 on arduino_giga_r1/stm32h747xx/m7.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Resolved a data race in shell.c by copying the user-provided
prompt-string into a private buffer within the shell, ensuring
proper synchronization with the shell-thread.
Fixes: #64972
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
If user created the capture device using the API and not via
the shell, then the device name was not set. Use the default
capture device in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The event NET_EVENT_CAPTURE_STARTED is generated when the
capture is enabled, and NET_EVENT_CAPTURE_STOPPED when capture
is disabled.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The net_capture_pkt() does not return information what happened
to the net_pkt because the packet was always cloned. With cooked
capture we can avoid the cloning in which case we need to know
the capture status in order to unref the packet if needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add support for capturing arbitrary data via the cooked mode (sll)
capture API. The actual packet capture is done using net_capture_data()
function, the packet capture infrastructure does not need any changes.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to create a kitchen sink pseudo a.k.a any network
interface that one is only able to write to. This might seem
unnecessary, but it is possible to attach virtual network
interfaces on top of this pseudo interface. These virtual
interfaces could then process the data for example for
packet capture purposes.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
For debugging purposes it would be nice to see the verdict
printed as a string instead of number.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add a recv callback to dummy API. After this it is possible to
receive data by a dummy network interface. This is only useful
if one attaches a virtual interface on top of the dummy one.
One such example is the cooked mode capture interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Change 'Hawkbit' and 'hawkbit' to 'hawkBit' wherever
makes sense, and a bit of touch ups here and there.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit fixes an issue where due to inverted logic (static function
returned 0 on success but the caller expected true/false) the MLDv2
reports were silently dropped.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Added a check for checking duplication when adding a source in the
broadcast assistant, as per requirement in BAP 6.5.4. It is not
permitted to add a source such that a combination of broadcast_id,
adv_sid and address type would result in same triple of values.
Added a recv_state struct to cache these values when read, and moved
past_avail and srd_ids into this as well.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Deprecate CONFIG_NET_TCP_ACK_TIMEOUT as it is redundant with the
combination of CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT and
CONFIG_NET_TCP_RETRY_COUNT. The total retransmission timeout (i. e.
waiting for ACK) should depend on the individual retransmission timeout
and retry count, having separate config is simply ambiguous and
confusing for users.
Moreover, the config was currently only used during TCP handshake, and
for that purpose we could use the very same timeout that is used for the
FIN timeout. Therefore, repurpose the fin_timeout_ms to be a generic,
maximum timeout at the TCP stack.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add hostname changed printout to event monitor. As the name
says, it is generated when the hostname of the device changes.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Starting with b1d24e425c (net: lwm2m:
device object: optionally store error list in settings), it was no
longer possible to build the code with coverage enabled when the
settings subsystem was disabled.
The build would fail with an error like this:
> subsys/net/lib/lwm2m/lwm2m_obj_device.c:262: undefined reference to
> `settings_name_steq'
This fixes#70923.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Add `gdb_q_packet` function to handle proccessing of query packets. Also
add `gdb_qsupported` function to serve as a single place to process and
respond to `qSupported` packets.
Signed-off-by: Robert Zieba <robertzieba@google.com>
Make the current gdb loop enum public under the name `gdb_loop_state`.
This will allow for extending the current stub with further
functionality in the future as new features will require control over
the loop state.
Signed-off-by: Robert Zieba <robertzieba@google.com>
According to the `RFC8415` the length of the DUID is at least 1 octet
up to 128 octets. Now a user can choose buffer length without the need
for source code modification.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
For BR/EDR L2CAP, if the function bt_l2cap_br_chan_send_cb
instead of bt_l2cap_chan_send is called, the ACL conn and
L2CAP chennel status will not be checked.
Check conn/channel status before sending data in
function bt_l2cap_br_chan_send_cb.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
eth_stats.h is using ethernet api but not including the header,
it must be working by luck in files that include it after
something else that includes ethernet.h, fix by just including it.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Change the receive workque name to "BT RX WQ" to distinguish it from the
receive thread, and the long workque one to "BT LW WQ" to make the
format consistent with the other Bluetooth threads.
On an nRF52 now "kernel stacks" looks like:
0x200016c8 BT RX (real size 448): unused 280 )
0x20001780 BT RX pri (real size 448): unused 224 )
0x200012c0 BT RX WQ (real size 2240): unused 1360 )
0x20001208 BT TX (real size 768): unused 408 )
0x20001130 BT LW WQ (real size 1344): unused 408 )
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change the input callback function name to make it easier to identify
what it belongs to. This clears some ambiguity when observing the symbol
names corresponding to the function pointers in the callback section.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Users should be able to call fs_mkfs() manually even if FS_FATFS_MOUNT_MKFS
is disabled.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Instead of having a single config specifying the memory pool size for
variable-sized net buffers, have a separate one for TX and RX for better
configuration granularity when optimizing memory usage of the
application.
Deprecate the old configuration but use its value as a default (for now)
for the new configs. This will need to change when the config is
deleted.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
To wait for the asynchronous suspending work item to complete, a
combination of semaphores and events is used. First, the semaphore is
released, then the events are cleared (through the boolean argument to
k_event_wait), then events are awaited.
However, if the event flag happens to be set by the work handler in the
short time between k_sem_give and k_event_wait, it is then cleared by
k_event_wait and k_event_wait blocks forever waiting for the event.
Make sure that we clear the event flag before releasing the semaphore.
Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
With CONFIG_BINDESC_BUILD_TIME_ALWAYS_REBUILD a re-run was called for
the entire project.
This can result in issues with the zephyr linker mechanism.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
There should be a particular defines which clarify the
use of that number. So, replacing numbers with defines
in wifi shell.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Outgoing block-transfers now set the socket hint
to ONGOING as long as the BLOCK1/BLOCK2 header has
MORE flag set to true.
This means as only the last packet in the block-transfer
set the socket hint to LAST or ONE_RESPONSE.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Once Wi-Fi is associated few parameters like listen interval and
power-save mode cannot be changed. The state for association is
"ASSOCIATED" and not completed. Even after state transitions to
COMPLETE, it can still go back to other states, e.g., PTK/GTK renewal.
Fix the state check.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
If host is not reading RTT data (because there is no PC connection
or RTT reading application is not running on the host), thread will
stuck continuously trying to write to RTT. All threads with equal or
lower priority are blocked then. Adding detection of that case and
if host is not reading data for configurable period then data is
dropped until host accepts new data.
Similar solution is using in RTT logging backend.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
All implementations of random number generator where duplicating logic
for sys_rand32_get. Since this subsystem already has a logic to
generate random values of arbitrary size, we can generically implement
sys_rand32_get on top of that.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The gPTP is not suppose to be run on top of VLAN and the
earlier support was just for testing purposes. Remove VLAN
support now after the VLAN overhaul.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print also network interface index together with the pointer value
in order to get more useful information what is going on in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print information whether a multicast address is properly
joined to a multicast group when print addresses using
"net iface" command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
As the interface type is always Virtual, no need to print it.
Print instead the name of the network interface as it is more
useful to the user.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If an IPv6 address was added to the interface while the
interface was down, its solicited node multicast address
is not joined properly and IPv6 communication will to
other hosts will fail. So make sure to rejoin all the
solicited node multicast groups that were joined already
when the network inteface is going up.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add debug information to print when the network L2 enable
callback is called and fails. Useful to see this information
as at that point the interface goes down.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Start any pending IPv6 DAD timers when interface comes up.
If IPv6 addresses have been added to the network interface when
it was down, the addresses would never work properly if the DAD
is not done.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of printing just a network interface pointer, print
also the interface index so debugging is a bit faster as no
lookup from interface listing is needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
No need to do the checks any more because user has specified
the VLAN count and so many VLAN virtual interface are already
created.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Re-implement the VLAN support inside the network stack.
All the user facing APIs stay as is but internally the VLANs
are implemented using the L2 virtual interfaces.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Simple rename to align the kernel naming scheme. This is being
used throughout the tree, especially in the architecture code.
As this is not a private API internal to kernel, prefix it
appropriately with K_.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Some compilers have trouble parsing variables directly after a case
statement.
Fixes: #70792
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Changing remaining users of fcntl.h to use the include from our own
POSIX file so that the values in there are consistent in all parts
of the sources.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Use only Zephyr specific POSIX header files so that the whole
system is getting values from the same files. There was an issue with
native_sim run of tests/net/socket/af_packet which had O_BLOCKING set
to 0x4000 from include/zephyr/posix/fcntl.h, but then the file
subsys/net/lib/socket/sockets.c was having O_BLOCKING set to 0x0800
because different header files were used.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit fixes this error seen in CI so that things
work even if CONFIG_POSIX_API is enabled.
subsys/shell/backends/shell_mqtt.c:727:12: error:
conflicting types for 'write'; have
'int(const struct shell_transport *, const void *, size_t, size_t *)'
727 | static int write(const struct shell_transport *transport,
const void *data, size_t length)
include/zephyr/posix/unistd.h:230:9: note: previous declaration
of 'write' with type
'ssize_t(int, const void *, size_t)'
230 | ssize_t write(int file, const void *buffer, size_t count);
subsys/shell/backends/shell_mqtt.c:787:12: error:
conflicting types for 'read'; have
'int(const struct shell_transport *, void *, size_t, size_t *)'
787 | static int read(const struct shell_transport *transport,
void *data, size_t length, size_t *cnt)
include/zephyr/posix/unistd.h:231:9: note: previous declaration
of 'read' with type
'ssize_t(int, void *, size_t)'
231 | ssize_t read(int file, void *buffer, size_t count);
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The library should be using internal socket API functions
so that we do not need to depend on POSIX_API.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Currently the socks library does not use sockets so there
is no need to select socket symbols.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The library should be using internal socket API functions
so that we do not need to depend on POSIX_API inside the
network stack.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Have special wrappers for zsock_fcntl and zsock_ioctl functions
so that gcc warning can be avoided.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The CONFIG_NET_SOCKETS_POSIX_NAMES option is marked as deprecated in
favor of using normal POSIX socket API includes found under the
include/zephyr/posix directory. If you want to use BSD socket API calls,
you need to select POSIX_API and use the socket headers found in the
POSIX subsystem. If you do not want to or cannot enable POSIX_API,
then you must use zsock_ prefix when working with BSD socket calls.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Added a check for duplication of add source operation in the Scan
Delagator. BAP 6.5.4 states that an assistant may not perform add
source operation if it results in a duplication of a source. While
this is not mentioned for the Scan Delegator, the spirit of the spec.
must be that no duplications can exists in the recv_state, which is
what this commit fixes.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
By using `getopt_state` to access `optarg`, offering a better alternative
to direct global `optarg` access.
This approach mitigates the risks associated with concurrent access to
the global variable.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This change marks each instance of the `struct option` as `static const`.
The rationale is that `struct option` is a read-only variable.
By using `static const`, we ensure immutability, leading to usage of only
the `.rodata` section and a reduction in the `.data` area.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit simplifies the access to structure members and omits
unnecessary variable initializations.
Specific adjustments include:
- Moving from pointer-based access (`(®d)->chan_info`) to
direct structure member access (`regd.chan_info`).
- Removing explicit initializations where not required.
- Removing excess backslashes '\' before '%' in the format string.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
When setting a name to a network interface, verify that no other
interface has the same name as that would make very difficult to
select an interface by a name.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The current implementation can raise a warning as the compiler sees
an attempt to index an array with a size of zero. This can be fixed by
giving `gdb_mem_num_regions` a default value of zero, but this gets
flagged by CI checks. Disable the warning around the array access.
Signed-off-by: Robert Zieba <robertzieba@google.com>
commit 67bb6db3f8 ("syscall: Export all emitted syscalls, enabling
them for extensions") exports all emitted syscalls, however, it does
that only for the `z_mrsh` symbols, effectively only available for
userspace. If an extension running at kernel level tries to use a
syscall, it will fail to load.
This patch fixes that by exposing the `z_impl` symbols instead. However,
this is not as straightforward as the `z_mrsh` ones. As, in their
signatures, they can basically contain any type, it's not just a matter
of emitting `EXPORT_SYMBOL(z_impl_<syscall>)`, as the compiler will
complain about the undefined types. Here, there are a few approaches.
One of them is to have the `EXPORT_SYMBOL` being generated on the same
files where the syscall is implemented - injecting it there would allow
it to access all known symbols. But changing a lot of files is
undesirable, and it was one of the nice points of first patch.
Another one would be to reconstruct - or simply use the absolute path -
for the includes where the syscalls are defined. Reconstruct the paths
seems fragile and I'm not sure using absolute paths is portable.
Finally, the approach used in this patch is to declare, on a different
generated file, all `z_impl_` symbols as `void *` - after all, only the
address (and the name) to the function is relevant to EXPORT_SYMBOL. By
living in an compilation unit that doesn't include any header which
would expose any of the syscalls, there shouldn't be any conflicts. And
to account for the possibility that a syscall is not compiled - due
being configured out via Kconfig - all those symbols are also weak
aliases to a pointer to NULL. This file is then included in
`llext_export.c` (which should naturally not include any conflicting
header).
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
For zero sized buffers, instead of pointing to a buffer, net_buf->__buf
is NULL. For this reason, when cloning a buffer, the code needs to check
__buf before dereferencing it.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
When z_test_1cpu_start() is called to ensure that only a single CPU
on an SMP system is available for use in a test, this commit will
ensure that that CPU is the primary CPU--CPU0. This is done because
some timer drivers only have the timer interrupt processed by one CPU.
A bit of a song and dance is performed to achieve this without enabling
the CPU mask/affinity pinning API. If the cpuhold thread is found to
be executing on CPU0, then a new copy of cpuhold thread is created. Once
the new copy is executing (incidentally guaranteed to be on another CPU)
then it informs the original copy and busy waits until it the original
copy is switched out of CPU0. At this point, we can create the next
cpuhold thread to occupy another CPU if needed.
During this song and dance, it is critical that the 'copy' not pend. If
it pends, we can not guarantee which CPU it will execute on when it
unpends. As the cpuhold threads have the highest priority, nothing is
going to cause them to execute on another CPU for as long as they do
not pend.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit removes `bt_hci_evt_get_flags`, and the associated flag
symbols. These symbols no longer serve a purpose in the driver interface
after the removal of `bt_recv_prio` from the interface.
The implementation of `bt_hci_evt_get_flags` is distributed to its
still-existing use sites, `hci_core` and the `hci_driver` in the
controller.
The duplication of code is intentional. This is no longer part of any
interface, and the host-developers expect the host copy of the function
to change or dissapear entierly. This will allow the host implementation
to progress without fear of breaking the controller implementation.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Remove `bt_recv_prio` from the HCI driver interface. It's primary
purpose was to be used in conjunction with `CONFIG_BT_RECV_BLOCKING`,
which has been removed.
`hci_raw.c` provided a adapter implementation to make drivers
implementing the `CONFIG_BT_RECV_BLOCKING` interface useable with
`CONFIG_BT_HCI_RAW`. But since `bt_recv_prio` is being removed from the
HCI driver interface, drivers needing the adapter should copy the
adapter implementation as private internals.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This config selects a variant of the HCI driver interface that spills
out host internals unto the drivers and even the Zephyr controller. It
will now be removed in favor of driver interfaces that hide the
internals of the host.
The new default is `CONFIG_BT_RECV_WORKQ_BT`.
Any references to the removed kconfig are refactored out.
Any out-of-tree driver using the removed interface can be easily adapted
by copying the following implementations into the driver as private
functions:
- `hci_driver.h:BT_HCI_EVT_FLAG_RECV_PRIO`
- `hci_driver.h:BT_HCI_EVT_FLAG_RECV`
- `hci_driver.h:bt_hci_evt_get_flags`
- `hci_raw.c:bt_recv_prio`
In combination these symbols function as a interface adapter. These
symbols will be removed in this PR in subsequent commits.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Return availability of free buffers after data is consumed. This
information may be important for the module using uart_async_rx to
schedule next reception if there is a new buffer available.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
As stated in "[RFC7959], Section 2.5":
"The Block1 Option provides no way for a single endpoint to perform
multiple concurrently proceeding block-wise request payload transfer
(e.g., PUT or POST) operations to the same resource. Starting a new
block-wise sequence of requests to the same resource (before an old
sequence from the same endpoint was finished) simply overwrites the
context the server may still be keeping."
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
Check max_tx_octects and max_tx_time are in the valid range, according
to the BT Core spec 5.4 [Vol 4, Part E, 7.8.46]
Fix#70472
Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
A Kconfig item is added and the buffer
is embedded into the modem_cmux struct.
The default value is increased from 16 to 64 bytes in
an effort to reduce the number of modem_pipe_receive() calls.
CONFIG_MODEM_CHAT_LOG_BUFFER is renamed
to CONFIG_MODEM_CHAT_LOG_BUFFER_SIZE for consistency.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Add a configurable delay between when a byte is received and
MODEM_PIPE_EVENT_RECEIVE_READY is sent.
This fixes data reception at baud rates above 460800, and
most likely also reduces the workload at any baud rate
when receiving bytes by not going through the work item
and callbacks for every single byte.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
- Set all the state bits before calling uart_rx_enable() because
interrupts may happen already before it returns.
- Fix the byte count in the "Receive buffer overrun" log.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
- Add the frame data length to the frame header log.
- Log the dropped frames as well.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The previous default value made UART TXs of size > 1145
time out at a baud rate of 115200.
It should not be so small that it can cause undesirable timeouts.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
MODEM_UBX: Adds Support for UBX Messages in Modem Subsystem.
GNSS API Supported: get_supported_systems, set_fix_rate, get_fix_rate,
set_enabled_systems, get_enabled_systems, set_navigation_mode,
get_navigation_mode.
Boards Tested: MIMXRT1062_FMURT6, VMU_RT1170.
Note: Partial support for U-BLOX Messages is provided as of now.
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
Signed-off-by: Mayank Mahajan <mayankmahajan.x@nxp.com>
Commit prevents updating replay protection list on any frame came
from the network layer.
Replay protection cache is updated only if
- transport handles transport command without errors
- access layer handles model message without errors
- transport frame has correct length
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit adds analyzing of returned status of element rx.
If at least one element receives multicast message then
access layer will return suceess status.
If option CONFIG_BT_MESH_ACCESS_LAYER_MSG is enabled then
access layer will return success always.
Function bt_mesh_access_recv has been introduced to cover
case when real model statuses should be returned over
oppcode aggregator model despite access returns success.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Refactor the IP tunneling support as the input callback was removed
in previous commit. The data will flow through the recv callback now
as expected.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The input callback was an unfortunate idea which just complicated
how the packet flows through virtual interfaces so removing it.
The data is passed normally through the recv callback from now on.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The function needs to loop through the virtual interfaces
tied to this physical interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Channel is mandatory for AP mode. It is processed only
if its less than or equal to three characters. Otherwise
we need to throw error for channel in AP mode.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
arch_interface.h is for architecture and should not be
under sys/. So move it under include/zephyr/arch/.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Add declaration of the _POSIX_C_SOURCE < 200809L for ztest library for
declaration of strtok_r and strdup functions.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
This functionality is useful on the following scenario:
1) The first buffer in a net_pkt contains user data which is relevant
for the (whole) net_pkt.
2) When inserting a new buffer in front of the net_pkt, the (previously)
first buffer (and its user data) are no longer accessible via
net_pkt->buffer.
3) net_buf_user_data_copy() allows to simply copy the user data from the
old to the new first buffer.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
If the network interface does not enable IPv4, then it is pointless
to print DHCPv4 information when invoking "iface" shell command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The final ACK check during passive close was wrong - we should not
compare its SEQ number with the ACK number we've sent last, but rather
compare the ACK number it acknowledges matches our current SEQ number on
the connection. This ensures, that the ACK received is really
acknowledging the FIN packet we've sent from our side, and is not just
some earlier retransmission. Currently the latter could be the case, and
we've closed the connection prematurely. In result, when the real "final
ACK" arrived, the TCP stack replied with RST.
Subsequently, we should increment the SEQ number on the connection after
sending FIN packet, so that we are able to identify final ACK correctly,
just as it's done in active close cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Dwell time Active or Passive is optional in wifi scan.
If user don't set the Dwell time value, it will be set
as 0. We are adding a range check in scan extensions
for dwell time. So need to set default values.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Add an error log if there's a failure when attempting to load
certificates during socket connect.
Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
remove hb_context.status_buffer_size and replace it with
sizeof(hb_context.status_buffer), because hb_context.status_buffer_size
is never set.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Current implementation of mDNS responder does makes it mandatory to have
all the records set at compile time. It is not suited well for applications
that have to publish/unpublish or change records in runtime, e.g. data
received from the network.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Follow-up: fe25709a9c twister: add unit_testing soc and board
Moving the soc.yml and board.yml to subsys/testsuite tree.
Introduce subsys/testsuite/arch/archs.yml with unit_testing arch.
Update the Zephyr CMake module unittest.cmake to include HWMv2 and
reorder includes to follow same order as zephyr_default.cmake.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Enables compatibility of NUS for codebases that are not
Bluetooth-centric (e.g: Non-bluetooth samples that use UART over
Bluetooth LE for Console, Logging, Shell, others).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Enables usage Bluetooth LE GATT as a serial endpoint to exchange data
using UART APIs. This implementation is compatible with UART Interrupt
Driven APIs and uses the nus-uart device-tree node properties to
configure FIFO buffers for transmitting and receiving. Defining
multiple instances of the driver is possible and it allows implementing
multiple GATT NUS service instances to exchange data as separate serial
endpoints.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
NUS is implemented as a Bluetooth LE service, exchanging data treating
the NUS characteristics as Serial endpoints: RX characteristic to
receive, TX characteristic to send binary packets.
This implementation also enables the ability to define multiple
instances of the NUS Service, analogous to mutliple serial endpoints,
to use each one for different purposes. Unless disabled through Kconfig,
NUS instantiates a default instance, similar to what other services do,
which allows users not interested in using multiple instances, to not
worry about the inherent complexities.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Zephyr's DHCPv4 server does not implement persistent storage of address
leases. In result, all leases are lost on reboot, which can cause
delays with clients starting in INIT-REBOOT state and thus sending
(potentially several) Requests before attempting full Discover-Request
procedure.
Add option to override RFC defined behavior, which states that if we
don't recognize the client sending the Request, the server shall remain
silent. Enabling that option allows the server to send NAK reply in case
client is not recognized, informing the client it should proceed with
full procedure.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
RFC6842 updated RFC2131 in terms of including client ID option in
responses sent from the server. According to that RFC, the server MUST
include the client ID option in Offer/Ack/Nak replies, if it was
provided by the client.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case ACK from the server was lost, we'd not reply Request
retransmissions, as the lease state is already in allocated state on the
server side. Therefore we also need to allow to reply with ACK in such
case.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
5 seconds turned out to be too short timeout in case retransmissions
kicked in at DHCP level, hence increase the timeout.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add message types for line coding and contol line state updates.
Add a publish message function that takes a pointer to a device
structure as payload, and use USB notification in the CDC ACM
implementation.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The implementation uses the system workqueue and a callback provided
and registered by the application. The application callback is called in
the context of the workqueue. Notification messages are stored in a
queue and delivered to the callback in sequence.
We cannot call application callback directly from the USB device stack
thread because the behavior of arbitrary code provided by the
application is unpredictable, and we do not want it to be executed in
the same context where all events from the device controller are
handled.
Nor can we use the ZBUS subsystem directly. ZBUS offloads responsibility
for defined behavior to the observers and application, and does not
provide any way for the publisher to enforce defined behavior and
execution context.
ZBUS listener would be called from the USB thread context and is not
acceptable. ZBUS subscriber does not provide delivery guarantee and
cached message can be overwritten. ZBUS message subscriber has
cumbersome global configuration and buffers that are too complicated to
handle from USB configuration, and even if we would use it, defined
behavior is not possible because of how listener and subscriber are
handled.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Debugging IPv6 Neighbor Discovery issues requires to enable full IPv6
logs, which can get bloated given it provides logs for every single
packet. We should be able to focus on IPv6 ND logs only, hence introduce
a separate log module for IPv6 ND.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Recently (during Bluetooth UPF), a lot of developers experience
confusion due to weird errors in SMP, etc, which are actually irrelevant
and caused by the connection never having existed.
As a stop-gap measure, until upper layers properly report lower layer
failures, add a warning in the logs to stop wasting developer time.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Since the cap_common.c rely on CONFIG_BT_MAX_CONN, and is
only used for connected procedures, it should be guarded
by CONFIG_BT_CAP_INITIATOR_UNICAST instead of
CONFIG_BT_CAP_INITIATOR
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Increase the timeouts to be 60 instead of 6.
The reason for this is that some controllers (like the Zephyr
controller) will reserve some of these to ensure stability,
and in fact with skip = 5 and retry = 6, it would still
send the PA reports at every interval.
To accomodate a higher timeout value, the functions used to
convert PA intervals to PA timeouts have been updated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added the CONFIG_MCUMGR_TRANSPORT_BT_DYNAMIC_SVC_REGISTRATION Kconfig
option to manage how the SMP service should be registered.
By default the SMP service must be registered at runtime.
If this Kconfig option is disabled, the SMP service is statically
defined and registered.
This change allows to opt out of using the CONFIG_BT_GATT_DYNAMIC_DB
Kconfig option and as a result, lower the memory usage.
Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
Linkable loadable extensions can only use syscalls if they are exported
via EXPORT_SYSCALL (or EXPORT_SYMBOL). Instead of enabling used syscalls
one by one, this patch exports all of them automatically via
`gen_syscalls.py`. If CONFIG_LLEXT=n, the section where the exported
symbols live is discarded, so it should be a non-op when llext is not
enabled.
This patch also removes the now redundant EXPORT_SYSCALL macro. Note
that EXPORT_SYMBOL is still useful on different situations (and is
indeed used by the code generated by `gen_syscalls.py`).
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Sets the retries in cmd struct to their Kconfig value. This fixes
an issue in imx_usdhc.c where retries would be used uninitialized. That
leads to a loop not being entered and subsequently no data being read
from the controller.
Tested on mimxrt1170_evk.
Signed-off-by: Jakob Genßler <jakob.genssler@gin.de>
As we are replacing native_posix with native_sim, let's
refer to native_sim instead of native_posix in the comments.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
There is no need to validate stream_param->data if it is NULL.
Fixes failing PTS BAP/BSRC test cases.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
When the policy returns NULL pm_system_suspend was assuming that
the current state in z_cpus_pm_state was ACTIVE, since that is the
state set after the core wakes and return to this function. The
problem is that in cases where the cpu does not preserve the context,
and returns to this function, z_cpus_pm_state has the value of the
last state used and the cpu use it again.
Fix it setting z_cpus_pm_state to ACTIVE every time the policy returns
NULL.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The function inteval_timeout() was missing "r", the function
should be called interval_timeout()
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Tracing with sysview is missing both
sys_port_trace_k_thread_abort_enter()/_exit() which exist on
other tracing backends. So add them.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
As per current definition of the Z_TEST macro, defined in
include/zephyr/ztest_test_new.h, the passed parameter is named
'fixture', not 'this'.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Rename the internal input callback structure to input_callback. This is
for coherency with "INPUT_CALLBACK_DEFINE" and other similar code paths
in Zephyr, and also to avoid confusion with terminology.
This is an internal structure, applications should not have any
references to it so there should be no need for any release note
entries.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Remove SCO security management code block.
Currently, security related checks are not
necessary. It can be added if needed.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Call bt_sco_server_register to register SCO
server. Manage the SCO connection request.
Get SCO connect/disconnect status via SCO
channel ops.
Notify the uppper layer of the SCO connection
status changes through bt_hfp_hf_cb::
sco_connected and bt_hfp_hf_cb::
sco_disconnected.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Currently, SCO connections and disconnections
are agnostic to upper-layer.
Add two functions, bt_sco_connected and
bt_sco_disconnected, to notify the SCO
connect changes.
For Central side, pass "struct bt_sco_chan"
object when calling bt_conn_create_sco. it
uses to manage the SCO channel for upper-
layer.
For Peripheral side, two functions
bt_sco_server_register and
bt_sco_server_unregister are added to monitor
SCO connection request for upper-layer. The
upper-layer could accept or reject SCO connect
When the connection request received. If the
connect is accepted, the "struct bt_sco_chan"
object could be passed by "sco_server->accept".
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The codecs used for the bap bt_bap_stream_config was only
valid for the lifetime of the procedure, which meant
that by the end of the procedure the stream->codec_cfg
became invalid.
This is fixed by using the pointer provided to the
CAP API, and documentating the lifetime of the codec_cfg.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
IGMP queries sent out by a proxy querier can have
a source IP address 0.0.0.0
Allow these incoming packets.
Fixes#69917
Signed-off-by: Savin Weeraratne <savin.weeraratne@audinate.com>
When we receive Router Advertisement with life time,
we will add this as default router, like typing command "net iface"
and has show below
IPv6 default router :
fe80:xxxx::xxxx
When this default router is backend A and
we ping backend B with link local address,
we will use default router A and send echo request
to backend A instead of B, which will receive Redirect and no reply.
Fix it by link local address does not check route.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
When calling `mesh prov beacon-listen on` shell command before
provisioning the local device, the stack won't report unprovisioned
beacons. This is because the scanner has not been started yet. This
behavior confuses users. Print a warning that the device needs to be
provisioned first before it can listen to unprovisioned beacons.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
In the simulated bsim boards there is no jittery delay
from a (D)PPI event until a TIMER starts.
The timer starts instantaneously so we do not need to
compensate for it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The building error is reported in Ubuntu if
CONFIG_NET_BUF_LOG is true.
Change __line__ to __LINE__ to fix building
error.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Use the HAL always when setting the TIMERs CC registers,
(also for coded Phy) to ensure things work properly for simulation.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add HCI input parameter validation according to spec for passing
qualification tests.
- Conditional compile of LE Set PA Receive Enable feature
- Store BIGinfo encryption state and number of streams
- Do not report BIGinfo if phy is invalid or unsupported
- Return disallowed ll_read_iso_tx_sync uses sync recever handle
- Validate BIS indices in ll_big_sync_create
Signed-off-by: Morten Priess <mtpr@oticon.com>
Debug logs in helper functions like tcp_unsent_len() or
tcp_window_full() are not very helpful and generate a heavy, unnecessary
log output. Therefore, tcp_unsent_len() will no longer generate log, and
tcp_window_full() will print out a log only when the window is actually
full, which could be an useful information.
Also, reduce the log load during TX, as currently redundant logs were
printed in tcp_out_ext(), tcp_send_process_no_lock() and finally in
tcp_send().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If send the igmp packet when lower interface is down, the packet will be
freed twice and show error log. Remove the net_pkt_unref in igmp_send(),
and let the caller free it.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Zperf upload multicast always use default interface.
Zperf download multicast cannot receive packets from other than
224.0.0.1 which is default multicast group.
Add zperf upload/download option -I <interface name> for multicast.
So that user can select interface for multicast.
Add join multicast group for zperf download.
Use the "device list" command to get the interface name as
follows:
"- ua (READY)" #uAP interface name
"- ml (READY)" #STA interface name
Multicast traffic commands:
zperf udp upload -a -I ua 224.0.0.2 5001 10 1470 1M
zperf udp download -I ua 5001 224.0.0.3
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
Fix compilation warning due to taking member from a packed structure
and assigning it to a pointer. Compiler warns that it may be
unaligned. However, it is ensured that it will be aligned by
operations preceding this assignment.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
A lot of the log messages are using highest level, optimize
them to recycle as much messages as possible.
When building the sample with `CONFIG_HAWKBIT_LOG_LEVEL_DBG`
on `frdm_k64f`, the FLASH size is reduced from 150860 B to
150048 B, saving ~800 bytes.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Fix CIS accepted by Host being failed in the Controller with
reason 0x20 Unsupported LL Parameter Value, by relaxing the
check that the ACL connection is sufficiently placed such
that the time reservation using in the Controller
implementation does not overlap with the CIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In order to reduce dns resolve requests when using the dns
resolver an optional cache was introduced. This cache
retains query requests for the TTL duration and therefore
prevents premature refetching of DNS RRs.
Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
Implement the ALPN Support for Mqtt Library allow mqtt to have
ability to utilize ALPN for connect to server that support ALPN, such
as AWS IoT Core
Signed-off-by: sukrit buddeewong <sukrit.omu@gmail.com>
The opval argument of arch_elf_relocate() was modified by
adding the value stored at opaddr before passing it to
arch_elf_relocate(). This presumed that the addend would
always be stored as a raw value at opaddr, which is not the
case for all relocation types.
This PR modifies opval to be the absolute address of opval,
and moves the addition of the addend from llext_link_plt()
to the implementation of arch_elf_relocate().
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
This commit applies the issues detected in UDP to recv_raw() as
well. Please refer to the previous commit log for details.
Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
When receiving a UDP packet, net_conn_input() searches for a
matching connection within `conn_used`.
However, when receiving UDP packets simultaneously from multiple
clients, we may encounter a situation where the connection that was
supposed to be bound cannot be found within `conn_used`, and raise
the ICMP error.
This is because, within recv_udp(), to avoid the failure of
bind_default(), we temporarily remove it from `conn_used` using
net_conn_unregister().
If the context already has a connection handler, it means it's
already registered. In that case, all we have to do is 1) update
the callback registered in the net_context and 2) update the
user_data and remote address and port using net_conn_update().
Fixes#70020
Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit adds the new internal function for update the callback,
user data, remote address, and port for a registered connection
handle.
Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
This commit adds the new static function for change the remote
address and port to connection, and replaces the changing process
for remote address and port in net_conn_register().
Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
The net_conn_change_callback() is not currently being called by
anyone, so this commit moves to static function, and replaces
the change callback parameter process in net_conn_register().
Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
The mutex was removed in tcp_recv() where it doesn't seem
to be needed anymore as tcp_conn_search() got
tcp_mutex. In the other areas the tcp_mutex was
narrowed down to protect only the list.
Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
During stress test with WiFi connect, disconnect, ping and throughput
traffic, ARP table updating failed issue may occur.
In arp_prepare(), if packet allocate failed, should add the arp
entry back to arp_free_entries, to avoid this entry is leak forever.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
For command zperf udp download 5001 192.168.10.1,
zperf will bind both ipv4 and ipv6 sockets on ipv4 address.
But bind ipv6 socket will fail, thus command return fail.
Fix it by check ip address when zperf download.
For ipv4 address only bind ipv4 socket.
For ipv6 address only bind ipv6 socket.
For unspecific address bind both ipv4 and ipv6 sockets.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
Add checks for vendor specific data path in ULL and HCI driver, to
enable use of vendor data path for BIS reception.
Signed-off-by: Morten Priess <mtpr@oticon.com>
- Calculate broadcaster channel for control subevent
- Calculate sync receiver channel for control subevent
- Fix broadcast CSTF only set in first subevent
- Remove ctrl_chan_use from LLL, as there is no longer a reason for
storing it.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Update the legacy low latency variant of the ticker
implementation to skip to next periodic interval when
ticks to expire is behind the current tick. This makes
the low latency variant of the implementation consistent
with the default ticker implementation.
Also, cleanup conditional compiles in the implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
My recent change overlooked this configuration, which is not tested in CI
currently.
If someone had enabled it, they would've just gotten an unfixable assert.
The correct test would be checking if the current thread is the system wq,
but I think the compiler can't know that and can't remove the "dead" code.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Add new commands to manage the Encrypted Advertising Data feature.
Overview of those new commands:
- `bt encrypted-ad set-keys`: set key materials (session key and
initialisation vector) used for encrypted and decryption of EAD;
- `bt encrypted-ad add-ad`: store a given advertising data structure;
- `bt encrypted-ad add-ead`: encrypt the given advertising data
structres and store the generated AD structure;
- `bt encrypted-ad commit-ad`: set the AD of the selected advertiser
with the stored AD;
- `bt encrypted-ad clear-ad`: remove all stored AD;
- `bt encrypted-ad decrypt-scan`: decrypt data using the previously set
key materials when receiving AD with type `0x31`.
The documentation of the Bluetooth Shell has been updated to include
those new commands.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
On some content-types, it might be impossible to
send strings with size of zero.
Therefore empty URI should also allow cases
where strlen() is zero.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When the AUX_ADV_IND and AUX_SYNC_IND are close to each
other, the duration between them is not sufficient to
schedule a new instance of ticker to establish
synchronization. This processing time introduces latencies
detected by the prepare callback.
When the sync offset is low, schedule the start of the
reception to next periodic interval.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing PPI to timer start compensation and missing
inclusion of range delay in the calculation of packet
header receive timeout value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Extended Advertising Parameter check to exclude legacy
high duty cycle directed advertising from validating the
intervals as advertising interval parameter values are not
applicable for high duty cycle directed advertising.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
If no callbacks have been registered then callback_list
is NULL, in which case we can skip searching.
This also fixes a NULL-pointer acces in the while loop
as previous_callback would be NULL when it gets
dereferenced as previous_callback->_next.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The BIGinfo PDU bitsets were not accessed in a portable maner for
endianness independence, and need to be handled as bit-manipulations.
Add utility functions to access PDU bitset variables independent of
endianness. Use macros to abstract the offsets and widths.
Conversion of BIG_Handle to LE in HCI layer incorrectly use
sys_cpu_to_le16, which fail because target type is 8-bit.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Fixes commit a9a82d557c ("llext: use elf_rela_t instead of elf_rel_t")
Also switch sign of (unused?) `r_addend` to unsigned.
https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.reloc.html
Issue found thanks to the following warnings when compiling in 64bits:
```
/__w/zephyr/zephyr/include/zephyr/llext/elf.h:349:29: error:
right shift count >= width of type [-Werror=shift-count-overflow]
349 | #define ELF64_R_SYM(i) ((i) >> 32)
```
The name `elf64_word` was admittedly confusing.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Note `elf64_addr` and friends are defined as uint64_t which is defined
as `long long unsigned` which is for some reason different from
`size_t`. So they all require a cast.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
With recently introduced DNS retransmission mechanism, a certain bug
could occur when calculating query timeout.
If the time until the final DNS timeout (as indicated by
CONFIG_NET_SOCKETS_DNS_TIMEOUT) was less than 1 millisecond, the actual
millisecond timeout value was rounded down, resulting in 0 ms timeout.
This in order was interpreted as invalid argument by dns_get_addr_info()
function, so in result, instead of reporting query timeout, the function
reported invalid argument error.
Fix this by rounding the millisecond timeout up, instead of down, so
that in any case, if the final timeout is not due, we always provide
non-zero timeout to dns_get_addr_info().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When the broadcast sink is stopped, the sink was also
set to NULL via
default_broadcast_sink.bap_sink = NULL;
However the lifetime of the broadcast sink does not
follow the state of the streams, and it still exists
afterwards. The broadcast sink can only be terminated
(deleted) via the term_broadcast_sink command.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds the CAP Commander Change Microphone Gain procedure.
This procedure changes the microphone gain on one or more
CAP Acceptors.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Two places we did not have an error check from calling
bt_bap_ep_get_info before accessing the result. These
have simply been added (without an else), as they are
(very) unlikely to fail.
This was caught by coverity and thus fixes those
coverity issues.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Currently, the upper layer cannot know
whether the data is successfully sent
through DLC.
Add a field "sent" for RFCOMM DLC ops.
Notify upper-layer of the sending
result through the field "sent".
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add structured logging support to syslog backend. This means
that meta data can be included to logging output.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to configure the syslog net backend to use TCP
instead of UDP. The syslog server address for TCP needs to
have "tcp://" URI in front of the address, for example the
tcp://192.0.2.2 server address would use TCP as a transport.
If there is no URI, then UDP would be used by default.
See the relevant RFC at https://www.rfc-editor.org/rfc/rfc6587
for details.
Fixes#66728
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Current TELNET implementation wrongly assumed that if the command is
present, it will always be included at the beginning of the packet/data
buffer. Such assumptions however are not valid for STREAM sockets,
where the actual stream data could be fragmented in any way.
Therefore, the command parsing needed rework, so that we analyze each
byte received for the command escape code, and once received we enter
"command parsing" mode. Once no more commands are identified in a data
streak, the command bytes are removed from the data buffer before the
buffer is provided to the shell subsystem for processing.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Rework TELNET shell backend to use socket API for communication and
socket service library for socket monitoring.
Additionally, rework the TX part so that non-blocking TX is used when
sending from the system work queue. In case transfer is not possible at
the moment, the TX work is rescheduled instead of blocking the system
work queue.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Socket service pollfd count should not exceed the configured
NET_SOCKETS_POLL_MAX limit, as poll() will not be able to monitor
sockets beyond that limit anyway. Adding +1 there prevented the library
from catching the configuration error.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
By default `GDBSTUB_SERIAL_BACKEND` will be selected as it's the only
option here. This can cause problems for code that wants to provide its
own custom backend. Add a choice for a custom backend.
Signed-off-by: Robert Zieba <robertzieba@google.com>
Remove redundant depends on statements for SEGGER_SYSTEMVIEW.
This is already inside an if SEGGER_SYSTEMVIEW so depends on are
already added.
Signed-off-by: Joakim Andersson <joakim.andersson@heimdallpower.com>
The fix is to check if any of the adv set's rpa expired
callback returns false, then all adv sets continues with
the old RPA.
Note: Fix is applicable only to adv sets which shares the
same id.
Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
Commit adds const qualifier to models metadata.
Specification claims: Composition Metadata Page 0
shall not change during a term of a node on the network.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Codecs can be printed at different levels:
level 0: Generic and unicast
level 1: subgroup codec configs
level 2: BIS codec configs
This commit ensures that the indentation level
is correctly increase based on where the codec configuration
data is printed.
This also updates the documentation for the BAP shell.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
print_codec_cfg and print_codec_cap has been modified to print the
codec metadata in a more human-readable way, so it is easier to read.
This also adds the (final) human readable support when
parsing and printing BASEs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
print_codec_cfg has been modified to print the codec configs in a more
human-readable way, so it is easier to read.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
print_codec_cap has been modified to print the remote caps in a more
human-readable way, so it is easier to read and understand the remote
server's capabilities.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the broadcast_sink_streams to be an array of shell_stream
instead of bt_bap_stream, so that it can be used in a similar way
as the rest of the streams.
To help the transition, a new helper function,
bap_stream_from_shell_stream, was added.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add additional logging in past_available to easily see the PAST
support of the broadcast assistant and scan delegator devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function did not have a NULL check for the parameters,
and thus did not fail correctly on invalid input.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The simple test is there to test the API and simple extensions in
unison. Hello world was intended to be the first not the only extension
being tested.
Also refactors the entry thread to allow for usermode potentially by
passing the pointer to the function symbol rather than having it look it
up directly.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
When we receive the subnet mask option from the server, we
cannot yet set the netmask to the network interface as the
mask is tied to the IP address we received from the server.
We need to delay the setting of netmask until we have added
the requested IP address to the interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Adds a function to set the syslog server ip with a struct sockaddr,
so that it can be set without a string.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
In case the LL address is not set on a packet for any reason, don't try
to access address structure to determine packet type.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Shell stack size is too low for OpenThread without joiner
functionality, causing overflow.
In this commit, the value of stack size is not changed.
Incorrect assigning of value for opentrhead with
no joiner functionality has been removed.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
A few paths used only when there is Coded Phy support were
still setting the subscribe registers directly.
Let's use the nRFx HAL for this so it works properly also
in simulation.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Quite a few paths used only when there is Coded Phy
support were still setting the PPI directly.
Let's use the nRFx HAL for this so it works properly also
in simulation.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
In case the same callback handler is added to the list twice, this can
result in a loop.
Fixes: #69825.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
In iperf2, for multicast data, if it is a client, it will not wait for
the server's AckFIN packet. Because the iperf2 server will not send an
AckFIN packet.
So in zperf_upload_fin(), an error will occur when the zperf client
waits for the server's AckFIN packet.
Multicast only send the negative sequence number packet and doesn't
wait for a server ack can fix this issue.
Signed-off-by: Gang Li <gang.li_1@nxp.com>
During manual testing with UBSAN enabled, it was found that
bt_le_per_adv_sync_cb synced() callback in application
sometimes gets unexpected different values in
`sync_info.recv_enabled` field.
The UBSAN output contained the following warnings message:
runtime error:
load of value 65, which is not a valid value for type '_Bool'
It tunrned out that struct bt_le_per_adv_sync_synced_info sync_info
inside bt_hci_le_past_received_common() contains uninitialized
recv_enabled member.
Set it to true by default to avoid possible issues.
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
Update all usages of the MBOX API to the latest API changes (to be
squashed for bisectability).
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Invalid values should result in BT_HCI_ERR_INVALID_PARAM
The interval check should only fail with
BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL if the requested range
cannot be fulfilled by the controller (ie. there is no overlap
with the supported range)
Fixes EBQ tests HCI/DDI/BI-53-C through HCI/DDI/BI-61-C and
HCI/CCO/BI-64-C
Signed-off-by: Troels Nilsson <trnn@demant.com>
Some pieces of code were missing proper guards for Kconfig
values, which could cause compile issues
The massive amount of #if in bap.c clearly indicates that the
file should be split, as it contains many things that are specific
for various roles.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
While refactoring the handling of callbacks the setting of past_avail
status got deleted (and it was in the wrong place). Adding it back at
the correct place.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The existing implementation allows for only one callback per procedure.
This creates problems when for example adding CAP functionality.
The callbacks are here implemented as an SLIST
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Out-of-tree controllers do not necessarily mark the LE Set Host Feature
command as experimantal.
Add an additional entry to solve this like done for other ISO entries.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Add support for vendor specific Set Scan Request Reports command and
Scan Request Received Event, available for legacy advertising.
Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
The header file l2cap_interface.h has been included by
tests/bsim/bluetooth/host/* cases.
To avoid potential issue, include full path of header
l2cap_br_interface.h in file l2cap_interface.h.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
`att_req_send_process` is not thread safe.
In the case where the current context is pre-emptible (e.g. when a user
sends something over GATT from the main thread):
The iterator in `att_req_send_process` can get interrupted mid-processing,
breaking the logic and resulting in an assert/crash/data corruption.
Additionally, the connection state check in this fn is also not
thread-safe, the RX thread could pre-empt us and disconnect right before
we attempt to send on an ATT bearer that is on it.
This is a hotfix until we have a generalized solution for the host API
surface. It seems a lot of our logic assumes cooperative priority.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
We shouldn't be calling hooks from optional and upper layer subsystems
in the kernel, instead, just call the hook to set thread status in the
API where it is needed.
This now clears related bit in cmsis thread status bitarray when
terminating a thread in the cmsis rtos v1 layer directly and not in the
kenrel code.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit increases the default value of `ZTEST_TEST_DELAY_MS` from 3000
to 5000 milliseconds because the current value of 3000ms may not be
sufficient for the hosts with lower CPU clock frequency (e.g. new Zephyr CI
runners with cost-effective processors).
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The count stack variable is also used when CONFIG_NET_L2_ETHERNET_MGMT is
enabled. Make sure it is available.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Introduce a current state of Host Command subsystem.
It makes sures that a backend has been initilized and doesn't allow
sending a response twice. There is a possibility, that a command handler
that calls ec_host_cmd_send_response function returns anyway (which is a
mistake).
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
If getaddrinfo() is called with a long DNS timeout, then split
the timeout to smaller pieces with exponential backoff. Reason
for this is that if a DNS query is lost, then we do not need
to wait for a long time to find it out.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add option to not generate the logging dictionary database when the
zephyr finale image is created. Instead this database can be created
by its own build target.
This reduces the build time during debugging as the database file is not
required as part of the debugging.
Fix build byproducts not listing the output file.
Add comment so users know which command is executing as this command
can take a long time.
Signed-off-by: Joakim Andersson <joakim.andersson@heimdallpower.com>
DFD Server, DFU Server, and DFU Client models are extended models
that extend other underlaying models. If BT_MESH_MODEL_EXTENSIONS
is not enabled, extension hierarchy is not initialized and this
results in issues in subscriptions and errors in representation
of hierarchy in CDP1. Since extensions are spec defined, force
selection of this option here to prevent users forgetting about it.
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Fixes issue where it is possible to store the same appkey
multiple times in CDB implementation.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
DTLS socket should be able to combine more than one message into a
single datagram when calling sendmsg().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The original packet's link-layer destination and source address can be
stored in separately allocated memory. This allocated memory can be
placed just after pkt data buffers.
In case when `net_pkt_find_offset()` uses condition:
`if (buf->data <= ptr && ptr <= (buf->data + buf->len)) {`
the offset is set outside the packet's buffer and the function returns
incorrect offset instead of error code.
Finally the offset is used to set ll address in cloned packet, and
this can have unexpected behavior (e.g. crash when cursor will be set
to empty memory).
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
In certain scenarios, it may be necessary to get values of additional
options from the application layer. With this patch, this can be
accomplished by registering a callback with the DHCP client.
This change has been tested using the posix build in qemu.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Nearly all other code places for k_thread_entry_t also keep
unused params in place to stay compatible with k_thread_entry_t.
Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
Fixes two bugs:
* When a notify is executed before any observers are added, the age is
incremented from 0 to 1. When an observer is registered, the age is not 0
as expected, causing the age to be 1 instead of the expected 2
* The check if a message is newer than the last received one is described
in RFC7641, section 3.4. Simply incrementing age will not comply to what
the RFC describes once the value wraps around. This is now fixed
Signed-off-by: Sibert Declercq <sibert.declercq@basalte.be>
SEGGER_SYSVIEW_RecordU32 function takes only two parameters,
SEGGER_SYSVIEW_RecordU32x2 should be used instead.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Replace the use of a memcmp of a temp buffer filled with
the comparison value with a direct comparison of
the read buffer contents.
Improves speed of the function (no more memset() call)
and reduces stack usage.
Signed-off-by: Mike J. Chen <mjchen@google.com>
The added configuration files allow the sample to be run
on the nRF52840 present on the nRF9160 DK with the nRF9160
(running SLM) being the modem and communication happening
through pins that are routed internally between the two.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This was part of the mega hwmv2 commit. Looks like hpet drivers heavily
relies on soc.h. Reverting this for now while we look for a proper fix
and remove reliance on soc.h for drivers.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Added missing condition to check if log backend is configured before
calling the function: z_shell_log_backend_disable. Without this, in some
configurations, a compilation error appeared due to calling a
non-existent function.
Fixes: #69555
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
The dlc->session is invalid in the callback
hfp_hf_disconnected. The behavior of obtaining
an ACL connection handle through an invalid
pointer is unknown.
Add a field "struct bt_conn *acl" to "struct
bt_hfp_hf". Save acl connect handle to "struct
bt_hfp_hf::acl" in function bt_hfp_hf_accept.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Similar to the can_send, the can_recv field indicates whether
or not this endpoint can receive data.
This commit also slightly refactors and optimized how the
can_send field is set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For dev key encrypiton, BT_MESH_KEY_DEV_REMOTE should be used instead of
BT_MESH_KEY_DEV regardless of whether the destination is a local element
or remote.
BT_MESH_MSG_CTX_INIT_DEV macro selects correct key.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
There is an Kconfig option which results in RO string locations
being appended to the cbprintf package of a log message. Option was
not correctly handled, especially optimized API which was recently
added did not support that. Restoring support.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The FICR is also modelled in simulation, but changing this
conditional compile was forgotten, so it was only being
built for real HW.
A test had provided its own version of this function so it would
avoid a runtime warning due to the lack of static address. But
this needs to be removed as it conflicts with the function
provided now always by the nordic controller SW.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Move the nordic and openisa vendor file under ll_sw and add them back to
the list when building for nRF platforms, this was inadvertently removed
in
7bd2804c24 Bluetooth: Controller: Build vendor LLL as library
and is currently causing a:
<wrn> bt_id: No static addresses stored in controller
and random address on nRF devices.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Convert various networking subsystem files to use ARRAY_FOR_EACH
macro to make the looping more robust.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Convert various array loops in the net_if.c to use the
ARRAY_FOR_EACH() macro. This makes the code more robust
as we do not need to keep track of the separate define
that tells the array size.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit deprecates these legacy netmask get/set routines
net_if_ipv4_set_netmask()
net_if_ipv4_set_netmask_by_index()
net_if_ipv4_get_netmask()
as they do not work well if there are multiple IPv4 address
assigned to the network interface.
User should use these functions instead
net_if_ipv4_set_netmask_by_addr()
net_if_ipv4_set_netmask_by_addr_by_index()
net_if_ipv4_get_netmask_by_addr()
as they make sure the netmask it bound to correct IPv4 address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The netmask should be tied to the IPv4 address instead of being
global for the network interface.
If there is only one IPv4 address specified to the network interface,
nothing changes from user point of view. But if there are more than
one IPv4 address / network interface, the netmask must be specified
to each address separately.
This means that net_if_ipv4_get_netmask() and net_if_ipv4_set_netmask()
functions should not be used as they only work reliably if there is
only one IPv4 address in the network interface.
The new net_if_ipv4_get_netmask_by_addr() and
net_if_ipv4_set_netmask_by_addr() functions should be used as they make
sure that the netmask is tied to correct IPv4 address in the network
interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add 2 new Kconfig promptless options that are shorthand
for whether the ISO configuration can support RX and TX.
This also applies these new options as guards for existing
and missing code pieces.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Set a thread name for net conn_mgr, so that e.g. thread listings
within the shell are easier to look at.
Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
The work item for re-synchronization should be rescheduled immediately
after the periodicity is changed.
Calculation of the periodicity incl. jitter is moved to a dedicated
function so that it can be re-used.
Signed-off-by: Martin Jäger <martin@libre.solar>
Only the first resync transmission was sent out immediately because
the work item was rescheduled to the usual periodicity in the work
handler immediately after sending out the first transmission.
Signed-off-by: Martin Jäger <martin@libre.solar>
The emulator can be used for unit testing of LoRaWAN services.
It provides interfaces to send arbitrary messages to the LoRaWAN
stack and receive the response through callbacks without using
actual LoRa hardware.
Signed-off-by: Martin Jäger <martin@libre.solar>
When using the LC3 codec, all codec configuration are LTV encoded.
The broadcast source did not properly validate this, and it also
uncovered a bug in the bsim test for broadcast sources.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The codec configuration data from the BIS in the BASE was not
properly copied to the stream->codec_cfg, and thus it only
contained the subgroup codec configuration values.
This commit fixes that by first copying the subgroup codec
configuration to the stream, and then setting or overwriting
any fields (if they exist).
This requires that each stream have their own codec configuration
struct allocated, so this will slightly increase memory usage.
This also adds verification of the SDU size from the BIGInfo
in the ISO receive callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This is not used by anyone, and is unlikely to be useful actually.
Helps to save 4 bytes for each instance of struct net_nbr also (removing
a 2 bytes attributes, which was anyway generating a 4bytes loss due to
structure misalignment).
Removing relevant useless functions related to it as well.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
As noted in net_if.c:net_if_ipv6_addr_add() IPv6 ND needs MLD.
It is not selected during test, as the combination of ND without DAD/MLD
breaks (something to study/fix further it seems).
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Net MGMT uses layer identifiers that are meaningful only for itself, but
for users it requires a trivial operation to show the real layer value.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Net MGMT mask should be fully configured first, prior to be used to
initialize and add the callback.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
As for adding an ipv6 address, removing one should return the same error
code when the network interface is not found.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
It's an optional support, and it should not select it by default.
Improving information message in case such support is disabled.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
* Implement LL/IST/SNC/BV-01-C ISO Test Receive
* Refactor data structure for common code between CIS and BIS
Signed-off-by: Mads Winther-Jensen <mdwt@demant.com>
Introduce a backend for the Shell subsystem using a RPMsg endpoint.
This is useful for tooling & testing a remote processor from linux.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The zperf received or sent bytes length and duration are in 32bits,
if running long-duration zperf test more than 20min, the value will
overflow, and the test result is wrong. Change it to 64bits can fix
this issue.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
When the zperf command is called with '-S' option which means IP_TOS
for IPv4 and IPV6_TCLASS for IPv6, an error is printed and the
setting does not work. The socket option handling was changed by
commit 77e522a5a243('net: context: Refactor option setters'), but the
callers of option setters were not changed. This causes the IP_TOS
or IPV6_TCLASS option failed to set. The fix is to use uint8_t to
store the value of the -S option.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
The transfer byte order of SDP is big-endian.
The transaction ID(tid) should be big-endian before
sending.
And tid needs to be converted to CPU byte order
after receiving.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Allow the use of the NTP server address, set by
dhcpv4 option, by the net_init_clock_via_sntp function.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
It was an overlook to return 0 on TLS send() call, after detecting that
TLS session has been closed by peer, such a behavior is only valid for
recv(). Instead, an error should be returned.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Return error to the caller if no data was received or there
was some other error. Earlier we did not check the error
condition properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The cmd_sync_broadcast command now also takes an optional broadcast
code, to support syncing with encrypted broadcasts.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This allows to properly drop single CMUX frames that are
too big to fit in the receive buffer, keeping track of
where they end so that following frames are received
correctly regardless of the data contents.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The SOF delimiter byte may be omitted when a frame follows another
that just ended with that byte.
The parsing used to expect that second delimiter anyway,
which resulted in PPP frames going missing.
As an additional improvement, dropped bytes as well as the length
of received frames are now (debug) logged.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
modem_pipe_attach() can send events before returning, which could
provoke a crash as ppp->pipe, still NULL at that time, could be
used either in receiving (if the pipe had some data pending) or
in sending (if the PPP module had already been attached and had
some data to send in its transmit buffer).
ppp->pipe is now set before modem_pipe_attach().
Also, the ATTACHED_BIT is now set only after having actually attached.
And finally, the send_work is now scheduled on PIPE_EVENT_OPENED
so that data is flushed when the (closed) attached pipe is opened.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This makes the modem backends use the log level
set for the modem modules instead of the default one.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The default 512 bytes stack size is a bit tight for some architecture
and leads to samples running out of stack. Let's default to 1024 and let
the user tweak it down if necessary.
Suggested-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This makes it possible to set the minimum IPv6 packet size that
can be sent without fragmentation. The default value is 1280 bytes.
This commit allows user to set the IPv6 MTU value within reasonable
limits [1280, 1500].
Fixes#61587
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We select sockets service API in Kconfig but should select also
sockets API so that user does not need to set the sockets API separately.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The "net sockets" command did not print network management
socket information properly but claimed that the socket
was IPv4 one which it is not.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The net_mgmt socket does not support poll() or fcntl(), so
return EOPNOTSUPP error if user tries to use those functions
for AF_NET_MGMT type socket.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Build vendor LLL as separate library so that independent
compiler flags can be supplied if required.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add length checks local to the parsing function. This removes the need
for a separate data validation step.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Add bt_bap_base_subgroup_get_bis_indexes that gets the BIS indexes
of a subgroup. This work very similar to
bt_bap_base_get_bis_indexes, except that it works for subgroups
rather than BASEs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Check the value of net_dhcpv4_add_option_callback()
and net_dhcpv4_remove_option_callback() explicitly.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This ensures that the configured link address is
at least as big as the part of it that is used.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This commit allows to suspend the mesh stack from `bt_mesh_send_cb`
callbacks by removing the deadlock caused by `k_work_flush` in the
extended advertiser.
In case of the extended advertiser there are 2 cases:
- when the `bt_mesh_adv_disable` is called from any of `bt_mesh_send_cb`
callbacks which are called from the advertiser work item, or
- when it is called from any other context.
When it is called from `bt_mesh_send_cb` callbacks, since these
callbacks are called from the delayable work which is running on the
system workqueue, the advertiser can check the current context and its
work state. If the function is called from the advertiser work, it can
disable the advertising set straight away because all ble host APIs have
already been called in `adv_start` function. Before sending anything
else, the advertiser checks the `instance` value in `adv_start`
function, which is also reset to NULL in `bt_mesh_adv_disable` call, and
aborts all next advertisements. The `ADV_FLAG_SUSPENDING` tells the
advertiser work to abort processing while `bt_mesh_adv_disable` function
didn't finish stopping advertising set. This can happen if the work has
been already scheduled and the schedler ran it while sleeping inside
the `bt_le_ext_adv_stop` or `bt_le_ext_adv_disable` functions.
When `bt_mesh_adv_disable` is called from any other context or from the
system workqueue but not from the advertiser work, then `k_work_flush`
can be called safely as it won't cause any deadlocks.
The `adv_sent` function is inside the `bt_mesh_adv_disable` function to
schedule the advertiser work (`send_pending_adv`) and abort all pending
advertisements that have been already added to the pool.
In case of the legacy advertiser, if the `bt_mesh_adv_disable` is called
form the advertiser thread (this happens when it is called from
`bt_mesh_send_cb.start` or `bt_mesh_send_cb.end` callbacks), then
`k_thread_join` returns `-EDEADLK`. But the `enabled` flag is set to
false and the thread will abort the current advertisement and the
pending advertisements.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Issue:
When the setting nvs cache is disabled and `settings_nvs_save` is
called, the function reads all stored setting name entries from NVS
until either finds the desired setting name entry or reaches the last
stored setting name entry.
With the settings nvs cache enabled, `settings_nvs_save` runs through
the cached setting name entries first. If the cached entry matches with
the desired one, it immediately writes the new setting value to NVS
that corresponds to the cached setting name entry.
However, if the setting name entry is not found in the cache (which is
the case for a new entry), `settings_nvs_save` reads all stored setting
name entries from NVS again. This means that even if the number of
stored entries in the settings is less than the cache size, for each
new setting entry to be stored `settings_nvs_save` will first run
through the cache, then read all stored setting name entries from NVS
and only then will pick the next free name id for this new setting name
entry and will finally store the new setting entry.
This makes the cache ineffiсient for every new entry to be stored even
when the cache size is always able to keep all setting entries that will
be stored in NVS.
Use-case:
In the Bluetooth mesh there is a Replay Protection List which keeps
sequence numbers of all nodes it received messages from. The RPL is
stored persistently in NVS. The setting name entry is the source
address of the node and the setting value entry is the sequence number.
The common use case is when RPL is quite big (for example, 255 entries).
With the current settings nvs cache implementation, every time the node
stores a new RPL entry in settings (which is the first received message
from a particular source address), `settings_nvs_save` will always check
the cache first, then also read all stored entries in NVS and only then
will figure out that this is a new entry. With every new RPL entry to be
stored this search time increases. This behavior results in much worse
performance in comparison with when the corresponding entry was already
stored. E.g. on nRF52840, with bare minimal mesh stack configuration,
when the cache is bigger than number of stored entries or close to it,
storing of 255 RPL entries takes ~25 seconds. The time of subsequent
store of 255 RPL entires is ~2 seconds with the cache.
Solution:
This commit improves the behavior of the first write by bypassing the
reading from NVS if the following conditions are met:
1. `settings_nvs_load` was called,
2. the cache was not overflowed (bigger than the number of stored
entries).
As long as these 2 conditiones are met, it is safe to skip reading from
NVS, pick the next free name id and write the value immediately.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The command would attempt to parse the BASE and enter the
subgroup information in a NULL pointer.
The BASE copy was also done incorrectly, as it did not
properly take the UUID into account (which should be
moved to a helper function if we expect users to do this).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The shell currently prints out `: command not found` and
`Please specify a subcommand.` when invalid commands are
sent.
This can cause issues in certain situations, such as if a U-Boot
console in interactive mode is on the other end of the shell's
UART, where the U-Boot console will stop booting the device
if it receives any characters, and it will print out strings that
the shell then sees as commands. This causes the shell to send
out the messages above, preventing the device running
U-Boot on the other end from booting up.
I added the configurations
`CONFIG_SHELL_MSG_SPECIFY_SUBCOMMAND` and
`CONFIG_SHELL_MSG_CMD_NOT_FOUND` to allow disabling
these messages.
Signed-off-by: Brian Moran <brian.moran@sabantoag.com>
Replaced checks for
CONFIG_BT_ISO_UNICAST || CONFIG_BT_ISO_BROADCASTER with
CONFIG_BT_CONN_TX, as they are effectively the same.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit extends Zephyr's networking API to allow higher layers to
report on neighbor reachability.
Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
Apply ranges to DHCPv4 server timeout Kconfig options, so that it cannot
be set to a negative value by mistake.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case conflict is detected (either due to receiving Decline message or
due to ICMP probe getting reply), the conflicting address becomes
blocked for further use.
Although the RFC is not specific about how long should the address be
blocked, it make sense to implement some fallback mechanisms to reuse
blocked addresses in the server, otherwise, after longer period of
operation, it may run out of usable address.
This commit adds a timeout for declined addresses, so that by default
the address is marked back as "free" after 24 hrs (default lease time).
It also implements a mechanism, which allows to re-use the oldest
declined entry in case the server runs out of fresh addresses to assign.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Since PR, PR_SHELL, PR_ERROR, PR_INFO, and PR_WARNING already have
an embedded `sh` NULL check, we can remove the change from PR #68809.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
It is possible that the `sh` was not set before use.
This change adds a NULL check for `sh` in the following macros:
PR, PR_SHELL, PR_ERROR, PR_INFO, and PR_WARNING.
In case `sh` is NULL, the above macros will call `printk` instead.
Fixes#68793
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit renames a few variables and changes the
type and adds some additional checks.
It moves stream specific data to the shell stream
struct, but still keeps the global values that were used
to initialize the LC3 encoder
The purpose of this is to better allow for a future LC3 decoder
without any clashes in names or the like.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit adds tx power config options for nRF54Hx and nrf54Lx
SoCs, as well as the new radio defines.
Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
RPMsg currently sends four dummy bytes over the IPM when sending a
notification/interrupt to another CPU. However, most IPM drivers
support sending messages with no data transfer, and for some IPM
drivers, like the STM32 HSEM IPM driver, data transfer is not
possible at all, thus breaking compatibility. To fix this, send an
empty message with size 0 instead of a dummy message if the STM32
HSEM IPM driver is active.
Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
Using the `bap preset` command it is now possible to set all the
codec configuration data and metadata value at runtime. This will
allow to set specific values for each stream in each direction.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of the default presets being pointers, they are changed to
allocated structs so that they can be modified.
This will allow us to modify the config and metadata in a later patch.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit removes extra rescheduling in the extended advertiser after
the last advertising has been finished. This commit also removes the
`ADV_FLAG_SCHEDULED` flag as not needed anymore.
This extra rescheduling and the flag were needed to delay the next
advertisement by 20ms. Now, when the delay is removed the advertiser can
pick the next advertisement from the pool and push to the host right
away.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This patch allows selecting the combination of `CONFIG_BT_RECV_WORKQ_BT`
and `BT_LL_SW_SPLIT`. The implementation of `bt_recv_prio` is copied
from `hci_raw.c`. This ensures the order of packets is the same as when
the controller's `hci_driver.c` is off-chip and sends HCI over UART.
Without this patch, the Zephyr LL driver will duplicate some events on
behalf of `hci_core`. This duplication is not wanted when
`CONFIG_BT_RECV_WORKQ_BT=y`.
The above mentioned duplication is not sound and is evidenced in logged
warnings, e.g. in `tests/bsim/bluetooth/host/l2cap/stress` with
`CONFIG_BT_RECV_WORKQ_BT=y` logging "no transition".
This patch is a step towards the deprecation of
`CONFIG_BT_RECV_BLOCKING`. `CONFIG_BT_RECV_BLOCKING` is complicated and
tightly coupled to `hci_core`. In the future, removing
`CONFIG_BT_RECV_BLOCKING` will give a cleaner separation between
`hci_core` and the drivers and allow `hci_core` to evolve without
changes spilling out into the drivers.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The goal is to not access `buf` in the non-prio `hci_disconn_complete`
so that the buffer does not need to be retained.
This commit moves the copy of `conn->err` to the prio handler.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Fix CONFIG_BT_CTLR_TIFS_HW conditional compile by replacing
DPPI_PRESENT with CONFIG_BT_CTLR_TIFS_HW.
HAL_SW_SWITCH_TIMER_CLEAR_PPI can be same as
HAL_RADIO_END_TIME_CAPTURE_PPI, and this is ok as same
bit will be used to disable PPI/DPPI.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Always execute tx_notify from a single context. For sanity and ease of
debugging / observability.
The previous behavior was calling from BT_RX thread + system workqueue.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Changes include:
- Improving handling of frames for unconfigured DLCIs.
- Adding logs and outputting error codes in failure cases.
- Adding warnings to not reuse buffers.
- Fixing comments.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
In the function bt_l2cap_chan_set_state, BR
channel is treated as LE Chan.
The BR L2CAP channel state is updated
incorrectly.
Add a function bt_l2cap_br_chan_set_state
for BR L2CAP channel. For BR/EDR channel,
call bt_l2cap_br_chan_set_state directly.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In the scan delegator when adding a source, the state was not
marked as active before calling the PA sync callback, which
would prevent applications from requesting PAST in that callback.
This commit also adds and fixes a few log statements.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add traffic class priority custom option to customize traffic class
priority base for throughput performace.
Wi-Fi traffic performance depends on cooperation between net threads
and Wi-Fi driver threads. So we want traffic class threads priority
to be more flexible to fit more vendors.
Eg: when traffic class tx thread priority is higher than driver tx
thread, it will consume much more cpu time and send packets until driver
queue full.
When traffic class tx thread priority is lower than driver tx thread,
it will become serial transmition, also affecting throughput.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
This change reduces the memory footprint by changing the data type of
`valid_5g_chans_20mhz` from `uint16_t` to `uint8_t`.
Additionally, since the maximum channel number for 5GHz Wi-Fi is 177,
it can fit within the `uint8_t` range.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Add a command `net ipv4 gateway` that allows
setting IPv4 gateway for an interface from net shell.
Signed-off-by: Mateusz Karlic <mkarlic@antmicro.com>
Add CONFIG_NET_SOCKETS_DTLS_MAX_FRAGMENT_LENGTH for limiting
the Maximum Fragment Length (MFL) for DTLS with Mbed TLS.
This is needed when MBEDTLS_SSL_OUT_CONTENT_LEN and
MBEDTLS_SSL_IN_CONTENT_LEN are set to larger values than the MTU
of the network and IP fragmentation is not supported.
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
In current implementation, the upper is not notified when BR ACL
connection is established.
L2CAP does not know that ACL connection has been established.
All fixed channels will not be notified. Then The SDP server
cannot work properly.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
This flag indicates that only passive transmissions are allowed in that
channel for that regulatory domain.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Make sure that socket service is started earlier than
config library. This is enforced in config libs init.c
but set the default value here too.
The reason for this is that the config library might need
to start dhcpv4 server which needs socket service to work,
so the ordering is important here.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We must make sure that IPv6 configuration pointer is valid
so that the hop limit can be set for a given interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We must make sure that IPv4 configuration pointer is valid
so that the TTL can be set for a given interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
As the interface init function might configure the system
such a way that would affect the naming of the network
interface, we need to call the init before setting the name.
This is mostly needed by Wifi where the Wifi driver needs
to mark its network interface as Wifi interface as by default
the Wifi interface will look like Ethernet one.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Fix the dead lock between rx_q and tx_q thread.
When tx_q thread prepares to send ARP packet, it might get
the net_if_tx_lock in net_if_tx(), then in net_arp_prepare(),
it will try to get the arp_mutex.
At the same time, if the rx_q thread receives an ARP reply
packet, in arp_update(), it will get the arp_mutex first,
and flush the packets in arp pending_queue and try to get
the net_if_tx_lock. Then the dead lock occurs, two threads
stuck and all the packcets can't be freed.
In arp_update(), taking the net_if_tx_lock first then taking
the arp_mutex can fix this issue.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
The print_sirk function that simply logs the SIRK has been removed,
as the SIRK is now directly accessible to the application via the
get_sirk function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds the CAP Commander Change Volume mute procedure.
This procedure changes the volume mute on one or more
CAP Acceptors.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
CDP1 is mandatory to qualify a mesh device for mesh protocol v1.1.
The dependency on BT_MESH_MODEL_EXTENSIONS is removed because if a node
contains only base models (for example Generic OnOff Server), this API
will consume extra RAM bytes which won't be used.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the CONFIG_NET_SOCKETS_POLL_MAX is smaller than what is needed
for the socket service API to work properly, then we should not
start the service thread as the service API cannot work and might
cause memory overwrite in ctx.events[] array.
Fixes#69233
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This is obviously a copy & paste error. It was introduced by
107cb86bb3 (ztest: Add initial zexpect API
for delayed failing).
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
The LE Secure connection (LESC) mask also require encryption,
and some users have been using e.g. BT_GATT_PERM_READ_LESC
without BT_GATT_PERM_READ_ENCRYPT, and then the encryption
check in bt_gatt_check_perm was never properly applied.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There's not much to be done in case waking up the server thread with
socketpair send() fails, but at least we can log an error on such event
(to please coverity).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The shift is currently necessary due to a mismatch of the
specs and the API, but the shift should not be done when
the value is BT_BAP_BIS_SYNC_NO_PREF as that is a special value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the unicast_client_ep_notify we would always call
bt_gatt_get_mtu, regardless of whether data == NULL.
When there is a disconnection, the notify callbacks are
called with data == NULL to indicate a unsubscription.
In the case of the unicast client, this would also trigger
calls to bt_gatt_get_mtu when there is a disconnect, which
in turn would trigger a warning that ATT is not connected.
Postponing the call to bt_gatt_get_mtu fixes this.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This served no purpose for responces. The minimum MTU is sufficient for
all ATT headers.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
When EATT is enabled, bt_att_create_rsp_pdu used to reserve headroom for
the SDU header even when responding on the UATT bearer.
That subtracted from the room for the ATT payload in the buffers. The
remaining buffer size was insufficient to create a PDU of ATT MTU size,
since the exchanged local MTU is calculated the with the assumption that
the SDU header is not present.
This broke the ATT MTU promise, and e.g. our read response will have two
bytes fewer than promised. This caused a failure in PTS.
The new bt_att_create_rsp_pdu pays attention to the bearer type and only
allocates the SDU header on EATT bearers.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The unicast_stop command takes either "all" or one or more
stream pointers as argument, but the argument handler did
not allow this.
The documentation for the command was also out of date.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The context had a bug where if GMAP was enabled, the context
was only BT_AUDIO_CONTEXT_TYPE_GAME.
The context should also (per BAP spec requirement) contain the
BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED context.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix LLL ISO stream get by group to return stream context
sorted by CIS offset in ascending order.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The Broadcast Assistant API should be fully independent of the scan
delegator. Therefore the new struct bt_bap_bass_subgroup has been
defined to avoid a dependency.
Fixes: #68338
Signed-off-by: Ping Wang <pinw@demant.com>
Settings NVS adds entry into Settings NVS cache after writing it
into flash. Previously, the entry was added into cache only
on the second writing attempt that caused very huge timing
despite cache was enabled since it was still empty.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The warning should only apply for configurations where the
device may actually send ISO data (e.g. not the ISO sync receiver).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The Imax_abs value should be printed using %u instead of %d
as it can be large and should be printed as positive value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add COAP_RESPONSE_CODE_TOO_MANY_REQUESTS to coap_header_get_code(). CoAP
4.29 response code for "Too many requests" is defined in coap.h but was
missing from the list of cases, resulting in a 0 being returned instead
of the proper code.
Signed-off-by: Mike Szczys <mike@golioth.io>
The bt_iso_chan_send function could take an optional
timestamp by using 0 as an indicator. The issue with
this approach was that a timestamp value of 0 is valid,
and could cause potential issue with syncing streams
in a group.
To fully support transmitting with and without timestamp,
bt_iso_chan_send_ts has been introduced, which is the only
function of the two (bt_iso_chan_send being the other) that
supports timestamps.
A new function, rather than adding a boolean to the existing,
was chosen as it simplifies the individual functions as well
as making it more explicit what the function does.
Since the bt_iso_chan_send function is used by LE audio, both
the BAP and CAP send functions have similarly been updated.
Likewise, all tests and samples have been updated to use the
updated function(s), and BT_ISO_TIMESTAMP_NONE has been
removed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The calculation for BASE_SUBGROUP_MAX_COUNT was off by one.
The macro did not consider the non-subgroup parameters of
the BASE that take up space. This effectively modifies
BASE_SUBGROUP_MAX_COUNT to be 24 instead of 25.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
By default variable context.sh is set to NULL. If any net_mgmt
event will be called when the variable has default value, there
will be a system exception.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Currently, the only thread-safe part of the IPv6 Neighbor processing
implementation are stale_counter related operation.
Fix this, by extending the mutex protection over all of the module, so
that message handlers, timers and API functions do not interfere with
each other.
As IPv6 Neighbor cache is tightly coupled with the Routing module, use
the same mutex to protect both, neighbor and routing tables, to prevent
deadlocks.
Also, replace the semaphore used with a mutex, as it seems more fit for
this particular job.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Disable randomization at the access layer in the Remote Provisioning
server when sending Link Stauts message as a responce on Link Close
message and then sending Link Report message right after it. Because of
the randomization, the report message is sent before the status message
which makes MESH/SR/RPR/PDU/BV-03-C test to fail.
This fixes MESH/SR/RPR/PDU/BV-03-C test.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Disable randomization in the access layer when cancelling update in the
distribution server model. This is needed because the server sends 2
messages in a row and the gets reordered by the access layer
randomization feature making DFU/SR/FD/BV-43-C test to fail.
This fixes DFU/SR/FD/BV-43-C test.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
It is unclear from a cursory glance at the code what the caller of
`send_buf(buf)` should do with `buf` based on the returned error codes.
Document when ownership is and isn't transferred to `send_buf()`.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Verify the connection is active before popping the buffer from the TX
queue.
The current behavior enables a race condition between `create_frag` and
the connection being torn down, as `buf` can be popped from the TX queue
but not destroyed by `bt_conn_process_tx`.
In that case, `buf` will be leaked.
Original analysis and fix proposal by @watsug.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Reported-by: Adam Augustyn<watsug@gmail.com>
This commit implements simple rate-limiting for Neighbor Reachability
Hints in TCP module to prevent the potentially costly process of
frequent neighbor searches in the table, enhancing system performance.
Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
Multiple CDC ACM instances can block each other because there are only
buffers for a single instance. Fix this by configuring the number of
buffers in the pool based on the number of CDC ACM instances.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Changed poll to perform incoming data check with connected
DTLS connections. This allows the CONFIG_NET_SOCKETS_DTLS_TIMEOUT
to timeout the connections to server socket if there is no
incoming data.
Previously, if the remote client closed the DTLS connection without
close notify, the timeout of the ongoing connection only happened
when next connection was taken to the server socket. Depending on
the timeouts, this could prevent the next connection from succeeding.
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
Once an ISO channel has connected, the sequence number
always starts at 0. This reset was missing in the implementation,
and the _prev_seq_num from a previous connection may have
been kept.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Before a LL_FEATURE_REQ is sent, verify that the Data Length Update
procedure is still supported as it could have been unmasked as the result
of a previously completed Feature Exchange procedure.
Add unit test to verify the case of enqueuing both a
Feature Exchange procedure and Data Length Update procedure, where the
Feature Exchange procedure would result in the unmasking of the Data
Length Update procedure.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
Resume the TX Data Q when a LL_UNKNOWN_RSP is recieved instead of a
LL_PHY_RSP.
Update PHY Update unit test with more coverage of the TX Data Q pause
state.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
This will warn if any of the mesh module will try to send anything while
the stack is suspended. Not clear what to do here as both advertisers
(legacy and ext) behaves differently. The legacy advertiser has a
thread which is stopped after the `bt_mesh_adv_disable` call and any
sent advs after suspending the stack will stay in the pool until the
advertiser is resumed. The extended advertiser will schedule its work,
but then fail because `ext_adv->instance` value is NULL, but will call
`bt_mesh_send_cb.start` with error `-ENODEV`. What to do with these 2
behaviors is unclear at the moment. Ideally none of the mesh stack
modules should call `bt_mesh_adv_send` after the stack was suspended, so
if this warning appears, the faulty module wasn't stopped properly and
this should be fixed. If not to add the adv to the pool, then it kind
of gets lost as the implementation probably expects one
of `bt_mesh_send_cb` callbacks which will never be called. Leaving the
warning until clear customer request comes.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
WIFI scan result shows junk character in SSID because of
the length of ssid is maximum(32 character) which leads
to buffer overflow. It required one character for null
terminator ‘\0’.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
During local testing with UBSAN enabled, warning was reported:
bluetooth/host/l2cap.c:980:25: runtime error: member access
within null pointer of type 'struct k_work_q'
It turned out that le_chan->rtx_work.queue can be NULL.
Since null-pointer dereference is a UB, additional check
was added to ensure we don't access
`le_chan->rtx_work.queue->thread` when
`le_chan->rtx_work.queue == NULL`
The same changes applied to l2cap_br.c
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
During local testing with UBSAN enabled, warning was reported:
bluetooth/host/iso.c:237:2: runtime error: null pointer passed
as argument 2, which is declared to never be null
It turned out that when datapath doesn't contain
codec information, cc_len is 0 and cc is NULL
In order to avoid UB,
now we call memcpy only when cp->codec_config_len > 0
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
during local testling, UBSAN reported the following warnings:
- bluetooth/host/adv.c:2067:19: runtime error: shift exponent
255 is too large for 32-bit type 'long unsigned int'
- bluetooth/host/scan.c:828:18: runtime error: shift exponent
255 is too large for 32-bit type 'long unsigned int'
It turned out that we can't use BIT() macro directly on
bt_hci_evt_le_per_advertising_report::cte_type field.
According to Core Spec, `cte_type = 0xFF` corresponds
to `No contstant tone extension`.
Added separate function to convert CTE bit field from
HCI format to bt_df_cte_type
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
If `CONFIG_BT_MESH_GATT_SERVER` is disabled or the advertising set
doesn't support proxy adv, the solicitation PDU will not be sent.
However, solicitation PDU transmission doesn't depend on the proxy
feature of the device it sends. Therefore, solicatation PDU should be
sent regradless of `CONFIG_BT_MESH_GATT_SERVER` option and advertiser
tag.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Removed the "operation" infix from the bt_gatt_authorization_cb
callback structure in the Bluetooth GATT header.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Trigger erasing solicitation settings before calling
`bt_mesh_settings_store_pending` and `bt_mesh_prov.reset` callback.
The `bt_mesh_settings_store_pending` flushes every settings that is
pending to be erased. The `bt_mesh_prov.reset` callback must be called
as the last step because a user is free to do anything from this
callback including rebooting or reprovisioning the device.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add warning that file opened without R/W flags will have no read/write
access.
Remove suggestion for using fs_open to check if file exists.
Clarify -ENOENT return reason.
Fixes#64030
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Previously the boot_write_img_confirmed() function used the MCUboot
public API function boot_set_confirmed(), but this function is hardcoded
to set the confirmed flag of slot 0. This works for MCUboot swap modes
but not for Direct XIP, where applications can execute out of secondary
slots.
This commit changes boot_write_img_confirmed() to instead use
boot_set_next() which sets the confirmed flag for a given flash area
and works with Direct XIP.
DT_CHOSEN(zephyr_code_partition) is used to get the current partition.
The zephyr,code-partition chosen node must be defined.
This commit also adds the zephyr,code-partition chosen node to the
native_sim devicetree to allow the tests under tests/subsys/dfu to
build for this target.
Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
This patch modifies the way SHELL_BACKEND_SERIAL_API_ASYNC is selected.
The current logic causes conflicts (no console output) when the user tries
to use one of the UARTs in async mode, by setting CONFIG_SHELL_ASYNC_API,
while using Shell with a different UART (typically the Console's one).
Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
The work item will attempt to dereference pointers that have been nulled
by the backend.
To avoid that, wait until all items currently on the queue have been
processed.
The symptom is a busfault on ARM, and is "fixed" by adding a
`k_msleep(1)` right before `ipc_service_deregister_endpoint()`. This
will in effect do the same thing as this patch, and allow the scheduler
to run the work item on the ipc workqueue.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Previously, there was no way to determine maximum number of bytes
that can be allocated using only net_buf structure. This commit
introduces such field.
Moreover, this commit fixes an issue where allocation of less than
maximum number of bytes from a fixed buffer pool would set buffer's
size to this number instead of the whole buffer size.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Move the check of PM_DEVICE_FLAG_RUNTIME_ENABLED to the beginning of
the function. With this we avoid taking/release the semaphore and also
we no longer need check it in runtime_enable_sync(), because it was
already checked in pm_device_runtime_enable().
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Move around SYS_PORT_FUNC_ENTER and change a early return
in a way that when this function is called it will generate
tracing for entering / leaving this function.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Move the check of PM_DEVICE_FLAG_RUNTIME_ENABLED to the beginning of
the function. With this we avoid taking/release the semaphore and also
we no longer need check it in runtime_disable_sync(), because it was
already checked in pm_device_runtime_disable().
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Move around SYS_PORT_FUNC_ENTER and change a early return
in a way that when this function is called it will generate
tracing for entering / leaving this function.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Since we may go from enabling to qos-configured state if the
call to bt_iso_big_create fails, that is a valid transition.
If bt_iso_big_create currently fails, then the source ends in a
state where it cannot be recovered.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When CONFIG_BT_ISO_TEST_PARAMS is enabled then the
bt_bap_broadcast_source_param in
bt_cap_initiator_broadcast_audio_create had uninitialized values.
A general and future proof solution for this is to simply initialize
the entire struct to 0.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Include the full version in the output of the "kernel version" shell
subcommand. Previously, EXTRAVERSION was not included, causing
e.g. "3.6.0-rc1" to be printed as "3.6.0".
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Modifies two log statements so that it is clear whether it
is failing to validate broadcast or unicast PDU sizes.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the broadcast assistant commands that take the PA sync argument
so that it is treated as a bool. This allows users to use
"true", "on", "1" or "0x01" for true values and "false", "off", "0"
for false values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Advertising data has to be truncated at a PDU boundary
Similar to earlier fix for extended advertising reports
Found in several EBQ tests, including LL/DDI/SCN/BV-25-C,
LL/DDI/SCN/BV-21-C and LL/DDI/SCN/BV-46-C
Signed-off-by: Troels Nilsson <trnn@demant.com>
The SCO cannot be created if the eSCO is unsupported.
It is caused by the packet type cannot be set
correctly.
Set valid bitmap for SCO and eSCO packet type in
command "Accept Synchronous Connection Request".
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In the update_recv_state_base function, we should update the
BASE with any new metadata that we have received (as that may
change while streaming). However, this function did not properly
keep the existing bis_sync values for the
subgroups, causing the bis_sync for all subgroups to be 0.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The receive state may be added by the broadcast sink if not added
by the application, but even in that case when the broadcast sink
is deleted, we should not remove the receive state, as the receive
state may still container information about the PA sync that has a
lifetime not coupled with the broadcast sink.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the receive state is locally removed, then we should not
request permission from the application, as that is implicit
when removing the source locally.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The defines from the Bluetooth Audio assigned numbers are not
specific for LC3. This commit removes the LC3 infix and
the reference to LC3 in the documentation for them.
It also cleans up some of the documentation and
names of the enums.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some places VCP accessed AICS and VOCS when it was not supported.
Also modify existing guards to be consistent with new guards.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The VCP and MICP instances should use their respective
AICS and VOCS Kconfig options, rather than the overall
Kconfig options.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the parameters for bt_cap_initiator_unicast_audio_stop
so that they are more similar to
bt_cap_initiator_unicast_audio_start.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the parameters for bt_cap_initiator_unicast_audio_update
so that they are more similar to
bt_cap_initiator_unicast_audio_start.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
As defined in IEEE802.1AS-2020 ch. 10.2.12.2.1, the port identity
of an MDSyncSend structure sent from a port shall be set to the
port identity of the sending port according to and ch. 8.5.2.
This commit replaces the port identity before forwarding a sync.
Fixes#68385
Signed-off-by: Manuel Schappacher <manuel.schappacher@hs-offenburg.de>
This commit updates nordic lll controller to use
IRQ_DIRECT_CONNECT where applicable instead of
using IRQ_CONNECT with ISR_FLAG_DIRECT.
Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
Sets up memory partitions and allows for the partitions to be added to a
memory domain after loading an extension. This allows for applying
memory protection attributes to all of the needed memory regions an
extension requires to execute code correctly.
Currently only works when usermode is enabled as otherwise memory
protection APIs are unavailable.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
clangd like to automatically add include directives, this one slipped by
and made its way in the tree. Remove it.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
If recvmsg() does not update control data, then it must
set msg_controllen length to 0 so that the caller can
understand this.
Fixes#68352
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
In case zperf session was aborted by the user (by for instance stopping
it from shell), or practically in case of any other
communication-related error, the zperf session could end up in a state
other than NULL or COMPLETED, with no way to recover. This made the
session no longer usable and eventually could lead to zperf being not
able to start a new session anymore.
Fix this by introducing zperf_session_reset() function, which resets the
session state back to defaults. The function is called when the zperf
receiver service is stopped.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The issues found for UDP receiver were also identified for TCP receiver,
this commit applies practically the same set of changes as in case of
UDP.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit fixes restarting of UDP receiver service, along with some
other minor cleanups:
* The core issue was udp_server_running flag not being cleared when
service was stopped. Fix this by introducing udp_receiver_cleanup()
which does all of the required cleanups when receiver service is
stopped. The function is called either when the application stopped
the service with zperf_udp_download_stop(), or when the service was
stopped due to error.
* net_socket_service_unregister() was not called on
zperf_udp_download_stop(), but only from the service callback - that
would not work in case there's no active communication.
* at the same time, net_socket_service_unregister() would be called from
the service callback in case of errors. Fix this, by making
udp_recv_data() only return an error, and let the service callback to
do the cleanup.
* Remove no longer used udp_server_run semaphore
* Remove udp_server_stop - with socket services it seems no longer
needed.
* zperf_udp_receiver_init() now returns an error, so that we don't
mark the service as running in case of socket/services error.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add sockaddr member in struct net_pkt to store peer address if offloaded
network inteface is used. This enables recvfrom() to fill in src_addr if
socket type is UDP and offloaded interface driver supports it.
Signed-off-by: John Johnson <john.filip.johnson@gmail.com>
The LE Audio implementations do not really support bonding yet,
and removing subs on disconnect is the most effective (and correct)
way of ensuring that we do not subscribe more than once when we
re-discover after reconnection.
The broadcast assistant and the media control client does not
support multiple connections as of this commit, so they needed
special treatment. In the case that we do discovery on multiple
ACL connections, it is important that the existing subscriptions
are removed correctly by calling bt_gatt_unsubscribe.
In order to implement this change properly on some of the clients,
thet had no proper connection references or support
for clearing the data on disconnects, they had to be updated
as well.
The csip_notify.sh test has been disabled, as that expected a
notification in the client, but since this commit removes that
(until bonding is properly supported in the clients), then the
test will fail.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Several places the LE Audio clients called bt_gatt_subscribe without
checking the return value, which could cause some issues in the worst
case, and in the best case, cause some unexpected behavior.
Some implementations had a bit more updating to handle the new
behavior.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The user data size of hfp tx pool is zero.
There is not enough space to put tx_mate.
Use CONFIG_BT_CONN_TX_USER_DATA_SIZE to
set data size of hfp tx pool.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Fix Periodic Advertising Synchronization leading to
Peripheral ACL connection supervision timeout, due to
direction finding related radio hardware registers being
updated in the implementation that is not built for
direction finding feature support.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Enfore a range for BT_CTLR_ADV_AUX_SYNC_OFFSET such that
it does not take negative integer values.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix MFIFO_DEFINE to reduce FLASH usage by moving the pool
outside the struct that is static initialized.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing call to ull_chan_reset(), this fixes
uninitialized channel map being used after LL reset.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This change makes the optional procedures in the Media Control Client
optional and configurable through Kconfig.
Signed-off-by: Ping Wang <pinw@demant.com>
DHCPv4 server will send an ICMP probe (echo request) for the requested
address before replying with DHCP Offer, unless probing is disabled in
Kconfig.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The description for BT_BAP_SCAN_DELEGATOR_BUF_TIMEOUT is a bit misleading.
Rewriting this to be more accurate
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Convert the network log backend to use socket API instead of
net_context API. This allows the backend to be used also
with socket offloading network drivers.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
[Description]
tests: shell: Restart bt will register the same connection callback twice.
Callback next node point to itself, when link established callback function
loop infinitely.
[Fix]
Unregister the previous callback to avoid register repeatedly.
[Test]
After bt init/disable times, create connection successfully.
Signed-off-by: huajiang zheng <huajiang.zheng@nxp.com>
- Which allow listeners to attempt to use the freed connection object to
perform actions as e.g: start connectable advertisements.
- Refactored bt_conn_unref() so it does not access conn struct after
decrementing its reference count.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Introduce new USB Audio 2 implementation written from scratch. Main goal
behind new implementation was to perform entity configuration with
devicetree bindings, hiding the descriptor complexity from application.
Initial implementation is working at Full-Speed only. High-Speed support
will come later, but even at Full-Speed only this is viable replacement
for old stack USB Audio 1 class (USB Audio 1 is limited to Full-Speed by
specification, i.e. it is explicitly forbidden for USB Audio 1 device to
work at High-Speed).
Implemented is only absolute minimum set of features required for basic
implicit and explicit feedback samples. Only one sample frequency is
currently supported. Optional interrupt notifications are not supported.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Start of Frame is not relevant for most classes, but it is crucial for
isochronous operation. The most prominent example where SOF is necessary
is USB Audio class.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
In many cases suspending or resuming of a device is limited to
just a few register writes. Current solution assumes that those
operations may be blocking, asynchronous and take a lot of time.
Due to this assumption runtime PM API cannot be effectively used
from the interrupt context. Zephyr has few driver APIs which
can be used from an interrupt context and now use of runtime PM
is limited in those cases.
Patch introduces a new type of PM device - synchronous PM. If
device is specified as capable of synchronous PM operations then
device runtime getting and putting is executed in the critical
section. In that case, runtime API can be used from an interrupt
context. Additionally, this approach reduces RAM needed for
PM device (104 -> 20 bytes of RAM on ARM Cortex-M).
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
In the scan delegator when modifying the source we only want to
send a sync request to the upper layers if we are not yet synced,
and not also on a state change
Note that without this change the babblesim test for long writes
will fail
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Scan del bugfix
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Add support for sending long notifications, coming
from a long read, back to the application
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Make sure that buffers are large enough and add
semaphores so that we can do long reads
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
usbh_req_desc() truncates the descriptor id. This problem is most
visible with string descriptor requests, as only then can wIndex be
greater than 0xFF. In particular, this affects commonly used language
IDs such as English (United States), which is 0x0409.
Signed-off-by: Alexander Kaiser <akaiser@urbansky.com>
The get_val functions will now return -ENODATA in case that
a value isn't found, instead of 0.
This makes them more similar to the meta_get_val functions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds the CAP Commander Change Volume Offset procedure.
This procedure changes the volume offset on one or more
CAP Acceptors, but not to the same value (unlike the
volume change procedure).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the MICP microphone controller callbacks to support
multiple registers by making it into a linked list.
This allow for multiple applications to get the information
from procedures or notifications.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the playing state, we should still increment the track position,
but just avoid notifying it.
If the track is stopped, then we set the track position to 0, which
we should always notify, regardless of whether the current track position
is 0.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
bt_pbp_parse_announcement was defined as uint8_t return value function,
but returned errno values, so it was modified to return an int instead.
The return values are also now more granular and documented.
The function also triggered a coverity issue with the way that it
parsed the data->data, as it would be marked as tainted. This should
be fixed by using the net_buf_simple API, which also improves on
some other parts of the code.
Finally the meta argument for the function was changed from an
unknown sized buffer, where the caller somehow had to know the
size of the metadata before calling the parsing function, to
an output pointer. This also omits the requirement for the
caller to always copy the metadata, where now it just
gets a pointer to the metadata in the bt_data struct. The application
can now always decide whether to continue to parse the metadata or
to copy it, using the pointer and the return value of the function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since we always set up the ISO data path for endpoints in both
directions (due to limitations in the ISO API), we can actually
receive valid (empty) SDUs on a CIS in a direction that has not
been configured.
This is not the ideal solution, but prevents unncessary LOG_ERR.
The ideal solution is to modify the ISO API to provide the
flexibility that BAP needs w.r.t. ISO data paths, but that is
a larger change for later.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If we disconnect in the middle of e.g. a discovery, then
client-busy (and other values) were not correctly reset,
which effectively rendered the client useless.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Additionally, replace the local print(sh, level, fmt, ...) macros
with PR, PR_ERROR, and PR_WARNING macros.
Then remove the print(sh, level, fmt, ...) macros.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Replaced direct shell_fprintf calls with PR, PR_ERROR, PR_INFO
and PR_WARNING macros.
This change simplifies the code by using predefined macros.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Moved 'scan_result' from a standalone variable into the 'context' struct
to enhance code optimization.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit introduces a local variable 'sh' to store 'context.sh' for
use with the 'shell_fprintf' function.
By doing so, we avoid the repeated dereferencing of 'context.sh',
thereby reducing the code footprint.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Moved seq_num check to after bt_iso_chan_send.
This prevents WRN prints if ISO send fails.
Signed-off-by: Kristoffer Rist Skøien <kristoffer.skoien@nordicsemi.no>
`bt_buf_get_cmd_complete` is broken due to
https://github.com/zephyrproject-rtos/zephyr/issues/64158, and fixing it
would require changing its signature and put even more complexity into
the HCI drivers, as it would require the drivers to perform an even
deeper peek into the event in order to observe the opcode.
Instead of the above, this patch removes the use of
`bt_buf_get_cmd_complete` and adds logic to allow the host to accept
command complete events in normal event buffers.
The above means performing a copy into the destination buffer, which is
the original command buffer. This is a small inefficiency for now, but
we should strive to redesign the host into a streaming architecture as
much as possible and handle events immediately instead of retaining
buffers.
This fixes https://github.com/zephyrproject-rtos/zephyr/issues/64158:
Like all command completed events, the completion event for
`BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS` is now placed in normal event
buffers. The the logic where the host discards this event is already
present. Since it's discarded, it will not interfere with the logic
around `bt_dev.cmd_send`.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Add the ec_host_cmd_send_in_progress_continue function which allows
continuing execution of a handler, while the ec_host_cmd thread is not
blocked and new commands can be handled.
That means some long command handlers can executed in the background
while the Host Command subsys is not frozen.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Fix RXFIFO_DEFINE to reduce FLASH usage by moving the pool
outside the struct that is static initialized.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit introduces a new IPv6 API for positive reachability
confirmation, as specified in RFC 4861, Section 7.3.1. This feature aims
to enhance the effectiveness of the Neighbor Discovery mechanism, by
enabling upper-layer protocols to signal that the connection makes a
"forward progress".
The implementation within TCP serves as a reference. Compliance with
RFC 4861, especially Appendix E.1, was ensured by focusing on reliable
handshake and acknowledgment of new data transmissions.
Though initially integrated with TCP, the API is designed for broader
applicability. For example, it might be used by some UDP-based protocols
that can indicate two-way communication progress.
Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
We cannot always start the service monitor thread statically
because the static threads are started after the application
level. This means that when config library wants to start
dhcpv4 server which uses socket services, there would be a
deadlock. Simplest solution is to start the service thread
directly from socket service init function.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Not only check if the address pool belongs to the same subnet as the
server, but also that it does not overlap with the server address -
otherwise the server might end up assigning its own address.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When the CIS of a source ASE disconnects, the server shall put
it into the QoS Configured state, which is not really part of the
state machine for source ASEs, but more like a hidden bonus state
change.
The state machine handler in the unicast client has been updated
to support this state change.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
As connectivity backends need to be bound in the same file that the
`net_if` is created in, define a common backend type for WiFi modems.
All WiFi modems should be controllable through the `wifi_mgmt` API, so
there should be no need for dedicated context.
When enabled, the particular implementation to be used is chosen through
`CONNECTIVITY_WIFI_MGMT_IMPL`. For now, the only choice is an
application defined backend.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Adds an optional feature that can be used to reduce the maximum
allowed image upload file size whereby an image could be uploaded
that would be too large to swap even if it could fit the partition
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds support for an overhead size which MCUboot can set when using
sysbuild, this can be used to check the provided size of an
application being uploaded to ensure it will fit and swap without
being rejected
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
For a Wi-Fi station the connect API supports both band and channel
configuration, but for a shell command either channel or band makes
sense, so, overload the channel field to support band.
Rejig the band and channel validation to support all modes.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Change the samples and shell to use sinf instead of sin,
as that return the expect float data type, instead of
a double.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds an option to disable the automatic initialization of the default
dns_context. This lets applications use the default context, while also
managing the `init` and `close` functions.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
It might happens that DT(_INST)_PROP_OR is used with boolean properties.
For instance:
.single_wire = DT_INST_PROP_OR(index, single_wire, false), \
.tx_rx_swap = DT_INST_PROP_OR(index, tx_rx_swap, false), \
This is not required as boolean properties are generated with false
value when not present, so the _OR macro extension is superflous
and the above code can be replaced by:
.single_wire = DT_INST_PROP(index, single_wire), \
.tx_rx_swap = DT_INST_PROP(index, tx_rx_swap), \
Signed-off-by: Roman Studenikin <srv@meta.com>
ICMPv4/6 modules print error when ICMP message handling fails, which
includes no message handler registered. This is a bit problematic, as
there are many ICMP messages that Zephyr does not process, and every
time such a message is received, an error log is printed (which wasn't
the case before ICMP rework).
Restore the old behavior (no log on unrecognized ICMP message) by
explicitly filtering out ENOENT error code from printing error. That
way, log will only be printed if an error occured within the actual
message handler.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As discussed during DHCPv4 server integration, group DHCPv4 client files
with DHCPv4 server in a single lib directory.
Renamed internal "dhcpv4.h" header to "dhcpv4_internal.h" so that it's
not confused with the public "dhcpv4.h" header.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When debugging it is hard to remember each state value (e.g. 0, 1, 2,
3) means. Therefore, make functions to improve logging for humans.
Fixes#59679
Signed-off-by: Ping Wang <pinw@demant.com>
The net-shell printed virtual interface name so that it got
the impression it was the network interface name which is not
correct. Now the name is printed as "Virtual name" which is
unambiguous.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If IPv6 is not enabled for the interface, then do not try to
join the IPv6 solicited multicast address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
use the function utf8_lcpy to ensure that UTF8 encoded strings are
properly copied and NULL terminated.
Fixes#42128
Signed-off-by: Ping Wang <pinw@demant.com>
The ratio between mbps and kbps, kbps and bps should be 1000, instead of
1024, as common sense.
The wrong ratio will decrease the Zperf throughput result.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
The only thing we put in there is the CID and that fits comfortably into
the (at least) 4-byte void pointer `user_data`.
This removes the dependency between `CONFIG_BT_ATT_TX_COUNT` and
`CONFIG_BT_L2CAP_TX_BUF_COUNT` since previously there was still a need
for an L2CAP context for every TX'd buffer.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This implements the following statement from the section 5.3.3:
Each Generic Provisioning PDU shall be sent after a random delay between
20 and 50 milliseconds.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Return error code to let an implementation know if the adv was actually
stopped (was scheduled) or not.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Before this change, the bt_mesh_send_cb.end callback was called when all
references to the adv were removed. If an implementation kept more
references to the adv buffer after calling `bt_mesh_adv_send`, the end
callback would not be called when the advertiser finished advertising
this adv.
With this change, the end callback is always called by the advertiser
when the advertisement is finished regardless of the number of
references. This allows an implementation to keep the adv buffer for the
future use. As an example, pb_adv.c keeps advs for retransmission.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Make sure that scan band string is properly terminated when
parsing user supplied string.
Fixes: #67944
Coverity-CID: 342930
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When ENABLED flag is used, we generate 32 byte DTLS
Connection Identifier and include that in our
DTLS Client HELO. This has no benefit as client only
has one connection toward the server, it does not need
any identification.
When SUPPORTED flag is used, we just include
zero length Connection Identifier in the handshake,
which tell server that we support Connection Identifier
and server can generate one for it.
We then use the CID in the packets that we send towards
server, but response packets don't contain any CID.
This gives all the benefit of CID as server is able to
identify us even when NAT mapping have changed.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If an att buf is destroyed during bearer teardown, we want to avoid
using and passing invalid references to the application.
Double-check that the current bearer, the ATT object and the ACL conn
objects it is attached to are not NULL before proceeding.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Add command to query to WiFi driver/firmware revision. The API is expected
to return the firmware revision and driver version as a string, and can be
used by the user to determine what revision of the WiFi driver is in use.
Signed-off-by: Sandip Dalvi <sandip.dalvi@nxp.com>
Instead of relaying on those macros having been defined
somewhere else let's define them for this file.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
* The include for the host libC should be guarded with
using the host libC instead of the POSIX arch, as this
supports other C libraries.
* This code uses getopt, which is an extension to the
C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This file uses strtok_r which is an extension to the the
std C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Export the minimal set of ztest_test_* symbols to llexts so that the
zassert_* macros can be used by the extension code to affect test
execution. Calling these also requires vprintk() to be exported.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Fix radio packet length configuration when first subevent
has empty PDU in the BIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Synchronized Receiver sequential packing BIS PDU
being dropped in the first repetation just after previous
BIS subevents where skipped.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Broadcast ISO Create Scheduling to consider reducing
Host requested RTN value. And also use maximum overhead
calculation when Extended Advertising and Periodic
Advertising have not been started before BIG create.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect HCI ISO data length check for Broadcast ISO
transmissions.
Removed initially added code when preliminary support for
Broadcast ISO was implemented.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add functions to unset, or remove, specific codec
LTV structure from codec_cfgs or codec_caps.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the code comments referring to section 3.6.1, changed the reference
from 'SD specification' to 'SD host controller specification'
for a clearer and more accurate context.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
After a review of the usage of csd[4] and cid[4],
it has been determined that zero-initialization can be omitted.
It can be expected from successful operations that data will be
appropriately written back from the underlying layer.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
The decision to omit zero-initialization is driven by a desire to enhance
Zephyr's compactness and efficiency.
This is achieved by omitting zero-initialization, thereby reducing the
instruction count and, as a byproduct, the code size.
After a thorough review of the usage of struct sdhc_command and sdhc_data,
it has been determined that zero-initialization can be omitted.
Only a portion of the fields need to be manually initialized.
(e.g. cmd.retries, data.block_addr)
For the uninitialized fields, it can be expected from successful
operations that data will be appropriately written back from
the underlying layer.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Introduced the config SD_CMD_RETRIES option as a build-time parameter.
This allows the assignment of a specific value to cmd.retries.
The default value has been set to 0 to preserve the previous setting.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Now that we are using the shell macro to enforce argument count check,
both mandatory and optional arguments, these additions checks are
unnecessary.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This driver really needs a device associated with it for the
syncronization bit to make sense, and since the argument is DT_PARENT it
will get it all the time, so no changes in practice, but this should
have been using the normal macro anyway.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Refactors modem chat module to use TRANSMIT_IDLE event instead
of polling when transmitting, cleaning up the transmit handler
by combining duplicate code and using an internal state instead
of multiple iterators to track send state.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Remove receive and transmit timeouts which are no
longer useful as the RECEIVE_READY and
TRANSMIT_IDLE events will be used to efficiently
manage timeouts between transmit/receive calls.
Then update the the in-tree drivers using the
modem_chat module to omit the process timeout
parameter.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
As described in issue:
https://github.com/zephyrproject-rtos/zephyr/issues/65027,
sdmmc_wait_ready can enter an infinite loop if the card is removed while
waiting for it to report an idle status. Fix this by always decrementing
the timeout in sdmmc_wait_ready, regardless of whether the SD card is
busy.
Fixes#65027
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Fix the handling of buffers with fragments. What seems to have been
broken is the metadata reference that was not passed to the next frag in
the chain.
Add a test to regression too.
The main user of this is IPSP.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Add a pair of functions to translate from input events to hid codes,
mapping most of the current hid codes defined in zephyr/usb/class/hid.h.
Use a sparse table for the mapping, which takes advantage of the fact
that code 0 is reserved. Inspired by the linux equivalent hid to input
map:
https://elixir.bootlin.com/linux/latest/source/drivers/hid/hid-input.c#L27
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add macro that allows registration of initialization functions that
are called when LwM2M engine starts.
On LwM2M engine starts up, it first executes all initialization
functions in following priority order:
1. LWM2M_PRIO_ENGINE
2. LWM2M_PRIO_CORE, this is where all LwM2M core objects are initialized
3. LWM2M_PRIO_OBJ, this is where all other objects are initialized
4. LwM2M_PRIO_APP, application initialization.
Now on the initialization phase, we could rely that certain objects have
already been registered.
For example custom objects can register callbacks to core objects.
On application phase, we can initialize sensor objects and register
their callbacks because objects have already been initialized.
This LWM2M_ON_INIT() should replace all use of SYS_INIT()
with the default CONFIG_KERNEL_INIT_PRIORITY_DEFAULT.
Priority order is actually just alphabetical order of names, so
the order is set on a linkin phase, and we don't need any
runtime checking for it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
1. add function sensing_iodev_submit and defined struct
sensing_submit_config
2. fix the issue of phy_3d_sensor
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Initializers must be compile time constants (not expressions!) for clang
to be happy. Clang rightfully pointed out that the callback_list member
of sensing_connection was being initialized using an expression that was
not compile-time constant.
The macros passed along a pointer created by taking the address of a
global constant and then at initialization time attempting to
dereference it using the * operator. So in the end the compiler has
identifier its trying to first take the address of and then later
dereference in an initializer. Clang didn't appreciate this, though gcc
seemed to be just fine.
Actually clang 17 might work just fine with this as well, but clang 16
(the clang I tried) didn't like it at all.
Instead store the pointer to the callback list rather than copying the
struct. This could be done the other way and not passing a
pointer through the macros perhaps.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Fixes a few small code formatting issues in sensor_mgmt.c adding
brackets where needed for an if and droping a line continuation slash
that failed one of the CI lints.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Many sensors have multiple functions, for example, icm42688 supports
accel, gyro and temperature, and the sensor streaming api always mixes
the multiple functions in one function call. So we need add a layer in
sensing subsystem to dispatch the result returned from sensor streaming
api for each function.
I changed the sensor-type(int) to sensor-types(array) in sensing sensor
device bindings, so that one device can map to multiple instances of
sensing sensor.
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Add hinge angle virtual sensor for sensing subsystem, hinge angle sensor
takes both base accel and lid accel as reporter.
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
This patch is to implement the phy_3d_sensor in sensing subsystem. It's a
wrapper layer of AGM sensor driver for sensing subsystem. It supports
the accelerometer and gyrometer now.
This has been tested with bmi160 on native_posix simulator.
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
1. set/get interval sensitivity is implmented in sensor management module.
2. add the runtime thread to handle the sensor configuration.
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
1. use the sensor_driver_api instead of the sensing_sensor_api.
2. clean up the sensing_sensor.h after using the unified api.
3. select RTIO while CONFIG_SENSING is enabled.
4. remove the sensing_sensor_post_data and sensing_sensor_xxx_data_ready by
introducing the RTIO
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Non-configurable init priority POST_KERNEL/99 might
be too late for certain uses cases (e.g. fetching data from
the file system in driver initialization). Chabge it to
be configurable so that applications can mount the
file systems earlies if they want.
Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
fs_init was just initializing mutex and dlist. Those can be
done statically. Not having the SYS_INIT function helps
in ordering the init functions in case e.g. file system
mounts are wanted to happen early stage on the system
startup.
Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
Remove TX-Injection and Promiscuous mode setting from Wi-Fi mode shell
command. These commands are being moved to ethernet l2 layer
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
This set of changes brings in raw packet tx injection mode
feature to ethernet and removes it from being a Wi-Fi only feature.
It was earlier envisaged as Wi-Fi net management feature only.
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
Fix double prepare overhead considered in scheduling
extended, periodic and ISO broadcast radio events when using
LOW LAT variant.
ticks_slot maintained in ticker includes the overhead, the
ticks_slot stored in role/state context exclude the overhead
hence take care to include ticks_slot_overhead when value is
used from context and not when value used from ticker nodes.
Add jitter due to ticker resolution unit between scheduled
radio events. This will allow the synchronizing side too to
not overlap due to ticker resolution related jitter.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Synchronized Receiver sequential packing subevent
skip to next BIS subevent, so that radio channel is
correctly calculated.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
After removing 20ms in advertiser, all subnetwork beacons are sent as high
dense packet of frames with minimal distance between them. That might
cause collisions if beacon interval on devices will coincide.
This commit adds an artificial delay between each subnet advertsing
beacons.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
If bootstrap fails, RD client will call lwm2m_engine_stop()
which will close the context.
The socket loop, however still contains a call to
hint_socket_state(context, NULL) which has a null pointer now.
Fix the segfault by allowing nullpointer on hint_socket_state().
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Fix assertion due to LLL scheduling of auxiliary PDU
reception was not considered in the ULL when checking for
accumulated data length exceeding the supported maximum scan
data length. This caused the auxiliary context to be release
while LLL was still active with scheduled PDU reception.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
BAP would always set up the ISO data path in both directions,
even for unidirectional CIS. This meant that in the
unconfigured direction, the data path configuration data
would all be 0, which causes issues on some controllers.
The new refactored approach implemented by this commit
will always ensure that the data path is setup correctly,
and that we only set the data path in one direction for
unidirectional CIS. The unset path will use the default
ISO path of HCI and transparant format, which should always
be allowed by a controller.
This is building on the requirement in BAP that all streams in
a unicast group shall be QoS configured at the same time. This
ensures that before any streams in the CIG has been connected,
they have all been configured.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When the central aborts the CIS setup during the CIS Creation
procedure after it has accepted the CIS request, the peripheral
will receive the HCI LE CIS Established event with an error code.
It does not receive a disconnection event.
See the message sequence chart in Core_v5.4, Vol 6, Part D,
Section 6.23.
This commit ensures that the perirpheral disconnected callback gets
called for this particular scenario.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Add callbacks to the stream objects that reflects the
state of the isochronous channel. The connected callback
is called when the isochronous channel is connected, and
similarly the disconnected callback is called when it is
disconnected.
There is a special case for unicast, where if the ACL
disconnects first, then we won't get a ISO disconnect
callback. It should be assumed that the isochronous channel
is no longer valid when the BAP stream enters the idle state,
i.e. when the "released" callback is called.
The purpose of the new callbacks is to provide additional
information to the application. Especially the unicast client
can use this to determine when the stream_start function
can be called again, as there can only ever be 1 outstanding
CIS connection request at a time, but there can be multiple
GATT requests.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Change row and col static types to unsigned, this should prevent really
bad things from happening if a negative number ends up there for
whatever reasons without having to explicitly check for < 0.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Implement TRANSMIT_IDLE event for modem_ppp module. This addition
optimizes the sys workque CPU time when performing a throughput
test from 36% to 5%, while only reducing the throughput by 12%.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
The previous behavior of the CONFIG_SHELL_AUTOSTART option, where setting
it to 'n' disabled shell interaction at startup but kept the logger
active as a shell backend, was inconsistent.
Now, when CONFIG_SHELL_AUTOSTART is set to 'n', both the shell and the
logger are inactive at startup. Calling the shell_start function will
activate them and print any pending logs. This change ensures a more
consistent and logical behavior regarding shell and logger activity at
startup.
Additionally, now when the shell_stop function is called, both the shell
and the logger are halted. This enhancement ensures that stopping
the shell also effectively stops the associated logger.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
A growing number of CAN controllers do not have support for individual RX
hardware filters based on the Remote Transmission Request (RTR) bit. This
leads to various work-arounds on the driver level mixing hardware and
software filtering.
As the use of RTR frames is discouraged by CAN in Automation (CiA) - and
not even supported by newer standards, e.g. CAN FD - this often leads to
unnecessary overhead, added complexity, and worst-case to non-portable
behavior between various CAN controller drivers.
Instead, move to a simpler approach where the ability to accept/reject RTR
frames is globally configured via Kconfig. By default, all incoming RTR
frames are rejected at the driver level, a setting which can be supported
in hardware by most in-tree CAN controllers drivers.
Legacy applications or protocol implementations, where RTR reception is
required, can now select CONFIG_CAN_ACCEPT_RTR to accept incoming RTR
frames matching added CAN filters. These applications or protocols will
need to distinguish between RTR and data frames in their respective CAN RX
frame handling routines.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Added the GATT authorization callback API that allows the user to
define application-specific authorization logic for GATT operations.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Remove the logic for adding the SDU length when allocating segments. That
section was dead code after the recent patches.
Inline the remainder of the logic into `l2cap_chan_le_send()`.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The entries pointer does not change, no need to have it in RAM, 4 bytes
saved. Refactor the init macro a bit while at it.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Bluetooth Mesh Protocol 1.1 is backward compatible with Bluetooth Mesh
Profile 1.0.1, therefore the stack can still be qualified for 1.0.1 if
needed. But explicit support for both versions requires additional
maintenance efforts and doubles the CI time. To make the stack
qualifiable for 1.0.1, the one needs to remove Private Beacons reception
and compile out SHA256 algorithm support.
What is changed:
- Removed `CONFIG_BT_MESH_V1d1` option.
- Removed `transport_legacy.c` which was using 1.0.1 implementation. The
new transport layer has new SaR logic that should still be possible to
qualify for 1.0.1.
- Removed the legacy transport Kconfig options. They are superseded by
the new transport Kconfig options.
- Tester app: `overlay-mesh-v1d1.conf` is merged into
`overlay-mesh.conf`.
- Removed BabbleSim tests for 1.0.1.
- Updated documentation.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Implement DHCPv4 shell module, which allows to start/stop DHCPv4 server
operation, and print server status (address leases).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Increase socket services thread default stack size when DHCPv4 server is
enabled, as it uses synchronous processing.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
So that it's possible to register ARP entries manually. Needed for DHCP
server implementation, which in unicast mode needs to reply to an IP
address that is not registered on the peer interface yet (hence no ARP
reply will be sent). It's needed to add an ARP entry manually in that
case, as hardware address is already known at that point.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There is a possibility that the SPI STM32 Host Command backend is being
suspended, without earlier initialization.
Make sure we are not accessing uninitialized pointer, namely the cs
structure.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Remove the CAN_FILTER_FDF flag for filtering on classic CAN/CAN FD frames
as it is not supported natively by any known CAN controller.
Applications can still filter on classic CAN/CAN FD frames in their receive
callback functions as needed.
Fixes: #64554
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add new kconfig CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING.
When enabled and device is sleeping, Reqistration Update
message is skipped and messages from send operation and
notifications are sent right away.
Reqistration update message is also skipped when
lwm2m_engine resumes from pause state.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
L2 PPP is not able to handle the carrier being lost gracefully,
nor is it able to gracefully close the PPP connection when
net_if_down() is called.
This patch refactors the L2 PPP module to use the carrier state
to either properly close or simply terminate the PPP connection.
Additionally, it ensures that the PPP session is closed properly
before calling ppp->stop().
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Get TLS_DTLS_CID_STATUS and TLS_DTLS_PEER_CID_VALUE utilize
mbedtls_ssl_get_peer_cid, which expects that mbedtls_ssl_setup
has been done.
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
Fixes an issue whereby a message which is too large was attempted
to be sent via the UDP transport would wrongly give an error in
value error
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
User is able to tweak the socket service dispatcher thread
priority in order to get better performance from the system
if needed. By default the dispatcher thread runs in lowest
application thread priority (K_LOWEST_APPLICATION_THREAD_PRIO).
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The thread name output field was a bit too short in "net sockets"
command, so make it 25 char long.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The "net sockets" command was not checking if there is any
sockets in the system before trying to access them.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When using the auto discover CCC, and the function is called
more than once with the same parameters before the previous
discovery has completed, then that may cause issues when we
reset the parameters when we get the response.
This commit adds a small check for the callback function
which is only set to the specified function when the
discovery is in progress. This way we can return an error
if the application calls bt_gatt_subscribe multiple times
before the previous discovery has completed, rather
than asserting.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes:
/__w/zephyr/zephyr/subsys/usb/usb_c/usbc_tc_src_states.c:260:21: error:
declaration of 'ret' shadows a previous local [-Werror=shadow]
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The channel extraction from string directly uses the end variable with
limited data type, this causes issue if an invalid channel that exceeds
the data is given as an input e.g., 300, which would end up as a valid
channel 44.
Use an intermediate variable with type that can hold all possible
combinations (valid and invalid) and only after validation assign that
to the end type.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
For none and WPA-PSK MFP isn't applicable, it was only introduced in
WPA2-PSK (RSN) and later.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Do not process SegAcks which were not targeted to the node.
They were rejected in the next if statement always, but generated
the annyoing warning "No matching TX context for ack".
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add calls to the PPC API that enables and disables the sink and source
paths in the appropriate USB-C stack states.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
When device runtime pm is enabled on console device, do not suspend
device synchronously on each char transmission, but rather use asynchronous
suspension request.
This will save useless and costly suspension/resumption procedure, which
can involve uart device clock suspension but also pin configuration
to sleep state (which itself involves gpio clock activation ...).
On STM32, using asynch device suspension allows to divide by 3 the
transmission time of a character chain.
Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
Add support for controlling whether the local controller
should transcode, or whether it will be done by another
module (e.g. the host).
By default when using the macros,
controller transcoding will be disabled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The read callbacks may be called with conn == NULL if the device
does a local read of the attributes. This commit ensures that all
the read callbacks can handle the case where conn == NULL.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Various network shell commands like ping need floating
point support from libc so select the CONFIG_REQUIRES_FLOAT_PRINTF
option for it.
Fixes#67601
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The place where TF-M places its non-secure api header files has changed
Therefore changing it for for all applications that use it.
Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
Use transmit idle event to synchronize with data transmitted
through DLCI pipes to test TRANSMIT_IDLE implementation.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Implement transmit idle event both for transmitting data to the
bus, and for the individual DLCI channels.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Instead of asserting, handle CIS creation latency for the peripheral by
finding next valid ISO event at which to start the CIG ticker.
Refactored calculations of the cig_offset to separate functions, to be
used also when calculating a new start offset.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit adds a function that updates the hostname displayed by the
net backend. It is called by the network stack when the hostname is
updated.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
Always pull from the channel queue from the system workqueue context.
This simplifies debugging.
This also allows us to remove `sent` from the metadata struct.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Separate most of the param checking in `bt_l2cap_chan_send()`, with the
logic in `bt_l2cap_dyn_chan_send()`.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fix missing ISO Synchronized Receiver radio event time
reservation that did not calculate for all the subevents.
Introduce BT_CTLR_SYNC_ISO_RESERVE_MAX Kconfig option to
allow using a minimal time reservation if needed to allow
other role to pre-empt ISO Synchronized Receiver in
pre-transmission and control subevents.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
If runtime_suspend() is called early during Zephyr initialisation,
while k_is_pre_kernel() returns 'true,' 'async' is set to 'false,' so
if 'async' is 'true,' Zephyr initialisation is definitely complete,
so there is no need to check k_is_pre_kernel() again.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
If user has not supplied address pointer when calling accept(),
then we would not be able to figure out the used socket domain
properly. But as there is now SO_DOMAIN option supported, use
that to get the correct socket domain.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The getsockopt() will return the address domain of the given
socket like AF_INET or AF_INET6.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Made the definition of in_addr all_routers conditional to remove
compiler warning:
warning: 'all_routers' defined but not used [-Wunused-const-variable=]
The warning occurs when igmpv3 is enabled.
Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
If there's not enough networking buffers at certain moment,
they might become available later. So instead of closing connection
(and failing assertation) sleep and retry. This avoid the following
assertion failure when there's much of data to send:
net_pkt: Data buffer (1500) allocation failed.
net_tcp: conn: 0x20076024 packet allocation failed, len=1460
shell_telnet: Failed to send -105, shutting down
ASSERTION FAIL [err == 0] @ .../subsys/shell/shell_ops.c:416
os: r0/a1: 0x00000004 r1/a2: 0x000001a0 r2/a3: 0x00000004
os: r3/a4: 0x20044380 r12/ip: 0x00001958 r14/lr: 0x080c9027
os: xpsr: 0x41000000
os: Faulting instruction address (r15/pc): 0x0811ed26
os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
os: Current thread: 0x20045100 (shell_telnet)
os: Halting system
Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
The HDA log backend has been buggy for some time, and the fixes are well
understood. The issue with HDA log as it is implemented today means
there are concurrency and ISR issues where it can deadlock.
The fixes are effectively dropping the usage of ipc to communicate
status, using polling on the hda stream, and having a formatter per call
context (cores + isr) when log mode immediate is enabled to fix log
mangling. However it was found this had a lot of unintentional side
effects that made it difficult to make progress on when it came to
changes of the host side python tooling.
Meanwhile the feature has sat unused for nearly a year. Remove it, and
it can always be revisited in the future if something like it happens to
be needed.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
The meaning of bit0 in the audio location bitmap will change to
mono audio, so we update the audio location macro and releated
test cases.
Refer to BT SIG ES-22266.
Signed-off-by: Bi Jian <bi_jian@qq.com>
This commit adds a new function the net_buf's API that allow an user
to match the net_buf's content with a data without copying it to a
temporary buffer.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
The stream_in_subgroup variable in bt_bap_broadcast_source_reconfig
may have been uninitialized.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In pac_notify and pac_notify_loc coverity found logical dead
paths since if both sink and source notify was disabled,
the functions would still be compiled, but would
never get past the default case.
This is not a real issue as the functions were never called
in that case, but to make coverity happy, and to prevent
any future issues where the functions may be called
incorrectly, the static functions are now fully guarded.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of reimplementing the aes_cmac function, CSIP
will now use the bt_crypto_aes_cmac function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The channel allocation was incorrect when setting up multiple
streams to a single device, in which case we should apply
individual bits to each stream.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Previously it was not always possible to prepend the header.
It was not possible if the application neglected to reserve the space
for headers. This is bad because it forces a buffer segment allocation
even if the buffer had enough room for the headers. E.g. a payload of 10
bytes in a netbuf of 30 bytes would have been segmented.
We now explicitly reject the buffer if it does not have the headroom.
This allows us to do a nice thing; simplify L2CAP segmentation.
We convert the SDU from the application into a PDU payload, by
prepending the SDU header, i.e. the SDU length in the original buffer.
This PDU payload is ready to be chunked into PDUs without having to keep
track of where in the SDU we are. This has the effect of removing a
bunch of logic in the segmentation machine.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Enable by default the access layer responses random delays.
Commit also adapts all mesh models, samples and
babblesim tests to use random delay functionality correctly.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The asynchronous put is not checking if the device was successfully
suspended before suspending its domain and it is not checking if the
domain was claimed. This patch adds these two checks.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
gcc prints this warning message
'strncat' specified bound 1 equals source length [-Wstringop-overflow=]
58 | strncat(fd, "C", 1);
There was no error in the code but avoid the warning by not using
strncat().
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The socket service provides a similar functionality as what
initd provides in Linux. It listens user registered sockets
for any activity and then launches a k_work for it. This way
each application does not need to create a thread to listen
a blocking socket.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The function did not move data correctly when increasing
or decreasing the size of a value that was not the last value
in the LTV array.
Added a few tests to verify the fix, using the CCID list as the
main way of verifying it.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There was a few places where the scan delegator returned an
errno value instead of a valid GATT error codes when rejecting
write request. These have been modified to send
BT_ATT_ERR_WRITE_REQ_REJECTED to the client instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add additional debug information in some ASCS debug statements,
so it is easier to follow the state when there is a potentional
state change.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This adds notifications to do_first_track only when changing group.
Before the change was made, client was never notified about
track change when changing group in Media Player.
Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
Some of the ASCS response codes should not be used by the
unicast server, as those will be checked and validated by the
stack.
They are kept in the enum, as the enum is also used by the
unicast client.
Besides updating the documentation, this commit also adds
a function to validate the response codes as well as the
combination of response codes and reason/metadata values,
and log a warning if the application does not adhere to the
documented behavior.
A warning is used instead of an error/assert/modification
of the response codes, as there may be unforseen reasons
why an application provide a non-approved response code,
and since it may be spec-valid, we should not fully
prevent it.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
According to the POSIX specification, null pointer
is a valid value for the `address` argument
of the `accept` function.
This commit adds a check to prevent a null pointer
dereference inside `z_impl_zsock_accept`.
Signed-off-by: Mirko Covizzi <mirko.covizzi@nordicsemi.no>
This PR makes the modem_chat wait until a chat script chat
request has been sent before accepting responses to said
request.
This helps ensure that an unsolicitet response is not mistaken
for a response to a request, which is especially problematic
if the chat script chat is using an any match.
For example, start chat script sending AT+CGMI, expecting the
modem name as a response followed by OK
> start script, waiting for response immediately
> start sending "AT+CGMI"
> receive "+CEREG 1,0" while sending
> script accepts "+CEREG 1,0" as the response to "AT+CGMI"
> "AT+CGMI" sent
> receive "QUECTEL BG95"
> receive "OK"
script handler got "+CEREG 1,0" instead of "QUECTEL BG95"
After this PR:
> start script
> start sending AT+CGMI
> receive "+CEREG 1,0" while sending
> "AT+CGMI" sent
> start waiting for response
> receive "QUECTEL BG95"
> script accepts "QUECTEL BG95" as response to "AT+CGMI"
> receive "OK"
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
It seems like a nice idea at first, but leads to hard-to-debug
situations for the application.
The previous behavior can be implemented by the app by defining
`alloc_seg` and allocating from the same pool as `buf`.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Strings stripping was disallowed when LOG_OUTPUT was used. However,
there is a dictionary log_output module which could work with stripped
strings. Dependency is changed to LOG_DICTIONARY_SUPPORT.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
So far frontend supported only compile time filtering. Adding
support for runtime filtering. From runtime filtering perspective
frontend is treated similar to any other backend but since
it is a singleton it has fixed ID.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
A problem occurred while running PTP on a multi-port target
(RENESAS RZT2M) with two ports enabled. Announce messages on the
switched devices master port always contained local clock information
instead information from received on the slave port from the better
GM clock. Depending on the BMCA config this turned into having more
than one GM in the system.
Sending always the locally stored GM information helped to overcome
this issue.
Signed-off-by: Manuel Schappacher <manuel.schappacher@hs-offenburg.de>
Provision of configurable parameter for generating unblock event
ahead of TWT slot. Host application depending upon latencies can
configure this to wakeup rpu ahead of the TWT slot.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
ARM GCC version 12.2.0 (Zephyr SDK 0.16.4) generates the following build
warning from the strncpy call in "wifi_utils_parse_scan_bands":
warning: '__builtin_strncpy' output truncated before terminating nul
copying as many bytes from a string as its length
To resolve this warning, pass the maximum length of the temporary
parse_str buffer to strncpy. This also has the benefit of correctly null
terminating parse_str, since we already verify the
scan_bands_str is properly null terminated with the strlen() check in
this function. We can therefore remove the line adding a null terminator
to parse_str as well.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add support for DYNAMIC_INTERRUPTS and ARM specific
DYNAMIC_DIRECT_INTERRUPTS.
Co-authored-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ull_prepare_dequeue to not skip events when preempt
does not match the event in the head of the prepare queue.
The head of the prepare queue does not match when
ull_prepare_dequeue has put the head of the queue to the
last of the queue when it is calling lll_resume interface.
This happens when there is already an active event which
needs a preempt timeout to be setup and there is another
non-resume event in the pipeline which now becomes the
head. The fix ensure to restore the order of the events
if a preempt timeout was to be setup.
Currently ull_prepare_dequeue loops through all events
before stopping at the original way the queue was. This is
not efficient and is a scope for improvement in future.
This reverts commit 91781306e9 ("Revert "Bluetooth:
Controller: Fix ull_prepare_dequeue for skipped events"").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Adds a stub API for a non bus emulators. The stub is used to keep the
rest of the emulation consistent.
Signed-off-by: Yuval Peress <peress@google.com>
This was missed in earlier that tried to fix all string comparisons to
use case insensitive comparison.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This optimization aggregates frame headers before adding to the ring buffer
and computes the FCS of the frame header in one operation.
This approach improves execution efficiency and reduces memory footprint.
This code adjustment aligns with the changes proposed in https://github.com/zephyrproject-rtos/zephyr/pull/67062.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Implement transmit idle notification for TTY backend. Since TTY
has an "infinite" transmit buffer, we invoke transmit idle
immediately after writing the data to the TTY file.
The test suite for the TTY backend has been updated to match the
new behavior.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Make async and interrupt driven UART backends notify transmit
idle when transmit is idle.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Add transmit idle event to modem_pipe_event enum. This will
allow modules to await transmit idle before trying to transmit
more data, instead of blindly calling modem_pipe_transmit in
a loop until all data has been accepted.
This will reduce the time spent trying to transmit data while
the backend is blocked.
Similarly to the RECEIVE_READY event, backends will call
modem_pipe_notify_transmit_idle() to indicate that transmit
is idle, and the TRANSMIT_IDLE event will be reinvoked when
the modem pipe is attached to synchronize the state of the
pipe with the user of it.
Additionally, the TRANSMIT_IDLE event is also invoked when the
modem is opened to further help synchronization with the user
of the pipe.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>