diff mbox

[net-next,08/11] net: ixgbe: convert to timecounter adjtime.

Message ID 5d83679d541974c164cfc415c0bb171e2b363f16.1418504889.git.richardcochran@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Richard Cochran Dec. 21, 2014, 6:47 p.m. UTC
This patch changes the driver to use the new and improved method
for adjusting the offset of a timecounter.

Compile tested only.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Kirsher, Jeffrey T Dec. 23, 2014, 9:07 p.m. UTC | #1
On Sun, 2014-12-21 at 19:47 +0100, Richard Cochran wrote:
> This patch changes the driver to use the new and improved method
> for adjusting the offset of a timecounter.
> 
> Compile tested only.
> 
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>

Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Just for sanity sake, I will have Phillip test the changes, but there is
no need to hold this up from being committed in the mean time.

> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c |   11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
Richard Cochran Dec. 23, 2014, 9:42 p.m. UTC | #2
On Tue, Dec 23, 2014 at 01:07:19PM -0800, Jeff Kirsher wrote:
> Just for sanity sake, I will have Phillip test the changes, but there is
> no need to hold this up from being committed in the mean time.

FYI, here is a test that may show the improved behavior when comparing
before/after.

1. Start ptp4l, let it run long enough to find the frequency offset.

2. Stop ptp4l with ^C.

3. Wait a bit, to let the clock drift away.

4. Restart ptp4l, it will now start with the frequency offset learned
   in step 1.

5. Notice the the offsets in states s0 -> s1 -> s2.
   There will likely be less offset error with the patches applied.

Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index 5fd4b52..47c29ea 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -261,18 +261,9 @@  static int ixgbe_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
 	struct ixgbe_adapter *adapter =
 		container_of(ptp, struct ixgbe_adapter, ptp_caps);
 	unsigned long flags;
-	u64 now;
 
 	spin_lock_irqsave(&adapter->tmreg_lock, flags);
-
-	now = timecounter_read(&adapter->tc);
-	now += delta;
-
-	/* reset the timecounter */
-	timecounter_init(&adapter->tc,
-			 &adapter->cc,
-			 now);
-
+	timecounter_adjtime(&adapter->tc, delta);
 	spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
 
 	ixgbe_ptp_setup_sdp(adapter);