All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Abhijit Gangurde <abhijit.gangurde@amd.com>
Cc: leon@kernel.org, brett.creeley@amd.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, allen.hubbe@amd.com, nikhil.agarwal@amd.com,
	linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [for-next v2 2/4] net: ionic: Add PHC state page for user space access
Date: Mon, 25 May 2026 13:15:27 -0300	[thread overview]
Message-ID: <20260525161527.GA2492788@nvidia.com> (raw)
In-Reply-To: <20260512092623.1157199-3-abhijit.gangurde@amd.com>

On Tue, May 12, 2026 at 02:56:21PM +0530, Abhijit Gangurde wrote:
> +/*
> + * struct ib_uverbs_phc_state - timecounter state shared with userspace
> + *
> + * Drivers that use a software timecounter over a free-running hardware
> + * cycle counter can map this page read-only into userspace, allowing
> + * conversion of hardware timestamps to system time without a syscall.
> + *
> + * Synchronization uses a sequence counter (@seq): the kernel sets it
> + * to an odd value before updating, then to the next even value after.
> + * Userspace must retry the read if @seq is odd or changed during the read.
> + *
> + * @seq:             Sequence counter (even = stable, odd = update in progress)
> + * @rsvd:            Reserved
> + * @mask:            Cycle counter bitmask
> + * @cycles:          Cycle counter value at last update
> + * @nsec:            Nanoseconds at last update
> + * @frac:            Fractional nanoseconds at last update
> + * @mult:            Cycle-to-nanosecond multiplier
> + * @shift:           Cycle-to-nanosecond shift
> + * @overflow_period: Max interval (nsec) between reads before counter wraps
> + */
> +struct ib_uverbs_phc_state {
> +	__u32 seq;
> +	__u32 rsvd;
> +	__aligned_u64 mask;
> +	__aligned_u64 cycles;
> +	__aligned_u64 nsec;
> +	__aligned_u64 frac;
> +	__u32 mult;
> +	__u32 shift;
> +	__aligned_u64 overflow_period;
> +};

If we are going to do this then let's re-use the mlx5 struct and protocol

struct mlx5_ib_clock_info {
        __u32 sign;
        __u32 resv;
        __aligned_u64 nsec;
        __aligned_u64 cycles;
        __aligned_u64 frac;
        __u32 mult;
        __u32 shift;
        __aligned_u64 mask;
        __aligned_u64 overflow_period;
};

So at least two drivers can implement this new uAPI.

Jason

  reply	other threads:[~2026-05-25 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  9:26 [for-next v2 0/4] ionic: RDMA completion timestamping support Abhijit Gangurde
2026-05-12  9:26 ` [for-next v2 1/4] net: ionic: register PHC for rdma timestamping Abhijit Gangurde
2026-05-12  9:26 ` [for-next v2 2/4] net: ionic: Add PHC state page for user space access Abhijit Gangurde
2026-05-25 16:15   ` Jason Gunthorpe [this message]
2026-05-12  9:26 ` [for-next v2 3/4] RDMA/ionic: map PHC state into user space Abhijit Gangurde
2026-05-12  9:26 ` [for-next v2 4/4] RDMA/ionic: add completion timestamp to CQE format Abhijit Gangurde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260525161527.GA2492788@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=abhijit.gangurde@amd.com \
    --cc=allen.hubbe@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.agarwal@amd.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.