Skip to content

Commit

Permalink
pch_gbe: scale time stamps to nanoseconds
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Richard Cochran <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Takahiro Shimizu authored and davem330 committed Apr 21, 2012
1 parent 5f568e5 commit d50566c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions drivers/ptp/ptp_pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit d50566c

Please sign in to comment.