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

af_xdp: move rx timestamp read to support WODA #251

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wdebruij
Copy link
Contributor

Move AF_XDP rx timestamp read into vi->ops.receive_get_timestamp.

The original implementation added a branch in device independent get_rx_timestamp. This is not needed, and it breaks WODA, because record_rx_timestamp is skipped.

Fix this, and as a side-effect better isolate the AF_XDP from the device independent code.

WODA also needs the EF_VI_SYNC flags passed. XDP offers no way to query the device for these currently. Similar to ef10_mcdi_event, assume clock is always in sync.

With this change, src/tests/onload/wire_order succeeds.

@wdebruij wdebruij requested a review from a team as a code owner October 31, 2024 18:58
@wdebruij wdebruij force-pushed the master branch 2 times, most recently from 623ae39 to d77f5c3 Compare October 31, 2024 19:07
Copy link
Contributor

@ivatet-amd ivatet-amd left a comment

Choose a reason for hiding this comment

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

While this change looks good to me, I still would like @sianj-xilinx to approve too.

@ivatet-amd ivatet-amd requested review from sianj-xilinx and a team December 2, 2024 15:17
@wdebruij
Copy link
Contributor Author

Ping

Copy link
Contributor

@jfeather-amd jfeather-amd left a comment

Choose a reason for hiding this comment

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

Looks like a good change, thanks!

I've briefly tested this with some internal woda_latency_{server,client} apps and they seem to be happy to run over AF_XDP with this change, for internal reviewers, you can find the test log at ~jfeather/rhome/dev/public-pr-251/woda_latency_server.log.

I would like to check what testing @ivatet-amd has done and why specifically he wanted @sianj-xilinx's review before merging this, but he is currently off, so I'll aim to come back to this PR in the coming weeks.

@jfeather-amd jfeather-amd requested a review from a team February 19, 2025 10:50
ts_out->tv_sec = meta->tstamp / ns_to_sec;
ts_out->tv_nsec = meta->tstamp % ns_to_sec;
ts_out->tv_nsec_frac = 0;
ts_out->tv_flags = EF_VI_SYNC_FLAG_CLOCK_SET | EF_VI_SYNC_FLAG_CLOCK_IN_SYNC;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than fabricate traceability claims, would it be sufficient for WODA to claim only the CLOCK_SET flag and leave the IN_SYNC flag clear with EF_TIMESTAMPING_REPORTING kept at 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point.

As a matter of fact, after reviewing the code and running src/tests/onload/wire_order yesterday, I do not see a requirement of having either flag set for WODA at all.

They are used, of course, in SO_TIMESTAMPING to decide whether to fill in the (deprecated in Linux) SOF_TIMESTAMPING_SYS_HARDWARE field.

But for WODA, the critical part is only that ef_vi_receive_get_precise_timestamp returns 0, so that record_rx_timestamp is called.

I've been staring at this for a while, as it would mean that I was mistaken in October when I wrote that paragraph. Unfortunately, the comment does not explain why at the time I believed that "WODA also needs the EF_VI_SYNC flags passed".

From both testing and code inspection today, I believe it does not. WODA can work on the raw hardware timestamps, regardless of whether they are synced with the host clock or with PTP. It can also operate on trailer timestamps, after all, for which this information is not communicated explicitly either.

So agreed that EF_VI_SYNC_FLAG_CLOCK_IN_SYNC can be removed if EF_TIMESTAMPING_REPORTING is kept zero. But probably even better to leave both zero.

If you agree, I'll do that.

Thanks for the review!

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 have updated the commit as in my previous comment.

Move AF_XDP rx timestamp read into vi->ops.receive_get_timestamp.

The original implementation added a branch in device independent
get_rx_timestamp. This is not needed, and it breaks WODA, because
record_rx_timestamp is skipped.

Fix this, and as a side-effect better isolate the AF_XDP from the
device independent code.

With this change, src/tests/onload/wire_order succeeds.

Signed-off-by: Willem de Bruijn <[email protected]>
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.

4 participants