Introduce Controller dependent EVENT_MAFS_MIN_US value to
use as the value when populating the aux offset between
Extended Advertising primary and auxiliary channel PDUs.
This can be used as workaround for peers having difficulty
receiving Extended Advertising PDUs with near 300 us MAFS
values used in aux offset calculations.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Relax the radio packet pointer assignment deadline assertion
until access address being transmitted. The PDU buffer is
probably only needed just after access address is being
transmitted or received by the radio. This will give some
more breathing room for slow CPUs like in nRF51x SoCs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix regression using speed optimization introduced in
commit 1b7fe792e0 ("Bluetooth: Controller: Support Link
Time Optimizations (LTO)").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix regression in encrypted connection introduced in
commit f3deccda91 ("Bluetooth: Controller: CCM read data
to early when DF enabled on PHY 1M").
Due to this nRF51x SoC hang waiting to encrypt and/or
check MIC.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In case of ISR latencies, if packet pointer has not been
set on time then we do not want to check uninitialized
length in rx buffer that did not get used by Radio DMA.
This would help us in detecting radio ready event being
set? We can not detect radio ready if it happens twice
before Radio ISR executes after latency.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Only 3 bytes (PDU_EM_LL_SIZE_MAX) is required for empty PDU
transmission, but in case of Radio ISR latency if rx packet
pointer is not setup then Radio DMA will use previously
assigned buffer which can be this empty PDU buffer. Radio
DMA will overrun this buffer and cause memory corruption.
Any detection of ISR latency will not happen if the ISR
function pointer in RAM is corrupted by this overrun.
Increasing ISR latencies in OS and CPU usage in the
ULL_HIGH priority if it is same as LLL priority in
Controller implementation then it is making it tight to
execute Controller code in the tIFS between Tx-Rx PDU's
Radio ISRs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISR profiling when using single timer for tIFS radio
switching wherein in the timer is cleared on every radio
end. Hence, the captured timer value is the latency and
does not required the radio end timestamp to be subtracted.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use uint16_t to store ISR profiling value to avoid overflow
in case of higher latencies.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix in-system ISR profiling for advertiser and connection
role for the missing implementation when there is CRC error.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The interval and latency for a CIG are set for each direction now,
allowing applications to use e.g. 10ms for sink ASEs and 7.5ms for
source ASEs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add name to choice symbol, so that default value can be changed
downstream.
Developed-by: Andreas Rudolf <andreas.rudolf@husqvarnagroup.com>
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
- Remove the `strlen`, as it is unnecessary for safe copying.
- Limit the `strncpy` to `sizeof(fsm->terminate_reason) - 1`
to ensure the last byte is reserved for null-termination.
- Add an explicit null terminator to guarantee correct string termination.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Cloning a packet for a capture may fail due to insufficient memory.
In such a case, the networking statistics should be updated
to reflect this processing error. This commit updates the processing
error count on the capture tunnel network interface because this is
the interface that the captured packet would have been assigned to.
Signed-off-by: Tom Finet <tomfinet@outlook.com>
Add profiling subsystem.
Add perf util based on periodic stack unwinding. Perf from Linux
was taken as a reference.
The operation of module is based on frame pointer usage and saving
registers during interruption handling.
The unwinding function stay in timer as expiry functioin so is called
during interruption handling. Thus the function have access to saved
registers (program counter and frame pointer in particular) of the current
thread and use it to unwind the thread stack.
Timer starting and results printing function are made as shell commands
for conveniency.
Originally-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
Signed-off-by: Mikhail Kushnerov <m.kushnerov@yadro.com>
Refactor (1 << xyz) to use the BIT(xyz) macro.
The change aims to enhance code readability.
Signed-off-by: Muhammad Haziq <muhammad.haziq@zintechnologies.com>
gcc 13 thinks max_adv_duration may be used unitialized
and warns accordingly (see below)
It seems the reason is the goto, which confuses it.
In any case, pacifying this warning is trivial,
so let's just do so.
The warning:
```
In function ‘gatt_proxy_advertise’,
inlined from ‘bt_mesh_proxy_adv_start’ at
subsys/bluetooth/mesh/proxy_srv.c:1214:9:
subsys/bluetooth/mesh/proxy_srv.c:842:44: error: ‘max_adv_duration’ may
be used uninitialized [-Werror=maybe-uninitialized]
subsys/bluetooth/mesh/proxy_srv.c: In function ‘bt_mesh_proxy_adv_start’
zephyr/subsys/bluetooth/mesh/proxy_srv.c:786:17: note:
‘max_adv_duration’ was declared here
786 | int32_t max_adv_duration;
| ^~~~~~~~~~~~~~~~
```
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
On ARM64 the build will fail with coverage and GCOV enabled:
CONFIG_COVERAGE=y
CONFIG_COVERAGE_GCOV=y
CONFIG_FORCE_COVERAGE=y
west build -b rpi_5 -p always samples/hello_world -- \
-DCONFIG_COVERAGE=y -DCONFIG_FORCE_COVERAGE=y
Failure:
"linker_zephyr_pre0.cmd:181: undefined symbol `__gcov_bss_end' referenced
in expression"
Fix build of ARM64 platforms with coverage and GCOV enabled by adding for
ARM64 the same gcov linker sections as it is done for ARM.
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
90ab94f61d added a change that source name pointers were not stored
in the const data structure associated with a logging source. That was
done because those string pointers were invalid (on purpose pointing to
non-existing memory) and reading those strings could lead to a fault.
However, those pointers are used by scripts which are building the
dictionary database and after this change script was no longer
able to retrieve source names from elf file and database was incomplete.
This patch brings back storing of source name string pointers but in
API for reading those source names guards are added to not return
invalid addresses.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Undefine _POSIX_C_SOURCE before defining it to avoid double
definition
The previous version, changed in this PR
https://github.com/zephyrproject-rtos/zephyr/pull/70363, did the undef.
Make sure to do the same for all files in the current dir.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
- Made CCC_STORE_MAX configurable under the BT_SETTINGS
- Added a buffer overflow check on ccc_save
Fixes: #76838
Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
Using DEVICE_DEFINE, a device without a corresponding DT node can be
defined (for example CRYPTO_MTLS), Z_DEVICE_INIT() does not initialize
dt_meta for such devices, leaving the field as NULL.
device_get_dt_nodelabels() and functions calling it have to handle
dev->dt_meta == NULL to prevent fatal errors.
Signed-off-by: Jan Peters <peters@kt-elektronik.de>
http1_headers_sent flag has to be cleared when entering
HTTP_SERVER_REQUEST_STATE and not only on the client init. Otherwise,
serving multiple HTTP1 POST requests over the same connection does not
work as intended (headers were not sent for the second and further
requests).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make appending to the newest log file in the fs logging backend optional.
By default, if there is still free space in the latest log file,
the fs logging backend appends to it on startup. This is useful for saving
space and avoiding the removal of older log files, if the maximum number
of log files has been reached. The drawback of this behavior is,
that log files that got appended can not be decoded, if the firmware
has changed between startups, for instance by an update,
since the log_dictionary.json used for decoding has also changed.
Therefore, it may be desirable to deactivate appending to log files.
Signed-off-by: Niklas Fabian <niklas.fabian@lemonbeat.com>
This function call frees the buffer kept by the host for reassembling L2CAP
PDUs into.
Without this call, the current buffer will eventually be
leaked, leading to a non-functional host due to lack of RX buffers.
The effect is worse when host flow control is not enabled, as the RX
buffer pool is shared with events, which means communication with the
controller is essentially dead.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
`net_buf_alloc(K_FOREVER)` can now return NULL if running in the system
workqueue. `bt_hci_evt_create()` is called in that context in a few cases.
Since we can't really do anything about it, add a (default-on) assert.
This should ideally never fail. I saw it fail because of a leak in the ACL
buffer pool, which is also shared with events when host flow control is not
enabled.
In that particular case, the host is rendered non-functional, so trying to
recover using error handling is futile.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
set _XOPEN_SOURCE appropriately to avoid compilation errors
due to missing S_IFxxx macros on some systems.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The testsuite subsystem provides the macro PRINT_DATA() which can be
overridden using CONFIG_ZTEST_TC_UTIL_USER_OVERRIDE. Switch all calls of
PRINT() to PRINT_DATA withing the testsuite subsystem.
Signed-off-by: Keith Short <keithshort@google.com>
Introduce `wifi_utils_get_next_chan_6g` to get the next
valid Wi-Fi 6GHz channel.
This commit addresses the proper handling of cases when
`chan_start` is not 1.
Fix#74063
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Reduce the size of the ble notification if the length of
the line output is less than the current mtu size.
Signed-off-by: Victor Chavez <vchavezb@protonmail.com>
Enhancing code consistency provides cognitive leverage with
the following changes:
- Unified the order of declaration for `opt`, `opt_index`,
`state`, and `long_options`.
- Unified the wrapping of `getopt_long` calls, regardless of
the length of the `options` string.
- Renamed `option_index` to `opt_index` for consistency.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Using `getopt_state` to access `optarg` and also `optopt` offers
a better alternative to direct global access.
See e145eb9201 for the previous change related to this.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This change marks the remaining instance of the `struct option` as
`static const`.
The rationale is that `struct option` is a read-only variable.
By using `static const`, we ensure immutability, leading to usage of only
the `.rodata` section and a reduction in the `.data` area.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Various manual code formatting adjustments, including:
- Wrapping lines in the `long_options` declaration to prevent them
from extending too far to the right.
- Adding missing `{` and `}` in the `if` statement in
`cmd_wifi_set_rts_threshold`.
- Aligning `SHELL_CMD_ARG` in `wifi_commands` with previous declarations.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
SenML is technically a JSON based format which can
be encoded as a CBOR. SenML-CBOR specification in
RFC 8428 section 6 states that numbers can be decoded
as an integer.
Also RFC 7049 section 4.2 states that JSON numbers
without fractional part can be decoded as an integer.
I have seen with one commercial LwM2M platform that
the decoder they use, sends floating point values as
integers, if there is no fractional part.
So LwM2M engine cannot assume from the path that
the incomming number is either float or int. Accept both.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit moves reading nexthop's LL address only if it's supported
by a given neighbor and can be used for routing between interfaces.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Don't push the TS flag on `buf` itself.
This messes up the MTU calculations: a packet that would exactly fit the
MTU and has a timestamp would be unnecessarily fragmented.
The MTU check is done on `buf` as a whole. At the point where the
fragmentation length is decided, `buf` includes one extra byte to pass the
TS bit around. That byte shouldn't count towards the MTU.
Instead, infer the presence of the timestamp by inspecting the amount of
headroom that the buffer has. This works because we always reserve
enough memory to push the timestamp, but not always push a timestamp on
the buffer. #tightlycoupled
This method is slightly uglier IMO, but eases MTU confusion and doesn't
rely on user_data.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Allow to run with timer random generator which does not need any
entropy device.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Current PHY rate
It represents the current PHY rate of transfer
of data in bits per second. It will a TX data rate.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Over run count
It represents the number of packets dropped either at
received and sent due to lack of buffer memory to retain
all packets on the network interface.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
This commit fixes an issue where deprecated IPv6 addresses were not
being correctly marked. In some cases, deprecated addresses might have
been used as source addresses.
Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
Add an opaque pointer to store upper layer private data and initialize
it with the USB device context during controller initialization. Use the
pointer in event processing to get the correct context.
Fixes commit 48f2a4bc1a
("usb: device_next: remove initialized state checks in event processing")
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
On a successful update we should reset the retry counter, similarly
like we do on successful registration.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>