Commit graph

19212 commits

Author SHA1 Message Date
Benjamin Cabé
4458a05ec2 fs: fuse: ensure S_IFxxx macros are available
set _XOPEN_SOURCE appropriately to avoid compilation errors
due to missing S_IFxxx macros on some systems.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-08-11 10:32:20 +02:00
Keith Short
da4f4e8748 ztest: Replace PRINT with PRINT_DATA
The testsuite subsystem provides the macro PRINT_DATA() which can be
overridden using CONFIG_ZTEST_TC_UTIL_USER_OVERRIDE. Switch all calls of
PRINT() to PRINT_DATA withing the testsuite subsystem.

Signed-off-by: Keith Short <keithshort@google.com>
2024-08-09 08:39:18 -04:00
Keith Short
82a2a16649 ztest: Fix formatting
Run clang-format on some ztest files.

Signed-off-by: Keith Short <keithshort@google.com>
2024-08-09 08:39:18 -04:00
Keith Short
d8bc125469 ztest: fix compliance issue
Check compliance flagged an UNNESSARY_INT error.

Signed-off-by: Keith Short <keithshort@google.com>
2024-08-09 08:39:18 -04:00
Nick Ward
e738bca67f net: lwm2m: location object: make optional resources optional
Provides the user control over whether the altitude, radius,
or speed resources are in use.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-08-09 08:37:25 -04:00
Pisit Sawangvonganan
edbf8efeab net: wifi_utils: correct channel scan range in Wi-Fi 6GHz
Introduce `wifi_utils_get_next_chan_6g` to get the next
valid Wi-Fi 6GHz channel.

This commit addresses the proper handling of cases when
`chan_start` is not 1.

Fix #74063

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-09 08:36:22 -04:00
Victor Chavez
3ee6fa8c07 logging: Optimize ble notification size
Reduce the size of the ble notification if the length of
the line output is less than the current mtu size.

Signed-off-by: Victor Chavez <vchavezb@protonmail.com>
2024-08-09 09:54:14 +02:00
Pisit Sawangvonganan
721ee31c36 net: wifi: shell: enhance consistency in code style
Enhancing code consistency provides cognitive leverage with
the following changes:
- Unified the order of declaration for `opt`, `opt_index`,
  `state`, and `long_options`.
- Unified the wrapping of `getopt_long` calls, regardless of
  the length of the `options` string.
- Renamed `option_index` to `opt_index` for consistency.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 20:21:13 -04:00
Pisit Sawangvonganan
2ef08cee38 net: wifi: shell: use getopt_state for safer optarg access
Using `getopt_state` to access `optarg` and also `optopt` offers
a better alternative to direct global access.

See e145eb9201 for the previous change related to this.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 20:21:13 -04:00
Pisit Sawangvonganan
5af4e9df2f net: wifi: shell: apply struct option as static const
This change marks the remaining 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>
2024-08-08 20:21:13 -04:00
Pisit Sawangvonganan
e87d508ae5 net: wifi: shell: manual code formatting
Various manual code formatting adjustments, including:
- Wrapping lines in the `long_options` declaration to prevent them
  from extending too far to the right.
- Adding missing `{` and `}` in the `if` statement in
  `cmd_wifi_set_rts_threshold`.
- Aligning `SHELL_CMD_ARG` in `wifi_commands` with previous declarations.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 20:21:13 -04:00
Seppo Takalo
e3100c6f3a net: lwm2m: Allow SenML-CBOR floats decoded as int
SenML is technically a JSON based format which can
be encoded as a CBOR. SenML-CBOR specification in
RFC 8428 section 6 states that numbers can be decoded
as an integer.

Also RFC 7049 section 4.2 states that JSON numbers
without fractional part can be decoded as an integer.

I have seen with one commercial LwM2M platform that
the decoder  they use, sends floating point values as
integers, if there is no fractional part.

So LwM2M engine cannot assume from the path that
the incomming number is either float or int. Accept both.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-08-08 15:37:56 +02:00
Konrad Derda
5e4e63ba8f net: ipv6: route: get nexthop's LL address only if relevant
This commit moves reading nexthop's LL address only if it's supported
by a given neighbor and can be used for routing between interfaces.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-08-08 15:37:32 +02:00
Jonathan Rico
58ec51616d Bluetooth: host: fix incorrect ISO HCI fragmentation logic
Don't push the TS flag on `buf` itself.

This messes up the MTU calculations: a packet that would exactly fit the
MTU and has a timestamp would be unnecessarily fragmented.

The MTU check is done on `buf` as a whole. At the point where the
fragmentation length is decided, `buf` includes one extra byte to pass the
TS bit around. That byte shouldn't count towards the MTU.

Instead, infer the presence of the timestamp by inspecting the amount of
headroom that the buffer has. This works because we always reserve
enough memory to push the timestamp, but not always push a timestamp on
the buffer. #tightlycoupled

This method is slightly uglier IMO, but eases MTU confusion and doesn't
rely on user_data.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-08 06:07:08 -04:00
Krzysztof Chruściński
5bd6050241 testsuite: busy_sim: Add alarm cancelation to stop function
Without cancelation next start may return error.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-08-07 19:04:04 -04:00
Krzysztof Chruściński
42f003cebd testsuite: busy_sim: Allow running with timer random generator
Allow to run with timer random generator which does not need any
entropy device.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-08-07 19:04:04 -04:00
Kapil Bhatt
2f088fabc2 net: wifi: Add Current PHY rate
Current PHY rate
It represents the current PHY rate of transfer
of data in bits per second. It will a TX data rate.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-07 19:02:32 -04:00
Kapil Bhatt
459a63b137 net: wifi: Add over run count statistics
Over run count
It represents the number of packets dropped either at
received and sent due to lack of buffer memory to retain
all packets on the network interface.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-07 19:02:32 -04:00
Łukasz Duda
fb71ca2237 net: openthread: Handle deprecated IPv6 addresses correctly
This commit fixes an issue where deprecated IPv6 addresses were not
being correctly marked. In some cases, deprecated addresses might have
been used as source addresses.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-08-07 07:13:54 -04:00
Johann Fischer
5ddaa3b1a1 drivers: udc: add opaque pointer to store upper layer private data
Add an opaque pointer to store upper layer private data and initialize
it with the USB device context during controller initialization. Use the
pointer in event processing to get the correct context.

Fixes commit 48f2a4bc1a
("usb: device_next: remove initialized state checks in event processing")

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-08-06 17:17:41 -04:00
Seppo Takalo
b68477b372 net: lwm2m: Reset retry counter on update
On a successful update we should reset the retry counter, similarly
like we do on successful registration.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-08-06 17:16:46 -04:00
Seppo Takalo
e7b06e1c86 net: lwm2m: send REGISTRATION_TIMEOUT event on error
When socket errors call sm_handle_timeout_state() we might be
in a state where application assumes we are in registered state
but we are dropping it.
Therefore we must ensure that all registration states emit either
REGISTRATION_TIMEOUT event for application to indicate that
we have lost the connection to server.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-08-06 17:16:46 -04:00
Pisit Sawangvonganan
253d216589 net: ip: utils: revise data type declarations in z_impl_net_addr_ntop
Revise data type declarations to avoid implicit/explicit casts:
- Changed `unsigned char` to `uint8_t` for `zeros` array
  to match with `longest`.
- Declared variables `i`, `j`, and `pos` as `int` to use the same type.
- Cast `value` to `uint16_t` instead of `uint32_t` since
  `value` is `uint16_t`.
- Moved `bh` and `bl` declarations to narrow the scope of variables.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-06 17:15:50 -04:00
Pisit Sawangvonganan
71877efe27 net: ip: utils: simplify logic in z_impl_net_addr_ntop
Simplify high and low byte conversion by removing redundant checks,
since `net_byte_to_hex` already takes care of zero padding.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-06 17:15:50 -04:00
Pisit Sawangvonganan
dd864dbda0 net: ip: utils: simplify logic in net_byte_to_hex
Replace the loop with direct high and low nibble extraction,
and ensure the padding and zero suppression logic is simplified.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-06 17:15:50 -04:00
Roman Studenikin
edf09ca7f9 testsuite: coverage: Correct value of GCOV_COUNTERS for gcc 14
number of counters have changed in gcc 14 by commit
08a5233180

Specifically, a new counter was added in gcc/gcov-counter.def:
```
/* Conditions.  The counter is interpreted as a bit-set.  */
DEF_GCOV_COUNTER(GCOV_COUNTER_CONDS, "conditions", _ior)
```

which in turn updates the value of GCOV_COUNTERS that is defined in
gcov-io.h like this:
```
enum {
GCOV_COUNTERS
};
```

Signed-off-by: Roman Studenikin <srv@meta.com>
2024-08-06 17:15:22 -04:00
Nicolas Pitre
be119d7d8c demand_paging: LRU eviction: avoid ping pong deadlock loop
If only 2 page frames are queued and code executing in one frame is
making an access to memory in the second frame then the access will trap
and k_mem_paging_eviction_accessed() will be called to move that frame
to the end of the queue ... marking the new head frame unaccessible.
But that newly unaccessible frame contains the code that has yet to be
resumed to perform its memory access. Since it is now unaccessible, a
trap is triggered, the frame is moved to the end of the queue and the
new head frame (the one we trapped for initially) is marked unaccessible.
Execution is resumed with the memory access which is unaccessible again
and the cycle repeats infinitely.

Fix this by not marking the new head unaccessible if there is only one
queued frame left in the queue.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-08-06 17:15:15 -04:00
Georges Oates_Larsen
1c79445059 net: net_if: fix net_if_send_data for offloaded ifaces
Some offloaded ifaces have an L2, but lack support for
net_l2->send. This edge case is not handled by
net_if_send_data, resulting in a NULL dereference under
rare circumstances.

This patch expands the offloaded iface guard in
net_if_send_data to handle this edge case.

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2024-08-06 09:19:36 +01:00
Benjamin Cabé
43b948f9a8 net: ptp: Properly handle second overflow/underflow
Fixes issues with net_ptp_time arithmetic where second
overflow/underflow would not be handled properly.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-08-06 09:17:26 +01:00
Benjamin Cabé
dff19c3ac6 net: ptp: Adjust clock using correct offset
Offset should be *subtracted* from current clock value, not added.
This was causing clock to accumulate error instead of actually
"converging".

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-08-06 09:17:26 +01:00
Fengming Ye
86b5b59928 net: wifi: shell: add DPP commands
DPP shell command handler will parse user args to params in enum
and send l2 mgmt DPP requests.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-08-05 18:40:17 -04:00
Fengming Ye
1640826fc5 net: wifi_mgmt: add hostap DPP support
Add wifi l2 mgmt dpp handlers.
Add wifi subcommand dpp to call l2 mgmt dpp handlers.

DPP l2 handlers will parse params to hostap wpa_cli format args
and send wpa_cli commands to hostap.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-08-05 18:40:17 -04:00
Ravi Dondaputi
37491cb0f7 wifi: utils: Get correct channel count
For 2.4GHz and 6GHz bands, while counting the channels in configured
range, start of the range is being counted twice. Correct this
by advancing the index by 1 while counting channels in range.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-08-05 18:39:58 -04:00
frei tycho
3603d831fd Bluetooth: Controller: change condition in while to Boolean
Use `do { ... } while (false)` instead of `do { ... } while (0)`.

Signed-off-by: frei tycho <tfrei@baumer.com>
2024-08-05 16:30:13 +02:00
Kapil Bhatt
cd14be6073 net: wifi: Add reset command for Wi-Fi statistics
Add "reset" as a subcommand of wifi statistics.
Also add help option in statistics command.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-05 16:29:21 +02:00
Kapil Bhatt
3d38b5e094 wifi_mgmt: Add new API to reset Wi-Fi statistics
Add a new offload API to reset Wi-Fi statistics from
the Wi-Fi driver.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-05 16:29:21 +02:00
Morten Priess
ca1ceeffa4 Bluetooth: controller: Notify when BIG create fails due to timeout
When periodic scanning reaches timeout and BIGinfo has not yet been
received, notify with BT_HCI_ERR_CONN_FAIL_TO_ESTAB for sync receiver.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:58 +02:00
Morten Priess
64faceea72 Bluetooth: controller: Stop Sync ISO ticker when establishment fails
When an ISO stream fails to sync to a broadcaster within the first 6
events, the establishment fails (as expected). However, it did not stop
the ticker, and subsequently it was impossible to establish a new sync
after this.

Make asynchronous call to ticker_stop when establishment fails, and exit
done handling. Cleanup is handled via ll_rx_dequeue().

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:58 +02:00
Morten Priess
0e6bb8aa96 Bluetooth: controller: Fix number of handles in le_big_sync_established
Use lll->stream_count instead of lll->num_bis for returning the correct
number of handles.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:58 +02:00
Morten Priess
3b14cd4891 Bluetooth: controller: Add lll_sync_iso_flush interface to LLL
When the ISO sync receiver has been disabled (terminted), ULL now calls
lll_sync_iso_flush in lower link layer, to allow cleanup and releasing
of resources.

Make sure ISO sync LLL flush is also called when terminating a stream
from local side (app). Add blocking mayfly call to lll_sync_iso_flush in
ll_big_sync_terminate.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:44 +02:00
Morten Priess
a0e108d56b Bluetooth: controller: Send TX PDU release with no DP to vendor function
If a race condition occurs between stopping CIS stream and tearing down
data path, releasing TX PDUs was not possible for vendor data path, as
the DP configuration is gone.

In that case, call a new vendor specific function for cleaning up and
returning PDUs to correct pool.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:35 +02:00
Morten Priess
056387b5aa bluetooth: controller: Add LLCP TX to tx_ack FIFO size
The MFIFO holding TX nodes on the ack path back to the host was only
sized to hold the possible number of ACL TX nodes. However, additional
TX nodes are allocated for LLCP and use the same FIFO.

By adding LLCP_TX_CTRL_BUF_COUNT to the size, the FIFO will be able to
hold the worst-case number of TX nodes.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:27 +02:00
Vinayak Kariappa Chettimada
404ed809ed Bluetooth: Controller: BT_TICKER_REMAINDER_SUPPORT conditional
Added BT_TICKER_REMAINDER_SUPPORT conditional compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:28:18 +02:00
Vinayak Kariappa Chettimada
134251bb11 Bluetooth: Controller: Rename to BT_TICKER_START_REMAINDER
Rename to BT_TICKER_START_REMAINDER better reflect what it
means in terms of providing remainder parameter to ticker
start interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:28:18 +02:00
Troels Nilsson
a9f80e2c12 Bluetooth: Controller: Fix scoring for scan_aux events
Score was never increased for scan_aux events since they are
one-shot events; Fixed by keeping the scan_aux score as part
of the scan structure

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-08-05 16:27:50 +02:00
Vinayak Kariappa Chettimada
313fe30be4 Bluetooth: Controller: Rework related to separate SDU interval support
Review rework related to separate SDU interval for C_to_P
and P_to_C support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:27:43 +02:00
Vinayak Kariappa Chettimada
fe556f5cd6 Bluetooth: Controller: Separate SDU interval for C_to_P and P_to_C
Support for separate SDU interval for C_to_P and P_to_C
directions when setting CIG parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:27:43 +02:00
Fin Maaß
8f9148eff8 mgmt: hawkbit: move to zephyr kernel heap
switch to kernel heap from the libc, as there
is now a `k_realloc()` available.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-05 11:32:49 +02:00
Tom Finet
c1235bb4fb net: http: fix %d format string to %zu
Fixes logging of size_t variable to work on both 32
and 64 bit platforms.

Signed-off-by: Tom Finet <tomfinet@outlook.com>
2024-08-05 11:32:08 +02:00
Aleksandar Stanoev
52ffbd85c8 bluetooth: shell: Add shell commands for LE Connection Subrating
Add commands to allow requesting a subrate change via the BT shell.
A new build configuration has been added to ensure this is tested in CI.

Signed-off-by: Aleksandar Stanoev <aleksandar.stanoev@nordicsemi.no>
2024-08-05 10:16:27 +02:00