[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220426024915.GA22745@hoboy.vegasvil.org>
Date: Mon, 25 Apr 2022 19:49:15 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Jonathan Lemon <jonathan.lemon@...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 Mon, Apr 25, 2022 at 04:30:43PM -0700, Jonathan Lemon wrote:
> 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.
Okay, this is something different. This won't work because that
corrupts the PTP message format.
I'm talking about a different mode where the PHY places the time stamp
into the reserved1/2 fields.
Thanks,
Richard
Powered by blists - more mailing lists