From patchwork Tue Mar 21 10:32:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Chebbi X-Patchwork-Id: 13182553 X-Patchwork-Delegate: kuba@kernel.org 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 194CBC74A5B for ; Tue, 21 Mar 2023 10:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230301AbjCUKdx (ORCPT ); Tue, 21 Mar 2023 06:33:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbjCUKdu (ORCPT ); Tue, 21 Mar 2023 06:33:50 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B886937739 for ; Tue, 21 Mar 2023 03:33:19 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id k2so15505844pll.8 for ; Tue, 21 Mar 2023 03:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1679394799; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=FEj2BBbk4m7LfrBwoZM0xHy0yDmRcR0kWmS+Xqd6aOA=; b=KMhVWJMD6LtHunb+3KvlyTFYOqsxIRXvYeN4Xkiyn0MTGA2SMZAkNMoQNmKWBdWEST GUtfIzOcE+FK6DvxhFXSLGKAD9vv3P4Y+0VwRugg+J2ow2hUmqRBmcKqutYGBx5ODLHW SOxWBP1qOMT5nFVBQ+uh9vPTEoPlvZayg/waU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679394799; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FEj2BBbk4m7LfrBwoZM0xHy0yDmRcR0kWmS+Xqd6aOA=; b=09sE1n2XfD9YVFP9k64XwTJ48JnuDYIkG5GTZuE4fNczGu7R8UqFn3cwoqA1+W+Y34 5bkEyla/fG45GFfLvkfz296xu3ipdJlpI7+AcfthZ50Wt0QF6ZqDHwgpMKbXeSZAk+X4 k+fRptQfGKbPzOCLwpUxoUAFpojBnROdiu+FeJj4WbC9DdFoyXq28fjDutK3B1gOGm0y XPaCQaVZdArHwGSi8sWttyWyMSP3CV1YCbSPiVuldWW/9T2Gzf7ZywlbF1B/hH4a0n65 Gftv0G5/v1NkFQxJ3IX+9DkAYVKD8nn/6JiN9Z4HpIaOP8hKOiz08FuRkDR93SpUKtT6 j4RA== X-Gm-Message-State: AO0yUKW3h0fnFgnbFWOJ3ak9TglgIzPF+V5hGpLg9TMDumLSPI6b9AxR EvJ2AhUT7M2nonDcIcdT62wBzg== X-Google-Smtp-Source: AK7set9Sq+91lyzrXF3Ke8zbeZ/Rzeqebywt4qqP56RfnX5MgEBAa8TxTHkz5cOkhmLQPLKxV9qJ6Q== X-Received: by 2002:a05:6a20:ca49:b0:cc:cc27:9185 with SMTP id hg9-20020a056a20ca4900b000cccc279185mr1392186pzb.50.1679394798734; Tue, 21 Mar 2023 03:33:18 -0700 (PDT) Received: from PC-MID-R740.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t13-20020a62ea0d000000b005a87d636c70sm7888416pfh.130.2023.03.21.03.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 03:33:18 -0700 (PDT) From: Pavan Chebbi To: michael.chan@broadcom.com, kuba@kernel.org Cc: davem@davemloft.net, edumazet@google.com, gospo@broadcom.com, netdev@vger.kernel.org, pabeni@redhat.com, richardcochran@gmail.com, Pavan Chebbi Subject: [PATCH net-next 2/3] bnxt: Defer PTP initialization to after querying function caps Date: Tue, 21 Mar 2023 03:32:26 -0700 Message-Id: <20230321103227.12020-3-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230321103227.12020-1-pavan.chebbi@broadcom.com> References: <20230321103227.12020-1-pavan.chebbi@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Driver uses the flag BNXT_FLAG_MULTI_HOST to determine whether to use non-realtime mode PHC when running on a multi host NIC. However when ptp initializes on a NIC with shared PHC, we still don't have this flag set yet because HWRM_FUNC_QCFG is issued much later. Move the ptp initialization code after we have issued func_qcfg. The next patch will use the BNXT_FLAG_MULTI_HOST flag during PTP initialization. Signed-off-by: Pavan Chebbi Reviewed-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 +++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index f533a8f46217..656a28ac2ff0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7769,7 +7769,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) if (flags & FUNC_QCAPS_RESP_FLAGS_WOL_MAGICPKT_SUPPORTED) bp->flags |= BNXT_FLAG_WOL_CAP; if (flags & FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED) { - __bnxt_hwrm_ptp_qcfg(bp); + bp->fw_cap |= BNXT_FW_CAP_PTP; } else { bnxt_ptp_clear(bp); kfree(bp->ptp_cfg); @@ -12298,6 +12298,8 @@ static int bnxt_fw_init_one_p2(struct bnxt *bp) bnxt_hwrm_vnic_qcaps(bp); bnxt_hwrm_port_led_qcaps(bp); bnxt_ethtool_init(bp); + if (bp->fw_cap & BNXT_FW_CAP_PTP) + __bnxt_hwrm_ptp_qcfg(bp); bnxt_dcb_init(bp); return 0; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index d7eb0d244f42..0eeaed95a4ac 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1996,6 +1996,7 @@ struct bnxt { #define BNXT_FW_CAP_HOT_RESET_IF BIT_ULL(29) #define BNXT_FW_CAP_RING_MONITOR BIT_ULL(30) #define BNXT_FW_CAP_DBG_QCAPS BIT_ULL(31) + #define BNXT_FW_CAP_PTP BIT_ULL(32) u32 fw_dbg_cap;