Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp883584lqo; Wed, 8 May 2024 19:48:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSTigqa7c0b2EG0lUEbhO5MCFEeP7+nQyTtSGq2sT+9OaC45SYLcReJMEfsJzmMTKq0XhyOqwkyhM5qQkHEPBTfCx32bUI+Sl31fumHg== X-Google-Smtp-Source: AGHT+IE0A50RWvVvZ7aCE3ysFzQcEE+fEQ9dN1Wtpm0WsuNMXQ6ybcyEqv3xKoOADIaCNTlBd6I9 X-Received: by 2002:a05:6358:7f0b:b0:192:26d8:fd40 with SMTP id e5c5f4694b2df-192d3586017mr533966755d.27.1715222931229; Wed, 08 May 2024 19:48:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715222931; cv=pass; d=google.com; s=arc-20160816; b=eh2FZ9yaHlPUnRGSzEIYY1xSjx82JLFDC9pEEU7mqFvSOA6usseHFdBoToo7iBGTT8 FRNFv3QTzl5HSxA7QY4J9UtcWWstJ1V7OCm9Lx/eff8FZhWNv/jZB5WQP7fqx2ENVWjT iQK34pV+3u8um/6WdMhrDV3dfx6j4jGiEzhwyy0zxRmnDdduCRKQADIY9EDQS1AhLMg8 df49jbWbW/3cbn09SdJPQFfS9K33IO0npAN2BmXuwITeqOG4rY1k7DvM7W9jMyDSc4zT LNaHAFVKwLelElEi+QXcQRoKfA+kkViP+LGcb9MBtU54ZMcAJVng+1+AT7W59wQeefkV JnSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8t5MjaAMAXet3sIw/oEjf3p3suprAqTqym8YuM7ds4g=; fh=VsxMteOb5dfk+fUX2Cg8EI8OA8oieuk5n3eAlGqnhq4=; b=UnqMquIcTZU3pZqFoCAB8nwBsqsljP9UMaFVs6e5j4HGvE9SDlrO+df4ogfR3TJIr8 fXfR4b14oo2+Q1G27YWTGti45bMSrLP3YD09nmIJh0TDgdmE2HeU041Il0cJx7iJkYWB XWElE0+f+gX2fu9up2GPWDvIzY+8eCh8XdMNo/u+OQ6ejd+vw6EuyiRc11h1R+HXFspD KTOzDA/hBA1EX3wHwUeRj6yJcxcJy9IS5VdqKu1Eo3wWnM+Ccb5gbZwQrQi/vy2Im5k4 DJJy6RtYir4T4PMaE6Etx6GScYdlWX4Mn6rNrn08N5rIFFyFckRGnUaj9bNTD3tvOEBv QTLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TcRoAy5a; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-174067-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6340a06c13csi455628a12.165.2024.05.08.19.48.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 19:48:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174067-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TcRoAy5a; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-174067-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CCF6F283EC0 for ; Thu, 9 May 2024 02:48:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9019213C3D9; Thu, 9 May 2024 02:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TcRoAy5a" Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AF2085950 for ; Thu, 9 May 2024 02:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715222922; cv=none; b=kiLGVltK3CMz8gHKelLaP6uzMSE18GTi1RK5OS0IDITKieOq8xQDwquts6ffTLxio+1FaC9NxhXwmsVdojGIOBmqZIr1pTjgCMVqySqK+1teen8U1qJTblj4L0Rztu3x3Xcrcs05/HrnErnweRrJlJ7GoLEVHQufiw4+0KI1w8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715222922; c=relaxed/simple; bh=wQkXTf5xKOi/jkQqHQ2AkEYJzxMOlLiqa4piZ7/Gmgs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=mNdo6kMlmiuKOtinD+t2jBo/qzt0hps3fSLgiD2dd7QRY+7dV5VB+xN+jHicO2FC+r/BpPOOFzfJD43dAzT1wBveRYOTDGt3KA7nUSN/cbSkzziX2Pe9uASNPaQp14ySsodMW55Ey9qNi3AALWgZKJnYaZ6Zw4ELW+z+fN64YrI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TcRoAy5a; arc=none smtp.client-ip=209.85.222.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ua1-f41.google.com with SMTP id a1e0cc1a2514c-7f74cca5a35so135516241.3 for ; Wed, 08 May 2024 19:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715222920; x=1715827720; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8t5MjaAMAXet3sIw/oEjf3p3suprAqTqym8YuM7ds4g=; b=TcRoAy5aqnI587XnOMn5ebUnicnkw7crwSX07/GOUk0GtH5SvTYF9P967pqaePynoE AFPK66gy439+gLl1qKNB/HMhq4j0mzFU6EENi6crc8yPziKd8z+t9ERJYVJyF6ahcOJP 7YegStGQo8+eI17SlqpPHSktNXIrc/bnzsdBBObgbKMAYOtFCA862/3WN4kOkS3ZML+M LG52WDZ/Egv1dk7U+yqtYTzbirWSapSaY21wSk8j4EndGwoc7bhTvWoSHSVSuF/MjMkt VcyyEomnOl1exDFGrI5z3n9l/TxsvzZfh1/1YHMKlKMcCGksLJ0GmivSzG8wN2qRmL9U vK5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715222920; x=1715827720; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8t5MjaAMAXet3sIw/oEjf3p3suprAqTqym8YuM7ds4g=; b=FZpW+1oFJcmZvPhWnWpEtJ1jYvX6wDRtXgLR0UrHUa3iCO8HPruVN//pYIIUzPvQcM TFcAUsgYPZ7f4x89ihEM8Hey0X3Ny3VoNvi65ffqnxdqTVUDL7CFe4uWCeUn/TX+u7I9 dxeLDax2ucZSUSpUVO9DhbJzaXPUuo4F0OGjiUF0xGk4vCoM8u51RQ/x2sHEn0J43aC1 S3SdmyIntOJ2at9nS2luwZwsgGve8Ic2Nh5Bu/KMx557oQZJ/6T5EtAGaPU1QOHKkf0e wQiG0Jma8d5of9VCqpklj7FsqoNXQCcSGFIT8p/aPEykFJgs2TRAuym38nk5OmIqRvSs DbTQ== X-Forwarded-Encrypted: i=1; AJvYcCWurBl6i1jnoFnUQK3Umb5CK6hx5WbIF19MbYdIq/oqKVZxnjnC6jsbsCQeuhNRwc/ybRgfoZziewQ8+PJZKxkVNLg9IUEs4MfRXYHm X-Gm-Message-State: AOJu0Yzx6Nha3k9iewlmnVhbffMz9zXiBVBbQSZ6yxiN6Yo2tNMlR2xm S+0rGclDIoMbT38c+mxlDUaEzxD7jjrRx0Ak1BqrrupAkI5hybRK8yeynmSJHsUWwFEWBXTmEh+ KT3/txmncOU1Thykj/Ohr+TxGnGFvd9cAPuBH X-Received: by 2002:a67:f448:0:b0:47e:f147:ca71 with SMTP id ada2fe7eead31-47f3c2eaa12mr4070131137.19.1715222920018; Wed, 08 May 2024 19:48:40 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240502211047.2240237-1-maheshb@google.com> In-Reply-To: From: =?UTF-8?B?TWFoZXNoIEJhbmRld2FyICjgpK7gpLngpYfgpLYg4KSs4KSC4KSh4KWH4KS14KS+4KSwKQ==?= Date: Wed, 8 May 2024 19:48:12 -0700 Message-ID: Subject: Re: [PATCHv4 net-next] ptp/ioctl: support MONOTONIC_RAW timestamps for PTP_SYS_OFFSET_EXTENDED To: Richard Cochran Cc: Netdev , Linux , David Miller , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Thomas Gleixner , Arnd Bergmann , Sagi Maimon , Jonathan Corbet , John Stultz , Mahesh Bandewar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 7, 2024 at 9:44=E2=80=AFPM Richard Cochran wrote: > > On Thu, May 02, 2024 at 02:10:47PM -0700, Mahesh Bandewar wrote: > > > @@ -457,14 +459,34 @@ static inline ktime_t ptp_convert_timestamp(const= ktime_t *hwtstamp, > > > > static inline void ptp_read_system_prets(struct ptp_system_timestamp *= sts) > > { > > - if (sts) > > - ktime_get_real_ts64(&sts->pre_ts); > > + if (sts) { > > + switch (sts->clockid) { > > + case CLOCK_REALTIME: > > + ktime_get_real_ts64(&sts->pre_ts); > > + break; > > + case CLOCK_MONOTONIC_RAW: > > + ktime_get_raw_ts64(&sts->pre_ts); > > + break; > > Why not add CLOCK_MONOTONIC as well? > That would be useful in many cases. > In fact my original implementation had it but my use case is really CLOCK_MONOTONIC_RAW, however, the general opinion on the thread was to implement what is needed now and if someone needs (CLOCK_MONOTONIC), it can be added at that time. So I removed it. > > +/* > > + * ptp_sys_offset_extended - data structure for IOCTL operation > > + * PTP_SYS_OFFSET_EXTENDED > > + * > > + * @n_samples: Desired number of measurements. > > + * @clockid: clockid of a clock-base used for pre/post timestamps. > > + * @rsv: Reserved for future use. > > + * @ts: Array of samples in the form [pre-TS, PHC, post-T= S]. The > > + * kernel provides @n_samples. > > + * > > + * History: > > + * v1: Initial implementation. > > + * > > + * v2: Use the first word of the reserved-field for @clockid. That's > > + * backward compatible since v1 expects all three reserved words > > + * (@rsv[3]) to be 0 while the clockid (first word in v2) for > > + * CLOCK_REALTIME is '0'. > > This is not really appropriate for a source code comment. The > un-merged patch series iterations are preserved at lore.kernel in case > someone needs that. > This was added in rev3 (Also this is the API version-history which intends to track how the fields have changed / morphed and not to be confused with the patch versions) > The "backward compatible" information really wants to be in the commit > message. > I have the last paragraph in the commit log about compatibility. Thanks for the comments, --mahesh.. > Thanks, > Richard >