Skip to content

Conversation

@jukkar
Copy link
Member

@jukkar jukkar commented May 24, 2018

This converts remaining MSEC() calls to K_MSEC() in networking code.
Also convert MSEC_PER_SEC to K_SECONDS() as that is more intuitive.

Fixes #7657

@codecov-io
Copy link

codecov-io commented May 24, 2018

Codecov Report

Merging #7849 into master will decrease coverage by <.01%.
The diff coverage is 35.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7849      +/-   ##
==========================================
- Coverage   55.02%   55.02%   -0.01%     
==========================================
  Files         481      481              
  Lines       53970    53963       -7     
  Branches    10483    10483              
==========================================
- Hits        29695    29691       -4     
+ Misses      19996    19993       -3     
  Partials     4279     4279
Impacted Files Coverage Δ
subsys/net/ip/tcp.c 55.24% <ø> (ø) ⬆️
drivers/ethernet/eth_native_posix.c 22.1% <ø> (ø) ⬆️
subsys/net/ip/l2/ethernet/arp.c 62.75% <ø> (ø) ⬆️
subsys/net/ip/ipv6.c 46.27% <0%> (ø) ⬆️
drivers/net/loopback.c 72% <100%> (ø) ⬆️
subsys/net/ip/dhcpv4.c 5.72% <20%> (+0.02%) ⬆️
subsys/net/ip/rpl.c 16.47% <20%> (-0.17%) ⬇️
subsys/net/ip/net_if.c 62.62% <60%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71ce9b5...7dcf1b1. Read the comment docs.

Copy link
Contributor

@pfalcon pfalcon left a comment

Choose a reason for hiding this comment

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

Good! (Was in my queue too ;-) )

Suggested to over "raw" time-related values in net/ip/ and convert them too.

Copy link
Contributor

Choose a reason for hiding this comment

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

We have more "raw" values like this, IMHO makes sense to convert them within the scope of this PR too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should convert this to msecs for better granularity. In a separate PR apparently.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe K_MSEC(500) after all?

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment few lines above says "Set up another DAO within half the expiration time" so in this respect it makes sense to leave the division in place.

subsys/net/buf.c Outdated
Copy link
Member

Choose a reason for hiding this comment

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

The rest of the fixes in this PR seem good, but I'm not sure I agree with this. The way the K_SECONDS, K_MSEC, K_MINUTES, K_HOURS macros work, is that you don't need to know what the "native" representation of time is that's passed to the kernel APIs. It might be milliseconds, but it could be something else that the macros convert the input to. The above change assumes that the macro converts to milliseconds, whereas with MSEC_PER_SEC it's at least explicit.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to @jhedberg's comment, I'd also say that division by MSEC_PER_SEC is easier to understand than division by K_SECONDS(1).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, lets leave MSEC_PER_SEC there then.

subsys/net/buf.c Outdated
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.

jukkar added 3 commits May 28, 2018 13:39
Convert couple of MSEC() calls to K_MSEC() as the timeouts
when using MSEC() are just too long.

Signed-off-by: Jukka Rissanen <[email protected]>
Use of K_SECONDS() macro is more intuitive so use that instead of
plain MSEC_PER_SEC define.

Signed-off-by: Jukka Rissanen <[email protected]>
This one converts "raw" timeout value to use K_MSEC() macro
in order to make clear how long the timeout is.

Signed-off-by: Jukka Rissanen <[email protected]>
@jukkar jukkar force-pushed the k_sleep-too-long branch from 032a21b to 7dcf1b1 Compare May 28, 2018 11:06
@jukkar
Copy link
Member Author

jukkar commented May 28, 2018

Updated according to comments.

@nashif nashif merged commit 48ac4a3 into zephyrproject-rtos:master May 28, 2018
@jukkar jukkar deleted the k_sleep-too-long branch June 21, 2018 06:43
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.

5 participants