Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc/guides/device_mgmt: SMP protocol documentation #40894

Merged

Conversation

de-nordic
Copy link
Collaborator

The commit adds guide that describes format of SMP reqests/responses
as issued by Zephyr implementation within mcumgr.

Signed-off-by: Dominik Ermel [email protected]

@de-nordic
Copy link
Collaborator Author

@lairdjm @carlescufi FYI for preview.
Still in draft because I need to divide this into sections add more ref tagging and fix formatting.

Copy link

@simon-iversen simon-iversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding myself as reviewer

doc/guides/device_mgmt/smp_protocol.rst Outdated Show resolved Hide resolved
Comment on lines 21 to 19
Frame is encoded in "Big Endian" (Network endianess), where field is more than
one byte lone, and takes the following form:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Frame is encoded in "Big Endian" (Network endianess), where field is more than
one byte lone, and takes the following form:
Frame is encoded in "Big Endian" (Network endianess) and takes the following form:

This sentence was incomplete. I think the explanation of endianess should be longer than a single line, if required at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the sentence, with the exception of "lone" that should be "long" tried to clarify that you should not change bit order, only byte order for types longer than one byte.

doc/guides/device_mgmt/smp_protocol.rst Outdated Show resolved Hide resolved
doc/guides/device_mgmt/smp_protocol.rst Outdated Show resolved Hide resolved
doc/guides/device_mgmt/smp_protocol.rst Outdated Show resolved Hide resolved
doc/guides/device_mgmt/smp_protocol.rst Show resolved Hide resolved
doc/guides/device_mgmt/smp_protocol.rst Outdated Show resolved Hide resolved
doc/guides/device_mgmt/smp_protocol.rst Outdated Show resolved Hide resolved
```
{
(str)"argv" : [
(str)<cmd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct that the cmd in in the array?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@de-nordic
Copy link
Collaborator Author

@caspermeijn Thanks for starting the review. Mind that this is still draft, so depending on my further work and suggestions from reviewers it may change a lot.

@de-nordic de-nordic force-pushed the mcumgr-smp-protocol-doc branch 10 times, most recently from 35f8eb4 to 2cbe3fe Compare December 8, 2021 14:33
Comment on lines 96 to 99
| "rc" | :ref:`mcumgr_smp_protocol_status_codes` |
+-----------------------+---------------------------------------------------+
| "rsn" | :ref:`mcumgr_smp_protocol_status_codes` |
+-----------------------+---------------------------------------------------+
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 156 to 157
(str)"rc" : (int)
(str,opt)"rsn" : (str)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rsn here also

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

==============

The command lacks formal definition except for being assigned ID. It is not really
know what the request should look like or what the response should contain.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*known

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


The command lacks formal definition except for being assigned ID. It is not really
know what the request should look like or what the response should contain.
It is also not know whether this is ``write request`` or ``read reqest``
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*known

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 129 to 116
+===============+===============================================+
| ``0`` | write request |
+---------------+-----------------------------------------------+
| ``1`` | write response |
+---------------+-----------------------------------------------+
| ``2`` | read request |
+---------------+-----------------------------------------------+
| ``3`` | read response |
+---------------+-----------------------------------------------+
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong way around, read request is 0, read response is 1, write request is 2, write response is 3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

doc/guides/device_mgmt/smp_protocol.rst Show resolved Hide resolved
| ``5`` | Designated for test crashing application |
| | (unused by Zephyr) |
+---------------+-----------------------------------------------+
| ``6`` | Designated for run tests |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

doc/guides/device_mgmt/smp_protocol.rst Outdated Show resolved Hide resolved
| | when there is not enough memory to complete |
| | response. |
+---------------+-----------------------------------------------+
| ``3`` | Invalid value; a request contains invalid |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*contains an invalid

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@de-nordic de-nordic force-pushed the mcumgr-smp-protocol-doc branch from 2cbe3fe to 4655339 Compare December 20, 2021 16:15
@de-nordic de-nordic requested a review from nordicjm December 20, 2021 16:15
@de-nordic de-nordic force-pushed the mcumgr-smp-protocol-doc branch 2 times, most recently from 9be2f9f to bfdf364 Compare December 20, 2021 16:42
@de-nordic de-nordic marked this pull request as ready for review December 20, 2021 16:42
@de-nordic de-nordic requested a review from nashif as a code owner December 20, 2021 16:42
@de-nordic de-nordic self-assigned this Dec 20, 2021
@de-nordic de-nordic force-pushed the mcumgr-smp-protocol-doc branch from bfdf364 to ff7a165 Compare December 20, 2021 16:46
@de-nordic
Copy link
Collaborator Author

@caspermeijn @lairdjm @philips77 Somehow I can not re-request review for this PR, so I am mentioning you here to drag you back to review.

+========+==============+================+==================================+
| ``1`` | ``0`` | ``0`` | When request ``OP`` was ``0`` |
+--------+--------------+----------------+----------------------------------+
| ``3`` | ``0`` | ``0`` | When request ``OP`` was ``1`` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*was 2

(str)"tid" : (uint)
(str)"state" : (uint)
(str)"stkuse" : (uint)
(str)"stksize" : (uint)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*stksiz

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

+-----------------------+---------------------------------------------------+
| "stkuse" | task's/thread's stack usage |
+-----------------------+---------------------------------------------------+
| "stksize" | task's/thread's stack size |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*stksiz

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

| "rc" | :ref:`mcumgr_smp_protocol_status_codes` |
+-----------------------+---------------------------------------------------+

Task statistics command
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding the 'not known' text here about the terminal/echo command also?

(str,opt)"len" : (uint)
(str)"off" : (uint)
(str,opt)"sha" : (str)
(str,opt)"data" : (str)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-querying this


Mcumgr server side re-opens a file for each subsequent request, and current
specification does not provide means to identify subsequent requests as
belonging to specified download session. This means that the file is not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved

{
(str)"off" : (uint)
(str)"data" : (str)
(str)"rc" : (int)0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved

*************

Command allows to download contents of an existing file from specified path
at a target device. The command is stateless and mcumgr does not hold file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved

Statistics: group data request
==============================

Statistics group date request header
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved


+-----------------------+---------------------------------------------------+
| "stat_list" | array of strings representing group names; this |
| | array may be empty if there are not groups |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved

@de-nordic de-nordic force-pushed the mcumgr-smp-protocol-doc branch 2 times, most recently from c08f1aa to 43540c3 Compare February 8, 2022 15:42
@de-nordic
Copy link
Collaborator Author

de-nordic commented Feb 8, 2022

@carlescufi @caspermeijn @philips77 I have changed, in entire documentation, sentences:

CBOR data of request command:

to

CBOR data of request:

as the former was not really accurate.
I have also changed description of echo and reset commands where now the "rc" is not included in successful responses.

Comment on lines 90 to 92
.. code-block:: none
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. code-block:: none
{
.. code-block:: none
{

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

gmarull
gmarull previously approved these changes Feb 8, 2022
@de-nordic de-nordic force-pushed the mcumgr-smp-protocol-doc branch from 43540c3 to 654ebdf Compare February 8, 2022 16:53
caspermeijn
caspermeijn previously approved these changes Feb 8, 2022
Copy link
Contributor

@caspermeijn caspermeijn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how the tables are rendered. Overall, I think the text is clear and understandable. LGTM


.. note::
Response from Zephyr running device may have "rc" value of 6, bad state,
(:ref:mcumgr_smp_protocol_status_codes) which means that the secondary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reference is not rendered correctly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@de-nordic de-nordic force-pushed the mcumgr-smp-protocol-doc branch 4 times, most recently from d69a538 to eca385a Compare February 9, 2022 14:22
@de-nordic
Copy link
Collaborator Author

@dleach02 @caspermeijn @gmarull @carlescufi @philips77 The review is in some strange state: I have this "comment" icons on the right-side of reviewers nicks but there are not changes requested and the request review button works only for some reviewers.

| | an application specific management groups |
+---------------+-----------------------------------------------+

The payload for above groups, except for ``64`` which is not defined,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not groups 64 and above? Would add a note here about that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

philips77
philips77 previously approved these changes Feb 21, 2022
The commit adds guide that describes format of SMP reqests/responses
as issued by Zephyr implementation within mcumgr.

Signed-off-by: Dominik Ermel <[email protected]>
Comment on lines +80 to +85
(str)"name" : (str)
(str)"fields" : {
(str)<entry_name> : (uint)
...
}
(str)"rc" : (int)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unaware of this restriction with zcbor/cddl-gen: NordicSemiconductor/zcbor#176
If the plan is to move to zcbor, should these entries show the current layout or the layout that things would go with? At present, the layout is rc before name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That only happens when you use decoder generated from CDDL. When you decode by hand it is up to you how the processing of CBOR is handled.
Anyway, this is comment for #43333 and/or #40591 rather than documentation for SMP.

@carlescufi carlescufi merged commit 92109e1 into zephyrproject-rtos:main Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants