mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Carolina Jubran <cjubran@nvidia.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Gal Pressman <gal@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>,
	Bar Shapira <bshapira@nvidia.com>,
	Maciek Machnikowski <maciejm@nvidia.com>,
	Wojtek Wasko <wwasko@nvidia.com>,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Mahesh Bandewar <maheshb@google.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] ptp: extend offset ioctls to expose raw free-running cycles
Date: Tue, 10 Jun 2025 20:29:26 -0700	[thread overview]
Message-ID: <aEj4Fp05_lTdMgu3@hoboy.vegasvil.org> (raw)
In-Reply-To: <20250610171905.4042496-1-cjubran@nvidia.com>

On Tue, Jun 10, 2025 at 08:19:05PM +0300, Carolina Jubran wrote:

> @@ -398,8 +423,14 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
>  			break;
>  		}
>  		sts.clockid = extoff->clockid;
> +		cycles = !!(extoff->rsv[0] & PTP_OFFSET_CYCLES);
>  		for (i = 0; i < extoff->n_samples; i++) {
> -			err = ptp->info->gettimex64(ptp->info, &ts, &sts);
> +			if (cycles)
> +				err = ptp->info->getcyclesx64(ptp->info, &ts,
> +							      &sts);
> +			else
> +				err = ptp->info->gettimex64(ptp->info, &ts,
> +							    &sts);

ugh...

> @@ -86,9 +111,15 @@
>   *
>   */
>  struct ptp_clock_time {
> -	__s64 sec;  /* seconds */
> -	__u32 nsec; /* nanoseconds */
> -	__u32 reserved;
> +	union {
> +		struct {
> +			__s64 sec;  /* seconds */
> +			__u32 nsec; /* nanoseconds */
> +			__u32 reserved;
> +		};
> +		__u64 cycles;
> +	};
> +
>  };

This overloading of an ioctl with even more flags goes too far.
Why not just add a new ioctl in a clean way?

Thanks,
Richard

  reply	other threads:[~2025-06-11  3:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 17:19 Carolina Jubran
2025-06-11  3:29 ` Richard Cochran [this message]
2025-06-12  9:15   ` Carolina Jubran

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=aEj4Fp05_lTdMgu3@hoboy.vegasvil.org \
    --to=richardcochran@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bshapira@nvidia.com \
    --cc=cjubran@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciejm@nvidia.com \
    --cc=maheshb@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tariqt@nvidia.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=vinicius.gomes@intel.com \
    --cc=wwasko@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®