Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp711577pxv; Thu, 15 Jul 2021 14:09:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1rv3rRxAEwdQFVc/7jcYtN1R52S8T2hHYMz+V1h7nhpJ+okzimdonIM79XAdPwWj8IJyc X-Received: by 2002:a17:907:3e1f:: with SMTP id hp31mr7501904ejc.55.1626383368347; Thu, 15 Jul 2021 14:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383368; cv=none; d=google.com; s=arc-20160816; b=mpUdHRQ1lJsYlFluNIML+3tgUQqnwj/xC+kntSElZ/Qu6CS4rtCIksrngKRhpgpjFb KmYZP7ht/ssA6Jiqwt7TCaqfJBryplg/1RYEWOUfsdC5sWJf9N0mxkIFVV45UwD3+bJV OTrviQzDEM5FMM5d+oF782idO5ekyICeCXe/31FvrqAB8AkdfBS55ubJD1cEBfWiCOG+ 3RCAF9acZCyaknF7r4bFa0Ol9sbkNF6HRWTQs/BfciWvIVCX8evKFklsvY6sHvEFeSG1 XDIGm4fwR4hVkd1bCONE+KlSVcwQwPz+o1CsJc6w9+t4au1/ch8szM207S7S1FBDshxC FQFA== 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=cKiQyZPwkSFreUIm4nmnglj7gQM/frL2nBYQebzftopsZsT+exbESkOxSgG6Ff2rex RfBL1JarID6YV9qiv4keS4sdHPw1SvOeU+3KKuaOspipqJDkdZyErQJU72X/+HEN0Iq4 R6DcS6HaNfvtsWDQ4jMnNpMFEU10bPqVJ22V+kf8mapOUap+myuOEN+SXfFp6AZEFb3X 0V0vYz+/vxNVoaAotZ6D0LBLISOhCO5UdTjW3goFo7tyB3pNkxUKl6RP34qrfgL2eY88 ViOAT9chy+3G8bcWI6QqxCSWuS1thvBiTsTYbMZQogzD3zNzwaZ6ruY7auNip9ZCB2nb hVcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xRQtgBJX; 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 18si8719130ejj.568.2021.07.15.14.09.04; Thu, 15 Jul 2021 14:09:28 -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=xRQtgBJX; 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 S245293AbhGOTUk (ORCPT + 99 others); Thu, 15 Jul 2021 15:20:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:38830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242684AbhGOTFO (ORCPT ); Thu, 15 Jul 2021 15:05:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D4045613D3; Thu, 15 Jul 2021 19:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375694; bh=+eZ0yTPFBqX/+7MawF+ewYY+p2odJue09D667njTbPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xRQtgBJXAryQmftQufTkfrf0/LErJbgMh7363VzmH0t5uEGLqicqOVa4Xn9lUDMma EAkwb1DcAZeNUfTxMGTNIzMKuGr8ntQZYOeBp1Ws3ysusTWvDBV1GM/xddED8CerGc KXO+Ucblslv3RCDCSzux8hx7ELyEl1C0JggRgS4Q= 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.12 195/242] i40e: fix PTP on 5Gb links Date: Thu, 15 Jul 2021 20:39:17 +0200 Message-Id: <20210715182627.545843558@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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;