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: <057b01db6584$a13a69d0$e3af3d70$@trustnetic.com>
Date: Mon, 13 Jan 2025 14:30:24 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: "'Richard Cochran'" <richardcochran@...il.com>
Cc: <andrew+netdev@...n.ch>,
	<davem@...emloft.net>,
	<edumazet@...gle.com>,
	<kuba@...nel.org>,
	<pabeni@...hat.com>,
	<linux@...linux.org.uk>,
	<horms@...nel.org>,
	<jacob.e.keller@...el.com>,
	<netdev@...r.kernel.org>,
	<vadim.fedorenko@...ux.dev>,
	<mengyuanlou@...-swift.com>
Subject: RE: [PATCH net-next v3 4/4] net: ngbe: Add support for 1PPS and TOD

On Sun, Jan 12, 2025 1:16 AM, Richard Cochran wrote:
> On Fri, Jan 10, 2025 at 11:17:16AM +0800, Jiawen Wu wrote:
> 
> When I quickly scan the logic here...
> 
> > +	/* Figure out how far past the next second we are */
> > +	div_u64_rem(ns, WX_NS_PER_SEC, &rem);
> > +
> > +	/* Figure out how many nanoseconds to add to round the clock edge up
> > +	 * to the next full second
> > +	 */
> > +	rem = (WX_NS_PER_SEC - rem);
> > +
> > +	/* Adjust the clock edge to align with the next full second. */
> > +	wx->pps_edge_start += div_u64(((u64)rem << cc->shift), cc->mult);
> > +	trgttiml0 = (u32)wx->pps_edge_start;
> > +	trgttimh0 = (u32)(wx->pps_edge_start >> 32);
> > +
> > +	wx_set_pps(wx, wx->pps_enabled, ns + rem, wx->pps_edge_start);
> > +
> > +	rem += wx->pps_width;
> > +	wx->pps_edge_end += div_u64(((u64)rem << cc->shift), cc->mult);
> > +	trgttiml1 = (u32)wx->pps_edge_end;
> > +	trgttimh1 = (u32)(wx->pps_edge_end >> 32);
> > +
> > +	wr32ptp(wx, WX_TSC_1588_TRGT_L(0), trgttiml0);
> > +	wr32ptp(wx, WX_TSC_1588_TRGT_H(0), trgttimh0);
> > +	wr32ptp(wx, WX_TSC_1588_TRGT_L(1), trgttiml1);
> > +	wr32ptp(wx, WX_TSC_1588_TRGT_H(1), trgttimh1);
> > +	wr32ptp(wx, WX_TSC_1588_SDP(0), tssdp);
> > +	wr32ptp(wx, WX_TSC_1588_SDP(1), tssdp1);
> > +	wr32ptp(wx, WX_TSC_1588_AUX_CTL, tsauxc);
> > +	wr32ptp(wx, WX_TSC_1588_INT_EN, WX_TSC_1588_INT_EN_TT1);
> > +	WX_WRITE_FLUSH(wx);
> > +
> > +	rem = WX_NS_PER_SEC;
> > +	/* Adjust the clock edge to align with the next full second. */
> > +	wx->sec_to_cc = div_u64(((u64)rem << cc->shift), cc->mult);
> 
> ... that appears to be hard coding a period of one second?

Yes. We only want to support 1pps functionality.

> 
> > +	wx->pps_width = rq->perout.period.nsec;
> > +	wx->ptp_setup_sdp(wx);
> 
> And this ^^^ is taking the dialed period and turning into the duty
> cycle?

We try to use "width",  which means the time from the rising edge to the falling edge.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ