When closing a listening socket the functions waiting on the
FIFO will be unblocked this will result in receiving a NULL child
context. If that is the case return an error instead of carrying on.
Return the same error code (EINVAL) that is returned on Linux when
calling shutdown on a blocked accept call.
Signed-off-by: Léonard Bise <leonard.bise@gmail.com>
In case CoAP packet does not carry payload, and the last option is
zero-length, the option structure was not filled with data (opt number
and length). Fix the length check to prevent this from happening.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This should be boolean according to specification. It makes difference
when JSON encoding is used.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Allow passing the channel as a number instead of a string in order to
support sensor-specific channels (channel SENSOR_CHAN_PRIV_START and
up).
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Enable VLAN support so that this driver can be used to test
the VLAN when using qemu_x86 board.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This change removes references to raw POSIX types and functions,
allowing the drivers to build without NET_SOCKETS_POSIX_NAMES.
After this, the dependency between NET_SOCKETS_OFFLOAD and
NET_SOCKETS_POSIX_NAMES can be removed.
See issue #26033 for additional context
Signed-off-by: Adam Porter <porter.adam@gmail.com>
The driver currently blindly copies all of the outgoing bytes into the
endpoint. Instead, calculate the endpoint size and copy up to that
amount instead.
Signed-off-by: Michael Hope <mlhx@google.com>
Sets thread names for all usb device class threads (bluetooth, bt_h4,
mass storage, and rndis) to aid debug.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This patch introduces the support of low power modes
for the STM32L4xx from STMicroelectronics based on the lptim
Here, the power modes are sleep modes with lptimer as wakeup.
Depending on the SYS_POWER_MANAGEMENT configuration.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
A non-blocking, isr-safe version of get_entropy() is necessary in order
to be called during boot time before POST_KERNEL initialization.
Otherwise a crash is seen as the existing get_entropy() implementation
uses k_sem and relies on interrupts.
Fixes#18629
Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
Introduce new test for eventfd, which will test it in only basic
scope. The real reason why this is introduced is to have a test with
minimal set of configuration dependencies, such as disabled
pthreads (compared to full tests/posix/eventfd/ variant). This allows to
test eventfd mechanism with both POSIX_API=n and POSIX_API=y.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
The test takes ~175s to end on nrf5284dk_nrf52840 and was failing
due to too short default timeout (60s).
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Avoid null pointer access by checking that Ethernet device has
PTP clock before trying to get the actual PTP clock device.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
In order to follow threads by name in the debug output,
output a thread name if CONFIG_THREAD_NAME is enabled.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
So far net config initialization code relied on number of services
needed by application. This was fine as long as all enabled
services (e.g. CONFIG_NET_IPV4=y, CONFIG_NET_IPV6=y) were selected by
project configuration as "needed" (e.g. CONFIG_NET_CONFIG_NEED_IPV4=y,
CONFIG_NET_CONFIG_NEED_IPV6=y). Problem appeared for example when both
IPv4 and IPv6 were enabled (CONFIG_NET_IPV4=y, CONFIG_NET_IPV6=y), but
only IPv6 was marked as "needed" (CONFIG_NET_CONFIG_NEED_IPV6=y). In
such situation number of required services was equal to 1. When IPv4
setup was completed, this resulted in returning from net_config_init()
function. Application code failed, because IPv6 was still not
functional.
Do not rely on number of services anymore, as it is error prone. Use
flags instead to mark which services are ready. Compare those flags with
the flags passed to net_config_init() (selected in project configuration
in most cases) to decide whether network configuration has completed
already or not.
Also introduce services_notify_ready() and services_are_ready() helper
functions to isolate implementation details from the logic.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
With current design there is single semaphore (called 'waiter') for
wakeing up initialization thread. This thread should then check for
number of protocols that still need to be initialized. This happens now
only when waiting on 'waiter' semaphore times out.
Do not check for k_sem_take(&waiter) return value, as all needed
information about protocols being initialized already is in 'counter'
semaphore.
Fixes: #25358
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Unit test code requires IPv6 to be ready. Select
CONFIG_NET_CONFIG_NEED_IPV6=y to ensure that.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Unit test code requires IPv6 to be ready. Select
CONFIG_NET_CONFIG_NEED_IPV6=y to ensure that.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
zperf takes a potentially unaligned netowrk packet, casts it to a
struct, and then dereferences the fields. This causes a crash on
cores that don't support unaligned access such as the Cortex-M0+.
Use the UNALIGNED_GET helper instead.
Signed-off-by: Michael Hope <mlhx@google.com>
Add command to register a receive callback to the net_context used for
the TCP connection that is opened with 'net tcp connect'. The receive
callback will simply print the number of bytes received and inform if
the connection is closed. This makes it possible to test both the tx
and rx paths with the net shell.
Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
Convert the description comment at the top of the file to a
documentation string. That string then maybe viewed with the --help
argument. Also, rework a bit the documentation string: remove usage,
since that is provided by the help message of the argparse module.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
It might happen that while we are waiting for the response
to one of our query, we receive a query to resolve another name.
Previously this would make the current name resolution to fail because
only responses were expected to be received.
Signed-off-by: Léonard Bise <leonard.bise@gmail.com>
Clarify that number of bytes_written means bytes number of bytes
written belongs to the user's payload.
Added API note for emphasize that any flush write should be
the last write operation in any writes row.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
stream_flash_bytes_written() returned number o bytes physically
written to the flash. This number might be bigger than the requested
number as is aligned to the device write-block-size.
stream_flash_bytes_written() should return number of bytes
written requested by the user.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
iProc PCIe EP IP is present in Broadcom PCIe offload chips.
Add iProc PCIe EP driver to provide basic PCIe EP functionality.
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
Introduce common API to achieve data transfer using memcpy
to/from outbound region of PCIe EP.
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Add public APIs for PCIe endpoint driver:
- EP configuration space read/write
- Mapping/Unmapping of Host buffer and PCIe outbound region
- Raise interrupt to Host
These are minimal base APIs to make PCIe EP functional.
Also, add a Kconfig and an empty CMakeLists.txt for drivers to extend.
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
This helps distingush between fatal errors if logging isn't
enabled.
As detailed in comments, pass a reason code which controls
the QEMU process' return value.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
For some reason GCC 9.x doesn't seem to be able to realize that set_num
will always be > 0 and so the local variable status will always be
initialized. Use a do {} while instead to keep it happy.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>