From patchwork Sun Jul 18 19:36:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 479779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71367C636CB for ; Sun, 18 Jul 2021 19:37:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59AF161029 for ; Sun, 18 Jul 2021 19:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232895AbhGRTkD (ORCPT ); Sun, 18 Jul 2021 15:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230502AbhGRTj5 (ORCPT ); Sun, 18 Jul 2021 15:39:57 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96ACEC061762 for ; Sun, 18 Jul 2021 12:36:58 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id w15so16625733pgk.13 for ; Sun, 18 Jul 2021 12:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9T7FgujEBx8O+M1214H2X9sSix5P14rHz+/H29xSICw=; b=hvxTykG2tjuyaqXU4XXf9a3fIBqC6ZLGy/v6BNP6UpTyO4SXWhtX2AacxHZZMIoOoV WAU3PcuofSD23b6qJ6PXG8J0DyLe2sfmqCb/1vNPPt/9qtqq/8AEbyN36JZiMehT/2jB lGZ/brm0qbl/bABYNMInLdp67DufAiWA9zkMI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9T7FgujEBx8O+M1214H2X9sSix5P14rHz+/H29xSICw=; b=Oaeoup8EHgMet7s3XLIHqimlxX1QZB7UL9R3b4FHfnyxWvtgySrzQ7Cil8vOx9QYoU ZT0oIdy96YBEaUifXBE/v45v74JLDOI5+K+lPqLZU28gSY4bGQQlG3qZE/LL5dycw0gO WKgUNGm+vf/hDQYeVpUimuHUQ5Q/F/L52urIBpBaNw1Mgueb4+1YronPSwBB8YKX/b1T qbmePiA/ints9NCHtRZvsdT9jSqu2r3Vwraa1wo+JqEQPuBVXEmV2jLows2yB2mXCahq pB7lBB7Yjs8GONoWACFJ8Q89u02ljmCSWdRtZ19K9DFs8KiO2bQk2J3XqELV7+CQ/hep F7+A== X-Gm-Message-State: AOAM533PUuMeZkH0dYOcA8sRz6D/zR8vVTbsXPr9xkPQYcuCQooUBYpH 7CUgRX7Nprr2DLALZfHN1PAncQ== X-Google-Smtp-Source: ABdhPJzIOV9sAqinw4HndaGPbvv1CwWcVRVSYMqA3fVdOPSGUorXXWf2ZgD7LuG4UGqgczjtPJHMcg== X-Received: by 2002:a05:6a00:114f:b029:340:aa57:f69 with SMTP id b15-20020a056a00114fb0290340aa570f69mr6946356pfm.28.1626637017421; Sun, 18 Jul 2021 12:36:57 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 22sm16743648pfo.80.2021.07.18.12.36.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jul 2021 12:36:56 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Richard Cochran Subject: [PATCH net 9/9] bnxt_en: Fix PTP capability discovery Date: Sun, 18 Jul 2021 15:36:33 -0400 Message-Id: <1626636993-31926-10-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1626636993-31926-1-git-send-email-michael.chan@broadcom.com> References: <1626636993-31926-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The current PTP initialization logic does not account for firmware reset that may cause PTP capability to change. The valid pointer bp->ptp_cfg is used to indicate that the device is capable of PTP and that it has been initialized. So we must clean up bp->ptp_cfg and free it if the firmware after reset does not support PTP. Fixes: 93cb62d98e9c ("bnxt_en: Enable hardware PTP support") Cc: Richard Cochran Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b8b73c210995..4db162cee911 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7574,8 +7574,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_WOL_CAP; if (flags & FUNC_QCAPS_RESP_FLAGS_WOL_MAGICPKT_SUPPORTED) bp->flags |= BNXT_FLAG_WOL_CAP; - if (flags & FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED) + if (flags & FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED) { __bnxt_hwrm_ptp_qcfg(bp); + } else { + kfree(bp->ptp_cfg); + bp->ptp_cfg = NULL; + } } else { #ifdef CONFIG_BNXT_SRIOV struct bnxt_vf_info *vf = &bp->vf;