Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp660387pxv; Thu, 15 Jul 2021 12:46:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3dv6NzTwpi65J9/A2Lb8L6zwhNHUPw+iaLEcTfHX4dArkY/3Ww1D+PMlaNVxSvEJv/7Zh X-Received: by 2002:a17:906:4e52:: with SMTP id g18mr7419089ejw.214.1626378369181; Thu, 15 Jul 2021 12:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378369; cv=none; d=google.com; s=arc-20160816; b=Kj96hwpgMO3E5J8IQxQxQdZZECSFIwUEfJvNop5VqFJy6mKhpdJlW95zzfm8kkK3Wg NJZ9VOxjzGk2oyhp0g1RzEW5BNRsFMKbTapujzJCw2ayfOZII79kVLV5swuz2rcyIbMB NIAf8epceXU61VCm5cSz0jn3YkkhnFtRmeZln/99AiMDD8cJ+L3/p/c/HIYtHvMq6gAX WWErsG/WTUE8c+2XTqG/p1m7CWHjNfYfRqnU7sOmk3hQPy8KQs2ElFDdzfn0jNgy/BwU HytaH9sh0AZjS3TkHZZ7J+yapCAFILDrfJQT/31wVB09nQcUxCQaRErpM/T62mHQAoV5 Zv/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BHSI/flgIoa8Y//m5OdyVii/cDGP2MoDQvTiodECrxY=; b=qHTO6n4WGeDMBti8uwtlqyrXVryNIrCH+TbFTMca62wVL0L7hO8O7tnF6ikO+bqGYl Bujn/KlfBw4YyZeSxJGZqVUQgHQH7F75tpylVHO8tgK/QmiAS+Ei6pDcLA+TFQxsC6Q/ tO5bd1/aIwqaop/CbPdMGTUJQvPVu4JCdeSaRejY9cXVtCu2hWGu3gGvGMQCD268WefF CvmRTQTvhDthyyB+J3kcePv1gz8XCPQ1LHPJ4qGjKIfkvsGFR67GlxsTHQxxYvezQlrs 2AtRzcV9+kFDduRuwM3QjmHw8t8+AHPnzvGLrfw0malIBDdDYn8dr/++NdwxyCth70ar 4elg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Mbo/cGIm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb8si9261803edb.233.2021.07.15.12.45.46; Thu, 15 Jul 2021 12:46:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Mbo/cGIm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345780AbhGOTpW (ORCPT + 99 others); Thu, 15 Jul 2021 15:45:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:51430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242117AbhGOTPR (ORCPT ); Thu, 15 Jul 2021 15:15:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 664416117A; Thu, 15 Jul 2021 19:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376313; bh=+eZ0yTPFBqX/+7MawF+ewYY+p2odJue09D667njTbPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mbo/cGImB6XXgFq91NN9L1jXyIzshQz+f33dWo5xJMTQUi2jgo1rl0ZedeFFkuw55 TfMLDMvMHAhFw4yjhZp5bKGeV7EYRWCCxyu8xskv1VBka5i1ICuSWPEoRIzhki92rp ngOvJCBxkrvQWSelU9xcTUMNAm//j7A47bm5h70c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Sergeev , Jesse Brandeburg , Tony Brelinski , Tony Nguyen Subject: [PATCH 5.13 219/266] i40e: fix PTP on 5Gb links Date: Thu, 15 Jul 2021 20:39:34 +0200 Message-Id: <20210715182648.092860747@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesse Brandeburg commit 26b0ce8dd3dd704393dbace4dc416adfeffe531f upstream. As reported by Alex Sergeev, the i40e driver is incrementing the PTP clock at 40Gb speeds when linked at 5Gb. Fix this bug by making sure that the right multiplier is selected when linked at 5Gb. Fixes: 3dbdd6c2f70a ("i40e: Add support for 5Gbps cards") Cc: stable@vger.kernel.org Reported-by: Alex Sergeev Suggested-by: Alex Sergeev Signed-off-by: Jesse Brandeburg Tested-by: Tony Brelinski Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c @@ -11,13 +11,14 @@ * operate with the nanosecond field directly without fear of overflow. * * Much like the 82599, the update period is dependent upon the link speed: - * At 40Gb link or no link, the period is 1.6ns. - * At 10Gb link, the period is multiplied by 2. (3.2ns) + * At 40Gb, 25Gb, or no link, the period is 1.6ns. + * At 10Gb or 5Gb link, the period is multiplied by 2. (3.2ns) * At 1Gb link, the period is multiplied by 20. (32ns) * 1588 functionality is not supported at 100Mbps. */ #define I40E_PTP_40GB_INCVAL 0x0199999999ULL #define I40E_PTP_10GB_INCVAL_MULT 2 +#define I40E_PTP_5GB_INCVAL_MULT 2 #define I40E_PTP_1GB_INCVAL_MULT 20 #define I40E_PRTTSYN_CTL1_TSYNTYPE_V1 BIT(I40E_PRTTSYN_CTL1_TSYNTYPE_SHIFT) @@ -465,6 +466,9 @@ void i40e_ptp_set_increment(struct i40e_ case I40E_LINK_SPEED_10GB: mult = I40E_PTP_10GB_INCVAL_MULT; break; + case I40E_LINK_SPEED_5GB: + mult = I40E_PTP_5GB_INCVAL_MULT; + break; case I40E_LINK_SPEED_1GB: mult = I40E_PTP_1GB_INCVAL_MULT; break;