patch 'net/hns3: fix inaccurate RTC time to read' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Mon Feb 27 07:58:56 CET 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/01/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=58db4361dc585b453a6808ef5ada1002476cdf08

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 58db4361dc585b453a6808ef5ada1002476cdf08 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong at huawei.com>
Date: Mon, 9 Jan 2023 16:23:44 +0800
Subject: [PATCH] net/hns3: fix inaccurate RTC time to read
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 6170abd5c0cc3d8cf4e358c4200ed7737d639d10 ]

The sequence of reading current RTC time register doesn't meet
the hardware requirements, which causes this time obtained is
the one before modifying RTC time.

Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP")

Signed-off-by: Huisong Li <lihuisong at huawei.com>
Acked-by: Dongdong Liu <liudongdong3 at huawei.com>
---
 drivers/net/hns3/hns3_ptp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c
index 6bbd85ba23..db3c007b12 100644
--- a/drivers/net/hns3/hns3_ptp.c
+++ b/drivers/net/hns3/hns3_ptp.c
@@ -216,17 +216,21 @@ hns3_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 int
 hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 {
+#define HNS3_PTP_SEC_H_OFFSET	32
+#define HNS3_PTP_SEC_H_MASK	0xFFFF
+
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t sec_hi, sec_lo;
 	uint64_t ns, sec;

 	if (!hns3_dev_get_support(hw, PTP))
 		return -ENOTSUP;

-	sec = hns3_read_dev(hw, HNS3_CURR_TIME_OUT_L);
-	sec |= (uint64_t)(hns3_read_dev(hw, HNS3_CURR_TIME_OUT_H) & 0xFFFF)
-		<< 32;
-
 	ns = hns3_read_dev(hw, HNS3_CURR_TIME_OUT_NS);
+	sec_hi = hns3_read_dev(hw, HNS3_CURR_TIME_OUT_H) & HNS3_PTP_SEC_H_MASK;
+	sec_lo = hns3_read_dev(hw, HNS3_CURR_TIME_OUT_L);
+	sec = ((uint64_t)sec_hi << HNS3_PTP_SEC_H_OFFSET) | sec_lo;
+
 	ns += sec * NSEC_PER_SEC;
 	*ts = rte_ns_to_timespec(ns);

--
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-02-27 14:08:41.872754400 +0800
+++ 0029-net-hns3-fix-inaccurate-RTC-time-to-read.patch	2023-02-27 14:08:40.739237000 +0800
@@ -1 +1 @@
-From 6170abd5c0cc3d8cf4e358c4200ed7737d639d10 Mon Sep 17 00:00:00 2001
+From 58db4361dc585b453a6808ef5ada1002476cdf08 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 6170abd5c0cc3d8cf4e358c4200ed7737d639d10 ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list