From: Richard Cochran <richardcochran@gmail.com>
To: Antoine Tenart <antoine.tenart@bootlin.com>
Cc: davem@davemloft.net, alexandre.belloni@bootlin.com,
UNGLinuxDriver@microchip.com, ralf@linux-mips.org,
paul.burton@mips.com, jhogan@kernel.org, netdev@vger.kernel.org,
linux-mips@vger.kernel.org, thomas.petazzoni@bootlin.com,
allan.nielsen@microchip.com
Subject: Re: [PATCH net-next 8/8] net: mscc: PTP Hardware Clock (PHC) support
Date: Fri, 5 Jul 2019 14:58:43 -0700 [thread overview]
Message-ID: <20190705215843.ncku546l3lktpwni@localhost> (raw)
In-Reply-To: <20190701100327.6425-9-antoine.tenart@bootlin.com>
On Mon, Jul 01, 2019 at 12:03:27PM +0200, Antoine Tenart wrote:
> +static irqreturn_t ocelot_ptp_rdy_irq_handler(int irq, void *arg)
> +{
> + struct ocelot *ocelot = arg;
> +
> + do {
> + struct skb_shared_hwtstamps shhwtstamps;
> + struct list_head *pos, *tmp;
> + struct ocelot_skb *entry;
> + struct ocelot_port *port;
> + struct timespec64 ts;
> + struct sk_buff *skb = NULL;
> + u32 val, id, txport;
> +
> + val = ocelot_read(ocelot, SYS_PTP_STATUS);
> +
> + /* Check if a timestamp can be retrieved */
> + if (!(val & SYS_PTP_STATUS_PTP_MESS_VLD))
> + break;
Instead of an infinite do/while loop, I suggest a for loop bounded by
number of iterations or by execution time. That would avoid getting
stuck here forever. After all, this code is an ISR.
Thanks,
Richard
> + WARN_ON(val & SYS_PTP_STATUS_PTP_OVFL);
> +
> + /* Retrieve the ts ID and Tx port */
> + id = SYS_PTP_STATUS_PTP_MESS_ID_X(val);
> + txport = SYS_PTP_STATUS_PTP_MESS_TXPORT_X(val);
> +
> + /* Retrieve its associated skb */
> + port = ocelot->ports[txport];
> +
> + list_for_each_safe(pos, tmp, &port->skbs) {
> + entry = list_entry(pos, struct ocelot_skb, head);
> + if (entry->id != id)
> + continue;
> +
> + skb = entry->skb;
> +
> + list_del(pos);
> + kfree(entry);
> + }
> +
> + /* Next ts */
> + ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT);
> +
> + if (unlikely(!skb))
> + continue;
> +
> + /* Get the h/w timestamp */
> + ocelot_get_hwtimestamp(ocelot, &ts);
> +
> + /* Set the timestamp into the skb */
> + memset(&shhwtstamps, 0, sizeof(shhwtstamps));
> + shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
> + skb_tstamp_tx(skb, &shhwtstamps);
> +
> + dev_kfree_skb_any(skb);
> + } while (true);
> +
> + return IRQ_HANDLED;
> +}
prev parent reply other threads:[~2019-07-05 21:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 10:03 [PATCH net-next 0/8] net: mscc: PTP Hardware Clock (PHC) support Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 1/8] Documentation/bindings: net: ocelot: document the PTP bank Antoine Tenart
2019-07-01 13:52 ` Andrew Lunn
2019-07-05 13:30 ` Antoine Tenart
2019-07-05 14:45 ` Andrew Lunn
2019-07-05 16:39 ` Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 2/8] MIPS: dts: mscc: describe the PTP register range Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 3/8] Documentation/bindings: net: ocelot: document the PTP ready IRQ Antoine Tenart
2019-07-01 13:54 ` Andrew Lunn
2019-07-01 10:03 ` [PATCH net-next 4/8] MIPS: dts: mscc: describe the PTP ready interrupt Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 5/8] net: mscc: describe the PTP register range Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 6/8] net: mscc: improve the frame header parsing readability Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 7/8] net: mscc: remove the frame_info cpuq member Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 8/8] net: mscc: PTP Hardware Clock (PHC) support Antoine Tenart
2019-07-01 15:12 ` Willem de Bruijn
2019-07-01 15:54 ` Eric Dumazet
2019-07-05 7:49 ` Antoine Tenart
2019-07-05 7:47 ` Antoine Tenart
2019-07-04 12:48 ` kbuild test robot
2019-07-05 16:47 ` Richard Cochran
2019-07-05 17:16 ` Antoine Tenart
2019-07-05 21:58 ` Richard Cochran [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=20190705215843.ncku546l3lktpwni@localhost \
--to=richardcochran@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=allan.nielsen@microchip.com \
--cc=antoine.tenart@bootlin.com \
--cc=davem@davemloft.net \
--cc=jhogan@kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--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.