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]
Date:   Mon, 25 Apr 2022 16:30:43 -0700
From:   Jonathan Lemon <jonathan.lemon@...il.com>
To:     Richard Cochran <richardcochran@...il.com>
Cc:     f.fainelli@...il.com, bcm-kernel-feedback-list@...adcom.com,
        andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
        netdev@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH net-next v1 1/4] net: phy: broadcom: Add PTP support for
 some Broadcom PHYs.

On Sun, Apr 24, 2022 at 06:19:31PM -0700, Richard Cochran wrote:
> On Sat, Apr 23, 2022 at 07:23:53PM -0700, Jonathan Lemon wrote:
> 
> > +static bool bcm_ptp_rxtstamp(struct mii_timestamper *mii_ts,
> > +			     struct sk_buff *skb, int type)
> > +{
> > +	struct bcm_ptp_private *priv = mii2priv(mii_ts);
> > +	struct skb_shared_hwtstamps *hwts;
> > +	struct ptp_header *header;
> > +	u32 sec, nsec;
> > +	u8 *data;
> > +
> > +	if (!priv->hwts_rx)
> > +		return false;
> > +
> > +	header = ptp_parse_header(skb, type);
> > +	if (!header)
> > +		return false;
> > +
> > +	data = (u8 *)(header + 1);
> 
> No need to pointer math, as ptp_header already has reserved1 and reserved2.
> 
> > +	sec = get_unaligned_be32(data);
> 
> Something is missing here.  The seconds field is only four bits, so
> the code needs to read the 80 bit counter once in a while and augment
> the time stamp with the upper bits.

The BCM chip inserts a 64-bit sec.nsec RX timestamp immediately after
the PTP header.  So I'm recovering it here.  I'll also update the patch
to memmove() the tail of the skb up in order to remove it, just in case
it makes a difference.
-- 
Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ