]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Oct 2023 11:49:18 +0000 (13:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Oct 2023 11:49:18 +0000 (13:49 +0200)
added patches:
i40e-fix-the-wrong-ptp-frequency-calculation.patch

queue-6.1/i40e-fix-the-wrong-ptp-frequency-calculation.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/i40e-fix-the-wrong-ptp-frequency-calculation.patch b/queue-6.1/i40e-fix-the-wrong-ptp-frequency-calculation.patch
new file mode 100644 (file)
index 0000000..25d528a
--- /dev/null
@@ -0,0 +1,53 @@
+From yajun.deng@linux.dev  Sat Oct  7 13:32:05 2023
+From: Yajun Deng <yajun.deng@linux.dev>
+Date: Tue, 26 Sep 2023 15:10:59 +0800
+Subject: i40e: fix the wrong PTP frequency calculation
+To: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, jacob.e.keller@intel.com, gregkh@linuxfoundation.org
+Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Yajun Deng <yajun.deng@linux.dev>
+Message-ID: <20230926071059.1239033-1-yajun.deng@linux.dev>
+
+From: Yajun Deng <yajun.deng@linux.dev>
+
+The new adjustment should be based on the base frequency, not the
+I40E_PTP_40GB_INCVAL in i40e_ptp_adjfine().
+
+This issue was introduced in commit 3626a690b717 ("i40e: use
+mul_u64_u64_div_u64 for PTP frequency calculation"), frequency is left
+just as base I40E_PTP_40GB_INCVAL before the commit. After the commit,
+frequency is the I40E_PTP_40GB_INCVAL times the ptp_adj_mult value.
+But then the diff is applied on the wrong value, and no multiplication
+is done afterwards.
+
+It was accidentally fixed in commit 1060707e3809 ("ptp: introduce helpers
+to adjust by scaled parts per million"). It uses adjust_by_scaled_ppm
+correctly performs the calculation and uses the base adjustment, so
+there's no error here. But it is a new feature and doesn't need to
+backported to the stable releases.
+
+This issue affects both v6.0 and v6.1, and the v6.1 version is an LTS
+release. Therefore, the patch only needs to be applied to v6.1 stable.
+
+Fixes: 3626a690b717 ("i40e: use mul_u64_u64_div_u64 for PTP frequency calculation")
+Cc: <stable@vger.kernel.org> # 6.1
+Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
+Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e_ptp.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
+@@ -361,9 +361,9 @@ static int i40e_ptp_adjfine(struct ptp_c
+                                  1000000ULL << 16);
+       if (neg_adj)
+-              adj = I40E_PTP_40GB_INCVAL - diff;
++              adj = freq - diff;
+       else
+-              adj = I40E_PTP_40GB_INCVAL + diff;
++              adj = freq + diff;
+       wr32(hw, I40E_PRTTSYN_INC_L, adj & 0xFFFFFFFF);
+       wr32(hw, I40E_PRTTSYN_INC_H, adj >> 32);
index 8af244f05c07cd5450f3470e73b124d21786186b..de781467fb0715c4295bad1095a9a8a2d0beebe8 100644 (file)
@@ -53,3 +53,4 @@ rbd-take-header_rwsem-in-rbd_dev_refresh-only-when-u.patch
 block-fix-use-after-free-of-q-q_usage_counter.patch
 hwmon-nzxt-smart2-add-device-id.patch
 hwmon-nzxt-smart2-add-another-usb-id.patch
+i40e-fix-the-wrong-ptp-frequency-calculation.patch