This fixes out of scope IRQ lock key by using SEGGER_RTT_Write
version that locks the IRQ by itself.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Print interface status information for "net iface" command.
This is useful information when debugging connectivity issues.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The server uses host support to export a USB device to a remote
USBIP client. It supports control and bulk transfers, interrupt
transfers may also work, but this depends on the host controller used.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Allow dynamic allocation of USB devices on connected event.
Add very basic USB device validation and configuration.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Handle them in separate contexts so that the request completion callback
cannot be blocked, such as when a device connection is detected and
requires configuration.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The transfers require enpoint MPS for proper transaction handling,
assign it in the common place during transfer allsocation so that it can
be reused.
Some users, such as USBIP, may need to keep a reference to private data,
add a parameter for completion callback data.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add an opaque pointer to store upper layer private data and initialize
it with the USB host context during controller initialization. Use the
pointer in event processing to get the correct context.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Address parameter/argument is no longer needed because we have a pointer
to the USB device. The Attrib parameter has never been used and will be
replaced by the interval and start-frame parameters in the future.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This will allow the controller driver to access information about the
device in the future.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Implement the dequeue function and remove the timeout parameter as it is
no longer necessary and can be handled in the upper layer. The dequeue
function is required for the USBIP implementation.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add the check if dev is NULL (when iface is NULL, dev is NULL) when
setting Wi-Fi CMD, in case Wi-Fi driver init fails and shell crashes.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Setting Wi-Fi cmd only when the net interface is up, avoid the case
that driver deinit and net interface is down, then the L2 APIs interact
with supplicant and driver, which may lead to CPU exception.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Add check that the command buffer claimed in `bt_le_create_conn_cancel`
is not `NULL`. Fixes a fault caused by providing the `NULL` buffer to
`bt_hci_cmd_state_set_init`.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Building with clang warns:
subsys/net/ip/utils.c:600:24: error: unused function 'pkt_calc_chksum'
[-Werror,-Wunused-function]
static inline uint16_t pkt_calc_chksum(struct net_pkt *pkt, uint16_t sum)
^
pkt_calc_chksum is called by net_calc_chksum, which only exists when
CONFIG_NET_NATIVE_IP is defined.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Adds API for Advertising Coding Selection.
Introduces two new advertising options to configure the advertiser's
requirement concerning coding scheme when LE Coded PHY is configured.
While the Bluetooth v6.0 specification makes a distinction betweeen
preferred and required advertising PHY options, a simplification is
made to only expose the required PHY options. Inline with how LE Coded
PHY is implemented; this API will set both the primary and secondary
advertising PHY's to the same coding scheme.
The support is enabled by CONFIG_BT_EXT_ADV_CODING_SELECTION, and requires
a controller that selects CONFIG_BT_CTLR_ADV_EXT_CODING_SELECTION_SUPPORT.
Signed-off-by: Thomas Deppe <thomas.deppe@nordicsemi.no>
Building sample.bluetooth.tmap_central with clang warns:
subsys/bluetooth/host/iso.c:2194:6: error: variable 'rsp' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (!advanced) {
^~~~~~~~~
subsys/bluetooth/host/iso.c:2202:6: note: uninitialized use occurs here
if (rsp == NULL) {
^~~
subsys/bluetooth/host/iso.c:2194:2: note: remove the 'if' if its
condition is always true
if (!advanced) {
^~~~~~~~~~~~~~~
subsys/bluetooth/host/iso.c:2137:21: note: initialize the variable 'rsp'
to silence this warning
struct net_buf *rsp;
^
= NULL
subsys/bluetooth/host/iso.c:2295:6: error: variable 'rsp' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (!advanced) {
^~~~~~~~~
subsys/bluetooth/host/iso.c:2303:6: note: uninitialized use occurs here
if (rsp == NULL) {
^~~
subsys/bluetooth/host/iso.c:2295:2: note: remove the 'if' if its
condition is always true
if (!advanced) {
^~~~~~~~~~~~~~~
subsys/bluetooth/host/iso.c:2258:21: note: initialize the variable 'rsp'
to silence this warning
struct net_buf *rsp;
^
= NULL
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
The function may return a BT_GATT_ERR which is a negative
value that cannot be returned as uint8_t. Change the function
to use int instead and document the return values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The encryption functions should document the expect byte order of
inputs and the byte order of the outputs.
The sef and sdf functions were also using an older, and incorrect,
description of the input, as it only takes the LTK as per CSIP 1.0.0
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When PM_POLICY_DEVICE_CONSTRAINTS is enabled, we create a list of
devices with the property “zephyr,disabling-power-states” and their
respective states to lock. However, if a device is declared but not
built (e.g., due to a Kconfig option), we have an undefined reference.
This PR changes the code to use the device name instead of the
reference. This increases lookup time (which could be cached at
runtime), and we still have an entry for a non-existent device.
Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
It might happen now after the commit 8519fa1627 ("net: socket service
resets its restart flag") that the event has disappeared before we
call the work, if that happens we must not bail out but restart
the service.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Just ignore any EALREADY error returned when trying to register a
DNS dispatcher. This could happen if trying to init things when the
interface comes up and we have already initialized the dispatcher.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The DNS_EAI_SYSTEM error value tells that the errno value
contains the actual system error value. So set the errno
properly when there is a system error.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Feed the dispatcher context to dispatcher callbacks instead of
resolver or responder context. The callback can then use the
proper context because the dispatcher context contains those
two context. This allows dispatcher callback to utilize all the
information (like interface etc) stored in dispatcher context.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
As the zsock_recv_dgram() is rather large, remove the inline
keyword from it and let compiler to decide what to do with it.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print the socket descriptor and interface after bounding it
successfully in order to help to figure out what sockets are
bind to one specific interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Restore only the socket descriptor that we marked as -1 after running
the work related to that socket. Earlier we tried to restore the whole
global array of descriptors which could go wrong and is not needed
as we only support synchronous work.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Added warning to the BT_RECV_WORKQ_SYS description
to explain the dangers by using this option.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
In order to check if the desired log file exists, the backend would open
the directory, then go through all the files seeing if one of them matches
the correct filename. Simplify to just `fs_stat` the file instead.
This has the added side effect of lowering the time spent checking if the
file exists after every log. Some quick testing revealed the time spent
checking went down from ~150-300ms to ~10ms (on my specific board, with a
nRF9160 writing to a LittleFS on external flash).
Signed-off-by: Kamil Krzyzanowski <kamnxt@kamnxt.com>
The previous behavior was to call `fs_sync` on the file after every log
item written. In many cases, log messages come in bursts, and `log_core`
already operates in batches, configurable using
`CONFIG_LOG_PROCESS_THREAD_SLEEP_MS` and
`CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD`. Once the batch is done, the
backends get notified with `LOG_BACKEND_EVT_PROCESS_THREAD_DONE` if any
logs were processed. This is a nice time to `fs_sync` the written changes.
This change both speeds up the time spent writing logs and reduces the
amount of block erases done on the flash, as the previous implementation
erased blocks after each individual log message.
Signed-off-by: Kamil Krzyzanowski <kamnxt@kamnxt.com>
Convert testing of the logging backend for file-system to include the
full implementation.
Need to disable logging and just include the unit under test to make
this simpler.
The API functions for the backend can then be called on the backend
object.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
PR #84651 introduced new shell commands that don't compile if
CONFIG_THREAD_MONITOR=n
Add THREAD_MONITOR to new shell commands.
Signed-off-by: Jeremy Bettis <jbettis@google.com>
There was a bug in pa_decode_base that would would spent time
parsing incoming BASEs and also update the receive
states, which caused some tests to fail.
This commit adds a simply check to verify that the BASE is
different before spending parsing the content and updating
the receive states.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The variable block_len in function coap_next_block_for_option()
can be used uninitialized in case of empty packet in
coap_packet_get_payload(). Mute the compiler warning with
default value of 0.
Signed-off-by: Dave Lacerte <lacerte.dave@hydroquebec.com>
The RFC1122 section 3.3.6 says we SHOULD drop the packets if L2 address
is brodcast but L3 address is unicast, but we had seen some Wi-Fi access
points in the field not conforming to that, and DHCP offer is dropped
due to this and causes Wi-Fi connectivity issues.
As the RFC saus it's SHOULD and not a MUST, add a config option to allow
such packets, disabled by default.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Tickless mode is refactored to use zvfs_eventfd,
but the Kconfig dependencies were not updated.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Coverity was unhappy that
`struct ll_conn_iso_stream *cis = NULL;` was never assigned to
a non-NULL value, which is due to the assignment being
guarded by `#if defined(CONFIG_BT_CTLR_CONN_ISO)`.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The socket service restarts whenever a new socket is registered.
This is triggered via zvfs_eventfd_write(ctx.events[0].fd, 1),
but the restart flag (ctx.events[0].revents) is not properly cleared,
causing unintended repeated restarts and skipped socket processing.
Detecting socket restart is done after the socket fd has processed its
data, so the socket doesn't lose its data. Ensure the socket service
clears its restart flag (ctx.events[0].revents = 0) immediately after
detecting a restart event, preventing unnecessary restarts.
Fixes#81813
Signed-off-by: Dominic Moffat <dom@illysky.com>