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

net/coap: Expose configurations to Kconfig #13227

Merged
merged 4 commits into from
Apr 24, 2020

Conversation

leandrolanzieri
Copy link
Contributor

@leandrolanzieri leandrolanzieri commented Jan 29, 2020

Contribution description

This moves the configuration macros for our generic CoAP options to the CONFIG_ namespace, and exposes them to Kconfig.

I didn't include a range constraint on COAP_ACK_TIMEOUT and COAP_RANDOM_FACTOR_1000 yet as I am not sure which would be a valid maximum. According to RFC 7252, section 4.8.1:

In particular, a decrease of ACK_TIMEOUT below 1 second would violate the guidelines of [RFC5405].

(So the minimum for COAP_ACK_TIMEOUT would be 1)

ACK_RANDOM_FACTOR MUST NOT be decreased below 1.0, and it SHOULD have a value that is sufficiently different from 1.0 to provide some protection from synchronization effects.

(So the minimum for COAP_RANDOM_FACTOR_1000 would be 1000)

Also, I made use of a 'feature' symbol (HAS_PROTOCOL_COAP) which indicates in a generic way that there is a module that provides this, as this options are generic. When nanocoap has its own Kconfig file then it should be selected from there.

Edit: If #13243 is merged first, the TODO in the Kconfig file should be removed.

Testing procedure

  • Build examples/gcoap. By default everything should still work the same.
  • Modify some parameters (e.g. the number of retries or the random factor), changes should be applied.

Issues/PRs references

Part of #12888
Related to #13243

@leandrolanzieri leandrolanzieri added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: CoAP Area: Constrained Application Protocol implementations TF: Config Marks issues and PRs related to the work of the Configuration Task Force labels Jan 29, 2020
@leandrolanzieri leandrolanzieri added this to the Release 2020.04 milestone Jan 29, 2020
@leandrolanzieri leandrolanzieri added the Area: Kconfig Area: Kconfig integration label Feb 21, 2020
@leandrolanzieri leandrolanzieri force-pushed the pr/kconfig_migrate/net/coap branch from 4f5089a to 04f3e9a Compare March 13, 2020 11:24
@leandrolanzieri leandrolanzieri force-pushed the pr/kconfig_migrate/net/coap branch from 04f3e9a to 02ac496 Compare March 13, 2020 11:28
@leandrolanzieri
Copy link
Contributor Author

Rebased to resolve conflicts.

@leandrolanzieri leandrolanzieri force-pushed the pr/kconfig_migrate/net/coap branch from 02ac496 to f912723 Compare April 3, 2020 08:46
Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

I didn't include a range constraint on COAP_ACK_TIMEOUT and COAP_RANDOM_FACTOR_1000 yet as I am not sure which would be a valid maximum. […]

Maybe @kb2ma can help here?

Also, I made use of a 'feature' symbol (HAS_PROTOCOL_COAP) which indicates in a generic way that there is a module that provides this, as this options are generic. When nanocoap has its own Kconfig file then it should be selected from there.

Not really sure what you mean by that? Does this mean that nanocoap and gcoap would become mutually exclusive? oO

@leandrolanzieri
Copy link
Contributor Author

Not really sure what you mean by that? Does this mean that nanocoap and gcoap would become mutually exclusive? oO

No, this does not do that. It just indicates that there is CoAP implementation using this options.

The reasoning was, that these options are defined 'generic CoAP options' for RIOT, so I did not want to make them depend on nanocoap being present. The HAS_PROTOCOL_COAP symbol is a generic way of indicating "hey, there are CoAP capabilities". If the symbol is y, then we show the options, and we can configure common CoAP options for whatever implementation that is used.

@kb2ma
Copy link
Member

kb2ma commented Apr 7, 2020

I didn't include a range constraint on COAP_ACK_TIMEOUT and COAP_RANDOM_FACTOR_1000 yet as I am not sure which would be a valid maximum. […]

Maybe @kb2ma can help here?

Sorry, no recommendation for max values. I have not had occasion to change them myself.

@miri64
Copy link
Member

miri64 commented Apr 8, 2020

Please rebase!

@leandrolanzieri leandrolanzieri force-pushed the pr/kconfig_migrate/net/coap branch from f912723 to a03c9c1 Compare April 8, 2020 09:10
@leandrolanzieri
Copy link
Contributor Author

Rebased and removed the TODO, as #13243 has been merged.

@leandrolanzieri leandrolanzieri added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 16, 2020
@cgundogan cgundogan added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 16, 2020
Comment on lines +28 to +29
@ref CONFIG_COAP_ACK_TIMEOUT and
(@ref CONFIG_COAP_ACK_TIMEOUT * @ref CONFIG_COAP_RANDOM_FACTOR_1000 / 1000).
Copy link
Member

Choose a reason for hiding this comment

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

The doxygen @ref do not work with kconfig, maybe simply omit them in the help here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know Kconfig files are not generating documentation yet, but I plan to do so in the future. So this is just so we don't lose track of references that are currently on the docs.

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to add the marker so that it doesn't show up in the kconfig help?

Copy link
Member

Choose a reason for hiding this comment

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

See #13916

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Leaving a note that this is being addressed in #13916

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #13916

Didn't see that 😄

@bergzand
Copy link
Member

Does it make sense to add a note to the help descriptions that the default values are copied from the RFC?

@leandrolanzieri
Copy link
Contributor Author

Does it make sense to add a note to the help descriptions that the default values are copied from the RFC?

Yes. I added a reference to https://tools.ietf.org/html/rfc7252#section-4.8 now.

@bergzand
Copy link
Member

Please Squash

COAP_ACK_TIMEOUT is moved to the compile time configuration macro
namespace.
COAP_RANDOM_FACTOR_1000 is moved to the compile time configuration macro
namespace.
COAP_MAX_RETRANSMIT is moved to the compile time configuration macro
namespace.
@leandrolanzieri leandrolanzieri force-pushed the pr/kconfig_migrate/net/coap branch from 58232ee to eeea9b7 Compare April 24, 2020 08:10
@leandrolanzieri
Copy link
Contributor Author

Please Squash

Squashed

Copy link
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

Ack

@bergzand bergzand merged commit 268152b into RIOT-OS:master Apr 24, 2020
@leandrolanzieri
Copy link
Contributor Author

Thanks for reviewing !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CoAP Area: Constrained Application Protocol implementations Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR TF: Config Marks issues and PRs related to the work of the Configuration Task Force Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants