From patchwork Sun Jun 14 23:57:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 217772 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=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 D6A8AC433E0 for ; Sun, 14 Jun 2020 23:57:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5C1420768 for ; Sun, 14 Jun 2020 23:57:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="GNUz1Dze" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbgFNX5i (ORCPT ); Sun, 14 Jun 2020 19:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727928AbgFNX5h (ORCPT ); Sun, 14 Jun 2020 19:57:37 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B3DDC05BD43 for ; Sun, 14 Jun 2020 16:57:37 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id dr13so15482098ejc.3 for ; Sun, 14 Jun 2020 16:57:37 -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=zoavvsU0jSHWhJ9DrD1KkSozYzyrIY/5183cZBKCV3E=; b=GNUz1DzeVzjf0yNBB63lwm7SqS5vPJMuynFmVER7XgI0tw8WGVBWnqrnHVKSfvDLWv roNpOroaFjdpbRxLi2GtlXY3JVPFGfIDeGc4OOILEqNccnX01d3QHNsZ/UEOm8UjnVki w+q67Cuiu7OFdTrAoRvAN9rRJgIWpvNmcbb5c= 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=zoavvsU0jSHWhJ9DrD1KkSozYzyrIY/5183cZBKCV3E=; b=JTBxL3kptNZ0P9d3vvUPFxO5OMjhw1F1q5YLfvvDmvOCfntPgNanDu3zkbot6Tvm54 do0irhB5/ByFMaiJ8xkAjsgcriMt9oyW1VV8Ni6m5tPY7/xwSfj+H+SVnxvqhX41iVi9 g6O3WTy+aQcC/duEg0UBe1lU16CWlXfxs7B9wZmXOEnd5BKh7ZPzFJJVE7gMu7Htk4wH 3Hmw5IqxQ5NwzOT1zltV4Rz/Den96sOb9tsZQ2WOxo028zfMI0XcUwSwO7XSOpPlbThS QTXOKWOn7vmsI5623/CGsByPQ/tVpE03a/XUC5x6MaSRk+tqZyxWHNiwDXBwrWlSaFC5 7iZQ== X-Gm-Message-State: AOAM532Ak4rVcsv1Aia3hjg2uw+KK/jw1/ZtX73B+VY0IjEnUkVyFuwN 1nIFi14gVU2iLagp1D/GA4xVDQ== X-Google-Smtp-Source: ABdhPJwxr/VaFTgpeOQ0Uh4hCFuPhOqJyNlRLHP1hCjbhmP0du0KHXZ98gUV2gvwRB/ABv/G498AZg== X-Received: by 2002:a17:906:f6c2:: with SMTP id jo2mr11020140ejb.424.1592179055035; Sun, 14 Jun 2020 16:57:35 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id gj10sm7891398ejb.61.2020.06.14.16.57.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jun 2020 16:57:34 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net 1/4] bnxt_en: Simplify bnxt_resume(). Date: Sun, 14 Jun 2020 19:57:07 -0400 Message-Id: <1592179030-4533-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592179030-4533-1-git-send-email-michael.chan@broadcom.com> References: <1592179030-4533-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The separate steps we do in bnxt_resume() can be done more simply by calling bnxt_hwrm_func_qcaps(). This change will add an extra __bnxt_hwrm_func_qcaps() call which is needed anyway on older firmware. Fixes: f9b69d7f6279 ("bnxt_en: Fix suspend/resume path on 57500 chips") Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index c62589c..1dc38d9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -12133,19 +12133,9 @@ static int bnxt_resume(struct device *device) goto resume_exit; } - if (bnxt_hwrm_queue_qportcfg(bp)) { - rc = -ENODEV; + rc = bnxt_hwrm_func_qcaps(bp); + if (rc) goto resume_exit; - } - - if (bp->hwrm_spec_code >= 0x10803) { - if (bnxt_alloc_ctx_mem(bp)) { - rc = -ENODEV; - goto resume_exit; - } - } - if (BNXT_NEW_RM(bp)) - bnxt_hwrm_func_resc_qcaps(bp, false); if (bnxt_hwrm_func_drv_rgtr(bp, NULL, 0, false)) { rc = -ENODEV; From patchwork Sun Jun 14 23:57:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 217771 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=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 D3925C433E1 for ; Sun, 14 Jun 2020 23:58:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B504820747 for ; Sun, 14 Jun 2020 23:58:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Lw9uAnmQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728033AbgFNX5l (ORCPT ); Sun, 14 Jun 2020 19:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727995AbgFNX5k (ORCPT ); Sun, 14 Jun 2020 19:57:40 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5DEEC05BD43 for ; Sun, 14 Jun 2020 16:57:39 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id p20so15466307ejd.13 for ; Sun, 14 Jun 2020 16:57:39 -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=jf/A/gK1QRhm6wRIfmSgoY2GZmGZiq12N5Yg+cGRqxY=; b=Lw9uAnmQzSU/8TRu5uq9R7J6xInS453KNN7BKcAvYEBVWKyyZ6aUUIJ8P3ascgJx7F +iVpAOwBYodDheI/M+KKVlBARL0Y4WTOwonuI3EKpE18XKXsAaqRUWt9fkUYtEJu0Lrw Idz0ZYng9bWHk0wsx96UT/rpBnIsZLPGD93UA= 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=jf/A/gK1QRhm6wRIfmSgoY2GZmGZiq12N5Yg+cGRqxY=; b=C8CZ9odN0IDypsrMvkIeZVEL4IEC2vfuXTNxBbALBETpKUTQqHsLw9oFVnmdmu269h 6yUfye3GJqvTRN+E8Kqhc3WFWZHg7X/vyFaAFGmAYOHqmx0gEcBEoyft3HZg9qorWl2c a77Cg59OuHdjIla0MudvGBR8EhMghmqaI6vsz38qxiF0RLyvkTsDEW3oLWZIYORrJK5j 5ZdUlWoly8E5gL/ts1S8HNXAZj9yAzxrXQjvRR/Pem0VoSLBKHQWmMfHhjGPFo8SOULI LOZhiNjQ5il/g6EtvNXa19ajujD3eGVl2Oy8DDIoeBEBtYOHE2RW1CaeZAKa8s7TlCIt rzuw== X-Gm-Message-State: AOAM530HIVOPsPrRjd/bEWtcut1RknNutgPvTATYP0slQAFMo1pNLeo/ hwtjIcZl3w3CYsE8rU0TLlQbHg== X-Google-Smtp-Source: ABdhPJxORu3aEyq2icGKBdRtsbWWeen3fXhJecv3nrHaYexnB0D8F/4epMTZeFRbmeEgyq4F9ROnhQ== X-Received: by 2002:a17:906:b817:: with SMTP id dv23mr22782476ejb.185.1592179058475; Sun, 14 Jun 2020 16:57:38 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id gj10sm7891398ejb.61.2020.06.14.16.57.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jun 2020 16:57:38 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net 3/4] bnxt_en: Fix AER reset logic on 57500 chips. Date: Sun, 14 Jun 2020 19:57:09 -0400 Message-Id: <1592179030-4533-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592179030-4533-1-git-send-email-michael.chan@broadcom.com> References: <1592179030-4533-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org AER reset should follow the same steps as suspend/resume. We need to free context memory during AER reset and allocate new context memory during recovery by calling bnxt_hwrm_func_qcaps(). We also need to call bnxt_reenable_sriov() to restore the VFs. Fixes: bae361c54fb6 ("bnxt_en: Improve AER slot reset.") Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 0d97f47..47b45ea 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -12196,6 +12196,9 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, bnxt_close(netdev); pci_disable_device(pdev); + bnxt_free_ctx_mem(bp); + kfree(bp->ctx); + bp->ctx = NULL; rtnl_unlock(); /* Request a slot slot reset. */ @@ -12229,12 +12232,16 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) pci_set_master(pdev); err = bnxt_hwrm_func_reset(bp); - if (!err && netif_running(netdev)) - err = bnxt_open(netdev); - - if (!err) - result = PCI_ERS_RESULT_RECOVERED; + if (!err) { + err = bnxt_hwrm_func_qcaps(bp); + if (!err && netif_running(netdev)) + err = bnxt_open(netdev); + } bnxt_ulp_start(bp, err); + if (!err) { + bnxt_reenable_sriov(bp); + result = PCI_ERS_RESULT_RECOVERED; + } } if (result != PCI_ERS_RESULT_RECOVERED) {