lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220306085658.1943-5-gerhard@engleder-embedded.com>
Date:   Sun,  6 Mar 2022 09:56:56 +0100
From:   Gerhard Engleder <gerhard@...leder-embedded.com>
To:     richardcochran@...il.com, yangbo.lu@....com, davem@...emloft.net,
        kuba@...nel.org
Cc:     mlichvar@...hat.com, vinicius.gomes@...el.com,
        netdev@...r.kernel.org,
        Gerhard Engleder <gerhard@...leder-embedded.com>
Subject: [RFC PATCH net-next 4/6] ptp: Support time stamps based on free running time

Physical clocks are used for hardware time stamping. Also ptp vclocks
support hardware time stamps. If a physical clock additionally supports
a free running time and this time is used as base for ptp vclocks, then
also hardware time stamps based on that free running time are required.

Add hardware time stamp of additional free running time to
skb_shared_hwtstamps and use it if physical clock supports an additional
free running time.

Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
---
 drivers/ptp/ptp_vclock.c | 5 ++++-
 include/linux/skbuff.h   | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index 3715d75ee8bd..84f798a11bca 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -268,7 +268,10 @@ ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps,
 
 	vclock = info_to_vclock(ptp->info);
 
-	ns = ktime_to_ns(hwtstamps->hwtstamp);
+	if (vclock->pclock->info->getfreeruntimex64)
+		ns = ktime_to_ns(hwtstamps->hwfreeruntstamp);
+	else
+		ns = ktime_to_ns(hwtstamps->hwtstamp);
 
 	spin_lock_irqsave(&vclock->lock, flags);
 	ns = timecounter_cyc2time(&vclock->tc, ns);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2be263184d1e..2ec8d944a557 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -521,6 +521,8 @@ static inline bool skb_frag_must_loop(struct page *p)
  * struct skb_shared_hwtstamps - hardware time stamps
  * @hwtstamp:	hardware time stamp transformed into duration
  *		since arbitrary point in time
+ * @hwfreeruntstamp:	hardware time stamp based on free running time
+ *			transformed into duration since arbitrary point in time
  *
  * Software time stamps generated by ktime_get_real() are stored in
  * skb->tstamp.
@@ -533,6 +535,7 @@ static inline bool skb_frag_must_loop(struct page *p)
  */
 struct skb_shared_hwtstamps {
 	ktime_t	hwtstamp;
+	ktime_t	hwfreeruntstamp;
 };
 
 /* Definitions for tx_flags in struct skb_shared_info */
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ