Commit d58809d8 authored by Gerhard Engleder's avatar Gerhard Engleder Committed by Paolo Abeni

ptp: Pass hwtstamp to ptp_convert_timestamp()

ptp_convert_timestamp() converts only the timestamp hwtstamp, which is
a field of the argument with the type struct skb_shared_hwtstamps *. So
a pointer to the hwtstamp field of this structure is sufficient.

Rework ptp_convert_timestamp() to use an argument of type ktime_t *.
This allows to add additional timestamp manipulation stages before the
call of ptp_convert_timestamp().
Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 51eb7492
...@@ -232,8 +232,7 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index) ...@@ -232,8 +232,7 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index)
} }
EXPORT_SYMBOL(ptp_get_vclocks_index); EXPORT_SYMBOL(ptp_get_vclocks_index);
ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps, ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index)
int vclock_index)
{ {
char name[PTP_CLOCK_NAME_LEN] = ""; char name[PTP_CLOCK_NAME_LEN] = "";
struct ptp_vclock *vclock; struct ptp_vclock *vclock;
...@@ -255,7 +254,7 @@ ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps, ...@@ -255,7 +254,7 @@ ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps,
vclock = info_to_vclock(ptp->info); vclock = info_to_vclock(ptp->info);
ns = ktime_to_ns(hwtstamps->hwtstamp); ns = ktime_to_ns(*hwtstamp);
spin_lock_irqsave(&vclock->lock, flags); spin_lock_irqsave(&vclock->lock, flags);
ns = timecounter_cyc2time(&vclock->tc, ns); ns = timecounter_cyc2time(&vclock->tc, ns);
......
...@@ -384,17 +384,16 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index); ...@@ -384,17 +384,16 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index);
/** /**
* ptp_convert_timestamp() - convert timestamp to a ptp vclock time * ptp_convert_timestamp() - convert timestamp to a ptp vclock time
* *
* @hwtstamps: skb_shared_hwtstamps structure pointer * @hwtstamp: timestamp
* @vclock_index: phc index of ptp vclock. * @vclock_index: phc index of ptp vclock.
* *
* Returns converted timestamp, or 0 on error. * Returns converted timestamp, or 0 on error.
*/ */
ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps, ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index);
int vclock_index);
#else #else
static inline int ptp_get_vclocks_index(int pclock_index, int **vclock_index) static inline int ptp_get_vclocks_index(int pclock_index, int **vclock_index)
{ return 0; } { return 0; }
static inline ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps, static inline ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp,
int vclock_index) int vclock_index)
{ return 0; } { return 0; }
......
...@@ -888,7 +888,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, ...@@ -888,7 +888,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
(sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE) && (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE) &&
!skb_is_swtx_tstamp(skb, false_tstamp)) { !skb_is_swtx_tstamp(skb, false_tstamp)) {
if (sk->sk_tsflags & SOF_TIMESTAMPING_BIND_PHC) if (sk->sk_tsflags & SOF_TIMESTAMPING_BIND_PHC)
hwtstamp = ptp_convert_timestamp(shhwtstamps, hwtstamp = ptp_convert_timestamp(&shhwtstamps->hwtstamp,
sk->sk_bind_phc); sk->sk_bind_phc);
else else
hwtstamp = shhwtstamps->hwtstamp; hwtstamp = shhwtstamps->hwtstamp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment