All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Lemon <jonathan.lemon@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
	linux@armlinux.org.uk, bcm-kernel-feedback-list@broadcom.com,
	kernel-team@fb.com, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, richardcochran@gmail.com
Subject: Re: [PATCH net-next v5 2/2] net: phy: broadcom: Add PTP support for some Broadcom PHYs.
Date: Mon, 30 May 2022 15:18:45 -0700	[thread overview]
Message-ID: <20220530221845.r4pf7pyu2pabzqi5@bsd-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <dd55b6ce-204e-557b-ef70-1c91f80e5f8d@gmail.com>

On Sun, May 22, 2022 at 07:49:20PM -0700, Florian Fainelli wrote:
> 
> 
> On 5/20/2022 7:04 PM, Jonathan Lemon wrote:
> > On Fri, May 20, 2022 at 10:24:25AM -0700, Florian Fainelli wrote:
> > > 
> > > 
> > > On 5/18/2022 3:39 PM, Jonathan Lemon wrote:
> > > > This adds PTP support for BCM54210E Broadcom PHYs, in particular,
> > > > the BCM54213PE, as used in the Rasperry PI CM4.  It has only been
> > > > tested on that hardware.
> > > > 
> > > > Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
> > > > ---
> > > [snip]
> > > 
> > > Looks good to me, just one question below:
> > > 
> > > > +static void bcm_ptp_init(struct bcm_ptp_private *priv)
> > > > +{
> > > > +	priv->nse_ctrl = NSE_GMODE_EN;
> > > > +
> > > > +	mutex_init(&priv->mutex);
> > > > +	skb_queue_head_init(&priv->tx_queue);
> > > > +
> > > > +	priv->mii_ts.rxtstamp = bcm_ptp_rxtstamp;
> > > > +	priv->mii_ts.txtstamp = bcm_ptp_txtstamp;
> > > > +	priv->mii_ts.hwtstamp = bcm_ptp_hwtstamp;
> > > > +	priv->mii_ts.ts_info = bcm_ptp_ts_info;
> > > > +
> > > > +	priv->phydev->mii_ts = &priv->mii_ts;
> > > > +
> > > > +	INIT_DELAYED_WORK(&priv->out_work, bcm_ptp_fsync_work);
> > > 
> > > Do we need to make sure that we cancel the workqueue in an bcm_ptp_exit()
> > > function?
> > > 
> > > I would imagine that the Ethernet MAC attached to that PHY device having
> > > stopped its receiver and transmitter should ensure no more packets coming in
> > > or out, however since this is a delayed/asynchronous work, do not we need to
> > > protect against use after free?
> > 
> > The workqueue is just mamually creatimg a 1PPS pulse on the SYNC_OUT
> > pin, no packet activity.  Arguably, the .suspend hook could stop all work,
> > but that seems out of scope here? (and this phy does not suspend/resume)
> 
> The BCM54210E entry does have a suspend/resume entry so it seems to me that
> we do need to cancel the workqueue as the PHY library will not do that on
> our behalf. What I imagine could happen is that this workqueue generates
> spurious MDIO accesses *after* both the PHY and the bus have been suspended
> (and their driver's clock possibly gated already).

Yes, you're right.  I was looking at the rpi-5.15.y tree, which doesn't
have these hooks yet.  I'll add a call to stop the workqueue.

Actually, in the next series, I'll break out the extts/perout into
separate patch.

Thanks for pointing this out!
-- 
Jonathan

  reply	other threads:[~2022-05-30 22:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 22:39 [PATCH net-next v5 0/2] Broadcom PTP PHY support Jonathan Lemon
2022-05-18 22:39 ` [PATCH net-next v5 1/2] net: phy: broadcom: Add Broadcom PTP hooks to bcm-phy-lib Jonathan Lemon
2022-05-18 22:39 ` [PATCH net-next v5 2/2] net: phy: broadcom: Add PTP support for some Broadcom PHYs Jonathan Lemon
2022-05-20 17:24   ` Florian Fainelli
2022-05-21  2:04     ` Jonathan Lemon
2022-05-23  2:49       ` Florian Fainelli
2022-05-30 22:18         ` Jonathan Lemon [this message]
2022-05-29  0:34   ` Richard Cochran
2022-05-30 17:07     ` Jonathan Lemon
2022-05-30 23:04       ` Richard Cochran
2022-05-31  1:15         ` Flugsvamp
2022-05-28  3:27 ` [PATCH net-next v5 0/2] Broadcom PTP PHY support Richard Cochran
2022-05-30 16:48   ` Jonathan Lemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220530221845.r4pf7pyu2pabzqi5@bsd-mbp.dhcp.thefacebook.com \
    --to=jonathan.lemon@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.