When ISO Central is enabled it is allowed to configure many CISes at
once. For this a large command buffer is needed. This is also tested
by HCI/CIS/BI-05-C.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Fixes#56657, incorrect TCP MSS calculation for IPv6.
Previously the supported MSS would incorrectly returned as the MTU if it
was less than the MTU, probably to account for the case where
the network interface MTU check returns 0.
New behaviour is to return the supported MSS as MTU minus header length,
using default MTU for this calculation if network interface MTU check
returns 0.
Signed-off-by: Kenny Johansson <wirehell@gmail.com>
If device running BLOB Server called `bt_mesh_blob_srv_recv`,
but rebooted before it received `XFER_START` message from BLOB Client,
it was wrongly "recovered" into Suspended phase, which would lead to
Server try to resume transfer on `XFER_START`. It would not be possible,
because `srv->state.xfer` was not set with acual values yet.
Set phase again to BT_MESH_BLOB_XFER_PHASE_WAITING_FOR_START, which will
allow to accept new transfer.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Corrected printed message on failing test with expected or received
NULL pointer in ztest_check_expected_data.
Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
A case of an invalid PDU was seen leading to a hit on this ASSERT, ie
this COULD happen. Refactoring of the state handling re. expectedness
in remote vs local request machines combined with ensuring the local
request machine ceases to expect PDUs when remote procedure 'takes over'
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Fix regression in refactored LLCP using uint16_t instead of
uint32_t in storing the win_offset_us value. This caused
connection update to fail with incorrect window offset being
used to schedule the connection radio events.
Regression since commit e1c2c36f56 ("Bluetooth: controller:
llcp: set refactored as default").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The arm-clang compiler/linker does not optimize away unused function
symbols and thus will error if symbols that are referenced are not
defined. To fix this add needed ifdef'ry.
Fixes#56630Fixes#56628
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.
Most of these changes were automated using coccinelle with the following
script:
@@
@@
- void
+ int
main(...) {
...
- return;
+ return 0;
...
}
Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.
Signed-off-by: Keith Packard <keithp@keithp.com>
The audio code utilizes BT_CONN so ensure its only built if
CONFIG_BT_CONN is set. This is to fix a build issue we see
with arm-clang for:
sample.bluetooth.broadcast_audio_source
which fails to link since bt_conn_get_info is missing.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Fix window offset calculation which is missing the radio
rx ready delay timing be subtracted because the connection
offset from the start of the radio for scan window to the
end of the ADV_IND PDU includes the radio rx ready delay
timing, where as the determined window offset by advanced
scheduling calculates the offset from the ticks_at_expire
of the scan window to an active central connection's
ticks_at_expire.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update Advanced Scheduling implementation to use remainder
value in precisely calculating the connection request window
offset in microseconds.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Move the use of rx chain delay value used to calculate the
window offset into lll_scan_prepare_connect_req() instead of
current two places, one for legacy and other for extended
connection setup.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Find and match only Central role ticker when applying the
BT_CTLR_CENTRAL_SPACING value.
Use the EVENT_TICKER_RES_MARGIN_US value as +/- jitter
margin when ticker advanced scheduling is used to group
radio events.
When using CONFIG_BT_CTLR_CENTRAL_SPACING, do not add the
+/- jitter to the ticks_slot.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Included consideration for the packet sequence number and time stamps
together with the SDU interval in matching the event for fragmentation
of SDUs to unframed PDUs.
Implemented:
-- Increase in kconfig limit of BT_CTLR_ISO_TX_BUFFERS to allow full 32
buffers to be available for LL/CIS/PER/BV-39C
-- ISO-AL microsecond time wrapping exposed to be used externally to
adjust incoming Group Reference Points and Time-stamps where required
-- Function that handles adjustment of payload number according to
incoming SDU exposed for external use to allow next payload number to
be accessed by ISO transmit tests
-- Changed internal fragmentation source identification parameter from
the source structure pointer to the source handle so that only the
source handle needs to be used for external calls
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
This new configuration option, SHELL_BACKEND_RTT_BUFFER, allows selecting
an alternative buffer for the Shell's RTT backend. By default buffer 0 is
used, which conflicts with the default logging subsystem RTT backend
buffer.
This option is the counterpart to the logger's LOG_BACKEND_RTT_BUFFER.
Signed-off-by: Maurits Fassaert <maurits.fassaert@sensorfy.ai>
Private Beacons are mesh-1.1 feature and without mesh-1.1 spec enabled,
the node shall not process such beacons.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Private Beacons and Secure Network Beacons are not mutually exclusive by
spec. This means both beacons can be sent simultaneously. For both
beacons spec defines their own observation intervals and related
parameters, which means we need to monitor both beacons types
separately.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Since we enable -fshort-enums for arm-clang we get the following
warning:
subsys/bluetooth/mesh/pb_adv.c:139:40: warning: cast to smaller
integer type 'enum prov_bearer_link_status' from
'void *' [-Wvoid-pointer-to-enum-cast]
Fix this by first casting to an int to grow the size of the type.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
it is too late to set ctx->state to ISOTP_TX_WAIT_FIN after send_sf
because send_state_machine could be called just between `send_sf` and
`ctx->state = ISOTP_TX_WAIT_FIN;` in extremely case. like below:
```c
ret = send_sf(ctx);
-> send_state_machine (irq handler)
ctx->state = ISOTP_TX_WAIT_FIN;
```
it will cause isotp_send never return.
Signed-off-by: Jiapeng Li <mail@jiapeng.me>
Some utility functions belong to lwm2m_util.c.
Block contexts belong to lwm2m_message_handling.c
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This changes so that generation of RSI now uses LE arrays instead of
uint32 words. Both input and output of rsi and sih genration now uses
LE. This also fixes the generation of RSI for BE systems, which
wasn't working.
Signed-off-by: Fredrik Danebjer <fredrik@danebjer.com>
Fix checkpatch issue: UNNECESSARY_INT: Prefer 'unsigned long' over
'unsigned long int' as the int is unnecessary
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The init infrastructure, found in `init.h`, is currently used by:
- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices
They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:
```c
struct init_entry {
int (*init)(const struct device *dev);
/* only set by DEVICE_*, otherwise NULL */
const struct device *dev;
}
```
As a result, we end up with such weird/ugly pattern:
```c
static int my_init(const struct device *dev)
{
/* always NULL! add ARG_UNUSED to avoid compiler warning */
ARG_UNUSED(dev);
...
}
```
This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:
```c
static int my_init(void)
{
...
}
```
This is achieved using a union:
```c
union init_function {
/* for SYS_INIT, used when init_entry.dev == NULL */
int (*sys)(void);
/* for DEVICE*, used when init_entry.dev != NULL */
int (*dev)(const struct device *dev);
};
struct init_entry {
/* stores init function (either for SYS_INIT or DEVICE*)
union init_function init_fn;
/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
* to know which union entry to call.
*/
const struct device *dev;
}
```
This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.
**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
init: convert SYS_INIT functions to the new signature
Conversion scripted using scripts/utils/migrate_sys_init.py.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
manifest: update projects for SYS_INIT changes
Update modules with updated SYS_INIT calls:
- hal_ti
- lvgl
- sof
- TraceRecorderSource
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: devicetree: devices: adjust test
Adjust test according to the recently introduced SYS_INIT
infrastructure.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: kernel: threads: adjust SYS_INIT call
Adjust to the new signature: int (*init_fn)(void);
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fix the BIG handle in the HCI LE BIG Sync Established event
when BIG Create Sync operation is cancelled by Host.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This fixes missing ISO connection state check, as there might be no ISO
connection when Receiver Stop Ready has been received. This might happen
on ASE state transition from Enabling to Disabling.
Without this check the code asserts in ascs_disconnect_stream_work_handler.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Aligns Bluetooth mesh shell parameter documentation to use the
same syntax, abbrevations and formating.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Changes the implementation and documentation in config client shell
command for Config Model Publication Set and Config Model Publication
Virtual Address Set to accept period resolution and period steps as
separate arguments to make it more user friendly.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Currently, the handshake operation could only be fully blocking or
non-blocking. This did not play well if SO_RCVTIMEO was set for DTLS
server, as the recv() call where the blocking handshake was used, could
block indefinitely, ignoring the timeout parameter. Fix this, by
allowing for the handshake operation to timeout.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As the underlying socket operations for TLS/DTLS are now non-blocking,
it's no longer possible to rely on the underlying socket timeout
handling. Instead, implement SO_RCVTIMEO/SO_SNDTIMEO at the TLS socket
layer.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As for TLS, switch to use non-blocking operations on underlying socket.
This is a bit tricker for DTLS, as there were not truly blocking bio
(binary input/output) function for DTLS, as timeout had to been
implemented. It is possible though to implement non-blocking mbedTLS bio
function instead, and handle timeout outside of mbedTLS context, which
has been done in this commit.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Switch TLS sockets to use non-blocking socket operations underneath.
This allows to implement the socket blocking outside of the mbedTLS
context (using poll()), and therefore release the mutex for the time the
underlying socket is waiting for data. In result, it's now possible to
do blocking TLS RX/TX operations simultaneously from separate threads.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Implement ZFD_IOCTL_SET_LOCK so that TLS socket layer gets access to the
mutex protecting socket calls.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make `BT_LOG` and `BT_LOG_LEGACY` hidden Kconfig symbols.
They should not be used by the user to configure the Bluetooth logging
system. If the user want to completely disable Bluetooth logging, they
should use `BT_LOG_LEVEL_OFF=y`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
When we receive `RPR_OP_LINK_CLOSE` message with reason other than
`SUCCESS` we should fail NPPI refresh procedure, not complete it.
Dropping `COMPLETE` flag will result in calling `reprovision_fail`
in `prov_link_closed`, not `reprovision_complete`.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
TCP packet allocation timeout is currently 100ms, but there are cases
where it is not enough and as a side effect, the kernel internals are
printing some errors on the log before retrying again, create a
Kconfig parameter to be able to tune this value.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
We should clear the bt_dev.sent_cmd pointer after using it to allocate a
new HCI event buffer in the bt_buf_get_cmd_complete() function.
Otherwise, there is a risk of reusing the same stored net_buf for
multiple consecutive HCI events in case the controller sents duplicate
or invalid event packets.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Added command to terminate the PA sync as the scan delegator.
This can also be used to cancel any pending PA syncs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add callback to notify the application about which
BIS it should sync to when requested by the Broadcast
Asssitant.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support to create a broadcast sink from a PA sync, rather
than using the broadcast sink scan functions.
This allows for the scan delegator implementation to
autonoumsly add broadcast sinks.
This refactors how the broadcast sink uses flags, to
ensure thread safetyness.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This integrates the Scan Delegator functionality with the
Broadcast Sink functionality. The Broadcast Sink will
automatically update the receive state for the PA and BIG
sync values, based on state of the Broadcast Sink.
Similarly, a request to terminate the BIG or PA sync from
a Broadcast Assistant will terminate the Broadcast Sinks'
PA or BIG syncs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>