Commit graph

21541 commits

Author SHA1 Message Date
Johann Fischer
dd5492b3ce usb: device_next: rework wSequence check in CDC NCM implementation
The consequences of a wSequence mismatch are unspecified and are
primarily for debugging purposes. Our checks are a bit too strict, and
if the header check fails, the sequence is not updated, and the header
check subsequently fails. Rework the code to just log a warning on
mismatch and also reset OUT sequence counter the same way as the IN
sequence counter.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
82891d3d32 usb: device_next: do not stop when OUT transfer has zero length
Align the OUT handling with the CDC NCM and change the logic to track
when the alternate data interface is set/reset instead of the class
implementation being part of the active configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
502e8116b5 usb: device_next: allow CDC ECM to survive alternate toggling
When interface alternate is set back to zero, the implementation still
attempts to submit OUT transfers, but the addressed endpoint is actually
disabled. Change the logic a bit to track when the alternate data
interface is set/reset instead of the class implementation being part of
the active configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
8940f43f5d usb: device_next: rework CDC ECM connected/disconnected notifications
Do not fail in iface_start/iface_stop if sending notification fails,
just log the error and try to send connected notification when alternate
interface is set and network interface is started.

Do not block in notification send function and allow to submit more than
one notification which means that the last valid one will also be
delivered.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
376e965d04 usb: device_next: do not accidentally disable CDC NCM network interface
The Zephyr network interface should not be disabled by the USB device
functions. This sounds confusing, but in the current implementation they
are different ends of the connection.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
78c0072dd9 usb: device_next: rework notification handling
We need to handle notifications periodically, for example, when the
interface alternate changes and we also need to track whether the
notification was actually transfered to the host. There is no need to
trigger notification work on iface_start/iface_stop when the USB
interface is not in active configuration. This commit intentianly
changes log level in the notification handling code.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
c437230b58 usb: device_next: fix CDC NCM GET_NTB_INPUT_SIZE
The device should set the maximum size and maximum number of datagrams
within the IN NTB.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
7f39e1a9ec usb: device_next: fix block length check in CDC NCM
In the current implementation, the block length in the OUT direciton
should be equal to the transfer length.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
539961035b usb: device_next: make error logging more verbose in CDC NCM
Log errors with LOG_ERR.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Johann Fischer
c7baf39126 usb: device_next: fix CDC NCM datagram pointers processing
The implementation should not assume that NDP is placed immediately
after NTH. According to the specification (revision 1.0), NDP can be
anywhere in the transfer buffer. There is also always a "terminating
zero datagram pointer entry", which we should also use to terminate the
datagram processing loop.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-18 12:46:08 +01:00
Lyle Zhu
830c1f8134 Bluetooth: AVDTP: Check buffer length before pulling it
Check the remaining data length of net buffer before pulling data from
it.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/83024

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-12-18 10:17:45 +01:00
Qingling Wu
d22026c440 net: wifi: hostap: add set RTS threshold command support
Add set RTS threshold command support for sta and sap.

Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
2024-12-18 10:17:24 +01:00
Mikhail Siomin
a5a955d024 fs: littlefs: add littlefs disk version selection
Add the ability to select littlefs disk version
to maintain backward compatibility
with existing littlefs
with the same major disk version.

Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
2024-12-17 20:55:51 +01:00
Guennadi Liakhovetski
024f43b1f0 llext: move a calculation to a more logical location
Currently llext_link_plt() calculates offsets to relocation addresses
relative to the .text section and passes them to
arch_elf_relocate_global() and arch_elf_relocate_local(), where then
.text memory address is added to them. Instead it's more logical to
concentrate the entire calculation in the caller, which then also
removes the assumption, that all sections have the same VMA - LMA
offset from those functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-12-17 20:55:15 +01:00
Johann Fischer
704b36f78f usb: device_next: remove redundant memset() after net_buf_alloc.*()
With changes introduced in commit 6a3602a306
("net: buf: Clear `user_data` on allocation")
our memset() calls are redundant.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-17 11:38:22 +00:00
Chang Kim
98928c0a4f bluetooth: host: Add conditions to ATT_READ_BY_TYPE_REQ handler
Core spec V5.4 Vol. 3 Part G 2.5.2.1 Robust Caching specifies
the conditions where Database Out Of Sync (0x12) error needs to
be returned as follows:

If a client that has indicated support for robust caching (by
setting the Robust Caching bit in the Client Supported Features
characteristic) is change-unaware then the server shall send an
ATT_ERROR_RSP PDU with the Error Code parameter set to Database
Out Of Sync (0x12) when either of the following happen:
• That client requests an operation at any Attribute Handle or
list of Attribute Handles by sending an ATT request.
• That client sends an ATT_READ_BY_TYPE_REQ PDU with Attribute
Type other than «Include» or «Characteristic» and an Attribute
Handle range other than 0x0001 to 0xFFFF.

Add the conditions to ATT_READ_BY_TYPE_REQ handler.

Signed-off-by: Chang Kim <changshik@meta.com>
2024-12-17 11:37:27 +00:00
Johann Fischer
36e8144b90 usb: device: remove USB H4 Bluetooth function and sample
The Bluetooth HCI USB transport layer implementation is provided by
"subsys/usb/device/class/bluetooth.c". The USB H4 Bluetooth function
implements a non-standard transport layer. There is no known host-side
equivalent that uses this protocol.

Note that the H4 protocol functionality is also provided by the
"subsys/usb/device/class/bluetooth.c".

Since that there are no real USB H4 Bluetooth users, remove the
implementation and sample without deprecation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-12-17 11:35:57 +00:00
Tomi Fontanilles
23a6a78599 secure_storage: its: store: settings: improve debug logging
Align the debug logging with that of the ZMS-based implementation.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
9ef6788bd9 fs: zms: fix format string
Use %zu for size_t.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
45a54ba782 secure_storage: its: store: settings: allow using zephyr,settings-partition
Align with the behavior of the settings subsystem.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
bb003f7bd3 secure_storage: warn when there is no ITS store module implementation
Output a CMake error when the ITS store module is enabled but no
implementation ended up enabled (due to unfulfilled prerequisites).
This is to make it more clear than undefined references at link time.
Not a fatal error because CMake cannot fail for the twister filtering
to work on the tests.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
3eba06d559 secure_storage: its: store: settings: stop using SETTINGS_MAX_VAL_LEN
Remove the hard restriction on CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE.
SETTINGS_MAX_VAL_LEN is in practice not used by any settings backend
implementation.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Tomi Fontanilles
0ea6f352e7 secure_storage: add a ZMS-based implementation of the ITS store module
It becomes the new default when the secure_storage_its_partition
devicetree chosen property is defined as it is a preferred alternative.

See the help message of the
`CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS` Kconfig option
for more information.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-12-17 11:34:42 +00:00
Maochen Wang
b5007b5190 net: wifi: avoid adding duplicate mgd_ifaces
Add iface and type check to avoid adding duplicate mgd_ifaces.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-17 09:48:29 +01:00
Gaofeng Zhang
0e59cf41d7 hostap: support legacy roaming
There are currently four types of roaming, 11r roaming, 11v roaming, 11k
roaming and legacy roaming, The priority of the roaming mode is
11r-->11v-->11k-->legacy roaming. If the ap does not support 11r/11v/11k
roaming, we will use legacy roaming. legecy roaming needs to do
full channel scan, which is the same as the general scan connection
process, so the legacy roaming time will be longer.

Signed-off-by: Gaofeng Zhang <gaofeng.zhang@nxp.com>
2024-12-17 05:49:21 +01:00
Djordje Nedic
2750492e86 fs: littlefs: Fix cache and lookahead size checks
This fixes an issue where wrong values were checked against block device
defaults. Kconfig values are used when no filesystem config values are
provided, and the buffers are sized according to the Kconfig values,
but the checks were only performed against filesystem config variables.

Signed-off-by: Djordje Nedic <nedic.djordje2@gmail.com>
2024-12-16 20:49:21 +01:00
Ilya Tagunov
ce50ea2f1f llext: disable for Harvard ARC variants
Some ARC processor configurations have separate memory for code (ICCM)
and for data (DCCM). Such configurations are unsuitable for LLEXT,
except for some quite special cases. For now, disable LLEXT and its
tests for these devices completely.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
2024-12-16 18:25:16 +01:00
Rex Chen
ab948b080d net: wifi: shell: fix twt setup quick failed issue
The default exponent is 0, will cause twt setup quick failed,
set exponent value derived from twt interval to fix it.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
0406f9b403 net: wifi: shell: add parameters for twt setup
Add two parameters for twt setup.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
a1f579a2f3 net: wifi: shell: add btwt feature support
Add btwt_setup cmd for sap.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
f9a96f3503 net: wifi: shell: enhance twt parse parameters code
Enhance the parse parameters code for twt.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Hongquan Li
bda1e7677e Subsys: mgmt: mcumgr: Fix mcumgr assertion error
In the case of IPV6 not enabled, when NET_SOCKETS_PACKET is enabled,
the sizeof(struct sockarr) will change to 20, the value of
MCUMGR_TRANSPORT_NETBUF_MIN_USER_DATA_SIZE is 8, which is not able
to pass the compilation, so I change its default value to 20.

Fixes #82757

Signed-off-by: Hongquan Li <hongquan.prog@gmail.com>
2024-12-16 13:09:28 +01:00
Maochen Wang
91c4482267 net: wifi: fix ap status when enabled
Add WIFI_SAP_IFACE_NO_IR state to keep same as hostapd_iface_state,
which is updated as the hostap upmerge.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 13:08:37 +01:00
Maochen Wang
10d4de5237 net: wifi: remove HAPD in Wi-Fi shell layer
For CMD 'wifi ap status', removing HAPD related definition to make it
more commonly used for non-supplicant case.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 13:08:37 +01:00
Vinayak Kariappa Chettimada
da792a9e17 Bluetooth: Controller: Fix interleaved extended scanning assert
Fix interleaved extended scanning assert.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-12-16 10:53:30 +01:00
Maochen Wang
671f0f6cfa net: sockets: choose SOCKETPAIR_HEAP when MEM_POOL enabled
Don't check 'HEAP_MEM_POOL_SIZE != 0', as HEAP_MEM_POOL_SIZE might be 0,
but HEAP_MEM_POOL_ADD_SIZE_xxx is defined, which means the actual heap
size is not zero. So check KERNEL_MEM_POOL instead.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 10:53:21 +01:00
DEVER Emiel
336c650646 fs: ext2: Fix ext2 read buffer overflow
Keep track of the amount of bytes read so no buffer overflow occurs.

Signed-off-by: DEVER Emiel <emiel.dever@psicontrol.com>
2024-12-16 10:52:29 +01:00
Make Shi
7349c8572d Bluetooth: Shell: BR: Set user data size for rfcomm tx pool
The user data size of the RFCOMM tx pool is zero. There is not enough
space to put the tx_meta data. Use CONFIG_BT_CONN_TX_USER_DATA_SIZE to
set the data size for the RFCOMM tx pool.

Signed-off-by: Make Shi <make.shi@nxp.com>
2024-12-16 08:35:10 +01:00
Make Shi
232ecfd880 Bluetooth: L2CAP_BR: Use LOG_WRN for not enough room in user_data
Using LOG_WRN could indicate that something about the user
configuration needs to be changed.

Signed-off-by: Make Shi <make.shi@nxp.com>
2024-12-16 08:34:58 +01:00
Pisit Sawangvonganan
865152fbe2 bluetooth: host: gatt: consolidate net_buf_add call
Consolidate `net_buf_add` calls using known `param->len`
to streamline the codebase.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-16 08:34:42 +01:00
Chaitanya Tata
cf7ecb18c0 net: l2: wifi: Add a verbose option for reg_domain
Most users won't be interested in the per-channel rules but only in the
country code, so, add a verbose option to hiden per-channel rules which
are too verbose.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-12-13 21:51:02 +01:00
Chaitanya Tata
6223c4a904 net: l2: wifi: Convert reg_domain to use get_opt
In order to prepare for extending the options, convert to getopt long
for easier parsing of options.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-12-13 21:51:02 +01:00
Pisit Sawangvonganan
b44250ae46 shell: modules: kernel: streamline code
This commit includes cleanups to `kernel_service`:
- `shell_tdata_dump()`:
  Adjust formatting to align with `.clang-format`.
- `shell_stack_dump()`:
  Update to pass `sh` directly instead of `user_data` since
  it is already assigned.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-13 11:35:28 +01:00
Pisit Sawangvonganan
8fedee30ee shell: modules: devmem: use shell_strtoul in cmd_dump
Switch from using direct `strtoul` calls to `shell_strtoul`.
This change leverages the extensive error handling provided
by `shell_strtoul`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-13 11:35:28 +01:00
Pisit Sawangvonganan
27cbe0553c shell: modules: date: omit NULL initialization of endptr
As `strtol` guarantee to set `endptr`, the initial `NULL` can be omitted.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-13 11:35:28 +01:00
Pisit Sawangvonganan
09f13a31e9 shell: utils: omit NULL initialization of endptr
As `strtoul`, `strtoll`, and `strtol` guarantee to set `endptr`,
the initial `NULL` can be omitted.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-13 11:35:28 +01:00
Pisit Sawangvonganan
13c74a0764 modbus: serial: remove redundant cfg->dev usage in uart_cb_handler
Simplify `uart_cb_handler` by directly using `dev` instead of `cfg->dev`,
as both hold the same value.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-13 11:34:44 +01:00
Make Shi
345c3f17eb Bluetooth: Shell: BR: Add NULL pointer check for result->resp_buf
In case the peer device has NO SDP record, the result is valid,
but the result->resp_buf is NULL, it would introduce a hardfault.
Therefore, also add a NULL pointer check for result->resp_buf.

Signed-off-by: Make Shi <make.shi@nxp.com>
2024-12-13 09:13:17 +01:00
Abe Kohandel
858ed0e2c3 bt: services: ots: l2cap close handling for read
Ensure OTS current object is returned to idle state when an L2CAP
connection is closed.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2024-12-13 04:24:32 +01:00
Jungo Lin
7019abb820 logging: increase the maximum value of LOG_BUFFER_SIZE
Increase the maximum value of LOG_BUFFER_SIZE from 64 KB to 1 MB
to accommodate varying device requirements.

Signed-off-by: Jungo Lin <jungolin.tw@gmail.com>
2024-12-12 19:59:51 +01:00