From: "Vick, Matthew" <matthew.vick@intel.com>
To: Richard Cochran <richardcochran@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>,
"e1000-devel@lists.sourceforge.net"
<e1000-devel@lists.sourceforge.net>,
"Keller, Jacob E" <jacob.e.keller@intel.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>
Subject: Re: [PATCH net-next 1/4] igb: refactor and simplify time sync interrupt handling
Date: Tue, 28 May 2013 15:24:08 +0000 [thread overview]
Message-ID: <CDCA19C9.1E862%matthew.vick@intel.com> (raw)
In-Reply-To: <e81791002acaf082ace4ec7bb1fa24ab6633fd49.1369645944.git.richardcochran@gmail.com>
On 5/27/13 2:21 AM, "Richard Cochran" <richardcochran@gmail.com> wrote:
>The code that handles the time sync interrupt is repeated in three
>different places. This patch refactors the identical code blocks into
>a single helper function. Also, reading the TSICR register already
>acknowledges the time sync interrupts, and so there is no need to
>write that register at all.
>
>Signed-off-by: Richard Cochran <richardcochran@gmail.com>
>---
> drivers/net/ethernet/intel/igb/igb_main.c | 47
>+++++++++++------------------
> 1 file changed, 17 insertions(+), 30 deletions(-)
>
>diff --git a/drivers/net/ethernet/intel/igb/igb_main.c
>b/drivers/net/ethernet/intel/igb/igb_main.c
>index 6a0c1b6..d25a965 100644
>--- a/drivers/net/ethernet/intel/igb/igb_main.c
>+++ b/drivers/net/ethernet/intel/igb/igb_main.c
>@@ -5035,6 +5035,17 @@ void igb_update_stats(struct igb_adapter *adapter,
> }
> }
>
>+static void igb_tsync_interrupt(struct igb_adapter *adapter)
>+{
>+ struct e1000_hw *hw = &adapter->hw;
>+ u32 tsicr = rd32(E1000_TSICR);
>+
>+ if (tsicr & E1000_TSICR_TXTS) {
>+ /* retrieve hardware timestamp */
>+ schedule_work(&adapter->ptp_tx_work);
>+ }
>+}
>+
> static irqreturn_t igb_msix_other(int irq, void *data)
> {
> struct igb_adapter *adapter = data;
>@@ -5066,16 +5077,8 @@ static irqreturn_t igb_msix_other(int irq, void
>*data)
> mod_timer(&adapter->watchdog_timer, jiffies + 1);
> }
>
>- if (icr & E1000_ICR_TS) {
>- u32 tsicr = rd32(E1000_TSICR);
>-
>- if (tsicr & E1000_TSICR_TXTS) {
>- /* acknowledge the interrupt */
>- wr32(E1000_TSICR, E1000_TSICR_TXTS);
>- /* retrieve hardware timestamp */
>- schedule_work(&adapter->ptp_tx_work);
>- }
>- }
>+ if (icr & E1000_ICR_TS)
>+ igb_tsync_interrupt(adapter);
>
> wr32(E1000_EIMS, adapter->eims_other);
>
>@@ -5850,16 +5853,8 @@ static irqreturn_t igb_intr_msi(int irq, void
>*data)
> mod_timer(&adapter->watchdog_timer, jiffies + 1);
> }
>
>- if (icr & E1000_ICR_TS) {
>- u32 tsicr = rd32(E1000_TSICR);
>-
>- if (tsicr & E1000_TSICR_TXTS) {
>- /* acknowledge the interrupt */
>- wr32(E1000_TSICR, E1000_TSICR_TXTS);
>- /* retrieve hardware timestamp */
>- schedule_work(&adapter->ptp_tx_work);
>- }
>- }
>+ if (icr & E1000_ICR_TS)
>+ igb_tsync_interrupt(adapter);
>
> napi_schedule(&q_vector->napi);
>
>@@ -5904,16 +5899,8 @@ static irqreturn_t igb_intr(int irq, void *data)
> mod_timer(&adapter->watchdog_timer, jiffies + 1);
> }
>
>- if (icr & E1000_ICR_TS) {
>- u32 tsicr = rd32(E1000_TSICR);
>-
>- if (tsicr & E1000_TSICR_TXTS) {
>- /* acknowledge the interrupt */
>- wr32(E1000_TSICR, E1000_TSICR_TXTS);
>- /* retrieve hardware timestamp */
>- schedule_work(&adapter->ptp_tx_work);
>- }
>- }
>+ if (icr & E1000_ICR_TS)
>+ igb_tsync_interrupt(adapter);
>
> napi_schedule(&q_vector->napi);
>
>--
>1.7.10.4
NAK due to the question you raised in the other thread--this will break
1588 on the 82580, but there was really no way for you to know that. As I
mentioned before, I'm getting the internal discussion going to confirm
that.
Matthew
next prev parent reply other threads:[~2013-05-28 15:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 9:21 [PATCH net-next 0/4] igb: auxiliary PHC functions for the i210 Richard Cochran
2013-05-27 9:21 ` [PATCH net-next 1/4] igb: refactor and simplify time sync interrupt handling Richard Cochran
2013-05-28 0:44 ` Jeff Kirsher
2013-05-28 15:24 ` Vick, Matthew [this message]
2013-05-27 9:21 ` [PATCH net-next 2/4] igb: add more register definitions for time sync functions Richard Cochran
2013-05-28 0:44 ` Jeff Kirsher
2013-05-27 9:21 ` [PATCH net-next 3/4] igb: do not clobber the TSAUXC bits on reset Richard Cochran
2013-05-28 0:44 ` Jeff Kirsher
2013-05-27 9:21 ` [PATCH net-next 4/4] igb: enable auxiliary PHC functions for the i210 Richard Cochran
2013-05-28 0:45 ` Jeff Kirsher
2013-05-28 15:58 ` Vick, Matthew
2013-05-28 16:23 ` Richard Cochran
2013-05-28 17:39 ` [E1000-devel] " Alexander Duyck
2013-05-28 17:49 ` Vick, Matthew
2013-05-28 21:12 ` Keller, Jacob E
2013-05-29 7:24 ` Richard Cochran
2013-05-29 7:34 ` David Miller
2013-05-29 20:32 ` Ben Hutchings
2013-05-28 15:58 ` [PATCH net-next 0/4] igb: " Vick, Matthew
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=CDCA19C9.1E862%matthew.vick@intel.com \
--to=matthew.vick@intel.com \
--cc=davem@davemloft.net \
--cc=e1000-devel@lists.sourceforge.net \
--cc=jacob.e.keller@intel.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).