From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: richardcochran@gmail.com, vinicius.gomes@intel.com,
yangbo.lu@nxp.com, davem@davemloft.net, kuba@kernel.org
Cc: mlichvar@redhat.com, netdev@vger.kernel.org,
Gerhard Engleder <gerhard@engleder-embedded.com>
Subject: [PATCH net-next v3 3/6] ptp: Pass hwtstamp to ptp_convert_timestamp()
Date: Sun, 1 May 2022 13:18:33 +0200 [thread overview]
Message-ID: <20220501111836.10910-4-gerhard@engleder-embedded.com> (raw)
In-Reply-To: <20220501111836.10910-1-gerhard@engleder-embedded.com>
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: Gerhard Engleder <gerhard@engleder-embedded.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/ptp/ptp_vclock.c | 5 ++---
include/linux/ptp_clock_kernel.h | 7 +++----
net/socket.c | 2 +-
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index 3a095eab9cc5..c30bcce2bb43 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -232,8 +232,7 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index)
}
EXPORT_SYMBOL(ptp_get_vclocks_index);
-ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps,
- int vclock_index)
+ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index)
{
char name[PTP_CLOCK_NAME_LEN] = "";
struct ptp_vclock *vclock;
@@ -255,7 +254,7 @@ ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps,
vclock = info_to_vclock(ptp->info);
- ns = ktime_to_ns(hwtstamps->hwtstamp);
+ ns = ktime_to_ns(*hwtstamp);
spin_lock_irqsave(&vclock->lock, flags);
ns = timecounter_cyc2time(&vclock->tc, ns);
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index ad309202cf9f..92b44161408e 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -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
*
- * @hwtstamps: skb_shared_hwtstamps structure pointer
+ * @hwtstamp: timestamp
* @vclock_index: phc index of ptp vclock.
*
* Returns converted timestamp, or 0 on error.
*/
-ktime_t ptp_convert_timestamp(const struct skb_shared_hwtstamps *hwtstamps,
- int vclock_index);
+ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index);
#else
static inline int ptp_get_vclocks_index(int pclock_index, int **vclock_index)
{ 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)
{ return 0; }
diff --git a/net/socket.c b/net/socket.c
index 5c1c5e6100e1..0f680c7d968a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -888,7 +888,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
(sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE) &&
!skb_is_swtx_tstamp(skb, false_tstamp)) {
if (sk->sk_tsflags & SOF_TIMESTAMPING_BIND_PHC)
- hwtstamp = ptp_convert_timestamp(shhwtstamps,
+ hwtstamp = ptp_convert_timestamp(&shhwtstamps->hwtstamp,
sk->sk_bind_phc);
else
hwtstamp = shhwtstamps->hwtstamp;
--
2.20.1
next prev parent reply other threads:[~2022-05-01 11:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-01 11:18 [PATCH net-next v3 0/6] ptp: Support hardware clocks with additional free running cycle counter Gerhard Engleder
2022-05-01 11:18 ` [PATCH net-next v3 1/6] ptp: Add cycles support for virtual clocks Gerhard Engleder
2022-05-05 13:51 ` Richard Cochran
2022-05-01 11:18 ` [PATCH net-next v3 2/6] ptp: Request cycles for TX timestamp Gerhard Engleder
2022-05-05 10:52 ` Paolo Abeni
2022-05-05 19:59 ` Gerhard Engleder
2022-05-05 13:54 ` Richard Cochran
2022-05-01 11:18 ` Gerhard Engleder [this message]
2022-05-01 11:18 ` [PATCH net-next v3 4/6] ptp: Support late timestamp determination Gerhard Engleder
2022-05-04 18:24 ` Jonathan Lemon
2022-05-04 19:33 ` Gerhard Engleder
2022-05-05 14:02 ` Richard Cochran
2022-05-01 11:18 ` [PATCH net-next v3 5/6] ptp: Speed up vclock lookup Gerhard Engleder
2022-05-05 14:07 ` Richard Cochran
2022-05-01 11:18 ` [PATCH net-next v3 6/6] tsnep: Add free running cycle counter support Gerhard Engleder
2022-05-04 15:55 ` [PATCH net-next v3 0/6] ptp: Support hardware clocks with additional free running cycle counter Jakub Kicinski
2022-05-05 14:08 ` Richard Cochran
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=20220501111836.10910-4-gerhard@engleder-embedded.com \
--to=gerhard@engleder-embedded.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=mlichvar@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=vinicius.gomes@intel.com \
--cc=yangbo.lu@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).