8000 gnrc/sixlowpan: migrate to ztimer_msec by jue89 · Pull Request #19067 · RIOT-OS/RIOT · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gnrc/sixlowpan: migrate to ztimer_msec #19067

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jue89
Copy link
Contributor
@jue89 jue89 commented Dec 20, 2022

Contribution description

This PR migrates all time stamping done by gnrc_sixlowpan_% to ZTIMER_MSEC.

Testing procedure

TBD

Issues/PRs references

#17607

@jue89 jue89 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 20, 2022
@github-actions github-actions bot added Area: sys Area: System Area: tests Area: tests and testing framework labels Dec 20, 2022
@riot-ci
Copy link
riot-ci commented Dec 20, 2022

Murdock results

✔️ PASSED

1ddab5a fixup! fixup! fixup! fixup! net/gnrc/sixlowpan/frag: use ztimer_msec for timestamping

Success Failures Total Runtime
2006 0 2006 03m:34s

Artifacts

@benpicco benpicco requested a review from kfessel December 20, 2022 19:12
The timebase has been switched from us to ms. Jitter will get much larger.
@jue89 jue89 force-pushed the fix/gnrc-sixlowpan-ztimer branch from f593bbd to 697bb5b Compare December 21, 2022 11:00
@jue89 jue89 marked this pull request as ready for review December 21, 2022 11:14
The garbage collector is triggered by a massage that is created by ztimer_set(CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT). On fast machines with low latencies, the gc runs in the same millisecond in which the ztimer expired.
@jue89 jue89 force-pushed the fix/gnrc-sixlowpan-ztimer branch from 697bb5b to bc813ea Compare December 21, 2022 11:19
((now_usec - rbuf[i].super.arrival) >
CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US)) {
((now_msec - rbuf[i].super.arrival) >=
CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US / US_PER_MS)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to de 8000 scribe this comment to others. Learn more.

This macro is only used within the reassembly buffer, so why not redefine it to TIMEOUT_MS. If you want to avoid API changes, we could define a deprecated TIMEOUT_US = TIMEOUT_MS * US_PER_MS as well.

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 actually had to deprecate 3 config vars.

94349f4

To get things clear I prefixed the time unit to some affected variables.

If you're happy with the changes, I'd squash if you don't mind.

@github-actions github-actions bot added the Area: Kconfig Area: Kconfig integration label Dec 21, 2022
@jue89 jue89 added the CI: no fast fail don't abort PR build after first error label Dec 21, 2022
* [gnrc_sixlowpan_frag_rb](@ref net_gnrc_sixlowpan_frag_rb) module
*
* @deprecated Use @ref CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS instead.
* Will be removed after 2023.01 release.
Copy link
Member

Choose a reason for hiding this comment

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

The usual deprecation cycle is two releases, since the 2023.01 release is just up ahead, I think, 2023.07 is the better release to deprecate. This way users still have some time to adjust ;-).

Copy link
Member

Choose a reason for hiding this comment

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

Ping?

@@ -112,13 +129,30 @@ extern "C" {
* @note Only applicable with
* [gnrc_sixlowpan_frag_rb](@ref net_gnrc_sixlowpan_frag_rb) module
*
* @deprecated Use @ref CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER_MS instead.
* Will be removed after 2023.01 release.
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

* [gnrc_sixlowpan_frag_vrb](@ref net_gnrc_sixlowpan_frag_vrb) module.
*
* @deprecated Use @ref CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_MS instead.
* Will be removed after 2023.01 release.
Copy link
Member

Choose a reason for hiding this comment

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

And here.

@MrKevinWeiss
Copy link
Contributor

We should get this in before the hard feature freeze if it is mostly about deprecations.

uint32_t now;
uint32_t if_gap = gnrc_sixlowpan_frag_sfr_congure_snd_inter_frame_gap(fbuf);
uint32_t now_msec;
uint32_t if_gap_msec = gnrc_sixlowpan_frag_sfr_congure_snd_inter_frame_gap(fbuf) / US_PER_MS;
Copy link
Member

Choose a reason for hiding this comment

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

IIRC the inter frame gap is currently configured to be in the sub-millisecond range. How is this handled here?

#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US
#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (3U)
#else
#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US / US_PER_SEC)
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
#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US / US_PER_SEC)
#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US / US_PER_MS)

#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US
#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (3U)
Copy link
Contributor
@kfessel kfessel Mar 20, 2023

Choose a reason for hiding this comment

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

Suggested change
#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (3U)
#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (3000U)

old default was "(3U * US_PER_SEC) " -> 3000 ms or 3 seconds

Copy link
Contributor
@kfessel kfessel left a comment

Choose a reason for hiding this comment

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

there seem to be a number of usec to msec conversions that result in the value being 1 such gaps or sleep might be 1 usec to 2000 usec ( this seems not to be enough resolution for at least some of the cases).
from ztimer.h:

 * 2. due to its implementation details, expect +-1 clock tick systemic
 *    inaccuracy for all clocks.

I think these parts may need higher resolution using ztimer_usec and if there are no ztimer_t that keep the timer running they need aquire and release are need for that as well (an event-timer or something like that might also be able to do the job).

if the single digit values are there only in the tests it might be ok but the 1s should be increased (to 2) (since 1count might be very close to 0ms 2 counts are at least 1ms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0