All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>,
	davem@davemloft.net, richardcochran@gmail.com,
	alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com,
	netdev@vger.kernel.org, thomas.petazzoni@bootlin.com,
	allan.nielsen@microchip.com
Subject: Re: [PATCH net-next v5 6/6] net: mscc: PTP Hardware Clock (PHC) support
Date: Mon, 12 Aug 2019 10:49:43 +0200	[thread overview]
Message-ID: <20190812084943.GG3698@kwain> (raw)
In-Reply-To: <20190810173224.GI30120@lunn.ch>

Hi Andrew,

On Sat, Aug 10, 2019 at 07:32:24PM +0200, Andrew Lunn wrote:
> > @@ -596,11 +606,53 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
> >  
> >  	dev->stats.tx_packets++;
> >  	dev->stats.tx_bytes += skb->len;
> > -	dev_kfree_skb_any(skb);
> > +
> > +	if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
> > +	    port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
> > +		struct ocelot_skb *oskb =
> > +			kzalloc(sizeof(struct ocelot_skb), GFP_ATOMIC);
> > +
> > +		skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
> > +
> > +		oskb->skb = skb;
> 
> You have not checked if oskb == NULL. The allocation could of failed.

Will fix.

> > +	irq_ptp_rdy = platform_get_irq_byname(pdev, "ptp_rdy");
> > +	if (irq_ptp_rdy > 0) {
> 
> I wonder if this should be
> 
> > +	if (irq_ptp_rdy > 0 && ocelot->targets[PTP]) {
> 
> There is not much you can do in the PTP interrupt handler if you don't
> have the PTP registers. In fact, bad things might happen if it tried
> to handle such an interrupt.

That's right, the IRQ could be described and the register bank not. I'll
fix that.

> > +		err = devm_request_threaded_irq(&pdev->dev, irq_ptp_rdy, NULL,
> > +						ocelot_ptp_rdy_irq_handler,
> > +						IRQF_ONESHOT, "ptp ready",
> > +						ocelot);
> > +		if (err)
> > +			return err;
> > +
> > +		/* Check if we can support PTP */
> > +		if (ocelot->targets[PTP])
> > +			ocelot->ptp = 1;
> > +	}

Thanks!
Antoine

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2019-08-12  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  9:22 [PATCH net-next v5 0/6] net: mscc: PTP Hardware Clock (PHC) support Antoine Tenart
2019-08-07  9:22 ` [PATCH net-next v5 1/6] Documentation/bindings: net: ocelot: document the PTP bank Antoine Tenart
2019-08-10 17:14   ` Andrew Lunn
2019-08-07  9:22 ` [PATCH net-next v5 2/6] Documentation/bindings: net: ocelot: document the PTP ready IRQ Antoine Tenart
2019-08-10 17:15   ` Andrew Lunn
2019-08-07  9:22 ` [PATCH net-next v5 3/6] net: mscc: describe the PTP register range Antoine Tenart
2019-08-10 17:16   ` Andrew Lunn
2019-08-07  9:22 ` [PATCH net-next v5 4/6] net: mscc: improve the frame header parsing readability Antoine Tenart
2019-08-07  9:22 ` [PATCH net-next v5 5/6] net: mscc: remove the frame_info cpuq member Antoine Tenart
2019-08-10 17:18   ` Andrew Lunn
2019-08-07  9:22 ` [PATCH net-next v5 6/6] net: mscc: PTP Hardware Clock (PHC) support Antoine Tenart
2019-08-10 17:32   ` Andrew Lunn
2019-08-12  8:49     ` Antoine Tenart [this message]

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=20190812084943.GG3698@kwain \
    --to=antoine.tenart@bootlin.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=thomas.petazzoni@bootlin.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.