e1000e: extend PTP gettime function to read system clock
This adds support for the PTP_SYS_OFFSET_EXTENDED ioctl. Cc: Richard Cochran <richardcochran@gmail.com> Cc: Jacob Keller <jacob.e.keller@intel.com> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

orang tua
916444df30
melakukan
98942d7053
@@ -161,14 +161,18 @@ static int e1000e_phc_getcrosststamp(struct ptp_clock_info *ptp,
|
||||
#endif/*CONFIG_E1000E_HWTS*/
|
||||
|
||||
/**
|
||||
* e1000e_phc_gettime - Reads the current time from the hardware clock
|
||||
* e1000e_phc_gettimex - Reads the current time from the hardware clock and
|
||||
* system clock
|
||||
* @ptp: ptp clock structure
|
||||
* @ts: timespec structure to hold the current time value
|
||||
* @ts: timespec structure to hold the current PHC time
|
||||
* @sts: structure to hold the current system time
|
||||
*
|
||||
* Read the timecounter and return the correct value in ns after converting
|
||||
* it into a struct timespec.
|
||||
**/
|
||||
static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
|
||||
static int e1000e_phc_gettimex(struct ptp_clock_info *ptp,
|
||||
struct timespec64 *ts,
|
||||
struct ptp_system_timestamp *sts)
|
||||
{
|
||||
struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
|
||||
ptp_clock_info);
|
||||
@@ -177,8 +181,8 @@ static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
|
||||
|
||||
spin_lock_irqsave(&adapter->systim_lock, flags);
|
||||
|
||||
/* Use timecounter_cyc2time() to allow non-monotonic SYSTIM readings */
|
||||
cycles = adapter->cc.read(&adapter->cc);
|
||||
/* NOTE: Non-monotonic SYSTIM readings may be returned */
|
||||
cycles = e1000e_read_systim(adapter, sts);
|
||||
ns = timecounter_cyc2time(&adapter->tc, cycles);
|
||||
|
||||
spin_unlock_irqrestore(&adapter->systim_lock, flags);
|
||||
@@ -258,7 +262,7 @@ static const struct ptp_clock_info e1000e_ptp_clock_info = {
|
||||
.pps = 0,
|
||||
.adjfreq = e1000e_phc_adjfreq,
|
||||
.adjtime = e1000e_phc_adjtime,
|
||||
.gettime64 = e1000e_phc_gettime,
|
||||
.gettimex64 = e1000e_phc_gettimex,
|
||||
.settime64 = e1000e_phc_settime,
|
||||
.enable = e1000e_phc_enable,
|
||||
};
|
||||
|
Reference in New Issue
Block a user