From: Wong Vee Khee <vee.khee.wong@linux.intel.com> To: Jakub Kicinski <kuba@kernel.org> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@st.com>, Jose Abreu <joabreu@synopsys.com>, "David S . Miller" <davem@davemloft.net>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Voon Weifeng <weifeng.voon@intel.com>, Ong Boon Leong <boon.leong.ong@intel.com>, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Richard Cochran <richardcochran@gmail.com>, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2 1/1] net: stmmac: Add support for external trigger timestamping Date: Sat, 10 Apr 2021 21:16:09 +0800 [thread overview] Message-ID: <20210410131609.GA12931@linux.intel.com> (raw) In-Reply-To: <20210409175004.2fceacdd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> On Fri, Apr 09, 2021 at 05:50:04PM -0700, Jakub Kicinski wrote: > Other than the minor nit below LGTM. Let's give Richard one more day. > > On Thu, 8 Apr 2021 01:04:42 +0800 Wong Vee Khee wrote: > > +static void timestamp_interrupt(struct stmmac_priv *priv) > > +{ > > + struct ptp_clock_event event; > > + unsigned long flags; > > + u32 num_snapshot; > > + u32 ts_status; > > + u32 tsync_int; > > + u64 ptp_time; > > + int i; > > + > > + tsync_int = readl(priv->ioaddr + GMAC_INT_STATUS) & GMAC_INT_TSIE; > > + > > + if (!tsync_int) > > + return; > > + > > + /* Read timestamp status to clear interrupt from either external > > + * timestamp or start/end of PPS. > > + */ > > + ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS); > > + > > + if (priv->plat->ext_snapshot_en) { > > Are you intending to add more code after this if? Otherwise you could > flip the condition and return early instead of having the extra level > of indentation. > Thanks fo the suggestion. There's no plan to add more code after this as per STMMAC features that required this interrupt. I will flip the condition. > > + num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >> > > + GMAC_TIMESTAMP_ATSNS_SHIFT; > > + > > + for (i = 0; i < num_snapshot; i++) { > > + spin_lock_irqsave(&priv->ptp_lock, flags); > > + get_ptptime(priv->ptpaddr, &ptp_time); > > + spin_unlock_irqrestore(&priv->ptp_lock, flags); > > + event.type = PTP_CLOCK_EXTTS; > > + event.index = 0; > > + event.timestamp = ptp_time; > > + ptp_clock_event(priv->ptp_clock, &event); > > + } > > + } > > +} > > Not really related to this patch but how does stmmac set IRQF_SHARED > and yet not track if it indeed generated the interrupt? Isn't that > against the rules? > Good point! Thanks for pointing that out. I looked at how STMMAC interrupt handlers are coded, and indeed there are no tracking. Will work on that and send as a seperate patch in near future.
WARNING: multiple messages have this Message-ID (diff)
From: Wong Vee Khee <vee.khee.wong@linux.intel.com> To: Jakub Kicinski <kuba@kernel.org> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@st.com>, Jose Abreu <joabreu@synopsys.com>, "David S . Miller" <davem@davemloft.net>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Voon Weifeng <weifeng.voon@intel.com>, Ong Boon Leong <boon.leong.ong@intel.com>, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Richard Cochran <richardcochran@gmail.com>, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2 1/1] net: stmmac: Add support for external trigger timestamping Date: Sat, 10 Apr 2021 21:16:09 +0800 [thread overview] Message-ID: <20210410131609.GA12931@linux.intel.com> (raw) In-Reply-To: <20210409175004.2fceacdd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> On Fri, Apr 09, 2021 at 05:50:04PM -0700, Jakub Kicinski wrote: > Other than the minor nit below LGTM. Let's give Richard one more day. > > On Thu, 8 Apr 2021 01:04:42 +0800 Wong Vee Khee wrote: > > +static void timestamp_interrupt(struct stmmac_priv *priv) > > +{ > > + struct ptp_clock_event event; > > + unsigned long flags; > > + u32 num_snapshot; > > + u32 ts_status; > > + u32 tsync_int; > > + u64 ptp_time; > > + int i; > > + > > + tsync_int = readl(priv->ioaddr + GMAC_INT_STATUS) & GMAC_INT_TSIE; > > + > > + if (!tsync_int) > > + return; > > + > > + /* Read timestamp status to clear interrupt from either external > > + * timestamp or start/end of PPS. > > + */ > > + ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS); > > + > > + if (priv->plat->ext_snapshot_en) { > > Are you intending to add more code after this if? Otherwise you could > flip the condition and return early instead of having the extra level > of indentation. > Thanks fo the suggestion. There's no plan to add more code after this as per STMMAC features that required this interrupt. I will flip the condition. > > + num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >> > > + GMAC_TIMESTAMP_ATSNS_SHIFT; > > + > > + for (i = 0; i < num_snapshot; i++) { > > + spin_lock_irqsave(&priv->ptp_lock, flags); > > + get_ptptime(priv->ptpaddr, &ptp_time); > > + spin_unlock_irqrestore(&priv->ptp_lock, flags); > > + event.type = PTP_CLOCK_EXTTS; > > + event.index = 0; > > + event.timestamp = ptp_time; > > + ptp_clock_event(priv->ptp_clock, &event); > > + } > > + } > > +} > > Not really related to this patch but how does stmmac set IRQF_SHARED > and yet not track if it indeed generated the interrupt? Isn't that > against the rules? > Good point! Thanks for pointing that out. I looked at how STMMAC interrupt handlers are coded, and indeed there are no tracking. Will work on that and send as a seperate patch in near future. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-04-10 13:16 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-07 17:04 [PATCH net-next v2 1/1] net: stmmac: Add support for external trigger timestamping Wong Vee Khee 2021-04-07 17:04 ` Wong Vee Khee 2021-04-10 0:50 ` Jakub Kicinski 2021-04-10 0:50 ` Jakub Kicinski 2021-04-10 13:16 ` Wong Vee Khee [this message] 2021-04-10 13:16 ` Wong Vee Khee
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=20210410131609.GA12931@linux.intel.com \ --to=vee.khee.wong@linux.intel.com \ --cc=alexandre.torgue@st.com \ --cc=boon.leong.ong@intel.com \ --cc=davem@davemloft.net \ --cc=joabreu@synopsys.com \ --cc=kuba@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=mcoquelin.stm32@gmail.com \ --cc=netdev@vger.kernel.org \ --cc=peppe.cavallaro@st.com \ --cc=richardcochran@gmail.com \ --cc=weifeng.voon@intel.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: linkBe 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.