diff --git a/0220-net-hns3-fix-inaccurate-RTC-time-to-read.patch b/0220-net-hns3-fix-inaccurate-RTC-time-to-read.patch new file mode 100644 index 0000000000000000000000000000000000000000..59a0c082af6ce12b7c6ccc8c5549e4b2b7b8329c --- /dev/null +++ b/0220-net-hns3-fix-inaccurate-RTC-time-to-read.patch @@ -0,0 +1,53 @@ +From 3cd01cd12d4987b76be0ff1b25bc21a558aab6f1 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Mon, 9 Jan 2023 16:23:44 +0800 +Subject: net/hns3: fix inaccurate RTC time to read + +[ upstream commit 4243282181f38d387188af5fd38a5428864a94a2 ] + +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") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Acked-by: Dongdong Liu +--- + 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.23.0 + diff --git a/dpdk.spec b/dpdk.spec index 618009580dd901adc1e71c40e8f3b03031c813a2..9a8cc2f097866e74bf177b7ad4b55c41848eeb8d 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -1,6 +1,6 @@ Name: dpdk Version: 21.11 -Release: 29 +Release: 30 Packager: packaging@6wind.com URL: http://dpdk.org %global source_version 21.11 @@ -237,6 +237,7 @@ Patch9216: 0216-kni-use-dedicated-function-to-set-random-MAC-address.patch Patch9217: 0217-kni-use-dedicated-function-to-set-MAC-address.patch Patch9218: 0218-linux-igb_uio-fix-build-for-switch-fall-through.patch Patch9219: 0219-linux-igb_uio-fix-build-with-liux-5.18.patch +Patch9220: 0220-net-hns3-fix-inaccurate-RTC-time-to-read.patch Summary: Data Plane Development Kit core Group: System Environment/Libraries @@ -379,6 +380,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko /usr/sbin/depmod %changelog +* Fri Feb 03 2023 chenjiji - 21.11-30 +- net/hns3: fix inaccurate RTC time to read + * Tue Jan 31 2023 jiangheng - 21.11-29 - remove unused patch