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: <20220324134934.GB27824@hoboy.vegasvil.org>
Date:   Thu, 24 Mar 2022 06:49:34 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Gerhard Engleder <gerhard@...leder-embedded.com>
Cc:     yangbo.lu@....com, davem@...emloft.net, kuba@...nel.org,
        mlichvar@...hat.com, vinicius.gomes@...el.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH net-next v1 2/6] ptp: Request cycles for TX timestamp

On Tue, Mar 22, 2022 at 10:07:18PM +0100, Gerhard Engleder wrote:
> The free running time of physical clocks called cycles shall be used for
> hardware timestamps to enable synchronisation.
> 
> Introduce new flag SKBTX_HW_TSTAMP_USE_CYCLES, which signals driver to
> provide a TX timestamp based on cycles if cycles are supported.
> 
> Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
> ---
>  include/linux/skbuff.h |  3 +++
>  net/core/skbuff.c      |  2 ++
>  net/socket.c           | 10 +++++++++-
>  3 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 26538ceb4b01..f494ddbfc826 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -578,6 +578,9 @@ enum {
>  	/* device driver is going to provide hardware time stamp */
>  	SKBTX_IN_PROGRESS = 1 << 2,
>  
> +	/* generate hardware time stamp based on cycles if supported */
> +	SKBTX_HW_TSTAMP_USE_CYCLES = 1 << 3,

Bit 4 used, but 3 was unused... interesting!

>  	/* generate wifi status information (where possible) */
>  	SKBTX_WIFI_STATUS = 1 << 4,
>  
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 10bde7c6db44..c0f8f1341c3f 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4847,6 +4847,8 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb,
>  		skb_shinfo(skb)->tx_flags |= skb_shinfo(orig_skb)->tx_flags &
>  					     SKBTX_ANY_TSTAMP;
>  		skb_shinfo(skb)->tskey = skb_shinfo(orig_skb)->tskey;
> +	} else {
> +		skb_shinfo(skb)->tx_flags &= ~SKBTX_HW_TSTAMP_USE_CYCLES;
>  	}
>  
>  	if (hwtstamps)
> diff --git a/net/socket.c b/net/socket.c
> index 982eecad464c..1acebcb19e8f 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -683,9 +683,17 @@ void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags)
>  {
>  	u8 flags = *tx_flags;
>  
> -	if (tsflags & SOF_TIMESTAMPING_TX_HARDWARE)
> +	if (tsflags & SOF_TIMESTAMPING_TX_HARDWARE) {
>  		flags |= SKBTX_HW_TSTAMP;
>  
> +		/* PTP hardware clocks can provide a free running time called
> +		 * cycles as base for virtual clocks.

"PTP hardware clocks can provide a free running cycle counter as a
time base for virtual clocks."


Thanks,
Richard


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ