MLX5DV_GET_CLOCK_INFO(3)

πŸ’– MLX5DV_GET_CLOCK_INFO πŸ’–

okay bestie, gather round, because we're talking about mlx5dv_get_clock_info(3) β€” a lil' library function from the Library Functions Manual section, and honestly? she's doing the most important job nobody talks about. πŸ•°οΈβœ¨


✨ NAME ✨

mlx5dv_get_clock_info β€” get device clock information πŸŽ€


🌸 SYNOPSIS 🌸

#include <infiniband/mlx5dv.h>

int mlx5dv_get_clock_info(struct ibv_context *ctx_in,
                          struct mlx5dv_clock_info *clock_info);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, this function goes and grabs the updated core clock_info straight from the device driver. like, fresh off the press. and why do we care? because later on, you're gonna use that info to translate a completion timestamp from the HCA core clock into nanoseconds. that's the whole glow-up. πŸ’…

now, real talk: the values of the clock get updated from the driver's PTP clock. which means β€” and this is the part where I need you to lock in β€” if there is no running PTP client on the machine, then the wall clock conversion will not be accurate. no cap. it's just not gonna be right, and that's not a bug, that's just physics being dramatic. 😭

so here's the move: pass the latest struct mlx5dv_clock_info into mlx5dv_ts_to_ns(3) and that's how you translate the completion timestamp from HCA core clock to nanoseconds. iconic combo, honestly. 🫢

⚠️ and if the clock_info gets too old? the time conversion will return wrong conversion results. periodt. so you, yes you, must make sure that mlx5dv_get_clock_info(3) is called at least once every max_clock_info_update_nsec β€” that value comes back from the mlx5dv_query_device(3) function. set a lil reminder, bestie, your future self will thank you. β°πŸ’€

πŸ‘‘ RETURN VALUE πŸ‘‘

  • 0 on success πŸŽ‰
  • or the value of errno on failure β€” which is the universe telling you why it went wrong πŸ™ˆ

🌈 SEE ALSO 🌈


πŸ’œ AUTHORS πŸ’œ

  • Feras Daoud <ferasda@mellanox.com>

and that's the whole page, bestie!! this one's from version 1.0.0 and it's dated 2017-11-08 β€” so yeah, vintage but still eating. mwah, go keep those clocks updated πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from