The way that the clock is synchronized between the system and the current mlx5 for the purposes of the M_TSTMP
being carried we loose a lot of precision. Instead lets change the math that calculates this to separate out
the seconds/nanoseconds and operate on the two values so we don't get overflow instead of just
shifting the value down and loosing precision.
Details
One can test with BB logs to see the timestamp and I have also tested this
with added query mechanisms (not included in the patch) so that I could compare
old and new timestamps generated and all of those to the real floating point
result. This new algorithm now gets us to be within the 1/10ths of a nanosecond
where you would expect it to be for integer math.
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | ||
---|---|---|
253 | Good point | |
261 | No I don't think its possible because the min time you can set in the callout is 1 second. And |
sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | ||
---|---|---|
261 | No reason to panic! Maybe a warn_once() from the LinuxKPI is better? |
sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | ||
---|---|---|
406–409 | If you can't get sync (check the lockless code) and see gen = 0, you return 0. |
sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | ||
---|---|---|
241 | No its my very poor spelling ;) |
sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | ||
---|---|---|
232–249 | Hans Here is the comment I was referring too about divisor.. same divisor basically except | |
258 | No it cannot.. Same for the original code I believe there is a comment in the | |
274 | Sure I left it in for your reference. |
Code looks sane to me.
sys/dev/mlx5/mlx5_en/mlx5_en_main.c | ||
---|---|---|
4801 | Are you sure you don't need to cast to ULL or uint64_t to have a proper 64-bit multiplication here? |
sys/dev/mlx5/mlx5_en/mlx5_en_main.c | ||
---|---|---|
4801 | Let me add that, I doubt its needed but it would not hurt :) |
sys/dev/mlx5/mlx5_en/mlx5_en_main.c | ||
---|---|---|
4801 | The cast is definitely not needed. |