netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Pavan Chebbi <pavan.chebbi@broadcom.com>
Cc: Vadim Fedorenko <vadfed@meta.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Andy Gospodarek <andrew.gospodarek@broadcom.com>,
	Michael Chan <michael.chan@broadcom.com>,
	Richard Cochran <richardcochran@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net v2] bnxt_en: reset PHC frequency in free-running mode
Date: Thu, 9 Mar 2023 10:50:48 +0000	[thread overview]
Message-ID: <a2e3f3d3-f53c-d270-0495-e67624c3db96@linux.dev> (raw)
In-Reply-To: <CALs4sv2cOFEVFwJ_UgV5T0iJOAzM7X=jvDqsdAtjiuQjTs5U8g@mail.gmail.com>

On 09/03/2023 10:11, Pavan Chebbi wrote:
> On Thu, Mar 9, 2023 at 3:02 PM Vadim Fedorenko
> <vadim.fedorenko@linux.dev> wrote:
>>
>> On 09.03.2023 04:40, Pavan Chebbi wrote:
>>> On Wed, Mar 8, 2023 at 8:12 PM Vadim Fedorenko <vadfed@meta.com> 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_USE_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)
>>>
>>> I understand from your response on v1 as to why it will not affect you
>>> if a new firmware does not report RTC on MH.
>>> However, once you update the fw, any subsequent kernels upgrades will
>>> prevent resetting the freq stored in the PHC.
>>> Would changing the check to if (BNXT_MH(bp)) instead be a better option?
>>
>> How will it affect hardware without RTC support? The one which doesn't have
>> BNXT_FW_CAP_PTP_RTC in a single-host configuration. Asking because if FW will
> 
> For single hosts, it should not matter if we reset the PHC frequency.
> bnxt_ptp_init() is [re]initializing the host-timecounter, and this
> function being called on a single host means everything is going to
> [re]start from scratch.
> 
>> not expose BNXT_FW_CAP_PTP_RTC, the check BNXT_PTP_USE_RTC() will be equal to
>> !BNXT_MH() and there will be no need for additional check in this else clause.
> 
> You are right, hence my original suggestion of resetting the PHC freq
> unconditionally is better.
> One more thing, the function bnxt_ptp_adjfine() should select
> non-realtime adjustments only for MH systems.
> You may need to flip the check, something like
> 
> if (!BNXT_MH(ptp->bp))
>      return bnxt_ptp_adjfine_rtc(bp, scaled_ppm);
> 
> This is because there can be a very old firmware which does not have
> RTC on single hosts but we still want to make HW adjustments.

Well, I just want to be sure that we will support all possible 
combinations of FW in the driver. AFAIU, there 3 different options:

1. Very old firmware. Doesn't have RTC support and doesn't expose 
BNXT_FW_CAP_PTP_RTC. Call to bnxt_ptp_adjfine_rtc on this variant may 
make HW unusable. We MUST not call it in this case. The timecounter is 
also not supported in this configuration, right?
2. Firmware which supports RTC and exposes BNXT_FW_CAP_PTP_RTC. 
Timecounter should be used only in MH case then.
3. Firmware which supports RTC, but doesn't expose BNXT_FW_CAP_PTP_RTC 
for MH configuration. How can we understand that it's not variant 1 in 
MH configuration? Or are we sure FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED is 
not set on old firmware?


  reply	other threads:[~2023-03-09 10:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 14:42 [PATCH net v2] bnxt_en: reset PHC frequency in free-running mode Vadim Fedorenko
2023-03-09  4:40 ` Pavan Chebbi
2023-03-09  9:32   ` Vadim Fedorenko
2023-03-09 10:11     ` Pavan Chebbi
2023-03-09 10:50       ` Vadim Fedorenko [this message]
2023-03-09 12:23         ` Pavan Chebbi
2023-03-09 15:37           ` Vadim Fedorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2e3f3d3-f53c-d270-0495-e67624c3db96@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pavan.chebbi@broadcom.com \
    --cc=richardcochran@gmail.com \
    --cc=vadfed@meta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).