Commit graph

18329 commits

Author SHA1 Message Date
Torsten Robitzki c1b07eda84 logging: fix backend index caluculation
Backend index must also be incremented, when backend is not an autostart
backend. Otherwise, the resulting bit field can not be used to address
a backend by index; autostart field would have to be taken into account.

Signed-off-by: Torsten Robitzki <Torsten@Robitzki.de>
2024-04-26 16:09:24 +02:00
Vinayak Kariappa Chettimada 8fa75e2ada Bluetooth: Controller: Ignore failure to Broadcast ISO remove data path
Ignore failure to Broadcast ISO remove data path when
terminating a BIG without a data path being setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:26 +02:00
Vinayak Kariappa Chettimada a1e8af0936 Bluetooth: Controller: Fix missing Broadcast ISO HCI reset
Fix missing Broadcast ISO implementation for HCI reset.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:26 +02:00
Vinayak Kariappa Chettimada ddce23b447 Bluetooth: Controller: Fix multiple advertiser assertion
When multiple advertisers overlap over time, the random
delay being applied need many ticker operation context.
This causes the ticker_update interface to return error
causing assertion in the Controller.

This is fixed by not applying random_delay value to the
overlapping advertiser that does not get to use the radio.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:14 +02:00
Vinayak Kariappa Chettimada fd15e89ae8 Bluetooth: Controller: Increase ull_sched ticker_next_slot_get retries
Increase retries for ull_sched use of ticker_next_slot_get.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-26 15:30:14 +02:00
Hang Fan 247ac7fce9 Bluetooth: Classic: Add SDP records for HFP
Add SDP records for HFP Hands-Free

Signed-off-by: Hang Fan <fanhang8@gmail.com>
2024-04-25 18:05:40 -04:00
Fabio Baltieri c5003e0eb1 pm: add device shell commands
Add support for a "pm" shell command to trigger suspend/resume as well
as runtime-get/put on devices. This is useful for testing during driver
development.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-25 18:00:05 -04:00
Flavio Ceolin ec83ab333d pm: policy: Fix event integer overflow
In the follow expression:

cyc_evt += UINT32_MAX + 1U

first it is evaluated (UINT32_MAX + 1U), since both types
interpreted as uint32_t, this operation causes an overflow resulting
in 0U.Then we have

cyc_evt = (uint64_t)cyc_evt + 0U

Fix it casting of the operands in the first operation to uint64_t.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-04-25 17:58:04 -04:00
Aleksander Wasaznik 2a7adae6c1 Bluetooth: Rename num_complete_pool -> sync_evt_pool
Refactor only. The surrounding ifdefs are intentionally not changed in
this patch. They will be in the near future.

Rename the pool and generalize the documentation to allow using this
pool for other events that fit the same criteria. This pool can be used
for any buffer that is processed synchronously, without negatively
affecting 'num complete' messages. E.g. 'cmd complete/status' can be put
in this pool already.

We will be working towards making the host process all event buffers
synchronously. This is because events have no dedicated flow control,
and discarding events in the driver without informing the host creates
problems. Discarding should instead happen in the host higher layers
when unavoidable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-25 15:10:50 +02:00
Szymon Janc e4747b28a8 Bluetooth: OTS: Fix checksum calculation support
There was a typo in Kconfig check (missing CONFIG_ prefix) which
resulted in not setting OACP_FEAT_BIT_CRC bit in features.

This also resulted in checksum feature being disabled due to check
in bt_ots_init().

This was affecting OTS/SR/OASP/BV-03-C qualificatio test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-04-25 07:44:08 -04:00
Jukka Rissanen 07599e3a53 net: vlan: Add a function to check if interface is VLAN one
We were missing a helper function that can be used to check
whether the given function is the virtual VLAN interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-25 11:06:23 +00:00
Nithin Ramesh Myliattil 92417967cf Bluetooth: BAP: Shell: Add BASS service data to ext-adv
As per the BAP spec, the scan delegator device should add the BASS service
data in the extended advertising data when it requests a broadcast
assistant to scan for it. For testing purposes that's usually the case
with the shell, extended advertising data shall be populated with the
BASS service data.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-04-25 09:56:25 +00:00
Galen Krulce 1cfe90d825 tracing: full reset during init
I am using the tracing module using the RAM backend on a system with
limited RAM & a buffer that can only store 300ms of tracing data. Current
tracing module starts recording during boot-up & we run out of memory prior
to executing code we actually want to trace.

By reseting buffer metadata here, I can call init() at an arbitrary point
of program execution & the tracing module will reset & start tracing.

I tested on E2E on an ARM M-class MCU by calling init & then reading
buffered tracing data via GDB

Signed-off-by: Galen Krulce <gkrulce@meta.com>
2024-04-24 17:08:24 -04:00
Al Semjonovs 0bca04635d shell: Allow extension of shell APIs
Similar to logging module, allow application specific extension of
shell fprintf APIs at a macro level.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2024-04-24 16:04:03 -04:00
Joakim Andersson 24264ad4af shell: Improve the default serial backend init level
Improve the default serial backend init level.
The documentation says to be bigger than the init level of the serial
device used. Since serial devices default to the kernel device init
level (50) then put this to default of application level drivers (90).

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2024-04-24 19:42:23 +00:00
Vinayak Kariappa Chettimada 2329a2f0a1 Bluetooth: Controller: Aux offset population assertion check
Add aux offset population assertion check, to ensure the
aux offset calculation is completed before the primary
PDU is setup for transmission.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-24 15:02:28 -04:00
Aleksandr Khromykh fe13209eb1 Bluetooth: Mesh: fix start rx transaction before tx is ended
Commit fixes behavior when provisioning protocol accepts
incoming transaction before ongoing tx transaction is
still active (device didn't receive acknowledgement yet).
Incoming data are ignored until ack is not received.

Specification:
5.3.3 Generic Provisioning behavior
...
If the sender receives a Transaction Acknowledgement
message, then the transaction has completed.
If the sender receives a message with other PDU types,
then the message shall be ignored.
...

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-04-24 15:01:43 -04:00
Tomi Fontanilles a986905df5 modem: chat: implement helper defines/structs
Those helpers allow to define some typical kinds of chat matches and
scripts with more ease/less boilerplate.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-04-24 15:00:10 -04:00
Dominik Ermel c007e717d4 mcumgr/img_mgmt: Fix zcbor logic in os_mgmt_bootloader_info
There have been to problems with the code where zcbor_bool_encode
has been fed value instead of expected pointer and the result
of previous zcbor_encode operations has not been taken to evaluate
value of ok status.
The change also replaces usage of  #if IS_ENABLED with #ifdef, as
IS_ENABLED should not be used outside if().

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-04-24 14:55:57 -04:00
Henrik Brix Andersen 7390740c29 canbus: isotp: use proper CAN ID masks
Use CAN ID masks matching the flags used in the CAN RX filter.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-04-24 09:53:06 +02:00
Ajay Parida 02f4e71633 net: l2: wifi: Fix for wrong return type
The function should return NULL instead of false in case of failure.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-04-24 09:52:48 +02:00
Ajay Parida b93002655e net: l2: wifi: Protect processing of nm data
Use lock while accessing nm data.
One of the use case is while setting regulatory, it accesses nm data,
while from some other place also it can be accessed same time.
Protected the nm data processing.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-04-24 09:52:48 +02:00
Jonathan Rico b08b1c21a0 net: buf: Disallow blocking allocation in syswq
Work items on the syswq should always run-to-completion.

Override the timeout value to always be K_NO_WAIT.

Allocating with K_FOREVER leads to deadlocks if the freeing also happens
from the syswq. Non-zero timeouts are also not nice for the other users
of the syswq.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 19:47:24 -04:00
Chaitanya Tata b29dff09fa net: wifi: Check for mandatory args
Even though we are passing mandatory args from the shell registration,
due to use of getopt the check can be bypassed without the hyphenated
options.

So, enforce and fail if mandatory parameters aren't passed through
getopt.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-04-23 19:46:57 -04:00
Chaitanya Tata ddf09c9f58 net: wifi: Add missing return code for failures
This is handy in debugging.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-04-23 19:46:57 -04:00
Vinayak Kariappa Chettimada dc56669c31 Bluetooth: Controller: Default to advertising coding in ACL connection
Change default to using advertising coding in ACL connection
when establishing connections on Coded PHY.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 21:29:10 +00:00
Vinayak Kariappa Chettimada a725931c11 Bluetooth: Controller: Add missing check for Coded PHY support
Add missing check for Coded PHY support when creating
extended advertising set.

Added a fallback in Controller for upper layers requesting
Coded PHY while Controller is implemented without Coded PHY.
In this case, 1M PHY will be used in extended advertising
for testing purposes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 21:29:10 +00:00
Aleksander Wasaznik 8714e3634e Bluetooth: Fix minor whitespace issue
Fix minor whitespace issue

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-23 21:27:35 +00:00
Andreas Rudolf f531afbd2c net: lwm2m: Add config to always report obj version
Adds a config that enables sending the object version for all objects.

According to LwM2M specification v1.0 and v1.1, non-core object versions
other than 1.0 'must' be provided, while all other versions 'may' be
provided. With specification v1.2, a client 'can always attach Object
Version Information'. Or in other words, it is OK to always report the
object version with all specifications.

Signed-off-by: Andreas Rudolf <andreas.rudolf@husqvarnagroup.com>
2024-04-23 21:26:39 +00:00
Vinayak Kariappa Chettimada 9bcf275d8b Bluetooth: Controller: Ignore bit 1 set in Initiating_PHYs
Ignore LE 2M PHY being set in Initiating_PHYs of the
LE Extended Create Connection command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-23 13:44:31 +00:00
Håvard Reierstad e56494634a bluetooth: mesh: Adapt BLOB IO to RRAM write size
Adapts flash writing for BLOB IO to RRAM. The previously used write
block alignment is not needed for RRAM.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-04-23 13:43:31 +00:00
Emil Gydesen e7ee26d5ed Bluetooth: BAP: Shell: Moved RX and TX fields into a union
An audio stream is unidirectional, so it's always either
TXing or RXing, so the fields can safely be moved to an
enum.

The struct now has both a is_rx and is_tx field. The reason
why two bools are being used, is that the both of them may
be false (we need 3 states).

All access to the rx and tx structs in the union shall be
guarded by these fields.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-23 15:36:39 +02:00
Jonathan Rico e4364413c2 Bluetooth: L2CAP: Don't try to send on disconnected channel
We could start executing the work item after the channel has been
disconnected or destroyed, due to a race condition.

Double-check we are connected before attempting to send data.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 15:34:48 +02:00
Jonathan Rico 57b94080b2 Bluetooth: L2CAP: don't use NULL buf
Allocation of `buf` can fail. It just very rarely happens in practice.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 15:34:42 +02:00
Aleksander Wasaznik df1e4aa70f Bluetooth: refactor add is_host_managed_ccc
This check is repeated many times in `gatt.c`, with various comments.
This patch refactors these occurrences into a named function.

Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/41789

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-23 15:34:25 +02:00
Jonathan Rico a5ae3b026b Bluetooth: conn: Don't wait for buf allocation in syswq
We can't just keep blocking the syswq, people be mad.
Override the timeout value so we always have K_NO_WAIT.
Also print a message to whomever's listening.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-23 15:34:10 +02:00
Szymon Janc baf3cc9fe0 bluetooth: OTS: Delay indications to system workqueue
OTS requires that indications about state change are sent after
response to ATT Write.

OTS Specification p.4.4.4.: "An OLCP or OACP operation is started
when the ATT Write Response is received from the Object Server as
a result of the Object Client writing an Op Code to a control point
to perform some desired action. The control point operation ends
when the Object Server sends an indication to the Object Client
 with the Op Code set to Response Code."

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-04-23 15:32:07 +02:00
Rubin Gerritsen 237c59585e Bluetooth: Host: Rename bt_conn_state_t states for clarity
To make it easier to understand the code, the following was done:
- Use INITIATING/ADV for state names that are exclusive to central
  or peripheral. Previously it was not necessarily clear that the state
  BT_CONN_CONNECTING was for central only by just looking at where
  it was used. The terms INITIATING/ADV were used in favor
  of central and peripheral as these terms also work for SCO connection
  establishment.
- BT_CONN_CONNECTING_SCAN -> BT_CONN_SCAN_BEFORE_INITIATING
  to make it more clear that we are not scanning and connecting at
  the same time. The new name should make it more clear why we are
  scanning - only with the intention to start the initiator later.
- BT_CONN_CONNECTING_AUTO -> BT_CONN_INITIATING_FILTER_LIST.
  This makes it clear that this state is something different than
  BT_CONN_AUTO_CONNECT.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-23 15:31:59 +02:00
Rubin Gerritsen 1c132c90aa Bluetooth: Host: Document flags used for connection establishment
When initially reading some of the host code it was unclear to me
why they were needed an how they are used.
By adding some documentation,
this can hopefully make it easier for others to understand these.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-23 15:31:59 +02:00
Carles Cufi a1dd9a5f6e bluetooth: host: Fix alignment of gatt_chrc
The following warning is issued by clang:

warning: field  within 'struct gatt_chrc' is less aligned than 'union
gatt_chrc::(anonymous at subsys/bluetooth/host/gatt.c:1859:2)' and
is usually due to 'struct gatt_chrc' being packed, which can lead
to unaligned accesses [-Wunaligned-access]

This is due to the fact that the uint16_t uuid field requires 2-byte
alignment but it is not marked as packed. Since the enclosing struct is
indeed packed, the required alignment is not guaranteed and so clang
complains. Fix it by ensuring that the union is marked as packed too.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-04-23 14:23:04 +03:00
Théo Battrel f461ae574f Bluetooth: Mesh: Remove usage of auto name in AD
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.

The Mesh files `proxy_srv.c` and `pb_gatt_srv.c` were using
BT_LE_ADV_OPT_USE_NAME. Add the device name in the advertising data
directly.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-23 12:42:24 +02:00
Théo Battrel 6c9010be9f Bluetooth: Shell: Remove usage of auto name in AD
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.

Update the Bluetooth shell and its documentation to not use those
options anymore.

The option of the legacy advertiser run with `bt advertise` and the
behavior hasn't changed. The code has been updated to no longer use the
advertiser option but the original behavior has been reproduced.

The option of the extended advertiser have been updated to be more
explicit. The options `name` and `name-ad` have been removed from the
`bt adv-create` and `bt adv-param`. The option `name` and `dev-name`
have been added to the `bt adv-data` command.

- `name <str>` will advertise the given name.
- `dev-name` will advertise the device name.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-23 12:42:24 +02:00
Johann Fischer 215b4ddf98 usb: device_next: rework USBD shell to take speed into account
Rework USBD shell to take speed arguments into account and revise
command help text. Rename some of the commands to better reflect what
they actually do.
Since most of the init code changes, rewrite the command to initialize
the default configuration in the shell to register all available
classes, but not to enable USB device support in a single command.
This will allow earlier notification in the future, if supported by the
controller, before the USB device controller is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 0cfc15da2e usb: device_next: rename usbd_class_iter to usbd_class_node
For the last dozen commits, the role of usbd_class_node has actually
been taken over by usbd_class_iter. After cleaning up and merging
usbd_class_node and usbd_class_data, we can rename usbd_class_iter to
usbd_class_node to better reflect its role.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 2bc55f17ec usb: device_next: rename usbd_class_node to usb_class_data
Since only usbd_class_node contains the class instance data, rename it
to usbd_class_data.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 9acd1e877d usb: device_next: temporarily remove struct usbd_class_data
With the latest change, there are two structures that actually contain
class instance related data. Merge them into usbd_class_dnode, because
there is already a handy macro that can be used in class instances.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer cc36727b95 usb: device_next: use helpers to get priv and device context
Some places have been overlooked, finally get rid of it. Use helpers to
get instance priv and device context.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 5144d0f65f usb: device_next: Introduce speed specific configurations
USB High-Speed devices must be able to operate at both High-Speed and
Full-Speed. The USB specification allows the device to have different
configurations depending on connection speed. Modify the API to reflect
USB Specification requirements on what can (e.g. configurations) and
what cannot (e.g. VID, PID) be speed dependent.

While the class configurations for different speeds are completely
independent, the actual class instances are shared between operating
speeds (because only one speed can be active at a time). Classes are
free to provide different number of interfaces and/or endpoints for
different speeds. The endpoints are assigned for all operating speeds
during initialization.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 99cd7ee991 usb: device_next: Fix uninitialized variable warning
Assign default value to prevent possible uninitialized variable warning.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 2470821dc2 usb: device_next: Allow class to return NULL descriptor set
Simply skip over the class if it returns NULL descriptor set for given
speed.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń f411f801fe usb: device_next: Separate endpoint assignment from class data
Introduce usbd_class_iter for keeping endpoint assignment variables
and the single-linked list node. No functional changes right now, but
this paves the way for independent speed specific configurations.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 2deab70f0f usb: device_next: Handle class requests the same regardless of debug
When device is not configured, any class or endpoint request must result
in request error. Do not try to find transfer owner because there cannot
be one.

Make sure that the actual handling code path does not depend on the
configured log level because it is absolutely not desired for log level
to affect actual handling.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń a2ce9b0151 usb: device_next: allow terminating descriptor set with NULL
Do not require nil descriptor at the end of descriptor set because it
serves no other purpose than a sentinel. Just end processing on first
NULL pointer within descriptor set.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 5e3a73de04 usb: device_next: uac2: Convert class to descriptor set
Convert to new descriptor interface, present only Full-Speed descriptors
to the USB stack.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń 52ce527c81 usb: device_next: uac2: add descriptor sets macros
Add necessary macros and convert UAC2 descriptor test from descriptor
blob to descriptor set. Currently there is only Full-Speed descriptor
set.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 42f7e1b97f usb: device_next: make HS support compliant with the USB2.0 specification
For specification-compliant high-speed support, we need to support
device quilifiers and other-speed-configuration descriptor requests. We
also need to store different configurations of the class/function
descriptors, which typically only affect the endpoint descriptors. With
this change, the stack expects class/function descriptors to be passed
as an array of struct usb_desc_header pointers to e.g. interface,
interface-specific, and endpoint descriptors, with the last element of
the array pointing to a nil descriptor. And also passed for a specific
speed, for now we support full and high speed configurations.

During instantiation, the class/function implementation must choose the
correct configuration in the full-speed and high-speed descriptor sets
for values such as maximum packet size and bInterval values of interrupt
and isochronous endpoints.

During initialization, the stack reads the highest speed supported by
the controller and uses it to get the appropriate descriptors set
from the instance. If the controller supports only full speed, the stack
configures the class/function descriptor for full speed only, if the
controller supports high speed, the stack configures the descriptors for
high speed only, and a class/function must update the full speed
descriptor during the init callback processing.

During device operation, the class/function implementation must check
the actual speed of the device and use the correct configuration, such
as the endpoint address or maximum packet size.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 5cd964a744 usb: device_next: introduce and interface to get class/function descriptor
Introduce interface to get class/function descriptor for specific
speed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 3fed5559e9 usb: device_next: add helpers to get highest supported and actual speed
Save actual device speed in the device context and add helpers to get
highest supported and actual speed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer fde4530055 usb: device_next: add helpers to get private data and device context
The class implementations should not access the members of the struct
usbd_class_node directly.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Johann Fischer 378a5f2bf7 usb: device_next: rework loopback interfaces
This implementation is WIP and has mostly been used to test interface
and endpoint configuration by the stack. For future changes, make the
interfaces more compliant with the USB specification.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Aleksander Wasaznik 46ff1dff56 Bluetooth: Fix store disconnected_handles reason
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/70497

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-22 06:49:00 -07:00
Herman Berget 9729651bb5 ipc_service: backends: icbmsg: Silence maybe-uninitialized warning
If compiling with optimizations (-O2/-Ofast) gcc emits a
maybe-uninitialized warning for `size`.

As far as I can tell, `size` will always be initialized in the cases
where it is used and only left uninitialized in error cases.

Reproduced on main with the multi_endpoint sample on
nrf5340dk/nrf5340/cpuapp.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2024-04-22 06:48:54 -07:00
Rubin Gerritsen d3cfbf1ae1 Bluetooth: Host: Document scanning dev flags
When initially reading some of the host code it was unclear
to me why they were needed an how they are used.
By adding some documentation, this can hopefully make it
easier for others to understand these.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-22 06:48:47 -07:00
Peter Mitsis 02cc127475 linker: subsys: Use Z_LINK_ITERABLE_SUBALIGN
Updates the linker script fragments under 'subsys' to use
Z_LINK_ITERABLE_SUBALIGN for the subalignment instead of
a hardcoded value of 4.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-04-20 13:45:25 -04:00
Denis Bourqui e3e009a199 logging: Fix backend filter setting
Call filter_set with backend-id instead of backend-index
when applying a filter on all backends.

Signed-off-by: Denis Bourqui <db@rnx.ch>
2024-04-19 18:01:03 +00:00
Jukka Rissanen b864cd9053 net: if: Do not add IPv6 address lifetime timer twice to list
The IPv6 address lifetime timers are kept in a slist, but
the code that adds the entry to the list does not check
whether the item is already in the list. This will cause
problems when trying to remove the address from the list.

Normally this is not causing issues, but if the function
net_if_ipv6_addr_update_lifetime() is called multiple times
before the address expires, then the item was added to the
slist multiple times.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-19 17:04:17 +00:00
Ravi Dondaputi b45ff98f47 wifi: shell: Support WPA auto personal security mode
Applications need to run a scan to identify the security
mode before attempting the connection which adds to the time
taken for connection to be established.
To avoid the initial scan, support auto security mode which will
enable STA to choose between WPA, WPA2 and WPA3, based on the
network configuration.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-04-19 16:40:29 +00:00
Fin Maaß 99953b55a5 mgmt: hawkbit: extend shell to settings
This commit extents the functions
of the hawkbit shell to set the settings

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Fin Maaß 679cf6111b mgmt: hawkbit: set server address, port and auth_token during runtime
In situations, where the address, the port and the auth token of the
hawkbit server are not known during build, it should be possible to set
it during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Fin Maaß ded865f489 mgmt: hawkbit: change Kconfig port to int
Ports set by Kconfig are mostly defined
as a int. This changes it for hawkbit too.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Fin Maaß 98d63ed286 mgmt: hawkbit: check for init
check for init before running hawkbit.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Fin Maaß ffb2f51127 mgmt: hawkbit: migrate to settings api
Migrates from nvs to settings api.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Fin Maaß 1af6d0d129 mgmt: hawkbit: change to K_SEM_DEFINE
Define and initialize probe_sem with K_SEM_DEFINE

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Franciszek Pindel 8cc2d90123 fs: ext2: Fix removing indirect blocks
This commit fixes removing indirect blocks (marking them as 0)
in the inode structure. Previous version of the code was removing
the top-level blocks only when the first removed block was
one of the first 12 direct blocks. However, when the first removed
block is the first block in the referenced block list, its parent
(indirect block) should also be removed.

Signed-off-by: Franciszek Pindel <fpindel@antmicro.com>
2024-04-19 10:13:09 +02:00
Ajay Parida 4d4b304e03 net: wifi_mgmt: Setting RTS threshold
Support to set RTS threshold.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-04-18 08:42:29 -07:00
Ravi Dondaputi 0e617a3929 net: wifi: shell: Remove redundant break
Having a `break` statement after `return` is redundant and
needs to be removed.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-04-18 08:07:35 -07:00
Ravi Dondaputi 72c81eec3b net: wifi: shell: Correct help text for connect command
Since `NONE` is a valid option for key management in `connect`
command, we should remove the part in help text which says:
"valid only for secure SSIDs".

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-04-18 08:07:35 -07:00
Théo Battrel 7d4b6c6306 Bluetooth: Controller: Fix UBSan error
UBSan was showing the following error:

```
runtime error: left shift of 137 by 24 places cannot be represented in
type 'int'
```

Cast the value to `uint32_t` to make UBSan happy.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-18 08:05:14 -07:00
Aleksander Wasaznik 5dd1cdda3b Bluetooth: Remove rx < tx prio check
The comment states the reason for this requirement is to detect
violations by a remote peer. The ATT version of this was removed in
ea04fd95f9. TLDR: It's neither possible
for, nor the job of the host to police the remote device.

We remove this requirement to be more flexible about the number of
priority levels in the system, and to avoid the temptation of using
priorities as a synchronization mechanism.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-18 14:56:42 +02:00
Erik Brockhoff 7724b3e356 Bluetooth: controller: refactor of procedure init for mem optim
Refactoring alloc/init of procedures in LLCP to optimize memory.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-04-18 14:54:47 +02:00
Fin Maaß 10fafa025e mgmt: hawkbit: add support for custom device identity callback
add support for custom device identity callback in hawkbit

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-18 11:19:29 +02:00
Ben Wolsieffer 57ed0a7ae9 logging: multidomain_link: fix crash caused by drop notification
The remote domain may send unsolicited Z_LOG_MULTIDOMAIN_ID_DROPPED IPC
messages, which are not handled in log_multidomain_link_on_recv_cb().
With CONFIG_ASSERT=y, this will cause an assertion failure. With asserts
disabled, this message would be treated as a reply to any in progress
request and cause getter_msg_process() to return early. In turn, this
can cause various kinds of memory corruption when the real reply arrives
and the callback reads/writes stack variables that are no longer valid.

Fix this by explicitly ignoring Z_LOG_MULTIDOMAIN_ID_DROPPED, and also
don't treat unrecognized message types as replies.

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
2024-04-18 11:12:35 +02:00
Fin Maaß 11e58b3aae mgmt: hawkbit: add support to define attributes
Allows the attributes to be defined in the user application
by using a callback function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-17 12:02:07 -07:00
Kamil Gawor 6c130bcbab ipc_service: backends: icbmsg: Fix strnlen warnings
This fixes warnings when building with icbmsg
backend for IPC service by defining
_POSIX_C_SOURCE 200809L in source file.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2024-04-17 16:52:52 +01:00
Fin Maaß 8990a94d46 mgmt: hawkbit: correct ddi api calls
In hawkbit there are currently a lot of values send to the server, that
are not required or even optional. This commit corrects that.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-17 14:42:05 +02:00
Konrad Derda 701b6aed4b net: shell: print interfaces per multicast route entry
This commit change a method of printing multicast routes by showing
all interfaces per entry instead of aggregating them by interface.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Konrad Derda 61dca2b8bf net: ipv6: add multiple interfaces to multicast routing entry
In order to save memory, a single multicast routing entry now
contains configurable number of network interfaces.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Konrad Derda 97fc5ea597 net: ipv6: check if multicast packet was forwarded
This commit adds a check to determine if the packet wasn't already
forwarded to a given interface.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Konrad Derda df34742df7 net: ipv6: use ARRAY_FOR_EACH_PTR() for iteration over mcast routes
This commmit changes the way of iterating over multicast routing
entries from explicit for-loop to ARRAY_FOR_EACH_PTR().

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Andries Kruithof d96f98188c Bluetooth: CAP: Shell: Add cancel command
We didn't have a cancel command for the CAP commander, so adding this
command here.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-04-17 14:31:56 +02:00
Ben Wolsieffer 72cdbcbbba logging: consistently retrieve source ID from remote messages
The log message header "source" field for messages received from a
remote domain contains the source ID, rather than a pointer to the
source data (which would not be valid in the local domain).

msg_filter_check() did not handle this case and obtained a garbage source
ID for remote log messages. This caused an assertion failure in
filter_get().

Consistently handle this by adding a log_msg_get_source_id() function
that returns the source ID for both local and remote messages. This
function was implemented based on code factored out of
log_output_msg_process().

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
2024-04-17 14:28:59 +02:00
Emil Gydesen b4eac67b8b Bluetooth: BAP: Shell: Add support for decoding LC3 data
Add support for decoding incoming LC3 data. At this point
we only instantiate a single LC3 decoder, so only one frequency
and duration is supported.

To accomodate for the increased RAM usage, the number of unicast
streams support have been decreased.

Further more, the LC3 handling in the shell has overall been
improved, also for encoding.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-16 09:12:47 +02:00
Marc Herbert 01a8202135 llext: fix llext_find_sym() not to return a "const" value
Returned values are copies, so trying to "const" return values cannot
have any effect.

Fixes the following compiler warning:
```
llext.h:165: warning: type qualifiers ignored on function return type
```

Fixes commit 41e0a4a371 ("llext: Linkable loadable extensions")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-04-16 09:06:49 +02:00
Jonathan Rico 0794b22c9c Bluetooth: l2cap: Fix SDU buffer leak
`ret` is the amount sent from the current buffer. `sent` contains the
total amount that was transferred in the while loop.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-15 16:24:12 +02:00
Emil Gydesen 2b7f5dce25 Bluetooth: Audio: Shell: Runtime config of CAP/GMAP ACs
Modifies the audio configuration (ac) commands for CAP
and GMAP to use the default presets instead of supplying
the preset as arguments. This will allow the user to
use the `bap preset` command to configure everything in the
codec configuration before the AC commands are issued.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-15 12:56:33 +02:00
Emil Gydesen dd7e77b77c Bluetooth: BAP: Shell: Fix bad PA sync ref for sink auto scan
When creating a broadcast sink using the auto scan feature,
the call to bt_le_per_adv_sync_create would use a local
PA sync pointer, instead of one from the per_adv_syncs
array, making it impossible to stop the PA sync afterwards.

This commit modifed the auto_scan so that it properly uses
the per_adv_syncs array, while still assigning the PA sync
in the shell broadcast sink struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-15 12:55:52 +02:00
Emil Gydesen 24f0a83326 Bluetooth: Audio: Shell: Fix chan alloc print for mono
The print_codec_cfg_chan_allocation did not take the case where
chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO into account,
in which case it should print "Mono".

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-15 12:55:35 +02:00
Brad Kemp 3e2c067010 net: wifi: shell: update wifi ap enable to use get opt parsing
The commit 8256d02d3a introduced
getopt parsing for the wifi connect command
This needs to be updated for the wifi ap enable since ap
enable also uses the same parsing as connect.
The use of getopt removes the parameter ordering restrictions

Signed-off-by: Brad Kemp <brad@beechwoods.com>
2024-04-15 12:53:47 +02:00
Robert Lubos a0f0e55668 net: tcp: Fix FIN with data handling
In case FIN packet included data bytes, Zephyr would ignore the
data. It wasn't passed to the application, and it wasn't considered
when bumping the ACK counter. This ended out in connection timing out,
instead of being properly terminated.

Fix this, by refactoring FIN processing in TCP_ESTABLISHED state.
Instead of handling FIN/FIN,ACK/FIN,ACK,PSH cases separately, have a
common handler when FIN flag is present, and when ACK flag is present
along with FIN. When FIN is present, take any potentially incoming data
into account.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-15 12:51:52 +02:00
Aleksander Wasaznik a64d20f6f0 Bluetooth: host: sched-lock bt_recv()
`bt_recv` is invoked from the BT long work queue, which is preemptible.
The host uses cooperative scheduling to ensure thread safety.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-13 07:05:20 -04:00
Seppo Takalo 51d80a9838 net: lwm2m: Allow CoAP block size to be changed
Allow changing the CoAP Block-wise transfers block-size
for subsequent GET requests.

It looks like Leshan switches block size back to its
configured value, if it is smaller.
So even when we send block N=0 with size of 512, Leshan
seem to handle that properly but still asks N=2 with
block size 256(if that is configured).

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-04-12 09:14:36 -04:00
Morten Priess 2f1a254eae Bluetooth: controller: Implement LE Create BIG Test command
Implement test version of the LE Create BIG command ll_big_test_create
(BT_HCI_OP_LE_CREATE_BIG_TEST) in the controller.

This enables use of CONFIG_BT_ISO_ADVANCED, which supports use of
the following BIG/QoS configuration parameters (otherwise derived):

- ISO_Interval
- NSE
- Max_PDU
- BN
- IRC
- PTO

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-04-12 14:58:07 +02:00
Vinayak Kariappa Chettimada 7ece6aed16 Bluetooth: Controller: Fix regression in BT_RX_STACK_SIZE use
Fix regression in BT_RX_STACK_SIZE use due to
commit b91728619c ("Bluetooth: host: remove
`CONFIG_BT_RECV_BLOCKING`").

Profiling of Controller Rx thread has been mentioned in
commit 586ba9fd13 ("Bluetooth: Controller: Increase
BT_RX_STACK_SIZE for BT_HCI_RAW enabled").

Also, move the TX_STACK_SIZE value as default in Kconfig
from the explicit value being set in hci_ipc sample.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-04-12 13:48:57 +02:00
Adam Matus 869d4fc041 net: zperf: Improve shell upload cmd
Minor improvements to usage of zperf_shell upload.
Added common defaults for the upload commands arguments.
Print defaults in cmd help.
Throw warning when user sets baud rate for TCP upload.

Signed-off-by: Adam Matus <adam.matus@nxp.com>
2024-04-12 11:54:49 +02:00
Jukka Rissanen d40abe8c0f net: vlan: Fix net_eth_get_vlan_tag() to check correct interface
The network interface parameter for net_eth_get_vlan_tag() should
be the VLAN interface so use the search loop properly.
Earlier the main interface could be checked.

Add also test cases for this so that we can catch that the func
works properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-12 11:54:33 +02:00
Robert Lubos b292a9e8b5 net: sockets: tls: Add more logging in case of errors
Add more error logs in case of (mostly) mbed TLS errors, so it's easier
to get an initial idea of what went wrong based on logs only. Getting
an information on an actual mbed TLS error code is quite helpful in such
cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-12 11:54:02 +02:00
Erik Brockhoff dca085e155 bluetooth: controller: refactor node_rx_pdu for memory optimization
Generic node_rx_hdr struct contains data not used for done event, so this
pdu specific data is moved to node_rx_pdu to minimize memory usage for
MFIFO_done alloc.

This however calls for a considerable write-through replacing the generic
node_rx_hdr with node_rx_pdu when relevant and needed.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-04-12 09:19:08 +02:00
Erik Brockhoff 83f0647762 bluetooth: controller: use correct CONFIG for central CIS create proc. data
Use CONFIG_BT_CTLR_CENTRAL_ISO instead of CONFIG_BT_CENTRAL in
declaring central CIS CREATE procedure context data. In some configs the
size of this data structure is bound by central CIS CREATE, so doing it
correctly will save memory in the procedure context allocation.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-04-12 09:18:22 +02:00
Luca Burelli e24295f0f5 llext: add support for building relocatable ELF files
This commit adds support for building relocatable (partially linked)
ELF files as the binary object type for the llext subsystem.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-11 11:35:24 -05:00
Luca Burelli 64e7d85ef6 llext: define target binary type
Add a new Kconfig option to select the binary object type for the llext
subsystem. This will allow to fully decouple the architecture type from
the kind of binary object that is expected by the loader.

The defaults have been chosen to match the current behavior of the ARM
and Xtensa architectures, but developers can now more easily experiment
with other object types.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-11 11:35:24 -05:00
João Gonçalves 96737a8e81 mgmt: smp: fix smp client with shell transport
Fix typo in mcumgr shell transport relating to SMP client.

Signed-off-by: João Gonçalves <jomigo96@yahoo.com>
2024-04-11 11:27:51 -05:00
Erik Brockhoff ad46ed78d4 bluetooth: controller: fix periph failure to disconnect on proc. collision
If central initiates incompatible procedure after having replied (with
_IND), peripheral fails to disconnect as spec'ed.

Fix by correctly setting the INCOMPAT flag to reserved on IND receipt to
enforce the disconnect.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-04-11 16:01:34 +02:00
Marco Argiolas f0212367dc net: lib: lwm2m: fix formula for expected next block
Block size is a 3-bit value mapping values [0, 6] to powers of 2 in the
range [16, 1024]. Value 7 is invalid.
The previous formula was not working in case the client's preferred size
was 4 (or more) times bigger than the server's.
This commit takes into account also the case the client's preferred size
is smaller than the server's.

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2024-04-11 14:40:44 +02:00
Jonathan Rico 43de309b3e Bluetooth: l2cap: Remove (net/buf) frag support
It's needless complexity, and the terminology clashes with
Bluetooth (HCI frags).

It has one user, IPSP, that is going away soon.

Removing frag support will allow a future optimization, removing the
need for HCI and L2CAP fragment buffer pools, saving memory.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-11 14:40:32 +02:00
Jonathan Rico e3ff993000 Network: L2: remove IPSP
Remove IPSP support from the tree.

It has no maintainers, and is regularly broken. The fact that it's
nontrivial to set-up in linux makes it hard to fix reported issues.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-11 12:48:50 +02:00
Rubin Gerritsen 75973852bf Bluetooth: Audio: Add iso_chan to bt_bap_ep_info
By exposing the underlying iso channel, the application can retrieve
properties of the iso channel.

This can be useful in case the application wants to use the connection
handle for vendor specific HCI commands or to retrieve the particular
parameters used for the given channel.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-11 10:33:42 +02:00
Franciszek Pindel e13d1b47c6 fs: ext2: Fix calculating fs_memory in ext2_format
First sector starts at CONFIG_EXT2_DISK_STARTING_SECTOR.
This commit fixes calculating free space, based on that value.

Signed-off-by: Franciszek Pindel <fpindel@antmicro.com>
2024-04-11 09:07:43 +02:00
Cedric Lescop 7b1d9d6166 llext: Full ARM ELF relocation support
Adds support for all relocation type produced by GCC
on ARM platform using partial linking (-r flag) or
shared link (-fpic and -shared flag).

Signed-off-by: Cedric Lescop <cedric.lescop@se.com>
2024-04-10 14:13:15 -04:00
Daniel Leung b60e09062d cmsis_rtos_v1: support memory mapped stack at abort hook
This extends the thread abort hook to support memory mapped
stack. The calculation to find out to which instance of thread
pools the outgoing thread belongs requires physical address.
So find the physical address via the memory mapped stack for
that.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-04-10 07:44:27 -04:00
Jukka Rissanen cb7aae6f82 net: dns-sd: Do not use sockaddr struct directly
The "struct sockaddr" should only be used in casts and never
as a standalone variable because it might not have enough
space allocated for all the protocol specific fields.
So refactor the port_in_use() function to reflect that.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-10 07:42:42 -04:00
Robert Lubos f77c7a3d05 net: dhcpv4_server: Fix positive error codes returned
errno values are positive, therefore they should be negated when
assigned as return values for net_dhcpv4_server_start().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-10 07:42:21 -04:00
Björn Stenberg 731f8d4736 modbus: Respect CONFIG_UART_USE_RUNTIME_CONFIGURE
Only perform runtime UART configuration if it is enabled.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2024-04-10 10:01:55 +02:00
Dominik Ermel 5a0ecb9641 flash: Move dependency on FLASH_PAGE_LAYOUT where it belongs
The commit adds dependency on Kconfig FLASH_PAGE_LAYOUT to subsystems
that really require it:
 FCB, NVS, LittleFS
and removes direct selection from '*.conf' files where no longer
needed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-04-10 10:01:40 +02:00
Yong Cong Sin 37dfafe3f4 subsys/mgmt/hawkbit: rearrange headers
The order of the headers could use some cleanup. I'm
rearranging them alphabetically.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-04-10 10:01:33 +02:00
Yong Cong Sin 033bf60776 subsys/mgmt/hawkbit: use zsock_setsockopt instead of setsockopt
`setsockopt` is enabled by `CONFIG_POSIX_API`, use
`zsock_setsockopt` instead, otherwise there will be a
compilation error if `CONFIG_NET_SOCKETS_SOCKOPT_TLS` is
enabled.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-04-10 10:01:33 +02:00
Jukka Rissanen 85911bcfc1 net: mdns_responder: Avoid joining IPv4 mcast group if iface is down
Check if the interface is down before joining IPv4 mDNS multicast
group. This avoids warning later when the network packet cannot be sent.

Fixes #71121

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-10 10:00:49 +02:00
Flavio Ceolin 3b895064af pm: Remove state lock/unlock API
This API is not widely used and it is actually broken since device
runtime power management is not checking it when suspending and
resuming.

On top of that, this API is very close to pm_device_busy* API,
close enough to consolidate in only one API.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-04-09 20:11:48 +02:00
Nick Ward 17abc2743b net: lib: coap: set MAX_RETRANSMIT maximum to 100
Some application environments may need it.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-04-09 20:11:21 +02:00
Robert Lubos eeb527a5da net: Restore the default networking behavior on qemu platforms
Commit e99b5228a1 changed the default
networking behavior on qemu platforms, as the SLIP_TAP driver no longer
selected Ethernet L2. In results, qemu platforms in default
configuration had no network interface to work with.

Fix this, by restoring select for NET_L2_ETHERNET, but this time in
NET_SLIP_TAP. The difference is that SLIP_TAP is a generic driver
config, which could be enabled on any platform, so not changing the
behavior here, while NET_SLIP_TAP is a config dedicated for qemu only,
so it's reasonable to enable all that's needed to get SLIP to work with
qemu by default.

As there were circular Kconfig dependencies, move the respective qemu
configs outside of NET_RAW_MODE if block (as this caused the circular
dependency with ETH_DRIVER_RAW_MODE). Also, remove dependency to
NET_L2_BT, as it made little sense there, and also caused dependency
problems.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-09 13:56:08 -04:00
Kapil Bhatt a087a40ac6 net: wifi: Remove constraints for dwell time
There is no limitations for dwell time. Just add
valid condition for positive value. So , it's better
to remove those constraints.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-04-09 14:21:10 +02:00
Emil Gydesen 16189b007f Bluetooth: BAP: Only dump active receive states
The bt_debug_dump_recv_state did not care if the receive
state being dumped to log was active or not, and if it was
not actice, then it may just contain random data.

Added a check to see if it was active.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-09 14:20:54 +02:00
Robert Lubos 837d09ed9e net: connection: Log an error when running out of contexts
Running out of connection contexts is most likely due to app
misconfiguration, therefore it's useful to get an explicit information
that context allocation failed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-09 11:05:10 +02:00
Emil Gydesen 58030cc31c Bluetooth: CAP: Shell: Stop all streams by default
The cap_initiator unicast_stop command will now stop
all streams by default, without supplying the "all" argument.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:27:34 -04:00
Théo Battrel 2e7befe240 Bluetooth: HCI: Reword BT_BUF_ACL_* description
Some part of the descriptions were wrong. Also, the description of
`BT_BUF_ACL_RX_SIZE` was too verbose and no longer needed with the
updated L2CAP documentation.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-08 09:26:42 -04:00
Théo Battrel c0700d9825 Bluetooth: L2CAP: Reword K-frame comment
The terminology was not following the Spec wording.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-08 09:26:42 -04:00
Emil Gydesen 8acada0608 Bluetooth: Audio: Shell: clear static buffers for ad data
The buffers for the PBP advertising data as well as the
buffers for the BASE periodic advertising data were
not cleared, so calling the functions multiple times
would simply append the data rather than just setting
the new data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:13:08 -04:00
Emil Gydesen d229b89a2b Bluetooth: BAP: Shell: Add tracking of empty SDUs
There are devices that will send empty SDUs instead of
empty PDUs, and while that should be harmless, it is nice
to know what is going on, and we may want to deal with
empty SDUs and empty PDUs differently.

This also modifies the state for TS and PSN to only be
applied for valid ISO packets.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:12:58 -04:00
Emil Gydesen 1d5acb7547 Bluetooth: Audio: Remove !found dbg log in codec.c
It is a common occurance that a specific type is not
found in the codec configuration, and the main way of
knowing that is by calling the function.

The debug log does not help debug anything (as it does also
return a specific error code), but rather just clutters up
the log if enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:12:45 -04:00
Emil Gydesen be5adb4323 Bluetooth: BAP: Unicast Client: Replace some LOG_ERR/WRN with DBG
When returning an error code directly to an application
in the API, it should not log as a warning or error.

The lack of PAC records is also reported directly to the
application, and is not an error (in fact it is valid not to have
e.g. sink or source pacs).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:12:31 -04:00
Emil Gydesen 5e840c1f1e Bluetooth: BAP: Shell: add additional printing in recv_state_cb
Add printing of the broadcast ID and whether an existing PA
sync was found in the bap_broadcast_assistant_recv_state_cb
function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:12:14 -04:00
Emil Gydesen a3c0f2b1e9 Bluetooth: BAP: Shell: Add support for "unknown" PA interval in mod_src
The bap_broadcast_assistant mod_src command can now take "unknown"
as a value to supply BT_BAP_PA_INTERVAL_UNKNOWN to the scan
delegator.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:12:02 -04:00
Emil Gydesen 0f3b0d29da Bluetooth: BAP: Shell: Fix documentation for broadcast_code
The documentation for the command
bap_broadcast_assistant broadcast_code
was incorrect and has been fixed.

Additionally, and example of the command has been added
in the shell documentation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:11:51 -04:00
Emil Gydesen ab57f2275a Bluetooth: BAP: Shell: Fix state lookup with PAST
When a PA is synced via PAST, the receive state does not
have a PA sync object, and the address and SID must be
used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:11:30 -04:00
Emil Gydesen 3caa8f403a Bluetooth: Audio: Shell: Fix snk_chan_cnt for AC_5
The audio configuration 5 is defined to have 2 sink channels
per stream and 1 source channel per stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:11:17 -04:00
Emil Gydesen 824e352a77 Bluetooth: BAP: Shell: Fix bad err check for PAST sync
If pa_sync_past returns 0 then that means we are ready to
sync to past, and the BT_BAP_PA_STATE_INFO_REQ state should be set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:10:40 -04:00
Guennadi Liakhovetski 2ccf775396 llext: add support for relocatable objects on Xtensa
Some toolchains cannot create shared objects for Xtensa, with them we
have to use relocatable objects. Add support for them to llext.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-04-05 21:54:47 -05:00
Georges Oates_Larsen 7fc6ef28d3 net: lib: http: Correct http_client edge-case behavior
Correct various small edge-case behaviors that have been accidentally
introduced in the http_client.

- http_client_req no longer incorrectly returns -ETIMEDOUT on NULL HTTP
  resonse. -ETIMEDOUT is now only returned when the underlying TLS
  socket times out.
- http_client_req now returns -ECONRESET upon incomplete (but non-NULL)
  HTTP response. The request callback is no longer called in this case
  (as with any other error state).
- http_wait_data has been refactored slightly to increase clarity.

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2024-04-05 13:35:22 -05:00
Fin Maaß e354927895 tests: use appropriate sys_randX_get()
use the appropriate sys_randX_get() instead
of always sys_rand32_get().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 10:57:45 -05:00
Declan Snyder 69e0b03ca9 net: zperf_shell: Fix IPv6 invalid warning
Fix the ipv6 invalid warning always appearing when
a valid ipv4 address is provided.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-05 18:46:58 +03:00
Jukka Rissanen 4c45884c8c net: tcp: Give a warning to user if packet cloning fails
If the packet cloning fails (can easily happen when working with
loopback interface and when having low net_buf count), then
print a warning to the user. Error could also be possible but
as the situation might correct itself in this case, the warning
should be enough.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-05 16:45:32 +03:00
Fin Maaß a1ea9b7351 net: use appropriate sys_randX_get()
use the appropriate sys_randX_get() instant
of always sys_rand32_get().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 12:28:46 +02:00
Fin Maaß 295aa36e60 jwt: use sys_rand_get directly
use sys_rand_get() directly.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 12:28:46 +02:00
Emil Gydesen 490fb20148 Bluetooth: Audio: Shell: CAP change microphone mute command
Adds the change microphone mute command to the CAP commander shell.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-05 12:21:38 +02:00
Emil Gydesen 5ab37692c0 Bluetooth: CAP: Commander change microphone mute procedure
Adds the CAP Commander Change Microphone Mute procedure.
This procedure changes the microphone mute state on one or more
CAP Acceptors.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-05 12:21:38 +02:00
Fin Maaß e3f182549a mgmt: hawkbit: Add support for reboot after update
Add support for automatic reboot after successful update completion

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 12:20:48 +02:00
Jukka Rissanen 83d879bb1a net: if: No error if mcast group join fails because iface down
If we fail to join all nodes or solicit node multicast groups
when the interface is down, then there is no need to print an
error message. The groups are automatically re-joined when the
interface comes up.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-05 12:19:27 +02:00
Fin Maaß 89c057a95a mgmt: hawkbit: optimize poll_sleep
remove unnecessary condition for CONFIG_HAWKBIT_POLL_INTERVAL,
changes poll_sleep to be in seconds,
change type of sleep_time in hawkbit_update_sleep(), so the return
value of hawkbit_time2sec() is interpreted correctly.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 11:54:47 +02:00
Luca Burelli 4867c56a51 llext: invalidate instruction cache after loading extension
In addition to flushing the dcache, to ensure that the new code is
actually read by the CPU when loading an extension, the icache must
be invalidated as well.

Without this, some tests are failing in hardware because the CPU is
executing stale code from its instruction cache.

Fixes #70906 on arduino_giga_r1/stm32h747xx/m7.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-05 11:54:31 +02:00
Fin Maaß 97eb8bf78c mgmt: hawkbit: little cleanup
a little cleanup in start_http_client().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 11:54:22 +02:00
Jakub Rzeszutko f8263e8293 shell: Add synchronization for prompt-string access in shell
Resolved a data race in shell.c by copying the user-provided
prompt-string into a private buffer within the shell, ensuring
proper synchronization with the shell-thread.

Fixes: #64972

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
2024-04-04 15:18:36 -05:00
Jukka Rissanen 78a0cfbd94 net: shell: capture: Set capture device if user did not use shell
If user created the capture device using the API and not via
the shell, then the device name was not set. Use the default
capture device in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 2064306d41 net: capture: Generate events when starting / stopping capture
The event NET_EVENT_CAPTURE_STARTED is generated when the
capture is enabled, and NET_EVENT_CAPTURE_STOPPED when capture
is disabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 0516ce9311 net: capture: Add capture function that returns a status
The net_capture_pkt() does not return information what happened
to the net_pkt because the packet was always cloned. With cooked
capture we can avoid the cloning in which case we need to know
the capture status in order to unref the packet if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 46cb5c0bd1 net: capture: Add Linux cooked mode capture support
Add support for capturing arbitrary data via the cooked mode (sll)
capture API. The actual packet capture is done using net_capture_data()
function, the packet capture infrastructure does not need any changes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 3bd43ea865 net: Implement pseudo a.k.a "any" interface
Allow user to create a kitchen sink pseudo a.k.a any network
interface that one is only able to write to. This might seem
unnecessary, but it is possible to attach virtual network
interfaces on top of this pseudo interface. These virtual
interfaces could then process the data for example for
packet capture purposes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 00502a8894 net: Add helper to print the verdict as string
For debugging purposes it would be nice to see the verdict
printed as a string instead of number.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 9a9f6f3d96 net: dummy: Add support for receiving data
Add a recv callback to dummy API. After this it is possible to
receive data by a dummy network interface. This is only useful
if one attaches a virtual interface on top of the dummy one.
One such example is the cooked mode capture interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Yong Cong Sin 10592b9df4 subsys/mgmt/hawkbit: change 'Hawkbit' & 'hawkbit' to 'hawkBit'
Change 'Hawkbit' and 'hawkbit' to 'hawkBit' wherever
makes sense, and a bit of touch ups here and there.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-04-04 09:46:22 +01:00
Konrad Derda 377756e0f9 net: ipv6: mld: fix handling of MLD queries
This commit fixes an issue where due to inverted logic (static function
returned 0 on success but the caller expected true/false) the MLDv2
reports were silently dropped.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-03 15:30:03 -05:00
Nithin Ramesh Myliattil 5be02da636 Bluetooth: Audio: Broadcast Assistant: add broadcast src duplicate function
Moved the check of broadcast src duplicate to function while adding source.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-04-03 21:11:30 +01:00
Fredrik Danebjer bbb87ae0ae Bluetooth: Audio: Broadcast Assistant: Check add_source duplication
Added a check for checking duplication when adding a source in the
broadcast assistant, as per requirement in BAP 6.5.4. It is not
permitted to add a source such that a combination of broadcast_id,
adv_sid and address type would result in same triple of values.
Added a recv_state struct to cache these values when read, and moved
past_avail and srd_ids into this as well.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2024-04-03 21:11:30 +01:00
Robert Lubos f211cd6345 net: tcp: Deprecate CONFIG_NET_TCP_ACK_TIMEOUT
Deprecate CONFIG_NET_TCP_ACK_TIMEOUT as it is redundant with the
combination of CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT and
CONFIG_NET_TCP_RETRY_COUNT. The total retransmission timeout (i. e.
waiting for ACK) should depend on the individual retransmission timeout
and retry count, having separate config is simply ambiguous and
confusing for users.

Moreover, the config was currently only used during TCP handshake, and
for that purpose we could use the very same timeout that is used for the
FIN timeout. Therefore, repurpose the fin_timeout_ms to be a generic,
maximum timeout at the TCP stack.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-03 15:32:45 -04:00
Jukka Rissanen eff03ca071 net: shell: Add printout when hostname changes
Add hostname changed printout to event monitor. As the name
says, it is generated when the hostname of the device changes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-03 15:40:16 +01:00
Reto Schneider ccc58b8ce5 net: lwm2m: device object: Fix coverage compatibility
Starting with b1d24e425c (net: lwm2m:
device object: optionally store error list in settings), it was no
longer possible to build the code with coverage enabled when the
settings subsystem was disabled.

The build would fail with an error like this:

> subsys/net/lib/lwm2m/lwm2m_obj_device.c:262: undefined reference to
> `settings_name_steq'

This fixes #70923.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-04-03 15:39:49 +01:00
Robert Zieba d012f280c7 gdbstub: Add v-packet handling function
Add `gdb_v_packet` function as a central location to handle processing
of v-packets.

Signed-off-by: Robert Zieba <robertzieba@google.com>
2024-04-03 15:39:28 +01:00
Robert Zieba 43cb0572e9 gdbstub: Add q-packet handling function
Add `gdb_q_packet` function to handle proccessing of query packets. Also
add `gdb_qsupported` function to serve as a single place to process and
respond to `qSupported` packets.

Signed-off-by: Robert Zieba <robertzieba@google.com>
2024-04-03 15:39:28 +01:00
Robert Zieba e410e2b740 gdbstub: Make loop enum public
Make the current gdb loop enum public under the name `gdb_loop_state`.
This will allow for extending the current stub with further
functionality in the future as new features will require control over
the loop state.

Signed-off-by: Robert Zieba <robertzieba@google.com>
2024-04-03 15:39:28 +01:00
Marcin Gasiorek 9c0b8181f3 net: dhcpv6: Add configurable DUID buffer length
According to the `RFC8415` the length of the DUID is at least 1 octet
up to 128 octets. Now a user can choose buffer length without the need
for source code modification.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-04-03 10:28:20 +03:00
Lyle Zhu 45ff5afbb7 Bluetooth: Host: Check conn/channel status of L2CAP BR
For BR/EDR L2CAP, if the function bt_l2cap_br_chan_send_cb
instead of bt_l2cap_chan_send is called, the ACL conn and
L2CAP chennel status will not be checked.

Check conn/channel status before sending data in
function bt_l2cap_br_chan_send_cb.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-04-03 10:27:53 +03:00
Declan Snyder db8a0b4b0c net: ethernet: Include ethernet API in eth_stats.h
eth_stats.h is using ethernet api but not including the header,
it must be working by luck in files that include it after
something else that includes ethernet.h, fix by just including it.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-02 21:02:25 -04:00
Fabio Baltieri 5591d2305e Bluetooth: host: tweak up the bluetooth thread names
Change the receive workque name to "BT RX WQ" to distinguish it from the
receive thread, and the long workque one to "BT LW WQ" to make the
format consistent with the other Bluetooth threads.

On an nRF52 now "kernel stacks" looks like:

0x200016c8 BT RX                    (real size  448):   unused  280    )
0x20001780 BT RX pri                (real size  448):   unused  224    )
0x200012c0 BT RX WQ                 (real size 2240):   unused 1360    )
0x20001208 BT TX                    (real size  768):   unused  408    )
0x20001130 BT LW WQ                 (real size 1344):   unused  408    )

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-02 21:01:00 -04:00
Pieter De Gendt f65715cb63 mgmt: mcumgr: Remove POSIX_API dependency for UDP transport
Zephyr subsystems should use non-posix socket API.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-04-02 14:31:23 +01:00
Luis Ubieda 92e0d0bbfc bluetooth: nus: Change Kconfigs prefix to BT_ZEPHYR_NUS
To prevent future conflicts with NCS's NUS implementation, whose
Kconfig's are prefixed with BT_NUS.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-04-02 10:36:01 +03:00
Fabio Baltieri fa6eca312f input: utils: rename the input dump callback
Change the input callback function name to make it easier to identify
what it belongs to. This clears some ambiguity when observing the symbol
names corresponding to the function pointers in the callback section.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-01 11:05:02 +01:00
Armin Brauns 63f713a170 fs: allow fs_mkfs() for FATFS without auto-format on mounting
Users should be able to call fs_mkfs() manually even if FS_FATFS_MOUNT_MKFS
is disabled.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-04-01 11:04:56 +01:00
Lukasz Mrugala 2f97795360 scripts: tests: Blackbox test expansion - platform
Adds tests related to the Twister's platform selection:
* -A, --board-root
* -K, --force-platform
* -p, --platform

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-31 17:37:09 -04:00
Reto Schneider da676d2e01 net: buf: Include user data when cloning
net_buf_user_data() is supposed to copy any data, which includes the
user data.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-29 16:00:39 -05:00
Robert Lubos 8e2722e1ca net: Provide separate configs for TX/RX memory pool for variable bufs
Instead of having a single config specifying the memory pool size for
variable-sized net buffers, have a separate one for TX and RX for better
configuration granularity when optimizing memory usage of the
application.

Deprecate the old configuration but use its value as a default (for now)
for the new configs. This will need to change when the config is
deleted.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-29 15:56:07 -05:00
Marco Widmer d83c63ecce pm: runtime: fix race when waiting for suspended event
To wait for the asynchronous suspending work item to complete, a
combination of semaphores and events is used. First, the semaphore is
released, then the events are cleared (through the boolean argument to
k_event_wait), then events are awaited.

However, if the event flag happens to be set by the work handler in the
short time between k_sem_give and k_event_wait, it is then cleared by
k_event_wait and k_event_wait blocks forever waiting for the event.

Make sure that we clear the event flag before releasing the semaphore.

Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
2024-03-29 15:08:56 +00:00
Pieter De Gendt 3102fdc8c1 bindesc: Update build time without re-running cmake entirely
With CONFIG_BINDESC_BUILD_TIME_ALWAYS_REBUILD a re-run was called for
the entire project.
This can result in issues with the zephyr linker mechanism.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-29 15:08:39 +00:00
Kapil Bhatt 6a0e6e4737 net: wifi: Replace numeric values with defines
There should be a particular defines which clarify the
use of that number. So, replacing numbers with defines
in wifi shell.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-03-29 15:08:00 +00:00
Seppo Takalo c62dd778cd net: lwm2m: Fix socket hints for block transfer
Outgoing block-transfers now set the socket hint
to ONGOING as long as the BLOCK1/BLOCK2 header has
MORE flag set to true.
This means as only the last packet in the block-transfer
set the socket hint to LAST or ONE_RESPONSE.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-03-28 16:02:34 -05:00
Chaitanya Tata 159617c8f6 net: wifi: Fix the Wi-Fi state check
Once Wi-Fi is associated few parameters like listen interval and
power-save mode cannot be changed. The state for association is
"ASSOCIATED" and not completed. Even after state transitions to
COMPLETE, it can still go back to other states, e.g., PTK/GTK renewal.

Fix the state check.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-03-28 14:47:50 +00:00
Krzysztof Chruściński 04a74ce107 shell: rtt: Add detection of host presence
If host is not reading RTT data (because there is no PC connection
or RTT reading application is not running on the host), thread will
stuck continuously trying to write to RTT. All threads with equal or
lower priority are blocked then. Adding detection of that case and
if host is not reading data for configurable period then data is
dropped until host accepts new data.

Similar solution is using in RTT logging backend.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-03-28 14:47:03 +00:00
Flavio Ceolin 85a7b27f97 random: Rename source files
s/rand32/random.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-03-28 09:44:44 +00:00
Flavio Ceolin d68db182b9 random: Remove duplicated code
All implementations of random number generator where duplicating logic
for sys_rand32_get. Since this subsystem already has a logic to
generate random values of arbitrary size, we can generically implement
sys_rand32_get on top of that.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-03-28 09:44:44 +00:00
Fin Maaß ba932f60af mgmt: hawkbit: remove hb_context.url_buffer_size
remove hb_context.url_buffer_size and replace it
with sizeof(hb_context.url_buffer)

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-03-28 09:43:18 +00:00
Jukka Rissanen def4a7ec12 net: gptp: Remove VLAN support
The gPTP is not suppose to be run on top of VLAN and the
earlier support was just for testing purposes. Remove VLAN
support now after the VLAN overhaul.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 3a67c6d8f5 net: arp: Enhance debug prints by printing interface index
Print also network interface index together with the pointer value
in order to get more useful information what is going on in the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 0e6341cc22 net: ethernet: Enhance debug prints by printing ifindex
Network interface index number is useful to see in
debug messages so print it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 0de1a75f91 net: shell: Print multicast join status for iface cmd
Print information whether a multicast address is properly
joined to a multicast group when print addresses using
"net iface" command.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 999c169d9d net: shell: Print VLAN name instead of interface type
As the interface type is always Virtual, no need to print it.
Print instead the name of the network interface as it is more
useful to the user.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen eb11a8af1c net: shell: Refactor VLAN configuration prints
Rework the way VLAN configuration is printed out.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 092f7f7666 net: virtual: Do not try to send data if interface is down
Make sure the interface is up before trying to send data to
lower level interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen e9994c8af8 net: virtual: Force LAA bit for link address
Make sure LAA (locally administred address) bit is set for the
generated link address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 63081bd7da net: if: We can only rejoin mcast groups for native IP stack
No point trying to join multicast groups if the network interface
is offloaded one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen e3f1271fb9 net: if: Join all unjoined solicited node multicast groups
If an IPv6 address was added to the interface while the
interface was down, its solicited node multicast address
is not joined properly and IPv6 communication will to
other hosts will fail. So make sure to rejoin all the
solicited node multicast groups that were joined already
when the network inteface is going up.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 493c1c1f01 net: if: Add debug print when interface is taken up
Add debug information to print when the network L2 enable
callback is called and fails. Useful to see this information
as at that point the interface goes down.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen a96a2f8d09 net: if: Start IPv6 DAD when interface comes up
Start any pending IPv6 DAD timers when interface comes up.
If IPv6 addresses have been added to the network interface when
it was down, the addresses would never work properly if the DAD
is not done.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen b5bdc1fa6b net: if: Enhance debug prints when adding IP address to iface
Instead of printing just a network interface pointer, print
also the interface index so debugging is a bit faster as no
lookup from interface listing is needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen ff01324c9b net: if: Remove VLAN count checks
No need to do the checks any more because user has specified
the VLAN count and so many VLAN virtual interface are already
created.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 2058d8f139 net: ethernet: VLAN overhaul and refactoring
Re-implement the VLAN support inside the network stack.
All the user facing APIs stay as is but internally the VLANs
are implemented using the L2 virtual interfaces.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Daniel Leung b69d2486fe kernel: rename Z_KERNEL_STACK_BUFFER to K_KERNEL_STACK_BUFFER
Simple rename to align the kernel naming scheme. This is being
used throughout the tree, especially in the architecture code.
As this is not a private API internal to kernel, prefix it
appropriately with K_.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-03-27 19:27:10 -04:00
Jukka Rissanen 42356b6d5c net: wifi: shell: Avoid declaring variables after case statement
Some compilers have trouble parsing variables directly after a case
statement.

Fixes: #70792

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 16:26:45 -05:00
Jukka Rissanen d7c9d67a9c net: Use always zephyr/posix/fcntl.h
Changing remaining users of fcntl.h to use the include from our own
POSIX file so that the values in there are consistent in all parts
of the sources.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 873af2ee98 net: sockets: Use only Zephyr POSIX headers
Use only Zephyr specific POSIX header files so that the whole
system is getting values from the same files. There was an issue with
native_sim run of tests/net/socket/af_packet which had O_BLOCKING set
to 0x4000 from include/zephyr/posix/fcntl.h, but then the file
subsys/net/lib/socket/sockets.c was having O_BLOCKING set to 0x0800
because different header files were used.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen e158c1729a shell: mqtt: Avoid using POSIX function names
This commit fixes this error seen in CI so that things
work even if CONFIG_POSIX_API is enabled.

subsys/shell/backends/shell_mqtt.c:727:12: error:
  conflicting types for 'write'; have
 'int(const struct shell_transport *, const void *, size_t,  size_t *)'
  727 | static int write(const struct shell_transport *transport,
                         const void *data, size_t length)

include/zephyr/posix/unistd.h:230:9: note: previous declaration
 of 'write' with type
 'ssize_t(int,  const void *, size_t)'
  230 | ssize_t write(int file, const void *buffer, size_t count);

subsys/shell/backends/shell_mqtt.c:787:12: error:
 conflicting types for 'read'; have
 'int(const struct shell_transport *, void *, size_t,  size_t *)'
  787 | static int read(const struct shell_transport *transport,
                        void *data, size_t length, size_t *cnt)

include/zephyr/posix/unistd.h:231:9: note: previous declaration
 of 'read' with type
 'ssize_t(int,  void *, size_t)'
  231 | ssize_t read(int file, void *buffer, size_t count);

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 515f547348 mgmt: mcumgr: transport: udp: Select POSIX_API
The NET_SOCKET_POSIX_NAMES is deprecated so enable POSIX_API
to use the socket API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen f27a26f9ec mgmt: updatehub: Use zsock_ API functions
The library should be using internal socket API functions
so that we do not need to depend on POSIX_API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 1b07425ead net: websocket: Use zsock_ API calls
Use zsock_ API calls so that we do not need to enable POSIX_API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen de52f8924f net: socks: Remove socket selection
Currently the socks library does not use sockets so there
is no need to select socket symbols.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 79585d5355 net: tftp: Use zsock_ API functions
The library should be using internal socket API functions
so that we do not need to depend on POSIX_API inside the
network stack.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen e6e6bb4242 net: socket: Create zsock_fcntl and fsock_ioctl functions
Have special wrappers for zsock_fcntl and zsock_ioctl functions
so that gcc warning can be avoided.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 3eeb0f0c7f net: sockets: Deprecate CONFIG_NET_SOCKETS_POSIX_NAMES
The CONFIG_NET_SOCKETS_POSIX_NAMES option is marked as deprecated in
favor of using normal POSIX socket API includes found under the
include/zephyr/posix directory. If you want to use BSD socket API calls,
you need to select POSIX_API and use the socket headers found in the
POSIX subsystem. If you do not want to or cannot enable POSIX_API,
then you must use zsock_ prefix when working with BSD socket calls.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Nithin Ramesh Myliattil a1893c5890 Bluetooth: Audio: Scan Delegator: update bass_source_is_duplicate fn
Address type is passed as an argument instead of the entire address.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-03-27 15:18:01 +00:00
Fredrik Danebjer 0fe8ddd75e Bluetooth: Audio: Scan Delegator: Guard for duplication in add_source
Added a check for duplication of add source operation in the Scan
Delagator. BAP 6.5.4 states that an assistant may not perform add
source operation if it results in a duplication of a source. While
this is not mentioned for the Scan Delegator, the spirit of the spec.
must be that no duplications can exists in the recv_state, which is
what this commit fixes.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2024-03-27 15:18:01 +00:00
Pisit Sawangvonganan e145eb9201 net: wifi: shell: adopt getopt_state for safer optarg access
By using `getopt_state` to access `optarg`, offering a better alternative
to direct global `optarg` access.

This approach mitigates the risks associated with concurrent access to
the global variable.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-03-27 14:33:51 +00:00
Pisit Sawangvonganan a6865c4191 net: wifi: shell: apply struct option as static const
This change marks each 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-03-27 14:33:51 +00:00
Pisit Sawangvonganan d9c6d30c25 net: wifi: shell: streamlined local variable initializations
This commit simplifies the access to structure members and omits
unnecessary variable initializations.

Specific adjustments include:
- Moving from pointer-based access (`(&regd)->chan_info`) to
  direct structure member access (`regd.chan_info`).
- Removing explicit initializations where not required.
- Removing excess backslashes '\' before '%' in the format string.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-03-27 14:33:51 +00:00
Jukka Rissanen d1ef9167da net: if: Make sure no other interface has same name
When setting a name to a network interface, verify that no other
interface has the same name as that would make very difficult to
select an interface by a name.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 14:32:34 +00:00
Robert Zieba 6049bbf4e0 gdbstub: Ignore indexing warning with -Warray-bounds
The current implementation can raise a warning as the compiler sees
an attempt to index an array with a size of zero. This can be fixed by
giving `gdb_mem_num_regions` a default value of zero, but this gets
flagged by CI checks. Disable the warning around the array access.

Signed-off-by: Robert Zieba <robertzieba@google.com>
2024-03-27 09:58:36 -04:00
Reto Schneider 8918247f37 net: buf_simple: Add support for 40 bit data type
This enables pulling and pushing values in 40 bit format.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:32:27 -04:00
Ederson de Souza 62b19ef65c syscalls: llext: Export z_impl symbols so they are available to kernel
commit 67bb6db3f8 ("syscall: Export all emitted syscalls, enabling
them for extensions") exports all emitted syscalls, however, it does
that only for the `z_mrsh` symbols, effectively only available for
userspace. If an extension running at kernel level tries to use a
syscall, it will fail to load.

This patch fixes that by exposing the `z_impl` symbols instead. However,
this is not as straightforward as the `z_mrsh` ones. As, in their
signatures, they can basically contain any type, it's not just a matter
of emitting `EXPORT_SYMBOL(z_impl_<syscall>)`, as the compiler will
complain about the undefined types. Here, there are a few approaches.

One of them is to have the `EXPORT_SYMBOL` being generated on the same
files where the syscall is implemented - injecting it there would allow
it to access all known symbols. But changing a lot of files is
undesirable, and it was one of the nice points of first patch.

Another one would be to reconstruct - or simply use the absolute path -
for the includes where the syscalls are defined. Reconstruct the paths
seems fragile and I'm not sure using absolute paths is portable.

Finally, the approach used in this patch is to declare, on a different
generated file, all `z_impl_` symbols as `void *` - after all, only the
address (and the name) to the function is relevant to EXPORT_SYMBOL. By
living in an compilation unit that doesn't include any header which
would expose any of the syscalls, there shouldn't be any conflicts. And
to account for the possibility that a syscall is not compiled - due
being configured out via Kconfig - all those symbols are also weak
aliases to a pointer to NULL. This file is then included in
`llext_export.c` (which should naturally not include any conflicting
header).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-26 19:31:56 -04:00
Reto Schneider 9b2312d055 net: buf: Fix cloning of zero-sized buffers
For zero sized buffers, instead of pointing to a buffer, net_buf->__buf
is NULL. For this reason, when cloning a buffer, the code needs to check
__buf before dereferencing it.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:31:21 -04:00
Peter Mitsis 87ca079e49 tests: z_test_1cpu_start() makes only CPU0 active
When z_test_1cpu_start() is called to ensure that only a single CPU
on an SMP system is available for use in a test, this commit will
ensure that that CPU is the primary CPU--CPU0. This is done because
some timer drivers only have the timer interrupt processed by one CPU.

A bit of a song and dance is performed to achieve this without enabling
the CPU mask/affinity pinning API. If the cpuhold thread is found to
be executing on CPU0, then a new copy of cpuhold thread is created. Once
the new copy is executing (incidentally guaranteed to be on another CPU)
then it informs the original copy and busy waits until it the original
copy is switched out of CPU0. At this point, we can create the next
cpuhold thread to occupy another CPU if needed.

During this song and dance, it is critical that the 'copy' not pend. If
it pends, we can not guarantee which CPU it will execute on when it
unpends. As the cpuhold threads have the highest priority, nothing is
going to cause them to execute on another CPU for as long as they do
not pend.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-03-26 18:07:41 -05:00
Aleksander Wasaznik 171363501a Bluetooth: Move bt_hci_evt_get_flags out of hci_driver.h
This commit removes `bt_hci_evt_get_flags`, and the associated flag
symbols. These symbols no longer serve a purpose in the driver interface
after the removal of `bt_recv_prio` from the interface.

The implementation of `bt_hci_evt_get_flags` is distributed to its
still-existing use sites, `hci_core` and the `hci_driver` in the
controller.

The duplication of code is intentional. This is no longer part of any
interface, and the host-developers expect the host copy of the function
to change or dissapear entierly. This will allow the host implementation
to progress without fear of breaking the controller implementation.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-26 11:17:29 -05:00
Aleksander Wasaznik 3d3b5b5a48 Bluetooth: hci_driver.h: Remove bt_recv_prio
Remove `bt_recv_prio` from the HCI driver interface. It's primary
purpose was to be used in conjunction with `CONFIG_BT_RECV_BLOCKING`,
which has been removed.

`hci_raw.c` provided a adapter implementation to make drivers
implementing the `CONFIG_BT_RECV_BLOCKING` interface useable with
`CONFIG_BT_HCI_RAW`. But since `bt_recv_prio` is being removed from the
HCI driver interface, drivers needing the adapter should copy the
adapter implementation as private internals.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-26 11:17:29 -05:00
Aleksander Wasaznik b91728619c Bluetooth: host: remove CONFIG_BT_RECV_BLOCKING
This config selects a variant of the HCI driver interface that spills
out host internals unto the drivers and even the Zephyr controller. It
will now be removed in favor of driver interfaces that hide the
internals of the host.

The new default is `CONFIG_BT_RECV_WORKQ_BT`.

Any references to the removed kconfig are refactored out.

Any out-of-tree driver using the removed interface can be easily adapted
by copying the following implementations into the driver as private
functions:

 - `hci_driver.h:BT_HCI_EVT_FLAG_RECV_PRIO`
 - `hci_driver.h:BT_HCI_EVT_FLAG_RECV`
 - `hci_driver.h:bt_hci_evt_get_flags`
 - `hci_raw.c:bt_recv_prio`

In combination these symbols function as a interface adapter. These
symbols will be removed in this PR in subsequent commits.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-26 11:17:29 -05:00
Ravi Dondaputi 73ed81ccce net: wifi: shell: Support BSSID configuration
Add support for BSSID configuration in connect call.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-03-26 11:13:21 -05:00
Ravi Dondaputi 8256d02d3a net: wifi: shell: Use getopt API for connect options
Use getopt API to process the arguments passed with connect
command.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-03-26 11:13:21 -05:00
Jukka Rissanen 9fb8d511e1 net: if: Set default interface name if needed
If the driver does not set the interface name, then set
a default name for it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-26 12:01:51 -04:00
Krzysztof Chruściński d2bd82eb5f drivers: serial: uart_async_rx: Add return value to consume function
Return availability of free buffers after data is consumed. This
information may be important for the module using uart_async_rx to
schedule next reception if there is a new buffer available.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-03-26 10:46:02 -04:00
Marco Argiolas 2f35d11bfe net: lib: lwm2m: block 0 resets prev block transfer for same resource
As stated in "[RFC7959], Section 2.5":
   "The Block1 Option provides no way for a single endpoint to perform
   multiple concurrently proceeding block-wise request payload transfer
   (e.g., PUT or POST) operations to the same resource.  Starting a new
   block-wise sequence of requests to the same resource (before an old
   sequence from the same endpoint was finished) simply overwrites the
   context the server may still be keeping."

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2024-03-26 09:38:55 +00:00
Marco Argiolas 215782aa5c net: lib: lwm2m: fix function parameter for SW management object
Fix build error.

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2024-03-26 09:38:55 +00:00
Sungwoo Kim 2ca179c96e Bluetooth: Host: Add a validation for hci_le_read_max_data_len()
Check max_tx_octects and max_tx_time are in the valid range, according
to the BT Core spec 5.4 [Vol 4, Part E, 7.8.46]
Fix #70472

Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
2024-03-26 09:30:11 +00:00
Tomi Fontanilles 18170ebce1 modem: cmux: make work buffer size configurable
A Kconfig item is added and the buffer
is embedded into the modem_cmux struct.
The default value is increased from 16 to 64 bytes in
an effort to reduce the number of modem_pipe_receive() calls.

CONFIG_MODEM_CHAT_LOG_BUFFER is renamed
to CONFIG_MODEM_CHAT_LOG_BUFFER_SIZE for consistency.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-03-26 09:29:55 +00:00
Tomi Fontanilles 419a398c01 modem: backends: uart_isr: improve the reception of bytes
Add a configurable delay between when a byte is received and
MODEM_PIPE_EVENT_RECEIVE_READY is sent.

This fixes data reception at baud rates above 460800, and
most likely also reduces the workload at any baud rate
when receiving bytes by not going through the work item
and callbacks for every single byte.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-03-26 09:29:55 +00:00
Tomi Fontanilles 9cea822cc4 modem: backends: uart_async: small improvements
- Set all the state bits before calling uart_rx_enable() because
  interrupts may happen already before it returns.
- Fix the byte count in the "Receive buffer overrun" log.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-03-26 09:29:55 +00:00
Tomi Fontanilles e7805f8d72 modem: cmux: improve frame debug logging
- Add the frame data length to the frame header log.
- Log the dropped frames as well.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-03-26 09:29:55 +00:00
Tomi Fontanilles 15cc3ff0d6 modem: backends: uart: register their own log modules
Instead of both using the same modem_backend_uart, for better visibility.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-03-26 09:29:55 +00:00