From patchwork Tue Feb 20 23:03:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13564708 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 022146BB28 for ; Tue, 20 Feb 2024 23:03:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708470228; cv=none; b=OBOPbtVqjazRQhfIul4Tp+YyAEeUPq94MXr8ksjV8lxC0Xfh0OCi7NDZ6jSVah7hrkgxEBIpxLg3N7vlY6kIfFpP3fSF2TRXOxNOSHXY61yjoKkNsBAJGdQmQjm6/pxdZA+n91mc0LKe0xZqiXYf9mGtVAZdjzuHcL0AsYhTLak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708470228; c=relaxed/simple; bh=6GOt6H7SVTo94hFbm5zwOTF6m/HL36b0p4tigFqlCFE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=fhjRUelTQM6s6Rm66xo9IPpBsUkor6NUELSyZYL+xiIsm6REXrFf02d/AM5W5za8OeDGNyX5unkPdKEpfKHczJYUPUhYMZ9u9jUr4zVuWpbXp/0I4g0cmKeCHi8FjOVTbOCiUKpA6IPfkqYwfaCl97qWWmJsBDss0WD1umAOX20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=ZjI+5gVz; arc=none smtp.client-ip=209.85.222.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ZjI+5gVz" Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-787225a2addso291262685a.0 for ; Tue, 20 Feb 2024 15:03:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708470226; x=1709075026; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=boRa4w80Rwfxs/xjAoWVdjWsR4PWhA/YHrv6U+4Dt/0=; b=ZjI+5gVzrPLfnTPy0M2GOfUs5r5xmS2T/lgeKVcRg+5SJWlMs2wG7KbRdokZYnzQys dSWN4shf1q73m2NrYmGijdPRaTITNAQvXS51fZrzd44csQFuY2QN6nOASQrrKQp1Mx4N zL3jwluvJOa3fvIkHtt54J4M3wD6At6kSd3N4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708470226; x=1709075026; 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=boRa4w80Rwfxs/xjAoWVdjWsR4PWhA/YHrv6U+4Dt/0=; b=lF0WosL6buy+sc6dZoJoDI+A6pZm9fQEV0v78f8ujP7BhHd+gMZTbEfAwSQ6bhvqLD lmX594NB6tCb6O96rfbpKG5UYZjWjVpUeM3nN1SyXGgg++l3Hm0JQ7urW1OU2t4EYY8V 1EBHL1jH5ChFoXJqTXCidWiIYjhtA4J9WvawzBjSREbYvtsiaWuCHX/5AKofw3qsGrbx n8YrWL0DXBsuB49cU5sCNeJsVTwptpujHw7qCKtwXV8aevkk1Vqm00HEDiTD/XwqAR5n IRJ91o2GMB/t46OWJv9oG9YsO81Idf/ap14Q3eCHyX6Kyf4cQ16DRYs4K9gNnK2lrv4I 5zHg== X-Gm-Message-State: AOJu0YwBb9oc2Kd/PRVmiZAY4RE7A51IM8k9wvENsMfOUHJL3qoNW5IZ 3PiKGq4ndVD98p6TLeuSQw3XwKXKWWj+cHxneDBTBtT49+HwI6jIfma92AEuyovaL8GJiebUDOc = X-Google-Smtp-Source: AGHT+IHPznZts7lvEiYvPYCCfkU6Yq+dEL7zaVA1+y+dRCU8pKyW2YIk2rcQjzFfz3N51+VGv/6eCA== X-Received: by 2002:a05:620a:22a3:b0:787:80f1:3a91 with SMTP id p3-20020a05620a22a300b0078780f13a91mr1505710qkh.61.1708470225522; Tue, 20 Feb 2024 15:03:45 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id g10-20020ae9e10a000000b00785d7dda9easm3797966qkm.28.2024.02.20.15.03.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2024 15:03:45 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Ajit Khaparde Subject: [PATCH net-next 02/10] bnxt_en: Explicitly specify P5 completion rings to reserve Date: Tue, 20 Feb 2024 15:03:09 -0800 Message-Id: <20240220230317.96341-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240220230317.96341-1-michael.chan@broadcom.com> References: <20240220230317.96341-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The current code assumes that every RX ring group and every TX ring requires a completion ring on P5_PLUS chips. Now that we have the bnxt_hw_rings structure, add the cp_p5 field so that it can be explicitly specified. This makes the logic more clear. Reviewed-by: Ajit Khaparde Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 ++++++++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 4a30eff0791b..4f3d2b1c9989 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7114,7 +7114,7 @@ __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) enables |= hwr->stat ? FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { enables |= hwr->cp ? FUNC_CFG_REQ_ENABLES_NUM_MSIX : 0; - enables |= hwr->tx + hwr->grp ? + enables |= hwr->cp_p5 ? FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; enables |= hwr->rx ? FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; @@ -7131,7 +7131,7 @@ __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { u16 rss_ctx = bnxt_get_nr_rss_ctxs(bp, hwr->grp); - req->num_cmpl_rings = cpu_to_le16(hwr->tx + hwr->grp); + req->num_cmpl_rings = cpu_to_le16(hwr->cp_p5); req->num_msix = cpu_to_le16(hwr->cp); req->num_rsscos_ctxs = cpu_to_le16(rss_ctx); } else { @@ -7164,7 +7164,7 @@ __bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) FUNC_VF_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; enables |= hwr->stat ? FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { - enables |= hwr->tx + hwr->grp ? + enables |= hwr->cp_p5 ? FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; } else { enables |= hwr->cp ? FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; @@ -7180,7 +7180,7 @@ __bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { u16 rss_ctx = bnxt_get_nr_rss_ctxs(bp, hwr->grp); - req->num_cmpl_rings = cpu_to_le16(hwr->tx + hwr->grp); + req->num_cmpl_rings = cpu_to_le16(hwr->cp_p5); req->num_rsscos_ctxs = cpu_to_le16(rss_ctx); } else { req->num_cmpl_rings = cpu_to_le16(hwr->cp); @@ -7350,6 +7350,8 @@ static void bnxt_copy_reserved_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) if (BNXT_NEW_RM(bp)) { hwr->rx = hw_resc->resv_rx_rings; hwr->cp = hw_resc->resv_irqs; + if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) + hwr->cp_p5 = hw_resc->resv_cp_rings; hwr->grp = hw_resc->resv_hw_ring_grps; hwr->vnic = hw_resc->resv_vnics; hwr->stat = hw_resc->resv_stat_ctxs; @@ -7359,7 +7361,7 @@ static void bnxt_copy_reserved_rings(struct bnxt *bp, struct bnxt_hw_rings *hwr) static bool bnxt_rings_ok(struct bnxt *bp, struct bnxt_hw_rings *hwr) { return hwr->tx && hwr->rx && hwr->cp && hwr->grp && hwr->vnic && - hwr->stat; + hwr->stat && (hwr->cp_p5 || !(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)); } static int __bnxt_reserve_rings(struct bnxt *bp) @@ -7378,8 +7380,9 @@ static int __bnxt_reserve_rings(struct bnxt *bp) hwr.vnic = 1; if (bp->flags & BNXT_FLAG_SHARED_RINGS) sh = true; - if ((bp->flags & BNXT_FLAG_RFS) && - !(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)) + if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) + hwr.cp_p5 = hwr.rx + hwr.tx; + else if (bp->flags & BNXT_FLAG_RFS) hwr.vnic = hwr.rx + 1; if (bp->flags & BNXT_FLAG_AGG_RINGS) hwr.rx <<= 1; @@ -13326,6 +13329,8 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, hwr.cp += bnxt_get_ulp_msix_num(bp); hwr.stat += bnxt_get_ulp_stat_ctxs(bp); } + if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) + hwr.cp_p5 = hwr.tx + rx; return bnxt_hwrm_check_rings(bp, &hwr); } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index bb3b31f8d02f..681a579afcc2 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1259,6 +1259,7 @@ struct bnxt_hw_rings { int rx; int grp; int cp; + int cp_p5; int stat; int vnic; };