From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E98D3C6FD1E for ; Tue, 7 Mar 2023 10:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbjCGKZR (ORCPT ); Tue, 7 Mar 2023 05:25:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjCGKZP (ORCPT ); Tue, 7 Mar 2023 05:25:15 -0500 X-Greylist: delayed 54684 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 07 Mar 2023 02:25:13 PST Received: from out-24.mta0.migadu.com (out-24.mta0.migadu.com [91.218.175.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42AB27698 for ; Tue, 7 Mar 2023 02:25:12 -0800 (PST) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1678184710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7lTK9UGJRDX4IkJKg2UZIo69ATgMXypgW/C+oA22R/E=; b=j1v7QAB6REeKDnJniPEIBDPotB4oaM7v9YJmdq7ON/15bZy4Soy2wyiAZnJ7DOL+NEV09P lQ3cymZ/FOHwe3OMqjv/zWhiYcwu1CJPxuC7AHe+MDzJmtF1sCXo5yqx5AGkqQESR9shW1 V+FloROpdCNKWeGNOGY0dH6y20z9AjY= Date: Tue, 7 Mar 2023 10:25:04 +0000 MIME-Version: 1.0 Subject: Re: [PATCH net] bnxt_en: reset PHC frequency in free-running mode Content-Language: en-US To: Pavan Chebbi Cc: Vadim Fedorenko , Jakub Kicinski , Andy Gospodarek , Michael Chan , Richard Cochran , netdev@vger.kernel.org References: <20230306165344.350387-1-vadfed@meta.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 07/03/2023 05:07, Pavan Chebbi wrote: > On Tue, Mar 7, 2023 at 12:43 AM Vadim Fedorenko > wrote: >> >> On 06/03/2023 17:11, Pavan Chebbi wrote: >>> On Mon, Mar 6, 2023 at 10:23 PM Vadim Fedorenko wrote: >>>> >>>> @@ -932,13 +937,15 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg) >>>> atomic_set(&ptp->tx_avail, BNXT_MAX_TX_TS); >>>> spin_lock_init(&ptp->ptp_lock); >>>> >>>> - if (bp->fw_cap & BNXT_FW_CAP_PTP_RTC) { >>>> + if (BNXT_PTP_RTC(ptp->bp)) { >>>> bnxt_ptp_timecounter_init(bp, false); >>>> rc = bnxt_ptp_init_rtc(bp, phc_cfg); >>>> if (rc) >>>> goto out; >>>> } else { >>>> bnxt_ptp_timecounter_init(bp, true); >>>> + if (bp->fw_cap & BNXT_FW_CAP_PTP_RTC) >>>> + bnxt_ptp_adjfreq_rtc(bp, 0); > > I am not sure if the intended objective of resetting the PHC is going > to be achieved with this. The FW will always apply the new ppb on the > base PHC frequency. I am not sure what you mean by "reset the hardware > frequency of PHC to zero" in the commit message. Well, I meant reset it to base frequency and remove any adjustments applied before. I'll re-phrase it in the next version. > If you want PHC to > start counting from 0 on init, you may use bnxt_ptp_cfg_settime() with > 0. That's not what we want, the current counter behavior is ok. > Also, the RTC flag may not be set on newer firmwares running on MH > systems. I see no harm in resetting the PHC unconditionally if we are > not in RTC mode. And that's perfectly fine! Each firmware upgrade requires full NIC reset and it will end up with reset of PHC to base frequency. But in the situation when we have several version of kernel running on the SLED, on kernel upgrade we end up with adjustment stored in the PHC using old kernel which was tuning RTC, but then booted into new kernel which stops tuning RTC. If the last stored adjustment was close to boundaries for some reasons, timecounter will never compensate the difference and all hosts in the sled will be drifting hard. The only way to bring it back to working state is to power reset the sled, which is disruptive action. The fix was proved to work actually in our setup. >>> >>> You meant bnxt_ptp_adjfine_rtc(), right. >>> Anyway, let me go through the patch in detail, while you may submit >>> corrections for the build. >>> >> Oh, yeah, right, artefact of rebasing. Will fix it in v2, thanks. >> >> >>>> } >>>> >>>> ptp->ptp_info = bnxt_ptp_caps; >>>> -- >>>> 2.30.2 >>>> >>