The function has been reimplemented within stat_mgmt_list directly,
reducing execution time and code size.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit merges Zephyr specific code from zephyr_stat_mgmt.c
to stat_mgmt.c, removes *_impl_* prototypes of functions that are
used for system specific implementations.
zephyr_ prefixes have been removed from identifiers as they are
no longer needed.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit reorganizes smp_handle_single_payload function to only
open map container, in response, after request have been validated
to be processable.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes arg parameter from mgmt_init_writer_fn
function typedef and implementation in zephyr_smp_init_writer.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes arg parameter from mgmt_init_reader_fn
function typedef and implementation in zephyr_smp_init_reader.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The smp_make_rsp_hdr prepares new response header from request
header, sets proper frame length to it and converts it to
network format.
Because a respose buffer has now pre-allocated space for header
it is no longer required to call the smp_make_rsp_hdr,
formerly smp_init_rsp_hdr, to reserve such space before adding
data that should follow it.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit changes cbor_nb_writer_init function to reserve
SMP header size on init. The change makes call to
mgmt_streamer_reset_buf within smp_write_hdr no longer needed.
The mgmt_streamer_write_at function, that has been exclusively
used to write headers, have been replaced with mgmt_streamer_write_hdr
and zephyr_smp_write_hdr, formerly zephyr_smp_write_at, has been
reduced as it no longer needs to check and update net_buf metadata
to write header as the cbor_nb_writer_init does it now.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Boolean options must not start with "Enable...". Adjusted the prompt to
comply with the guidelines.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
New CONFIG_MCUMGR_SMP_BT_PKASM has been added that enabled
SMP packet re-assembly, at transport level, to the BT.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds packet re-asembly to SMP that can be used to
collect packet from fragments at SMP transport level.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit fixes erase storage command so that it would return with
error code instead of bus faulting when no device is attached
to flash storage.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
It is possible for flash partition to have no device attached
which may cause image commands to bus fault device.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Following #42026, the body_start pointer now points to the
start of the body fragment in the recv_buffer as long as there
is body in it, either entirely or partially.
Rename the body_start to body_frag_start to better reflect
what it represents.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
The os_mgmt_echo is supposed to return MGMT type error not
Cbor; there was missing translation.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The cbor_value_advance at the end of attribute parsing loop could
overwrite err with 0; this could cause loop to fail to break
on error and make cbor_internal_read_object return success, even
if parsing of input buffer failed.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:
sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The commit:
- removes usage of strnlen to make taskstat code C99 compliant;
- corrects thread name len, following update description of
CONFIG_OS_MGMT_TASKSTAT_THREAD_NAME_LEN;
- reduces duplicated code.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes usage of strnlen from echo command to make
code C99 compliant, and allow it to compile with newlib.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The help for the OS_MGMT_TASKSTAT_THREAD_NAME_LEN stated that
the config includes terminating zero, but this is not true:
when thread name is encoded with CBOR it is encoded with actual
string length and is not zero terminated.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Kconfig options now belong to the Kconfig domain, therefore, the
:kconfig:option: role needs to be used.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This file defines the crypto driver API, cipher is supposed to be just
one type of capability (other can be hash) of these drivers, just
change the file name to be consistent with it.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Extended the connection parameters negotiation procedure used in the
SMP BT module. From now on, it is possible to configure a preferable
set of all connection parameters to be used during the image transfer.
The default values are optimized for transfer throughput.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
The commit removes redundant memcpy operations and switches from
using TinyCBOR provided byte order converters to sys_be, native
to Zephyr.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The smp_process_request_packet has been checking return code from
mgmt_streamer_init_writer where Zephyr implementation of the
callback always returns 0.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Since this CRC uses the 0x1021 poly with no reflection, a faster
implementation is available in the crc16_itu_t() function, which is
O(n).
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Guard call to k_thread_abort() to ensure it's not called with an
uninitialized thread and fix improper use of inet_pton() with
INADDR_ANY passed in place of a dotted-decimal string. Both of these
would otherwise lead to NULL pointer dereferences.
Signed-off-by: Berend Ozceri <berend@recogni.com>
The commit fixes smp_process_request_packet failing to decrement
message_size, of read stream, by number of bytes it trims from
an input buffer.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit fixes smp_process_request_packet not checking header
stated message length against actual message length.
This could lead to an erratic behavior of an application when it tries
to parse CBOR data beyond actual size of message or potential
Zephyr crash.
When application has asserts enabled the error leads to inevitable
Zephyr crash, caused by net_buf checks.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The changes smp_process_request_packet to return MGMT_ERR_ECORRUPT
in case when failed to read header.
This helps to recognize that there will not be any response sent
from mcumgr to the buffer given to smp_process_request_packet as
it has not been recognized as valid request.
It also removes redundant check on mgmt_streamer_init_reader which
always returns 0 (no failure) in Zephyr.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The mcumgr image upload uses buffed flash writes with use of stream
flash, which makes flash alignment check unneded.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit fixes bug in compile time calculation of file download
chunk, FS_MGMT_DL_CHUNK_SIZE, that is permitted within selected
mcumgr buffer size, where the mcumgr header length has not been
taken into account.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes internal names given to Kconfig options,
in img_mgmt_config.h, and modifies code to use the Kconfig options
directly.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes internal names given to Kconfig options,
in fs_mgmt_config.h, and modifies code to use the Kconfig options
directly.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The tasktat code filling reposes with use of CBOR has been modified,
utilizing lazy evaluation of C '||' operator, to terminate CBOR
encoding as soon as first error appears.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds OS_MGMT_TASKSTAT_STACK_INFO Kconfig option
that allows to skip, when disabled, "stksz" and "stkuse" reports,
in "taskstat" command responses.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds Kconfig options and supporting code that allows
to select characteristic that will be used for thread name
in taskstat from:
- thread name, when THREAD_NAME is enabled;
- thread ID/index;
- thread priority.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
By default the mcumgr taskstat responses send task priorities
as unsigned integers, while Zephyr uses int8_t as priority type.
This commit adds OS_MGMT_TASKSTAT_SIGNED_PRIORITY Kconfig option
that allows to switch to use signed priorities in responses.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The change adds OS_MGMT_THREAD_NAME_LEN that allows to set length of
thread name that is returned in taskstat response.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit changes taskstat code to directly process thread information
from Zephyr structures, instead of translating them to system agnostic
layer, before formatting response.
It also moves the takstat code to os_mgmt.c.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes os_mgmt_config.h that has been translating Kconfig
options to mgmt internal definitions for constants, and replaces
usage of these constants with direct use of Kconfig options.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
OS_MGMT_TASKSTAT depends on THREAD_MONITOR, so when it defaults to y
and THREAD_MONITOR is disabled we get a build error.
Add a depends on to enforce a correct configuration.
Remove default y, as features should be default n.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
zephyr_os_mgmt_task_at and friends are ifdef'ing on a feature they
depend on instead of their own Kconfig option.
Which is not correct.
ifdef on CONFIG_OS_MGMT_TASKSTAT instead.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This change adds a posibility to enable low latency connection
parameters for BT when SMP commands are handled.
Support for this functionality is disabled by the default and
can be enabled by CONFIG_MCUMGR_SMP_BT_LATENCY_CONTROL=y option.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>