Page MenuHomeFreeBSD

bpf: obtain timestamps from controller via pkthdr if available
ClosedPublic

Authored by jkim on Oct 3 2022, 8:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 30, 10:33 AM
Unknown Object (File)
Sat, Mar 30, 10:28 AM
Unknown Object (File)
Feb 8 2024, 8:58 AM
Unknown Object (File)
Jan 12 2024, 2:27 PM
Unknown Object (File)
Jan 7 2024, 1:55 AM
Unknown Object (File)
Dec 23 2023, 11:45 PM
Unknown Object (File)
Dec 22 2023, 11:44 PM
Unknown Object (File)
Oct 27 2023, 1:23 PM

Details

Summary

r325506 (3cf8254f1ea9666c9cd7bd55e56b4c8543505113) extended struct pkthdr to add packet timestamp in mbuf(9) chain. cxgbe(4) and mlx5en(4) seem to support this feature. Use the timestamp for bpf(4) if it is available. This patch was lightly tested on Chelsio T502-BT.

Test Plan

Check timestamp sanity with supported controllers via hwrxtstmp/-hwrxtstmp ifconfig parameters.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jkim requested review of this revision.Oct 3 2022, 8:40 PM

Please upload patches with context.

sys/net/bpf.c
2279

Please use mbuf_tstmp2timespec(), somebody might add more precision to it one day.

I think you should use "1000000000ULL" to always get unsigned results, but I'm not an expert. Else code looks good.

jkim marked an inline comment as done.
jkim added inline comments.
sys/net/bpf.c
2279

Thanks, I didn't see that.

This revision is now accepted and ready to land.Oct 3 2022, 9:39 PM
jkim marked an inline comment as done.Oct 3 2022, 9:42 PM

I think you should use "1000000000ULL" to always get unsigned results, but I'm not an expert. Else code looks good.

I used mbuf_tstmp2timespec() as @kib suggested. Note this function does not use ULL either.

Please, upload patches with context. git show -U 9999999 or git diff -U 999999999

This revision now requires review to proceed.Oct 3 2022, 9:56 PM
In D36868#836880, @kib wrote:

Please, upload patches with context. git show -U 9999999 or git diff -U 999999999

Sorry, done.

This revision is now accepted and ready to land.Oct 3 2022, 10:24 PM