Re: [PATCH 2/4] net: ionic: Add PHC state page for user space access

From: Allen Hubbe

Date: Fri Apr 10 2026 - 19:48:06 EST


On 4/10/2026 4:43 PM, Jakub Kicinski wrote:
On Fri, 10 Apr 2026 09:10:09 -0400 Allen Hubbe wrote:
+struct ionic_phc_state {
+ __u32 seq;
+ __u32 rsvd;
+ __aligned_u64 mask;
+ __aligned_u64 tick;
+ __aligned_u64 nsec;
+ __aligned_u64 frac;
+ __u32 mult;
+ __u32 shift;
+};

You're just exposing kernel timecounter internals.
Why is this ionic uAPI and not something reusable by other drivers?

The simple answer is just following the same approach as an existing
implementation. See struct mlx5_ib_clock_info and
mlx5_update_clock_info_page().

Making this common might risk presuming that other implementations will
be a similar design. Compare these to the sfc driver. The clock is
quite different from ionic and mlx5, not using timecounter, because
instead of a free-running cycle counter the hardware itself provides an
adjustable clock for timestamping.

So your augment is basically that drivers which don't use sw timecounter
exist so we shouldn't bother creating common definitions for drivers
that do? Why do we have common implementation of timecounter in the
kernel at all then?

These are rhetorical questions.

There is no suggestion to get rid of timecounter in the kernel.

Maybe I've been overthinking this and misunderstood your first reply. Did you mean, just, why not move this to ib_user_verbs.h, struct ib_uverbs_phc_state, and use it from the vendor driver?