[PATCH 01/11] net/hns3: fix uninitialized RTC time
Dongdong Liu
liudongdong3 at huawei.com
Mon May 29 15:09:30 CEST 2023
From: Huisong Li <lihuisong at huawei.com>
Driver doesn't initialize RTC time during probe phase, which
lead to an inaccurate time.
Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP")
Cc: stable at dpdk.org
Signed-off-by: Huisong Li <lihuisong at huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3 at huawei.com>
---
drivers/net/hns3/hns3_ptp.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c
index db3c007b12..fb834bb180 100644
--- a/drivers/net/hns3/hns3_ptp.c
+++ b/drivers/net/hns3/hns3_ptp.c
@@ -59,6 +59,8 @@ hns3_ptp_int_en(struct hns3_hw *hw, bool en)
int
hns3_ptp_init(struct hns3_hw *hw)
{
+ struct timespec sys_time;
+ struct rte_eth_dev *dev;
int ret;
if (!hns3_dev_get_support(hw, PTP))
@@ -71,6 +73,11 @@ hns3_ptp_init(struct hns3_hw *hw)
/* Start PTP timer */
hns3_write_dev(hw, HNS3_CFG_TIME_CYC_EN, 1);
+ /* Initializing the RTC. */
+ dev = &rte_eth_devices[hw->data->port_id];
+ clock_gettime(CLOCK_REALTIME, &sys_time);
+ (void)hns3_timesync_write_time(dev, &sys_time);
+
return 0;
}
--
2.22.0
More information about the stable
mailing list