From patchwork Mon May 4 08:50:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 219984 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 CE16BC47257 for ; Mon, 4 May 2020 08:51:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACA61206D7 for ; Mon, 4 May 2020 08:51:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Kbq3ekUw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728388AbgEDIvC (ORCPT ); Mon, 4 May 2020 04:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728379AbgEDIvA (ORCPT ); Mon, 4 May 2020 04:51:00 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 272C8C061A0E for ; Mon, 4 May 2020 01:51:00 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id mq3so3509205pjb.1 for ; Mon, 04 May 2020 01:51:00 -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=4kd5FJ+0g7EnjVR/IY5uppqlJFOJxh74Bu03xSB3jkM=; b=Kbq3ekUwHo2K1ecelw3kV8RGeqeZZ9GiIZDMVQrj3YxVIPR8tnyJYIqxI4Yd1qeAhN NH1dbSsthuUr+iZenHMfpAtuJVmNbX+FFRhc0sTmYGi/JArYyENWSNHbVi+kqsROC7VY ZTfZB3qYiz3TdneD4Z3h81slYqodQTIzZotTI= 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=4kd5FJ+0g7EnjVR/IY5uppqlJFOJxh74Bu03xSB3jkM=; b=OPBWFDalD/XX8jh2yNoHZ/ApGvtGDKYVypRa+oXtboTCzXZQn4wjpF3MCRyMkVz+CF NMigdlMMEhZPD5UqSLd2N0OXEHf3OX420egai4C3++sivgTghoVQBX96BOTuz8cQEMK+ nQytUyc/mdhog/41QP1t4py1Y2xzG7fz6TYTZOaugbXPRO+qAEtwEKxPuiVUakYpqnTu oFp0c5CO9H4v5oL7P+Why72SoSkg4zj70A2ssiSGDwSgBY6Ab0cCNoq7eAU9jxDkeKYS ahUDQ5DYrdJtuC4hvO/bGVqg07kg0/WmDGJJ/xIQTv7Cr3tRW0kMCJ7179ZUQZNT+bQQ q1kQ== X-Gm-Message-State: AGi0PuZDGTOOS8FAx1L3rmE0BxSkjFiZ07nFKageaOrLPNy+A2yu5mWb ux8ntq0QTcwURrhoM3IZOWvn5/rJb4g= X-Google-Smtp-Source: APiQypK4wmfVK6gO4Ax3jGl2D7/EiAD3MyzCelLb4pZ1pqZ62oVgsfXJh6NHpHsN0gFgpdhGic0q0w== X-Received: by 2002:a17:902:9693:: with SMTP id n19mr17164038plp.277.1588582259654; Mon, 04 May 2020 01:50:59 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm8754088pfd.54.2020.05.04.01.50.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 01:50:59 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH net-next 02/15] bnxt_en: Allocate TQM ring context memory according to fw specification. Date: Mon, 4 May 2020 04:50:28 -0400 Message-Id: <1588582241-31066-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1588582241-31066-1-git-send-email-michael.chan@broadcom.com> References: <1588582241-31066-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 Newer firmware spec. will specify the number of TQM rings to allocate context memory for. Use the firmware specified value and fall back to the old value derived from bp->max_q if it is not available. Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 30 +++++++++++++++++------------- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index fead64f..32a2083 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6434,23 +6434,13 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp) if (!rc) { struct bnxt_ctx_pg_info *ctx_pg; struct bnxt_ctx_mem_info *ctx; - int i; + int i, tqm_rings; ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) { rc = -ENOMEM; goto ctx_err; } - ctx_pg = kzalloc(sizeof(*ctx_pg) * (bp->max_q + 1), GFP_KERNEL); - if (!ctx_pg) { - kfree(ctx); - rc = -ENOMEM; - goto ctx_err; - } - for (i = 0; i < bp->max_q + 1; i++, ctx_pg++) - ctx->tqm_mem[i] = ctx_pg; - - bp->ctx = ctx; ctx->qp_max_entries = le32_to_cpu(resp->qp_max_entries); ctx->qp_min_qp1_entries = le16_to_cpu(resp->qp_min_qp1_entries); ctx->qp_max_l2_entries = le16_to_cpu(resp->qp_max_l2_entries); @@ -6483,6 +6473,20 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp) ctx->tim_entry_size = le16_to_cpu(resp->tim_entry_size); ctx->tim_max_entries = le32_to_cpu(resp->tim_max_entries); ctx->ctx_kind_initializer = resp->ctx_kind_initializer; + ctx->tqm_fp_rings_count = resp->tqm_fp_rings_count; + if (!ctx->tqm_fp_rings_count) + ctx->tqm_fp_rings_count = bp->max_q; + + tqm_rings = ctx->tqm_fp_rings_count + 1; + ctx_pg = kcalloc(tqm_rings, sizeof(*ctx_pg), GFP_KERNEL); + if (!ctx_pg) { + kfree(ctx); + rc = -ENOMEM; + goto ctx_err; + } + for (i = 0; i < tqm_rings; i++, ctx_pg++) + ctx->tqm_mem[i] = ctx_pg; + bp->ctx = ctx; } else { rc = 0; } @@ -6735,7 +6739,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp) return; if (ctx->tqm_mem[0]) { - for (i = 0; i < bp->max_q + 1; i++) + for (i = 0; i < ctx->tqm_fp_rings_count + 1; i++) bnxt_free_ctx_pg_tbls(bp, ctx->tqm_mem[i]); kfree(ctx->tqm_mem[0]); ctx->tqm_mem[0] = NULL; @@ -6849,7 +6853,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) entries = roundup(entries, ctx->tqm_entries_multiple); entries = clamp_t(u32, entries, ctx->tqm_min_entries_per_ring, ctx->tqm_max_entries_per_ring); - for (i = 0; i < bp->max_q + 1; i++) { + for (i = 0; i < ctx->tqm_fp_rings_count + 1; i++) { ctx_pg = ctx->tqm_mem[i]; ctx_pg->entries = entries; mem_size = ctx->tqm_entry_size * entries; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index f2caa27..1dbc3ae 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1357,6 +1357,7 @@ struct bnxt_ctx_mem_info { u16 mrav_num_entries_units; u8 tqm_entries_multiple; u8 ctx_kind_initializer; + u8 tqm_fp_rings_count; u32 flags; #define BNXT_CTX_FLAG_INITED 0x01 From patchwork Mon May 4 08:50:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 219983 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 4AE47C3A5A9 for ; Mon, 4 May 2020 08:51:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C4CA206D7 for ; Mon, 4 May 2020 08:51:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="d5pnGWQy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728379AbgEDIvG (ORCPT ); Mon, 4 May 2020 04:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728266AbgEDIvE (ORCPT ); Mon, 4 May 2020 04:51:04 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 622A9C061A0E for ; Mon, 4 May 2020 01:51:04 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id f8so6532027plt.2 for ; Mon, 04 May 2020 01:51:04 -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=URJDNd1lJ+QuNmxk9ITDFWobbJ2DGUF90uU6aEClO9M=; b=d5pnGWQyUeLUgstbibjALE0o5xy0DbF+6ZHZOHEIxcWaH3W8AKA6CIVr2Q8kyeVPEE gB/F+R9I6JNrHIf4ho+aWj6y9ZHbHSWU/R/H7RGhkhMgcbe5lhEfN12uTRF0SQcyo5fq Jw2izKxOFp4AKQxSP4cggZanST5gkP3Ik3YVA= 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=URJDNd1lJ+QuNmxk9ITDFWobbJ2DGUF90uU6aEClO9M=; b=WELj7hGGqUPhkBB2cHLAqrt/HHLiL7gGu+UwxfagG1FxXC5sH1GYq5Z3mnw/x9oSL5 jW2y4D2WKJt/52X6cH8be5n+emlSfEy20wUDuyLZhzVZ0Xrn3pW36q/0EgXw4lkB1vNV N+JOgOm+ThZBL43owxAvyfmtE6AGmOdnRdHnlS36DCmz0+W33Rs9kJE1EcgXKMmIOP0e LD3yr3CwF83y/Q5rtISFmv3lDp/n3RG24cvb9D0DgEY+myJEpPfA9SgyMCzfknggg7aw i/3tUDUZGucW+djTwD6cQKBClWB2pTX1AUovm7b1x8EwPsew0K1DVYyUV6O+lQG/jydk KYTA== X-Gm-Message-State: AGi0PubyNCV2sPZ5KurdhfBjJh3EFzGKaQe8D1F7ZPfK688dbM4z0/hG M6Z5S0Zrnw76oItkRZ60wQ3g9sLDSgA= X-Google-Smtp-Source: APiQypKx+aI4tKB4IYUYnFzoTmnu0TMl+OMU2PCACS80tQ+25+M8iLAkQeHUwxNvRsj9RGadRET66Q== X-Received: by 2002:a17:90a:f2ca:: with SMTP id gt10mr15633089pjb.160.1588582263848; Mon, 04 May 2020 01:51:03 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm8754088pfd.54.2020.05.04.01.51.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 01:51:03 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, Vasundhara Volam Subject: [PATCH net-next 04/15] bnxt_en: Do not include ETH_FCS_LEN in the max packet length sent to fw. Date: Mon, 4 May 2020 04:50:30 -0400 Message-Id: <1588582241-31066-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1588582241-31066-1-git-send-email-michael.chan@broadcom.com> References: <1588582241-31066-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 From: Vasundhara Volam The firmware does not expect the CRC to be included in the length passed from the driver. The firmware always configures the chip to strip out the CRC. Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +-- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 0cf41a1..5919f72 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -5045,8 +5045,7 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, u16 vnic_id) req.dflt_ring_grp = cpu_to_le16(bp->grp_info[grp_idx].fw_grp_id); req.lb_rule = cpu_to_le16(0xffff); vnic_mru: - req.mru = cpu_to_le16(bp->dev->mtu + ETH_HLEN + ETH_FCS_LEN + - VLAN_HLEN); + req.mru = cpu_to_le16(bp->dev->mtu + ETH_HLEN + VLAN_HLEN); req.vnic_id = cpu_to_le16(vnic->fw_vnic_id); #ifdef CONFIG_BNXT_SRIOV diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c index 6ea3df6d..c883e88 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -651,7 +651,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) FUNC_CFG_REQ_ENABLES_NUM_VNICS | FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS); - mtu = bp->dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; + mtu = bp->dev->mtu + ETH_HLEN + VLAN_HLEN; req.mru = cpu_to_le16(mtu); req.mtu = cpu_to_le16(mtu); From patchwork Mon May 4 08:50:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 219982 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 DDFEFC3A5A9 for ; Mon, 4 May 2020 08:51:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD3B9206D7 for ; Mon, 4 May 2020 08:51:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="VgOtVtRa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728281AbgEDIvL (ORCPT ); Mon, 4 May 2020 04:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728394AbgEDIvJ (ORCPT ); Mon, 4 May 2020 04:51:09 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2B8FC061A0E for ; Mon, 4 May 2020 01:51:08 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id w3so6530086plz.5 for ; Mon, 04 May 2020 01:51:08 -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=kg62eFxgwO2wu4QCcrY1ViR4TKDLoUjlJtZW3IvM6+w=; b=VgOtVtRapYBH2bBsGPG4exNU/1cb8rJ+MrdUb1XWZWkZTmC4UWoFeoIUfvOr7AHu5D +kbsJ04VnvTWNFHPCsKvBhAKa9+eqhiteg8c1wMbRks8OwviUNJ/6NVc5mg+WsgJ4KOn bu08d8hOxEfkeO6QxvwW/PWg46giMqLEZfoPc= 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=kg62eFxgwO2wu4QCcrY1ViR4TKDLoUjlJtZW3IvM6+w=; b=XOx4zivKFdq+rNCRCBd+mkoKybXf+T0BTHfMuoKXYIzCDQSeh4dNIGOwURQnUl/+ky 2F+sBjss2BmprD7oeVzeRok2mnEjRky4ZjlgmTjtO/sGOvG8HL1W5aKsPCcyAhiUDAVm 7ZGZ84nKy6L2vM1s6xYbPft05ONJAoi8bgXALnr4HnK5yEhCN4ZzF+QRXL4ySx+Tt6If me69iNjFdyMvbUPmImdhehvlXUP5xTvE5YM/N3CydCSOZhr2qtddZHJFguF+ZDns1JcV UoKAGdIEJX/H+dHO+Xm/vmSpmhwSg8ijPmInhUTcwHbm4BelNdNR5+LkrlTPPOD8rISF qCmA== X-Gm-Message-State: AGi0PuZMP6FLS+OAVLcvCPmFEuPvziab4sy5CABNBICIunPu3NOOabRf mvWvC9Kj4OkaUzHhMgRJyWDP7A== X-Google-Smtp-Source: APiQypKcNgag3xsJb7t/53umsV9lu82PRTfPbsnsDkk3sln/BjRd3KdzoO9+mV6WzF1LJGfCUGikHg== X-Received: by 2002:a17:90a:5584:: with SMTP id c4mr16807387pji.51.1588582268372; Mon, 04 May 2020 01:51:08 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm8754088pfd.54.2020.05.04.01.51.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 01:51:08 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, Edwin Peer Subject: [PATCH net-next 06/15] bnxt_en: refactor ethtool firmware reset types Date: Mon, 4 May 2020 04:50:32 -0400 Message-Id: <1588582241-31066-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1588582241-31066-1-git-send-email-michael.chan@broadcom.com> References: <1588582241-31066-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 From: Edwin Peer The case statement in bnxt_firmware_reset() dangerously mixes types. This patch separates the application processor and whole chip resets from the rest such that the selection is performed on a pure type. Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 38 +++++++++++++++-------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index ed6a322..d99da82 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1768,10 +1768,10 @@ static int bnxt_hwrm_firmware_reset(struct net_device *dev, u8 proc_type, return rc; } -static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type) +static int bnxt_firmware_reset(struct net_device *dev, + enum bnxt_nvm_directory_type dir_type) { u8 self_reset = FW_RESET_REQ_SELFRST_STATUS_SELFRSTNONE; - struct bnxt *bp = netdev_priv(dev); u8 proc_type, flags = 0; /* TODO: Address self-reset of APE/KONG/BONO/TANG or ungraceful reset */ @@ -1798,15 +1798,6 @@ static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type) case BNX_DIR_TYPE_BONO_PATCH: proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE; break; - case BNXT_FW_RESET_CHIP: - proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP; - self_reset = FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP; - if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET) - flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL; - break; - case BNXT_FW_RESET_AP: - proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_AP; - break; default: return -EINVAL; } @@ -1814,6 +1805,27 @@ static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type) return bnxt_hwrm_firmware_reset(dev, proc_type, self_reset, flags); } +static int bnxt_firmware_reset_chip(struct net_device *dev) +{ + struct bnxt *bp = netdev_priv(dev); + u8 flags = 0; + + if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET) + flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL; + + return bnxt_hwrm_firmware_reset(dev, + FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP, + FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP, + flags); +} + +static int bnxt_firmware_reset_ap(struct net_device *dev) +{ + return bnxt_hwrm_firmware_reset(dev, FW_RESET_REQ_EMBEDDED_PROC_TYPE_AP, + FW_RESET_REQ_SELFRST_STATUS_SELFRSTNONE, + 0); +} + static int bnxt_flash_firmware(struct net_device *dev, u16 dir_type, const u8 *fw_data, @@ -3006,7 +3018,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) if (bp->hwrm_spec_code < 0x10803) return -EOPNOTSUPP; - rc = bnxt_firmware_reset(dev, BNXT_FW_RESET_CHIP); + rc = bnxt_firmware_reset_chip(dev); if (!rc) { netdev_info(dev, "Reset request successful.\n"); if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) @@ -3018,7 +3030,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) if (bp->hwrm_spec_code < 0x10803) return -EOPNOTSUPP; - rc = bnxt_firmware_reset(dev, BNXT_FW_RESET_AP); + rc = bnxt_firmware_reset_ap(dev); if (!rc) { netdev_info(dev, "Reset Application Processor request successful.\n"); *flags = 0; From patchwork Mon May 4 08:50:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 219981 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 8C2A5C3A5A9 for ; Mon, 4 May 2020 08:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69B66206D7 for ; Mon, 4 May 2020 08:51:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="MdFOg67O" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728405AbgEDIvP (ORCPT ); Mon, 4 May 2020 04:51:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728403AbgEDIvN (ORCPT ); Mon, 4 May 2020 04:51:13 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7736EC061A0E for ; Mon, 4 May 2020 01:51:13 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id s10so6541557plr.1 for ; Mon, 04 May 2020 01:51:13 -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=ukO7xCfi57MbIdpZmphGNI+0Z1Oe5f/a95XRojt32rE=; b=MdFOg67Oc/ng0zY4NacsAms6LdC4RgrGb7l2HrJ0px11x0yDoEJvMPxZBSgF2Xx2pt /Pe+K+8aHJ0RbbsMTQnzufSKys5NMoDRoyVXNPhFu8l69sS7XAdDcfWkhrkw7j5PnJW9 ioyGOTI4YfU7z6znrfY3d8OygBpjacFaO1MX4= 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=ukO7xCfi57MbIdpZmphGNI+0Z1Oe5f/a95XRojt32rE=; b=LBoGVzLjpoPd49dvpO0QJjYgmvA6QCPx02gdQ54yQCN8txV5888zwgUyS3ScVmadbw 4XGbg+WvsLAm11TNGrUduHNbHbosWStQCgHDV2x9Ph9OEWkkolLNI4FovfN18Ih94kv5 C94P3Mpo6myXY4fFR5860VaCpUaUTglLgij4ih3CVDnTD0lpRgP107P9BG8y007/D76H BvQ7k2z4ccwF0rVysB73kDEK+q0HIi3Fh1KR6eOCBCcAeYrjIMQN2LmTxkchI8xE+Q1J /o8+QzEul8vGPG/zMPOceeK6l4LFmOrBKygaXPBs/xNkNHJmUjJULOXwEd+bA6l/t2n8 ZpcA== X-Gm-Message-State: AGi0PuaVHZvZUNadHM0YTvDVnupLSBdovOLi4hn0u8mNNJMvzhdiI58s SVVhmVc7JbFk1FwOWyUOfBjlyjfDRbs= X-Google-Smtp-Source: APiQypKg36lNDe0oqh79CfxNRfEjFapIzpBvo7p2XkCFdGT0Vafb1t7fqDqJDlsjtEGrWQ8bmDDEfg== X-Received: by 2002:a17:902:fe14:: with SMTP id g20mr17028748plj.330.1588582272992; Mon, 04 May 2020 01:51:12 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm8754088pfd.54.2020.05.04.01.51.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 01:51:12 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, Edwin Peer Subject: [PATCH net-next 08/15] bnxt_en: Improve kernel log messages related to ethtool reset. Date: Mon, 4 May 2020 04:50:34 -0400 Message-Id: <1588582241-31066-9-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1588582241-31066-1-git-send-email-michael.chan@broadcom.com> References: <1588582241-31066-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 From: Edwin Peer Kernel log messages for failed AP reset commands should be suppressed. These are expected to fail on devices that do not have an AP. Add missing driver reload message after AP reset and log it in a common way without duplication. Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 9937c21..ad68bc3 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1762,9 +1762,14 @@ static int bnxt_hwrm_firmware_reset(struct net_device *dev, u8 proc_type, req.selfrst_status = self_reset; req.flags = flags; - rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); - if (rc == -EACCES) - bnxt_print_admin_err(bp); + if (proc_type == FW_RESET_REQ_EMBEDDED_PROC_TYPE_AP) { + rc = hwrm_send_message_silent(bp, &req, sizeof(req), + HWRM_CMD_TIMEOUT); + } else { + rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); + if (rc == -EACCES) + bnxt_print_admin_err(bp); + } return rc; } @@ -2999,6 +3004,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, static int bnxt_reset(struct net_device *dev, u32 *flags) { struct bnxt *bp = netdev_priv(dev); + bool reload = false; u32 req = *flags; if (!req) @@ -3022,7 +3028,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) if (!bnxt_firmware_reset_chip(dev)) { netdev_info(dev, "Firmware reset request successful.\n"); if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) - netdev_info(dev, "Reload driver to complete reset\n"); + reload = true; *flags &= ~BNXT_FW_RESET_CHIP; } } else if (req == BNXT_FW_RESET_CHIP) { @@ -3035,6 +3041,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) if (bp->hwrm_spec_code >= 0x10803) { if (!bnxt_firmware_reset_ap(dev)) { netdev_info(dev, "Reset application processor successful.\n"); + reload = true; *flags &= ~BNXT_FW_RESET_AP; } } else if (req == BNXT_FW_RESET_AP) { @@ -3042,6 +3049,9 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) } } + if (reload) + netdev_info(dev, "Reload driver to complete reset\n"); + return 0; } From patchwork Mon May 4 08:50:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 219980 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 D8618C3A5A9 for ; Mon, 4 May 2020 08:51:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8F9C206D7 for ; Mon, 4 May 2020 08:51:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="E9SEz25x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728420AbgEDIvU (ORCPT ); Mon, 4 May 2020 04:51:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728415AbgEDIvR (ORCPT ); Mon, 4 May 2020 04:51:17 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65CC8C061A0E for ; Mon, 4 May 2020 01:51:17 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id f8so6532193plt.2 for ; Mon, 04 May 2020 01:51:17 -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=EH8UdflTRfBy2AyQLYxTrmA/gnhwcEfSvhyUrk6s5Ts=; b=E9SEz25xbfQ/YsSviu7dGkMi9qSnZlOSNKj9yi0CAUu86jgmfhWaIJTt8dxp7OtWNt ccGlCNsmH3jsswHZAVk/EukAcVhb2p23kJOrvxok4Flsy4bkHWXvgVec7s5wQV+TeDzE pla54icSXlbGrEL1uNWW9jC3wIX7tkm6tSZGo= 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=EH8UdflTRfBy2AyQLYxTrmA/gnhwcEfSvhyUrk6s5Ts=; b=HPOxHiuFZ8E9Y4L9RPN944vlNPGEtSPLWJg0XdIX81sNA7TkFHUvpYnQl0GS020wH/ b3WaXAvKOC/PQ0NOhmQkd/dMT1X+p4hbmXPGW5cbEEy22GGuYMYq8+20kdB4rd2527sj FNMlYlHTJ5X1awCliSGDMhA32Upo94oTCHlLatQBHSdc+gpCxiPJ3XypC7N4mAYFRxaC hFzepYZnoM1xepRFHEItDlbz6WGzMlPMOYS7yCfRfLuUhmxuZxsEg7+947/P9bqj/e5m vnR4ev6nPUzlrZrHD3/l/G4OQmUSzwgAp2mEA4xzZDIrOkUenczEzhGgwcT/LmJvsXtn V3ag== X-Gm-Message-State: AGi0PuZFLHUpYkYsuAlXgRkoCheWlNQZuI/enG2HI7DcKCS//Z0oCN0q pPPr+ZIOPPQjRCR8UH5vOaduWw== X-Google-Smtp-Source: APiQypKZCPqJ098Y5j4yYjuYV+Jj4Ivo2W3gf90jusvd8fQW/Pa5Ohg2fkOOcWHEQcNARWat13gfUA== X-Received: by 2002:a17:902:70c6:: with SMTP id l6mr15308973plt.31.1588582276935; Mon, 04 May 2020 01:51:16 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm8754088pfd.54.2020.05.04.01.51.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 01:51:16 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH net-next 10/15] bnxt_en: Set the db_offset on 57500 chips for the RDMA MSIX entries. Date: Mon, 4 May 2020 04:50:36 -0400 Message-Id: <1588582241-31066-11-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1588582241-31066-1-git-send-email-michael.chan@broadcom.com> References: <1588582241-31066-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 driver provides completion ring or NQ doorbell offset for each MSIX entry requested by the RDMA driver. The NQ offset on 57500 chips is different than legacy chips. Set it correctly based on chip type for correctness. The RDMA driver is ignoring this field for the 57500 chips so it is not causing any problem. Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index 4a316c4..4b40778 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -104,7 +104,13 @@ static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent) for (i = 0; i < num_msix; i++) { ent[i].vector = bp->irq_tbl[idx + i].vector; ent[i].ring_idx = idx + i; - ent[i].db_offset = (idx + i) * 0x80; + if (bp->flags & BNXT_FLAG_CHIP_P5) { + ent[i].db_offset = DB_PF_OFFSET_P5; + if (BNXT_VF(bp)) + ent[i].db_offset = DB_VF_OFFSET_P5; + } else { + ent[i].db_offset = (idx + i) * 0x80; + } } } From patchwork Mon May 4 08:50:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 219979 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 B2B9BC3A5A9 for ; Mon, 4 May 2020 08:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 937DB21655 for ; Mon, 4 May 2020 08:51:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="DF7ihhsC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728433AbgEDIvY (ORCPT ); Mon, 4 May 2020 04:51:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728422AbgEDIvV (ORCPT ); Mon, 4 May 2020 04:51:21 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7297C061A0E for ; Mon, 4 May 2020 01:51:21 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id mq3so3509561pjb.1 for ; Mon, 04 May 2020 01:51:21 -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=DlcHEeUPhljZuU6pyIa1Xdb30eTQ73mJQ0NrV1TD+NM=; b=DF7ihhsCXbiefNuEUxzHf3xu7ols7RHPjuynVmP2xsjSruh9UMx8NNxmu7KPbdZbgP u4Gi3hHsPwRzY9F2V5GZ6o9GUpKZAfEC0emGrCyNP5FwKaZRLR9R1MfRT+vDIxp4oGk9 JLoCY1e2Eup34TjRgq+9yVl8FuWv3JCu3zN/M= 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=DlcHEeUPhljZuU6pyIa1Xdb30eTQ73mJQ0NrV1TD+NM=; b=alwmrr7qiaoES0S4XSkebFEmqCQZKnT5rrYcch9/AWaGz+0Ia6oA3o1j/7kbZmTRvA DrxsJVbnsRTHPpLXqTPdIJENWyZiKtbdoKyBiUk8a1NL6IAlue8OS5Ja5D+K07gwBJGO ihJKa8IXP/RS+PSNt75zceZrxh9weL2BLlQ3w6J3x1F1/gdpuGis7LpI6OZlVDlO/WUZ Ec2tJViX3S/Fa9hMsb8N6bU5Kw6oNwBAj47YIJe2dn8tbimj+WFq9OpWhzcqf+T4Yr7J T9rKS8Y1eeflQKQWcdBzot11xHCgxKx649riNca+aIhWYvK15Hv510WhqneEoLLK9921 tMog== X-Gm-Message-State: AGi0PuaVBm72QAfAhXhci2HqtjBpQwg6wfH9mns/YDQAGirgMa7oB1jq 9vdxVkROYvnvpVHerPWgvej3rg== X-Google-Smtp-Source: APiQypI7f4Vz74N06fr4kSiSjf5OeL+Rt+1i3I1XEBZ0rh5SEoYmTX6fqiXJGaxQFkF7skRqXtX82A== X-Received: by 2002:a17:90a:2b8f:: with SMTP id u15mr16906406pjd.137.1588582281171; Mon, 04 May 2020 01:51:21 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm8754088pfd.54.2020.05.04.01.51.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 01:51:20 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH net-next 12/15] bnxt_en: Add doorbell information to bnxt_en_dev struct. Date: Mon, 4 May 2020 04:50:38 -0400 Message-Id: <1588582241-31066-13-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1588582241-31066-1-git-send-email-michael.chan@broadcom.com> References: <1588582241-31066-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 purpose of this is to inform the RDMA driver the size of the doorbell BAR that the L2 driver has mapped and the portion that is mapped uncacheable. The unchaeable portion is shared with the RoCE driver. Any remaining unmapped doorbell BAR can be used by the RDMA driver for its own purpose. Currently, the entire L2 portion is mapped uncacheable. Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 ++ drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index 4b40778..8c8368c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -481,6 +481,8 @@ struct bnxt_en_dev *bnxt_ulp_probe(struct net_device *dev) edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP; edev->net = dev; edev->pdev = bp->pdev; + edev->l2_db_size = bp->db_size; + edev->l2_db_size_nc = bp->db_size; bp->edev = edev; } return bp->edev; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index 9895406..6b4d255 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -67,6 +67,14 @@ struct bnxt_en_dev { #define BNXT_EN_FLAG_ULP_STOPPED 0x8 const struct bnxt_en_ops *en_ops; struct bnxt_ulp ulp_tbl[BNXT_MAX_ULP]; + int l2_db_size; /* Doorbell BAR size in + * bytes mapped by L2 + * driver. + */ + int l2_db_size_nc; /* Doorbell BAR size in + * bytes mapped as non- + * cacheable. + */ }; struct bnxt_en_ops { From patchwork Mon May 4 08:50:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 219978 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 BE4A3C3A5A9 for ; Mon, 4 May 2020 08:51:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9914E206D7 for ; Mon, 4 May 2020 08:51:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="gekN+Z0R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbgEDIva (ORCPT ); Mon, 4 May 2020 04:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728428AbgEDIv2 (ORCPT ); Mon, 4 May 2020 04:51:28 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DE20C061A0F for ; Mon, 4 May 2020 01:51:28 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id q124so8179771pgq.13 for ; Mon, 04 May 2020 01:51:28 -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=LRCDblSRJiI+h0s8c0CqbQk3dO/iqfIvOpiSibkp6xw=; b=gekN+Z0RiPRmNDWO9ZCOcTg3MVDslZenMzjG8/gOOpxbUVS0VUPmyznPo+5FLzvS8u rB4DaV1wEP+gCd0EU6SfOsQ6X0dyfhKus9D+miYle0DUqlm1Yzp63SblqfLOcjMQmlA0 feDjdHzcrvRWC6nudUPELKs6IXGh4M2NLZCco= 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=LRCDblSRJiI+h0s8c0CqbQk3dO/iqfIvOpiSibkp6xw=; b=cdvcKoWG1F7g5R13WEJvpzfOTmV89lCC+knEBKnjwXvvYh1ify3Z8+52L7SB+rKJWV yCvQVFuhEo7rXJvb81wEfeNXzCTqgUO+4AfPo0M1GPC3xM+iMygh1MweREBihZKzP8m0 JkLPq5uKVOInjG9a/PngacCAU9x+Cg06zKJtHOzZGhofV8IOMzx5wvIRJYquRWWGVr11 3g6fjue5mw4Jfa1q9oNa7pLpqUu+nMx/C6EpJsusEEmBsZ64TKBh6kRx8pvyQVJkK7Vv RudLnuEuSiJUP1sjyaRBCM+KXmiwTm+Mdqk3Dk9kTNScgH5fN2Rv9UVXQrnnHUQn8Qxh GZ8Q== X-Gm-Message-State: AGi0PuYRG2vtfQJWU957O+cn//IaeaGabo4Vz5ihJrXk9vcXSmiMw41u 0tJhLkJ+iUGgDMZzmMqkvroaacfWoys= X-Google-Smtp-Source: APiQypJw92N2QqyPxnlJS472l0mZQWCjHTFRk61GLM09WrJwc/2T1Q96Ru6uPNv/f8Oe0bdL2gK3Yw== X-Received: by 2002:a63:4446:: with SMTP id t6mr16000918pgk.450.1588582287445; Mon, 04 May 2020 01:51:27 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm8754088pfd.54.2020.05.04.01.51.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 01:51:27 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, Rajesh Ravi Subject: [PATCH net-next 15/15] bnxt_en: show only relevant ethtool stats for a TX or RX ring Date: Mon, 4 May 2020 04:50:41 -0400 Message-Id: <1588582241-31066-16-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1588582241-31066-1-git-send-email-michael.chan@broadcom.com> References: <1588582241-31066-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 From: Rajesh Ravi Currently, ethtool -S shows all TX/RX ring counters whether the channel is combined, RX, or TX. The unused counters will always be zero. Improve it by showing only the relevant counters if the channel is RX or TX. If the channel is combined, the counters will be shown exactly the same as before. [ MChan: Lots of cleanups and simplifications on Rajesh's original code] Signed-off-by: Rajesh Ravi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 93 +++++++++++++++++------ 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 85080f5..0752686 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -494,12 +494,20 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp) static int bnxt_get_num_ring_stats(struct bnxt *bp) { int rx, tx, cmn; + bool sh = false; + + if (bp->flags & BNXT_FLAG_SHARED_RINGS) + sh = true; rx = NUM_RING_RX_HW_STATS + NUM_RING_RX_SW_STATS + bnxt_get_num_tpa_ring_stats(bp); tx = NUM_RING_TX_HW_STATS; cmn = NUM_RING_CMN_SW_STATS; - return (rx + tx + cmn) * bp->cp_nr_rings; + if (sh) + return (rx + tx + cmn) * bp->cp_nr_rings; + else + return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + + cmn * bp->cp_nr_rings; } static int bnxt_get_num_stats(struct bnxt *bp) @@ -540,13 +548,29 @@ static int bnxt_get_sset_count(struct net_device *dev, int sset) } } +static bool is_rx_ring(struct bnxt *bp, int ring_num) +{ + return ring_num < bp->rx_nr_rings; +} + +static bool is_tx_ring(struct bnxt *bp, int ring_num) +{ + int tx_base = 0; + + if (!(bp->flags & BNXT_FLAG_SHARED_RINGS)) + tx_base = bp->rx_nr_rings; + + if (ring_num >= tx_base && ring_num < (tx_base + bp->tx_nr_rings)) + return true; + return false; +} + static void bnxt_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *buf) { u32 i, j = 0; struct bnxt *bp = netdev_priv(dev); - u32 stat_fields = NUM_RING_RX_HW_STATS + NUM_RING_TX_HW_STATS + - bnxt_get_num_tpa_ring_stats(bp); + u32 tpa_stats; if (!bp->bnapi) { j += bnxt_get_num_ring_stats(bp) + BNXT_NUM_SW_FUNC_STATS; @@ -556,6 +580,7 @@ static void bnxt_get_ethtool_stats(struct net_device *dev, for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i++) bnxt_sw_func_stats[i].counter = 0; + tpa_stats = bnxt_get_num_tpa_ring_stats(bp); for (i = 0; i < bp->cp_nr_rings; i++) { struct bnxt_napi *bnapi = bp->bnapi[i]; struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; @@ -563,12 +588,30 @@ static void bnxt_get_ethtool_stats(struct net_device *dev, u64 *sw; int k; - for (k = 0; k < stat_fields; j++, k++) + if (is_rx_ring(bp, i)) { + for (k = 0; k < NUM_RING_RX_HW_STATS; j++, k++) + buf[j] = le64_to_cpu(hw_stats[k]); + } + if (is_tx_ring(bp, i)) { + k = NUM_RING_RX_HW_STATS; + for (; k < NUM_RING_RX_HW_STATS + NUM_RING_TX_HW_STATS; + j++, k++) + buf[j] = le64_to_cpu(hw_stats[k]); + } + if (!tpa_stats || !is_rx_ring(bp, i)) + goto skip_tpa_ring_stats; + + k = NUM_RING_RX_HW_STATS + NUM_RING_TX_HW_STATS; + for (; k < NUM_RING_RX_HW_STATS + NUM_RING_TX_HW_STATS + + tpa_stats; j++, k++) buf[j] = le64_to_cpu(hw_stats[k]); +skip_tpa_ring_stats: sw = (u64 *)&cpr->sw_stats.rx; - for (k = 0; k < NUM_RING_RX_SW_STATS; j++, k++) - buf[j] = sw[k]; + if (is_rx_ring(bp, i)) { + for (k = 0; k < NUM_RING_RX_SW_STATS; j++, k++) + buf[j] = sw[k]; + } sw = (u64 *)&cpr->sw_stats.cmn; for (k = 0; k < NUM_RING_CMN_SW_STATS; j++, k++) @@ -650,20 +693,24 @@ static void bnxt_get_strings(struct net_device *dev, u32 stringset, u8 *buf) switch (stringset) { case ETH_SS_STATS: for (i = 0; i < bp->cp_nr_rings; i++) { - num_str = NUM_RING_RX_HW_STATS; - for (j = 0; j < num_str; j++) { - sprintf(buf, "[%d]: %s", i, - bnxt_ring_rx_stats_str[j]); - buf += ETH_GSTRING_LEN; + if (is_rx_ring(bp, i)) { + num_str = NUM_RING_RX_HW_STATS; + for (j = 0; j < num_str; j++) { + sprintf(buf, "[%d]: %s", i, + bnxt_ring_rx_stats_str[j]); + buf += ETH_GSTRING_LEN; + } } - num_str = NUM_RING_TX_HW_STATS; - for (j = 0; j < num_str; j++) { - sprintf(buf, "[%d]: %s", i, - bnxt_ring_tx_stats_str[j]); - buf += ETH_GSTRING_LEN; + if (is_tx_ring(bp, i)) { + num_str = NUM_RING_TX_HW_STATS; + for (j = 0; j < num_str; j++) { + sprintf(buf, "[%d]: %s", i, + bnxt_ring_tx_stats_str[j]); + buf += ETH_GSTRING_LEN; + } } num_str = bnxt_get_num_tpa_ring_stats(bp); - if (!num_str) + if (!num_str || !is_rx_ring(bp, i)) goto skip_tpa_stats; if (bp->max_tpa_v2) @@ -676,11 +723,13 @@ static void bnxt_get_strings(struct net_device *dev, u32 stringset, u8 *buf) buf += ETH_GSTRING_LEN; } skip_tpa_stats: - num_str = NUM_RING_RX_SW_STATS; - for (j = 0; j < num_str; j++) { - sprintf(buf, "[%d]: %s", i, - bnxt_rx_sw_stats_str[j]); - buf += ETH_GSTRING_LEN; + if (is_rx_ring(bp, i)) { + num_str = NUM_RING_RX_SW_STATS; + for (j = 0; j < num_str; j++) { + sprintf(buf, "[%d]: %s", i, + bnxt_rx_sw_stats_str[j]); + buf += ETH_GSTRING_LEN; + } } num_str = NUM_RING_CMN_SW_STATS; for (j = 0; j < num_str; j++) {