Commit graph

21541 commits

Author SHA1 Message Date
Jukka Rissanen
20a69f6dbf net: wifi: Add iterable_sections header file
This is related to change in commit dacb3dbfeb
("iterable_sections: move to specific header")

Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-08-01 12:36:00 +02:00
Seppo Takalo
e86bdf952d net: lwm2m: Always emit DISCONNECTED event
When LwM2M engine is requested to stop,
emit the disconnected event unconditionally.
There is really no reason to skip the event
on network error, or if we have never been registered.

Fixes #76422

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-08-01 12:35:53 +02:00
Fabio Baltieri
60df679366 debug: thread_analyzer: fix incorrect k_thread_foreach_unlocked argument
Fix the second k_thread_foreach_unlocked argument, it's supposed to be
an instance of ta_cb_user_data as that's what's it casted back to in
thread_analyze_cb. Current code results in an exception and crash for
single core applications.

This is a regression introduced in 1b6e0f6479.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-08-01 12:35:45 +02:00
Daniel Leung
d2b072078d debug: thread_analyzer: fix casting pointer to int warning
In thread_analyzer_auto(), it casts one function argument
directly into unsigned int. However, on 64-bit platforms,
the compiler complains about casting from pointer of
different size (-Wpointer-to-int-cast). So cast it first to
uintptr_t before casting it into unsigned int.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-08-01 12:35:34 +02:00
Kamil Piszczek
f9a5699bd8 Bluetooth: DIS: integrate app version into FW revision characteristic
Integrated the application version feature of the build system with
the default configuration of the Bluetooth DIS module and its Firmware
Revision characteristic.

The firmware revision string now defaults to APP_VERSION_TWEAK_STRING
if the application version feature is used in a project. This specific
version format is used to unify version formatting with other parts of
Zephyr like the MCUboot module and its versioning Kconfig:
CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-08-01 09:13:39 +01:00
Matt Rodgers
47fbb8512f net: coap_client: allow application to add block2 option to requests
Allow an application to add a Block2 option to an initial request for a
resource. For any subsequent requests as part of a blockwise transfer,
drop the application-added Block2 option since the coap_client must
append a Block2 option with updated NUM and SZX fields based on the
server response.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-08-01 09:13:32 +01:00
Henrik Brix Andersen
9af6ae50f4 usb: device_next: add usbd_device_set_bcd_device()
Add usbd_device_set_bcd_device() for setting the bcdDevice device
descriptor value.

The default bcdDevice is set to the version of Zephyr being used, which may
or may not be what a downstream USB device wants it to be.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-08-01 09:11:44 +01:00
Henrik Brix Andersen
196c9635d8 usb: device_next: rename usbd_device_set_bcd()
Rename usbd_device_set_bcd() to usbd_device_set_bcd_usb() to make room for
other BCD encoded values being set.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-08-01 09:11:44 +01:00
Fabio Baltieri
600217c52f usb: device_next: hid: move few pointer to a config struct
Some of the fields currently in hid_device_data are constant.

Move them to a const config struct to save some RAM and drop the rest of
the data static initializers to runtime to save some flash as well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-08-01 09:11:17 +01:00
Gerard Marull-Paretas
5a095d42a7 bluetooth: controller: nordic: provide dummy DEBUG_SETUP
So that clients do not have to understand in which situation it is not
defined.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-08-01 08:56:56 +01:00
Gerard Marull-Paretas
baad622063 bluetooth: controller: nordic: simplify board guarding
Since HWMv1, we also have CONFIG_$BOARD Kconfig symbols defined, ie, no
SoC/core/variant needed.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-08-01 08:56:56 +01:00
Pisit Sawangvonganan
6211de87c0 net: mqtt: improve decoder buffer handling
Improve buffer handling logic to use local variables extensively.

This change reduces the number of pointer dereferences, which leads
to more efficient runtime and helps reduce the code size.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-31 13:08:28 +02:00
Pisit Sawangvonganan
45282a41c1 net: mqtt: improve encoder buffer handling
Improve buffer handling logic to use local variables extensively.

This change reduces the number of pointer dereferences, which leads
to more efficient runtime and helps reduce the code size.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-31 13:08:28 +02:00
Robert Lubos
349bf81e00 net: tcp: Keep track of recv window size change since last ACK
Windows TCP stack has a peculiar behavior - when running iperf, it will
fill out the RX window almost entirely, but will not set PSH flag on
packets. In result, our stack would delay the ACK and thus window
update, affecting throughputs heavily.

In order to avoid that, keep track of the most recent window size
reported to the peer, and reduce it when receiving new data. In case the
RX window, as seen from the peer perspective, drops below certain
threshold, and the real RX window is currently empty, send an ACK
immediately when updating window, so that peer can continue
with sending data.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-31 12:56:52 +02:00
Rubin Gerritsen
a4e43d013c Bluetooth: Samples: Use string printing functions for error codes
When developing Bluetooth applications, you typically run into some errors.
If you are an experienced Bluetooth developer, you would typically know
how to translate the error codes into string representations.
Others might not.

This commit to adds string printing of error codes for all
samples to make them more user-friendly.

Several formatting alternatives were considered. The chosen alternative
balances code readability and FLASH size (with and without string
printing).

Example output from the peripheral_hids sample when the
peer rejects pairing:

```
Bluetooth initialized
Bluetooth authentication callbacks registered.
Advertising successfully started
Connected 5E:67:02:D3:1C:DB (random)
Security failed: 5E:67:02:D3:1C:DB (random) \
level 1 err 6 BT_SECURITY_ERR_PAIR_NOT_ALLOWED
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason 0x13 BT_HCI_ERR_REMOTE_USER_TERM_CONN
```

Other alternatives that were considered:

- Use of parantheses:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err BT_SECURITY_ERR_PAIR_NOT_ALLOWED(6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
BT_HCI_ERR_REMOTE_USER_TERM_CONN(0x13)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err (6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason (0x13)
```

- Spaces and parantheses:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err BT_SECURITY_ERR_PAIR_NOT_ALLOWED (6)
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason BT_HCI_ERR_REMOTE_USER_TERM_CONN (0x13)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err  (6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason  (0x13)
```

- Parantheses around everything:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err (BT_SECURITY_ERR_PAIR_NOT_ALLOWED(6))
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason (BT_HCI_ERR_REMOTE_USER_TERM_CONN(0x13))
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err ((6))
Disconnected from 5E:67:02:D3:1C:DB (random), reason ((0x13))
```

- Error code first, then string representation:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err 6 (BT_SECURITY_ERR_PAIR_NOT_ALLOWED)
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
0x13 (BT_HCI_ERR_REMOTE_USER_TERM_CONN)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err 6 ()
Disconnected from 5E:67:02:D3:1C:DB (random), reason 0x13 ()
```

- Apostrophes around error printing:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err "BT_SECURITY_ERR_PAIR_NOT_ALLOWED (6)"
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
"BT_HCI_ERR_REMOTE_USER_TERM_CONN (0x13)"
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err " (6)"
Disconnected from 5E:67:02:D3:1C:DB (random), reason " (0x13)"
```

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-31 12:56:11 +02:00
Fabio Baltieri
61129d8fd2 input: longpress, keymap: use an explicit callback name
Use an explicit callback name so that multiple instances of this do not
result in a:

redefinition of '_input_callback__longpress_cb'

error. This used to work when it was using unique generated wrappers,
but now it needs an index in the callback name.

Use it in one of the API tests as well, just in case.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-31 12:55:11 +02:00
Fabio Baltieri
716fa268f4 input: add a user_data pointer to the callback
Add a void *user_data pointer to the input callback structure. This is
useful for driver to get back the driver data structure and avoid
defining wrapper functions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-31 12:55:11 +02:00
Vinayak Kariappa Chettimada
8bf604ee10 Bluetooth: Controller: Fix missing BT_CTLR_BROADCAST_ISO_ENC
Fix missing BT_CTLR_BROADCAST_ISO_ENC conditional compile.

Relates to commit 2d49080cb8 ("Bluetooth: Controller: Fix
BT_CTLR_LE_ENC conditional compilation").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-07-31 12:55:04 +02:00
Jukka Rissanen
03885d1cbf net: if: No need to join mcast groups if interface IPv6 is disabled
If IPv6 is not enabled for a given network interface, then there
is no need to try to join IPv6 multicast groups as it will just
cause an error print which is pointless in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-07-31 12:40:32 +02:00
Konrad Derda
4e7bf281a1 net: ipv6: routing: decide whether to set interface's LL address
While routing between interfaces source Link-Local L2 address is set
for a packet. However, it should not be done for some of the interfaces.

This commit adds helper function to check this condition in runtime.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-07-31 12:40:16 +02:00
Konrad Derda
0ac5ab4a4e net: ipv6: routing: do not add route to original iface without ND
When packet is routed between interfaces new routing entry is added
to the table. This should not be done for interfaces that do not
support Neighbor Discovery protocol as they are not keep potential
neighbors in the common table.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-07-31 12:40:16 +02:00
Gerhard Jörges
e55278a87b net: lib: http_server: add static fs resource
adds filesystem as a resource for the http_server which serves static
(gzipped) files from a filesystem to the client.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2024-07-31 10:08:16 +02:00
Fabian Pflug
31e91794de net: l2: ieee802154: mgmt: allow beacons without association bit
The Association permit bit shall be set to zero if the coordinator does
not accept association requests.
Not accepting association request ist not a reason to filter the
beacons from this coordinator during network scan. It is still a
network, just one you cannot associate with.

Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
2024-07-31 10:08:03 +02:00
Matt Rodgers
44d39e2028 net: coap_client: limit payload size during block transfer to block size
Limit the coap payload size passed up to the application callback to the
block size, when a block transfer is in progress and the current payload
is not the final block.

If the current payload is not part of a block transfer, or is the final
block of a transfer, then the full payload can be passed to the
application to avoid having to make another request over the network for
data that has already been received.

This avoids a problem raised in issue #76089, where a payload longer
than CONFIG_COAP_CLIENT_MESSAGE_SIZE causes the same data to be passed
to the application callback twice (once in the large packet, and once in
the next block which must have an offset that is a multiple of the block
size).

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-07-31 10:07:45 +02:00
Matt Rodgers
93f871e2d1 net: coap_client: handle truncation of received data
Use the MSG_TRUNC flag to check the total length of UDP packets
receieved by the coap_client, and hence check if the receive buffer
contains the whole message, or if it is truncated.

If the message is truncated, then use a blockwise transfer to fetch the
rest of the data.

This is related to issue #76089.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-07-31 10:07:45 +02:00
Pisit Sawangvonganan
16386d7b5f net: shell: use shell_xxx_impl in PR ... PR_WARNING macros
Due to the introduction of `shell_xxx_impl` wrapper functions in
PR #75340, we can minimize caller overhead by eliminating direct
`color` parameter passing.

This is achieved by using `shell_print_impl`, `shell_error_impl`,
`shell_info_impl` and `shell_warn_impl` instead of `shell_fprintf`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-31 10:07:29 +02:00
Pieter De Gendt
ac983f633e net: lib: http: Use Kconfig constants
Replace Kconfig values with UINT32_MAX

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-07-30 18:31:11 +01:00
Rubin Gerritsen
39a70be4a0 Bluetooth: Only enable data length extensions when needed
We should disable the feature when it is not needed to
save flash and RAM.
There is no point in enabling data length extensions
when the maximum packet size used is always smaller or equal
to 27 bytes. Then data length updates would only use
parameters (octets=27, time=T) where T is some supported value
which would not improve throughput or power consumption.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-30 18:30:22 +01:00
Pieter De Gendt
92019b1dac emul: Support UART device emulation
Add support to the existing UART emulated bus, to have a client device
emulator.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-07-30 18:28:17 +01:00
Vinayak Kariappa Chettimada
6808f344f0 Bluetooth: Controller: Fix missing BIS data enqueue for skipped events
Fix implementation to consider event latencies due to
BIG events being skipped due to overlap with other state or
role, and generate any received/buffered pre-transmissions
towards the Host.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-07-30 18:27:46 +01:00
Vinayak Kariappa Chettimada
cf9a956c54 Bluetooth: Controller: Fix missed PTO subevent for subsequent BIS
Fix missing PTO subevent reception for second or more BISes
when current payload count associated PDUs where already
received in previous ISO events as pre-transmissions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-07-30 18:27:46 +01:00
Johann Fischer
67caae3aca usb: device_next: introduce UDC_BUF_POOL_*_DEFINE macros
Introduce UDC_BUF_POOL_*_DEFINE macros based on NET_BUF_POOL_*_DEFINE
macros but use our own version of alloc and unref callbacks to get
buffers with specific alignment and granularity. Also, do not use ref
callback because it breaks alignment.
Also introduces helper macros for defining and checking UDC
driver-compliant static buffers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-30 18:26:04 +01:00
Rubin Gerritsen
bfc0cdc905 Bluetooth: Conditionally print out HCI error codes as strings
When developing Bluetooth applications, you typically run into
some errors. If you are an experienced Bluetooth developer,
you would typically have an HCI error lookup table in your memory.
Others might not.

This commit utilizes defines CONFIG_BT_DEBUG_HCI_ERR_TO_STR
and utilizes bt_hci_err_to_str() to print out HCI error strings
when enabled to improve the user experience.

Several alternatives where considered. This approach was chosen
as it had the best balance between readability, code size, and
implementation complexity.

The alternatives are listed below as a reference.

1. Macro defined format specifier:

```c
  #define HCI_ERR_FMT "%s"
  #define BT_HCI_ERR_TO_STR(err) (err)
  #define HCI_ERR_FMT "%d"
  #define BT_HCI_ERR_TO_STR(err) bt_hci_err_to_str((err))

LOG_INF("The event contained " HCI_ERR_FMT " as status",
	BT_HCI_ERR_TO_STR(err));
```
Advantage: Space efficient: Code size does not increase
Disadvantage: Code becomes hard to read

2. Format specifier to always include both integer and string:

```c
static inline const char bt_hci_err_to_str(err)
{
	return "";
}

LOG_INF("The event contained %s(0x%02x) as status",
	bt_hci_err_to_str(err), err);
```

Advantage: Simple to use, implement, and read,
Disadvantage: Increases code size when CONFIG_BT_DEBUG_HCI_ERR_TO_STR
is disabled. The compiler seems unable to optimize away the unused
format specifier. Note: The size increase is only present when
logging is enabled.

3. Always print as string, allocate a stack variable when printing:

```c
const char *bt_hci_err_to_str(char *dst, size_t dst_size, uint8_t err)
{
  snprintf(dst, dst_size, 0x%02x, err);
  return dst;
}

LOG_INF("The event contained %s as status", BT_HCI_ERR_TO_STR(err));
```

Advantage: Very easy to read.
Disadvantage: Printing error codes becomes slow as it involves calling
snprint.

4. Implement a custom printf specifier, for example E.

   This requires a global CONFIG_ERR_AS_STR as I assume we cannot have
   one specifier for each type of error code.
   Also, I assume we cannot start adding specifiers for each subsystem.

```c
  #define BT_HCI_ERR_TO_STR(err) (err)
  #define BT_HCI_ERR_TO_STR(err) bt_hci_err_to_str((err))

LOG_INF("The event contained %E as status", BT_HCI_ERR_TO_STR(err));
```

Advantage: Both efficient code and readable code.
Disadvantage: This requires a global CONFIG_ERR_AS_STR as I assume
we cannot have one specifier for each type of error code.
Also, I assume we cannot start adding specifiers for each subsystem.
That is, this approach is hard to implement correctly in a scalable
way.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-30 18:25:56 +01:00
Jyri Sarha
1b6e0f6479 debug: thread_analyzer: Option to analyze threads on each core separately
Add implementation to analyze threads on each cpu separately. This
feature can be enabled with THREAD_ANALYZER_AUTO_SEPARATE_CORES Kconfig
option. If enabled, an analyzer thread is started for each cpu, and
the threads will only analyze thread on the cpu its running on.

This feature is needed for Intel ADSP platform, where cpu specific
caches are not synchronized between the cpu. It is also probably
needed by other platforms having CONFIG_KERNEL_COHERENCE=y, so default
to THREAD_ANALYZER_AUTO_SEPARATE_CORES=y for those platform.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
2024-07-30 18:25:40 +01:00
Rubin Gerritsen
3bcaa6f8d6 Bluetooth: Controller: Handle return value of ll_deinit()
This call may fail. Handling the return value makes it easier
to catch bugs.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-29 14:30:04 +02:00
Rubin Gerritsen
d7e6d6e2c0 Bluetooth: Controller: Fix deinitialization of the LFCLK
This fixes a bug where the stack may get stuck in the
POWER_CLOCK ISR after enabling and disabling the Bluetooth
stack a couple of times. It happens after calling
`onoff_request()` after a failing call to `onoff_release()`.
Then the `lf_cli`s next points to itself, generating a
circular list of clients.

Calling `onoff_release()` may fail if there is an outstanding
request. By calling `onoff_cancel()` we enter a state where
we can safely remove the client.

This was not seen earlier because the return value
from `ll_deinit()` in `hci_driver_close()` was ignored.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-29 14:30:04 +02:00
Nick Ward
c8526bc53f net: lwm2m: shell: add observations cmd
Outputs observation configurations.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-07-29 14:18:10 +02:00
Nick Ward
0645609b0b net: lwm2m: observations: add attr type to str
Allows strings used to be exposed outside of file.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-07-29 14:18:10 +02:00
Florian Larysch
22d6bfa0bd logging: backend: swo: add Kconfig option for SWO protocol
The TPIU supports serializing the data stream both using an UART-like NRZ
protocol as well as using Manchester encoding. Using Manchester encoding
has the advantage that it enables receivers that support it to recover the
clock from the SWO signal itself. This is particularly useful in situations
where the clock rate changes dynamically or is unknown (for example when
debugging the clock tree setup or working with a device with a misbehaving
main oscillator).

Add a Kconfig choice to switch the protocol, keeping the current default of
using the NRZ encoding.

Signed-off-by: Florian Larysch <larysch@fixme.gmbh>
2024-07-29 14:17:33 +02:00
Bjarki Arge Andreasen
372c7183ef modem: pipe: Add explicit timeout to sync APIs
The modem pipe APIs include synchronous calls to open/close,
which internally use a fixed timeout of 10 seconds. The timeout
should be configurable through the APIs, anywhere from K_NO_WAIT
to K_FOREVER.

This commit adds timeout parameters to the open/close APIs, and
updates in-tree usage of the open/close APIs to explicitly
provide the previously implicit timeout of 10 seconds.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-07-29 14:14:42 +02:00
Adrien Ricciardi
b09972b445 fs: nvs: Allow application to switch sector to get free space
Add an API function allowing the application to determine the amount of
free bytes in the current sector.

Add a second API function allowing the application to switch to the next
NVS sector, calling the garbage collector on such sector.

The goal is togive more granularity to the application to control when
the garbage collector is triggered.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2024-07-28 07:31:44 +03:00
Emil Gydesen
38d09af445 Bluetooth: BAP: Scan delegator add src without PA sync
Modify the bt_bap_scan_delegator_add_src to take an address and
a sid instead of a PA sync object, so that the scan delegator
can add a source without syncing to the PA.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-07-28 07:31:06 +03:00
Andreas Ålgård
a5850b794c net: lib: dhcpv4_server: Add callback to allow user to set address
This functionality is useful to allow for conditional or static leases.

Signed-off-by: Andreas Ålgård <aal@ixys.no>
2024-07-28 07:30:48 +03:00
Ren Chen
fdd488b38e usb: device: add USB_CONFIGURATION_STRING_DESC KConfig option
This change adds a Kconfig option "USB_CONFIGURATION_STRING_DESC_ENABLE"
to enable the USB configuration string descriptor. The default
configuration string is specified in "USB_CONFIGURATION_STRING_DESC."

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2024-07-28 07:30:30 +03:00
Marcin Gasiorek
313a92baf9 net: openthread: Set CIDR for NAT64
Implementation of functionality whitch configure CIDR for OT NAT64.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-07-28 07:29:50 +03:00
Marcin Gasiorek
ac0a9d79ab net: openthread: Add NAT64 send and receive callbacks.
Packets are routed between OT and Zephyr net stacks.
For IPv4 these packets are managed by NAT64 by default.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-07-28 07:29:50 +03:00
Pisit Sawangvonganan
444e135679 net: if: streamline interface name checking logic
This commit reduces `#if / #endif` pairs by leveraging the
`IS_ENABLED` macro:
- Removed `#ifdef / #endif` around `NET_L2_DECLARE_PUBLIC` in `net_l2.h`,
  enabling compilation without affecting link time if the configuration
  is unavailable.

`set_default_name` function:
- Replaced multiple `if` statements with `else if` to use the last `else`
  without indirectly checking `name[0] == '\0'`.
- Since `snprintk` guarantees null-termination if `sizeof(name) > 0`,
  the `-1` subtraction is unnecessary, eliminating the need for
  zero initialization in `char name[CONFIG_NET_INTERFACE_NAME_LEN + 1];`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-28 07:29:01 +03:00
Vineeta S Narkhede
232c802c05 net: hostname: Add a function to set the hostname postfix as is.
Fixes: #72363

The existing function to set the postfix is converting postfix
string to hexadecimal. Adding a new function to handle a use case
where the provided postfix should be used as is without any conversion.

Signed-off-by: Vineeta S Narkhede <VineetaSNarkhede@Eaton.com>
2024-07-28 07:28:51 +03:00
Pisit Sawangvonganan
c43b20e85c modem: cmux: apply static const to reduce RAM usage
Added `static const` to various `struct modem_pipe_api` and
`frame` in `modem_cmux_connect_handler` to make these structures
immutable and reduce RAM usage.

Corrected a typo, changing "consequtive" to "consecutive".

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-27 20:51:42 +03:00
Pisit Sawangvonganan
ba30e7b350 modem: pipe: make modem_pipe_api a pointer to constant
Changed the `api` field in the `modem_pipe` structure to be
a pointer to constant.

This ensures that the `api` field remains immutable after
initialization.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-27 20:51:42 +03:00