All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: <netdev@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>,
	Takahiro Shimizu <tshimizu818@gmail.com>
Subject: [PATCH v3.4-rc 1/9] pch_gbe: scale time stamps to nanoseconds
Date: Fri, 20 Apr 2012 22:09:20 +0200	[thread overview]
Message-ID: <3513bfe6f91cc4d793318867e97403d6f0832d35.1334949388.git.richardcochran@gmail.com> (raw)
In-Reply-To: <cover.1334949388.git.richardcochran@gmail.com>
In-Reply-To: <cover.1334949388.git.richardcochran@gmail.com>

From: Takahiro Shimizu <tshimizu818@gmail.com>

This patch fixes the helper functions that give the transmit and
receive time stamps to return nanoseconds, instead of arbitrary clock
ticks.

[ RC - Rebased Takahiro's changes and wrote a commit message
  explaining the changes. ]

Signed-off-by: Takahiro Shimizu <tshimizu818@gmail.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c   |    4 ----
 drivers/ptp/ptp_pch.c                              |    2 ++
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 8035e5f..7c2dabb 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -101,8 +101,6 @@ const char pch_driver_version[] = DRV_VERSION;
 
 #ifdef CONFIG_PCH_PTP
 /* Macros for ieee1588 */
-#define TICKS_NS_SHIFT  5
-
 /* 0x40 Time Synchronization Channel Control Register Bits */
 #define MASTER_MODE   (1<<0)
 #define SLAVE_MODE    (0<<0)
@@ -183,7 +181,6 @@ static void pch_rx_timestamp(
 		goto out;
 
 	ns = pch_rx_snap_read(pdev);
-	ns <<= TICKS_NS_SHIFT;
 
 	shhwtstamps = skb_hwtstamps(skb);
 	memset(shhwtstamps, 0, sizeof(*shhwtstamps));
@@ -226,7 +223,6 @@ static void pch_tx_timestamp(
 	}
 
 	ns = pch_tx_snap_read(pdev);
-	ns <<= TICKS_NS_SHIFT;
 
 	memset(&shhwtstamps, 0, sizeof(shhwtstamps));
 	shhwtstamps.hwtstamp = ns_to_ktime(ns);
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index 375eb04..847a3c3 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -261,6 +261,7 @@ u64 pch_rx_snap_read(struct pci_dev *pdev)
 
 	ns = ((u64) hi) << 32;
 	ns |= lo;
+	ns <<= TICKS_NS_SHIFT;
 
 	return ns;
 }
@@ -277,6 +278,7 @@ u64 pch_tx_snap_read(struct pci_dev *pdev)
 
 	ns = ((u64) hi) << 32;
 	ns |= lo;
+	ns <<= TICKS_NS_SHIFT;
 
 	return ns;
 }
-- 
1.7.2.5

  reply	other threads:[~2012-04-20 20:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 20:09 [PATCH v3.4-rc 0/9] pch_gbe: ptp bug fixes Richard Cochran
2012-04-20 20:09 ` Richard Cochran [this message]
2012-04-20 20:09 ` [PATCH v3.4-rc 2/9] pch_gbe: simplify transmit time stamping flag test Richard Cochran
2012-04-20 20:09 ` [PATCH v3.4-rc 3/9] pch_gbe: reprogram multicast address register on reset Richard Cochran
2012-04-20 20:09 ` [PATCH v3.4-rc 4/9] pch_gbe: export a method to set the receive match address Richard Cochran
2012-04-20 20:09 ` [PATCH v3.4-rc 5/9] pch_gbe: improve coding style Richard Cochran
2012-04-20 20:09 ` [PATCH v3.4-rc 6/9] pch_gbe: do not set the channel control register Richard Cochran
2012-04-20 20:09 ` [PATCH v3.4-rc 7/9] pch_gbe: correct receive time stamp filtering Richard Cochran
2012-04-20 20:09 ` [PATCH v3.4-rc 8/9] pch_gbe: run the ptp bpf just once per packet Richard Cochran
2012-04-20 20:09 ` [PATCH v3.4-rc 9/9] pch_gbe: remove suspicious comment Richard Cochran
2012-04-21  0:50 ` [PATCH v3.4-rc 0/9] pch_gbe: ptp bug fixes David Miller
2012-04-21  4:59   ` Richard Cochran
2012-04-21  5:13     ` David Miller

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=3513bfe6f91cc4d793318867e97403d6f0832d35.1334949388.git.richardcochran@gmail.com \
    --to=richardcochran@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tshimizu818@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.