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

Remove nix dependency #109

Merged
merged 8 commits into from
May 22, 2023
Merged

Remove nix dependency #109

merged 8 commits into from
May 22, 2023

Conversation

folkertdev
Copy link
Contributor

this is a big one. The nix dependency is gone, and a lot of logic has been imported from ntpd-rs. As far as I can establish, this PR does not regress any functionality, but 1) this is hard to actually verify and 2) it does expose some problems with the existing/prior implementation. I'll highlight these below.

@codecov
Copy link

codecov bot commented May 8, 2023

Codecov Report

Merging #109 (d0d1dc0) into main (840100b) will increase coverage by 3.85%.
The diff coverage is 77.50%.

@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
+ Coverage   56.91%   60.77%   +3.85%     
==========================================
  Files          56       59       +3     
  Lines        5508     5889     +381     
==========================================
+ Hits         3135     3579     +444     
+ Misses       2373     2310      -63     
Impacted Files Coverage Δ
statime-linux/src/main.rs 0.00% <0.00%> (ø)
statime/src/network.rs 0.00% <ø> (ø)
statime-linux/src/network/linux.rs 18.83% <14.58%> (-38.64%) ⬇️
statime-linux/src/clock/raw.rs 19.36% <53.33%> (+19.36%) ⬆️
statime-linux/src/clock/mod.rs 16.21% <60.00%> (+16.21%) ⬆️
statime-linux/src/network/raw_udp_socket.rs 71.65% <71.65%> (ø)
...tatime-linux/src/network/timestamped_udp_socket.rs 83.94% <83.94%> (ø)
statime-linux/src/network/interface.rs 87.50% <87.50%> (ø)
statime-linux/src/network/control_message.rs 90.16% <90.16%> (ø)
statime-linux/src/network/mod.rs 100.00% <100.00%> (ø)
... and 3 more

Comment on lines +256 to +266
libc::SOF_TIMESTAMPING_RAW_HARDWARE
| libc::SOF_TIMESTAMPING_RX_HARDWARE
| libc::SOF_TIMESTAMPING_TX_HARDWARE
| libc::SOF_TIMESTAMPING_OPT_TSONLY
| libc::SOF_TIMESTAMPING_OPT_ID
Copy link
Contributor Author

Choose a reason for hiding this comment

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

when did we last test with hardware timestamping? were the hardware timestamps actually used, because it can be hard to tell. Based on my testing for ntpd-rs, on our desktop machines at least, we need software timestamps to also be enabled for anything to happen.

Copy link
Member

Choose a reason for hiding this comment

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

This does work on both the intel i210 and x710 cards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, interesting


fn recv_with_timestamp(
tc_socket: &std::net::UdpSocket,
clock: &LinuxClock,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

passing in the clock here is extremely inelegant. On the other hand, maybe this generates (much) more accurate timestamps and that is important? can we determine this timestamp outside of the UDP logic, or would that be too inaccurate?

Copy link
Member

Choose a reason for hiding this comment

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

We can, but that leads to a more complicated interface that users of the library need to implement. The code always needs timestamps on the time critical socket, so the network abstraction should just provide them.

Copy link
Member

@davidv1992 davidv1992 left a comment

Choose a reason for hiding this comment

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

Most of the nix replacements look good, but I don't like the changes to the interface made. When sending a message on the time critical socket, we always need a timestamp back, so any fallback should (in my view) just be generated inside the send function.

Furthermore, this needs some rebasing to use the new (correct) epoll mechanism.

statime-linux/src/network/linux.rs Show resolved Hide resolved
statime-linux/src/network/raw_udp_socket.rs Show resolved Hide resolved
@folkertdev folkertdev force-pushed the remove-nix-dependency branch 2 times, most recently from cb68b19 to 9792532 Compare May 12, 2023 14:42
Copy link
Contributor Author

@folkertdev folkertdev left a comment

Choose a reason for hiding this comment

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

I think I fixed everything here

statime-linux/src/main.rs Show resolved Hide resolved
Comment on lines +256 to +266
libc::SOF_TIMESTAMPING_RAW_HARDWARE
| libc::SOF_TIMESTAMPING_RX_HARDWARE
| libc::SOF_TIMESTAMPING_TX_HARDWARE
| libc::SOF_TIMESTAMPING_OPT_TSONLY
| libc::SOF_TIMESTAMPING_OPT_ID
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, interesting

davidv1992
davidv1992 previously approved these changes May 22, 2023
@davidv1992 davidv1992 merged commit fa2a67c into main May 22, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants