From: Karol Kolacinski <karol.kolacinski@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: Karol Kolacinski <karol.kolacinski@intel.com>
Subject: [Intel-wired-lan] [PATCH net-next 2/2] ice: Remove gettime HW semaphore
Date: Mon, 3 Oct 2022 11:55:19 +0200 [thread overview]
Message-ID: <20221003095519.539390-2-karol.kolacinski@intel.com> (raw)
In-Reply-To: <20221003095519.539390-1-karol.kolacinski@intel.com>
Reading the time should not block other accesses to the PTP hardware.
There isn't a significant risk of reading bad values while another
thread is modifying the clock. Removing the hardware lock around the
gettime allows multiple application threads to read the clock time with
less contention.
Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ptp.c | 31 +++---------------------
1 file changed, 3 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 9d1afeca9624..1f481d455134 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -979,26 +979,6 @@ static void ice_ptp_reset_cached_phctime(struct ice_pf *pf)
ice_ptp_flush_tx_tracker(pf, &pf->ptp.port.tx);
}
-/**
- * ice_ptp_read_time - Read the time from the device
- * @pf: Board private structure
- * @ts: timespec structure to hold the current time value
- * @sts: Optional parameter for holding a pair of system timestamps from
- * the system clock. Will be ignored if NULL is given.
- *
- * This function reads the source clock registers and stores them in a timespec.
- * However, since the registers are 64 bits of nanoseconds, we must convert the
- * result to a timespec before we can return.
- */
-static void
-ice_ptp_read_time(struct ice_pf *pf, struct timespec64 *ts,
- struct ptp_system_timestamp *sts)
-{
- u64 time_ns = ice_ptp_read_src_clk_reg(pf, sts);
-
- *ts = ns_to_timespec64(time_ns);
-}
-
/**
* ice_ptp_write_init - Set PHC time to provided value
* @pf: Board private structure
@@ -1835,15 +1815,10 @@ ice_ptp_gettimex64(struct ptp_clock_info *info, struct timespec64 *ts,
struct ptp_system_timestamp *sts)
{
struct ice_pf *pf = ptp_info_to_pf(info);
- struct ice_hw *hw = &pf->hw;
+ u64 time_ns;
- if (!ice_ptp_lock(hw)) {
- dev_err(ice_pf_to_dev(pf), "PTP failed to get time\n");
- return -EBUSY;
- }
-
- ice_ptp_read_time(pf, ts, sts);
- ice_ptp_unlock(hw);
+ time_ns = ice_ptp_read_src_clk_reg(pf, sts);
+ *ts = ns_to_timespec64(time_ns);
return 0;
}
--
2.34.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2022-10-03 9:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 9:55 [Intel-wired-lan] [PATCH net-next 1/2] ice: Check for PTP HW lock more frequently Karol Kolacinski
2022-10-03 9:55 ` Karol Kolacinski [this message]
2022-10-03 18:03 ` [Intel-wired-lan] [PATCH net-next 2/2] ice: Remove gettime HW semaphore Tony Nguyen
2022-10-05 11:55 ` Kolacinski, Karol
2022-10-05 21:10 ` Vinicius Costa Gomes
2022-10-17 22:52 ` Jacob Keller
2022-10-18 0:50 ` Vinicius Costa Gomes
2022-11-11 4:38 ` G, GurucharanX
2022-11-11 4:39 ` [Intel-wired-lan] [PATCH net-next 1/2] ice: Check for PTP HW lock more frequently G, GurucharanX
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=20221003095519.539390-2-karol.kolacinski@intel.com \
--to=karol.kolacinski@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
/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