Commit graph

15409 commits

Author SHA1 Message Date
Krishna T
0fb3f35e49 wifi_mgmt: Add support for MFP
MFP (Management frame protection) a.k.a PMF (protected management
frames) is now a mandatory feature for certification esp. for WPA3.

Support is added for both scan and connect similar to security type.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00
Krishna T
dd7cc72e99 wifi_mgmt: Add WPA3-SAE support
SAE password is similar to WPA2 password but without any length
restrictions, so, add a separate optional field, if this is not given we
can fallback to WPA2 password (psk).

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00
Krishna T
1d932fded6 wifi_mgmt: Add PSK with SHA256 support
This is a variant of standard PSK which uses KDF instead of PRF for
key generation, see section Table 9-151 in [1].

[1] - https://standards.ieee.org/ieee/802.11/7028/

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00
Stephanos Ioannidis
230ddd9a7f lib: os: assert: Add unreachable path hint for assertion failure
This commit adds the `CODE_UNREACHABLE` hint at the end of the
assertion failure branch so that the compiler takes note of the assert
function not returning when an assertion fails.

This prevents the compiler from generating misguided warnings assuming
the asserted execution paths.

It also introduces the `ASSERT_TEST` Kconfig symbol, which indicates
that the "assert test mode" is enabled. This symbol may be selected by
the tests that require the assert post action function to return
without aborting so that the test can proceed.

Note that the `CODE_UNREACHABLE` hint is specified only when the assert
test mode is disabled in order to prevent the tests from crashing when
the assert post action function returns.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-10 14:32:36 +02:00
Marek Pieta
d5a453efaf bluetooth: smp: Add authentication callbacks per connection
Change introduces authentication callbacks used only for specified
BLE connection. The feature can be used by devices that require
reporting specific bonding capabilities only when pairing using
vendor-specific procedures.

If per-connection authentication callbacks are defined for given
connection, they are used instead of global authentication
callbacks. SMP latches authentication callbacks during the first
access to prevent updating the callbacks while pairing.

Fixes: #38336

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2022-08-10 12:49:30 +02:00
Yuval Peress
84dfb8edf8 ztest: allow asserts anywhere
Updates the ztest_test_fail() function to allow failures in setup.
When executed, a failed assert will fail every test in the suite owning
the setup function. This was verified by adding a suite which asserts
in the setup function and has a test that should pass. During
exeuction, ztest marks the test as failing.

In order to verify exection I also added 2 new APIs:
- ZTEST_EXPECT_FAIL(suite_name, test_name)
- ZTEST_EXPECT_SKIP(suite_name, test_name)

Signed-off-by: Yuval Peress <peress@google.com>
2022-08-09 13:30:15 -04:00
Henrik Brix Andersen
a0b0f053e3 drivers: clock_control: avoid calling device_is_ready() in API calls
Change the clock control driver API to not call device_is_ready() in every
API call. It is up to the caller to ensure that the clock control device is
ready before calling a clock control API function.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
aa856bb00d drivers: clock control: clarify possible return values
Document the possible return values from clock_control_get_rate().

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-08-09 17:13:40 +02:00
Gerard Marull-Paretas
a7c3e7e84a doxygen: remove redundant usages of def
The def command Indicates that a comment block contains documentation
for a #define macro. This is useful if the comment block documents a
macro not adjacent to it, e.g.

```c
/**
 * @def MAX(x,y)
 * @brief Computes the maximum of @a x and @a y.
 */
 #ifdef XXX
 #define MAX(x,y) ...
 #endif
```

However, it is not necessary if the comment is adjacent to the
definition, e.g.

```c
/**
 * @brief Computes the maximum of @a x and @a y.
 */
 #define MAX(x,y) ...
```

This patch removes all unnecessary def entries in-tree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-09 12:29:28 +02:00
Erwan Gouriou
7911fc3c35 include: dt-bindings: stm32 clocks: Use "domain" wording when possible
Update stm32 clocks include files to use "domain" when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-08 14:17:07 +02:00
Erwan Gouriou
1ef9e9eb9b include: drivers: stm32 clock_control: Replace OPT by DOMAIN
In the continuation of the previous commit, replace _OPT_ by _DOMAIN_
in macros relating to this feature.
hen, adapt drivers and tests to this new wording.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-08 14:17:07 +02:00
Krishna T
b754e63d1b net: ethernet: Add EAPoL ether type support
Wi-Fi protocol uses EAPoL ether type frames for authentication, so, add
support for that ether type so that they are not dropped.

Though we have NET_ETHERNET_FORWARD_UNRECOGNISED_ETHERTYPE to allow
unknown frames to be passed up the stack, but this might cause
performance penalty.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-08 14:03:54 +02:00
Martí Bolívar
0224f2c508 device.h: rework the device_extern.h mechanism
Now that we can iterate over all the status "okay" devicetree nodes
directly using <zephyr/devicetree.h>, use that along with a new helper
macro to pre-declare all possible struct devices.

Unlike the previous implementation, which declared devices even for
disabled nodes, we restrict the new mechanism to only declaring
devices for status "okay" nodes. This keeps drivers honest by not
pre-declaring devices for disabled nodes, which should not be
allocated in the first place.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Martí Bolívar
2520747f6b devicetree.h: DT_FOREACH_NODE, DT_FOREACH_STATUS_OKAY_NODE
Add two new utility macros for iterating over the entire tree, along
with tests.

I have a use case for DT_FOREACH_STATUS_OKAY_NODE() right now, but I
think it makes sense to define both of them right away for
completeness.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Martí Bolívar
b23e1727b6 device.h: add missing include
This header makes extensive use of devicetree macros, but it does not
include zephyr/devicetree.h. Fix it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Nazar Palamar
5897de1e53 include/net: add the alignment for data in NET_BUF_POOL_FIXED_DEFINE
NET_BUF_POOL_FIXED_DEFINE locates net_buf_data in __noinit section,
it does not guarantees that data buffer will aligned.

There is wifi driver which required network buffers to be aligned.

Changes:
line below (from NET_BUF_POOL_FIXED_DEFINE macro):
 static uint8_t __noinit net_buf_data_##_name[_count][_data_size];
is updated to:
 static uint8_t __noinit net_buf_data_##_name[_count][_data_size]
 __net_buf_align;

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-08-08 06:58:51 +01:00
Andreas Chmielewski
74a56b05a9 net: lwm2m: separate closing context from closing socket
Separate closing lwm2m context from closing socket. This patch is required
for the rd client to take more control over lwm2m context and the socket.
The goal is to close the socket and to keep the lwm2m context if this is
needed.

Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
2022-08-08 06:55:49 +01:00
Andriy Gelman
af6179d567 drivers: gpio: Add xmc4xxx drivers
Adds gpio drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-05 13:00:21 +02:00
Aurelien Jarno
c24acd0c26 drivers: adc: fix ADC_DT_SPEC* helpers for channels >= 10
Use the just introduced IS_EQ() to get the channel child node matching the
input.

Fixes #47119

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-08-04 17:35:39 +01:00
Aurelien Jarno
d98a75a4cb sys: util: export Z_IS_EQ macro as IS_EQ
And also add the corresponding documentation.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-08-04 17:35:39 +01:00
Kumar Gala
9341b98821 sys: util: add a Z_IS_EQ macro to compare integers
This macro compares two integers from 0 to 255 at compile time, using
the preprocessor.

Signed-off-by: Kumar Gala <galak@kernel.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-08-04 17:35:39 +01:00
Florian Grandel
6b09d0e791 net: l2: ieee802154: apply clang format
This change makes the files which are part of this changeset comply to
the project's coding style rules as defined in .clang-format.

This required addition of some forward declarations and additional
dependencies into header files as some of them depended on the order of
header inclusion which was changed due to alphabetical ordering of
includes.

Background: .clang-format states "SortIncludes:true" which will force
re-ording of include-statements which in turn might break the build if
header file inclusion is not order-independent.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-08-04 13:44:06 +02:00
Juha Heiskanen
ed5f3cdf06 net: lwm2m: LwM2M Pause and resume support
New API for suspend and resume LwM2M engine.
New event LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED for indicate
application that engine is suspended.

Simplify stack suspend and resume state same time for queue mode.

New CONFIG_LWM2M_RD_CLIENT_SUSPEND_SOCKET_AT_IDLE for enable skip socket
close at RX_OFF_IDDLE state that socket is only suspended and close is
called only when connection is resumed.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2022-08-04 13:42:55 +02:00
Gerard Marull-Paretas
a650c6c554 pm: policy: allow multiple subscribers to latency changes
Current API allowed to get notified when the maximum system latency
changes, however, a single callback was allowed. The design was intended
for SoC specific actions when latency changes. However, in some cases
drivers may also want to know the current maximum latency to perform
local actions if other parts of the system modify it.

This patch updates the API with a pair of subscribe/unsubscribe calls to
achieve such goal. Tests have been updated to show how the API can be
used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 11:19:17 +02:00
Fabio Baltieri
24d09d363c include: fix the remaining legacy #include paths
Add the "zephyr/" prefix to various #include statements that are
preventing the CI form running with LEGACY_INCLUDE_PATH=n.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Andrzej Puzdrowski
ccf8c547d0 settings: API for get storage instance used
Added API function +int settings_storage_get(void **storage)
which allows to get storage instance used by the
settings backed to store its records.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-08-02 15:15:10 +02:00
Piotr Pryga
c6e9b3c235 Bluetooth: hci: Extend VS fatal error for hard hault and assert
Extend current implementation of vendor-specific HCI events related
with Zephyr Fatal Error. The extended event is able to carry Zephyr
system wide fatal error as well as Controller related assertion.
That gives a possibility to use the event by bt_ctlr_assert_handle
or k_sys_fatal_error_handler to send information about unrecoverable
failures over HCI interface.

There are added two types of errors to Zephyr Fatal Error event:
- system fault error like e.g. Hard Fault. This one caries reason of
  a fault and a stack frame in the data field. The stack frame is
  defined for Corte-M SoCs only.
- Controller assert. The data field caries file name and line of code
  where an assert happened.

Except that the extended event can be used by Host, it can serve as a
debug mean to conformance testing of the Controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-08-02 13:53:32 +02:00
Gerard Marull-Paretas
6de9fcf315 soc: riscv: gd32vf103: use nuclei,systimer compatible
After some analysis I found out that there's no machine timer provided
by the "riscv" vendor. There are some specs for the mtime/mtimecmp
registers (this is why we can have a single driver), but the actual
register layout or implementations differ amongst vendors. GD32 uses the
Nuclei implementation, named "system timer" in their documentation. This
patch aligns with vendor specs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-02 09:12:31 +02:00
Michal Narajowski
fab8e29ee2 Bluetooth: Mesh: Add model publish support to Health Client
Mesh Profile Specification errata 11310
Section 4.4.4.1
"This model shall support model publication, as defined in Section
4.2.2 of the Mesh Profile specification and model subscription,
as defined in section 4.2.3 of the Mesh Profile specification."

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-08-01 18:04:42 +01:00
Nikolai Kondrashov
26eb116835 Bluetooth: GATT: Spell out BT_ATT_ERR_*
Spell out BT_ATT_ERR_* instead of using less specific "ATT error code".

Co-authored-by: Emil Gydesen <Thalley@users.noreply.github.com>
Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
2022-08-01 18:04:02 +01:00
Nikolai Kondrashov
fe6c6d4e1a Bluetooth: GATT: Document some macro arguments
Name some types in bluetooth/gatt.h and use those names to document the
expected values of some of the BT_GATT_* macro arguments, in an attempt
to make understanding the API a little easier.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
2022-08-01 18:04:02 +01:00
Nikolai Kondrashov
c194752daa Bluetooth: GATT: Refer to BT_GATT_WRITE_FLAG_*
Refer to BT_GATT_WRITE_FLAG_* specifically, instead of the more general
BT_GATT_WRITE_* namespace to avoid future clashes with new symbols
there.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
2022-08-01 18:04:02 +01:00
Robert Lubos
bead038ba2 net: sockets: Fill the address structure provided in recvfrom()
The packet socket implementation did not fill the address structure
provided by the application. This commit fixes this.

Note, that the implementation needs to cover two cases: SOCK_RAW and
SOCK_DGRAM. In the first case, the information is extracted directly
from the L2 header (curently only Ethernet supported). In latter case,
the header is already removed from the packet as the L2 has already
processed the packet, so the information is obtained from the net_pkt
structure.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-08-01 18:02:20 +02:00
Robert Lubos
b5b5c29f2d net: pkt: Add ll_proto_type field
The L2 protocol type information is not carried to the upper layers.
This is problematic for packet sockets, as the address structure in
recvfrom() is supposed to provide this information.

Fix this by adding ll_proto_type field in the net_pkt structure.
Set the protocol type in the Ethernet L2 when packet is processed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-08-01 18:02:20 +02:00
Jordan Yates
cfb8c5e70f pm: device: rename placeholder variable
Rename the placeholder variable generated for PM slots so that the
prefix doesn't colide with the PM structs declared by devices. This
simplifies the process of searching for symbols in `.elf` files.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-30 08:29:29 -05:00
Corey Wharton
f78726124f arch: fix typos for arch_icache_disable
arch_dcache_disable was declared twice and function comments were wrong.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2022-07-30 07:11:35 -04:00
Jun Lin
ec4f700202 driver: PECI: npcx: add driver support for Nuvoton npcx family
This commit add the PECI driver for Nuvoton npcx family to support PECI
APIs.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-07-29 14:09:17 +02:00
Vinayak Kariappa Chettimada
93728bf0ca Bluetooth: Add Periodic Advertising ADI support
Add support in Bluetooth Host to enable Periodic Advertising
ADI support feature when supported in the Controller to
include ADI in Periodic Advertising AUX_SYNC_IND PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-07-28 20:53:14 +02:00
Dylan Hung
662acc277e dts: bindings: clock: add binding for Aspeed AST10x0 clock
Add binding for Aspeed AST10x0 clock driver.  The clocks can be turned
on or off through the syscon registers.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2022-07-28 08:30:27 +02:00
Emil Gydesen
d4b132a059 Bluetooth: Audio: Unicast client read available contexts
Read the available contexts during discovery and subscribe
for notifications.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-28 08:29:29 +02:00
Francois Ramu
efa4d2c42a include: clock: stm32h7 helper for this serie
For the stm32h7x3 and stm32h7x5 there is a octospi
clock configuration in the D1CCIPR register

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-27 18:46:25 +02:00
Andreas Sandberg
61306aedb4 drivers: ssd16xx: Add an API to read raw RAM contents
Add the ssd16xx_read_ram() function that can be used to read the raw
contents of the two display RAM in the controller. This function is
similar to display_read(), but lets the caller specify the RAM to
operate on. The intention is that this can be used to read out the
contents of the old frame buffer after a partial refresh that
automatically swaps the black/red buffers.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:47 +02:00
Glauber Maroto Ferreira
17c29befc9 esp32: dt-bindings: clock_control: add RTC clock definitions
Add RTC source clock frequency definitions to
clock_control dt bindings.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-07-27 09:48:33 +02:00
Simon Hein
c1288208ce include: zephyr: comply to coding guidelines MISRA C:2012 Rule 14.4
MISRA C:2012 Rule 14.4 (The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.)

Use comparisons with NULL instead of implicitly testing pointers.
Use `do { ... } while (false)' instead of `do { ... } while (0)'.
Use comparisons with zero instead of implicitly testing integers.

The commit is a subset of the original auditable-branch commit:
5d02614e34a86b549c7707d3d9f0984bc3a5f22a

Signed-off-by: Simon Hein <SHein@baumer.com>
2022-07-26 15:30:11 -04:00
Thomas Stranger
5bdca4566f drivers/clock_control: stm32u5 add pll2, pll3 clk src/div definitions
This commit adds necessary definitions in stm32_clock_control.h
to enable pll2, and pll3 support by:
- reusing existing pll3 divider definitions introduced for h7 series.
- adding pll2 divider definitions, and including them for u5 only.
- introducing clock source definitions for pll2 and pll3
  contrary to h7 u5 can select the clock sources for the 3 plls
  individually.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-25 15:57:12 -07:00
Thomas Stranger
1e67957ad9 dts: stm32u5 add pll2 and pll3 nodes and add them as clk sources
This commit adds the pll2 and pll3 clock control nodes
with st,stm32u5-pll-clock compatible.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-25 15:57:12 -07:00
Andrew Jackson
e183671808 kernel: Add k_event_set_masked primitive
There is no easy way to clear event bits without
the potential for a race to exist between producer(s)
and consumer(s). The result of this race is that events
can be lost through the various resetting mechanisms
available (flag to k_event_wait(), or k_event_set()).

Add k_event_set_masked() which permits bits to be set or cleared.
This allows consumers to clear just the bits that they have read
without (accidentally) discarding any new bits.

Update unit tests to verify the functionality.

Partly Fixes #46117.

Signed-off-by: Andrew Jackson <andrew.jackson@amd.com>
2022-07-25 15:24:32 -04:00
Andrew Jackson
e7e827a0d2 kernel: Use mask rather than boolean to update events
Although there is nothing wrong with the existing code,
it doesn't permit individual bits to be set (or cleared).
This makes further changes slightly awkward.

Use a mask to restrict the bits set in an event.

Signed-off-by: Andrew Jackson <andrew.jackson@amd.com>
2022-07-25 15:24:32 -04:00
Thomas Stranger
4f632b0ca2 dt-dindings/clock: add HSE as clock source for stm32g0 and stm32g4
HSE is a valid alternate clock source for these series,
therefore STM32_SRC_HSE is added in this commit.

Both series can use HSE as an alternate clock source for USB and FDCAN.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-25 15:17:00 +02:00
Andrzej Głąbek
82bf0a6f17 include: drivers: adc: Fix initialization order in ADC_CHANNEL_CFG_DT
... so that the macro can be used in C++ code.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-25 11:14:43 +00:00