From patchwork Tue Dec 12 00:51:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488261 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="JSC3i7Pf" Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EF14A6 for ; Mon, 11 Dec 2023 16:51:53 -0800 (PST) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-77f8308616eso37643185a.2 for ; Mon, 11 Dec 2023 16:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342312; x=1702947112; 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=WguqJFGGFl7e8875DmHuLLtOdnq7eY2Vkwa0CIPYSw0=; b=JSC3i7Pfd3KJu9dEAmpxma/oWAzHuSpI+MXn8jb7l8ceUbu63QEJ6KzUW1qVM0SWEk U+vHNcXyZlcT2NUcG1D9c5jKliMx2PeGZQmoRs6ZsOygMLVFvktZcvFHCJdOLPmC4zQt J0PCKY6djSjSKk/gCunz2PyEO4P9iwDgqxVPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342312; x=1702947112; 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=WguqJFGGFl7e8875DmHuLLtOdnq7eY2Vkwa0CIPYSw0=; b=fY7d+I07B05DtQsU3AFkE4hYAyKcLqBAMl7NWZKrfnNrJRtNYXK6KgVHhirBvPn2Dr aOS40KgM81yrMHYoqz38kMJ2Fv6r2tGm642Bf7oK7XOsvqqeBAmidUk8wYic1NlFeXZ4 TX7CHeCdevFeq2WurRfhD0MrmhQhIEpwJSk9uI1Z8gyeIiNFMDa2RXCeFv8LF75Hek78 U8nWuHxYJzYjFDbnAVcAsgdzmAh/zAUxeqhVByL7XxKKkQZptYfGq76j/yl16NZJXLVM 75z25HhwLGX5Sr8u7w0+pZ8DVH8B3SLZSS9TaOQmvnGEp9R6CfGxs+b/CRlpB7+7fEzQ fqug== X-Gm-Message-State: AOJu0Yywu0YsXIXZQ26plJ43oOWV5JmzQ3JPvlwM5GxaYmFpx+49Ae6e ni5d/n6ocSB37Uyhz2M6r0kC4A== X-Google-Smtp-Source: AGHT+IGCcVHzuu8NbMCKMPE5+Zp/cwi4JFvU1qtrzIP7uPdR+nYxOsKaRqccvq1WWQ598YO0pxgPNw== X-Received: by 2002:a05:622a:64a:b0:425:9d55:e9f5 with SMTP id a10-20020a05622a064a00b004259d55e9f5mr8564026qtb.75.1702342312259; Mon, 11 Dec 2023 16:51:52 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:51 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, Selvin Xavier Subject: [PATCH net-next 06/13] bnxt_en: Allocate extra QP backing store memory when RoCE FW reports it Date: Mon, 11 Dec 2023 16:51:15 -0800 Message-Id: <20231212005122.2401-7-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 From: Selvin Xavier The Fast QP modify destroy RoCE feature requires additional QP entries in QP context backing store. FW reports the extra count to be allocated during backing store query. Use this value and allocate extra memory. Note that this works for both the V1 and V1 backing store FW APIs. Signed-off-by: Selvin Xavier Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 72e2bd4611de..42a52ee8c1bc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7535,6 +7535,7 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp) ctxm->max_entries = le32_to_cpu(resp->qp_max_entries); ctxm->qp_qp1_entries = le16_to_cpu(resp->qp_min_qp1_entries); ctxm->qp_l2_entries = le16_to_cpu(resp->qp_max_l2_entries); + ctxm->qp_fast_qpmd_entries = le16_to_cpu(resp->fast_qpmd_qp_num_entries); ctxm->entry_size = le16_to_cpu(resp->qp_entry_size); bnxt_init_ctx_initializer(ctxm, init_val, resp->qp_init_offset, (init_mask & (1 << init_idx++)) != 0); @@ -7672,6 +7673,9 @@ static int bnxt_hwrm_func_backing_store_cfg(struct bnxt *bp, u32 enables) bnxt_hwrm_set_pg_attr(&ctx_pg->ring_mem, &req->qpc_pg_size_qpc_lvl, &req->qpc_page_dir); + + if (enables & FUNC_BACKING_STORE_CFG_REQ_ENABLES_QP_FAST_QPMD) + req->qp_num_fast_qpmd_entries = cpu_to_le16(ctxm->qp_fast_qpmd_entries); } if (enables & FUNC_BACKING_STORE_CFG_REQ_ENABLES_SRQ) { ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; @@ -8004,6 +8008,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) u32 num_mr, num_ah; u32 extra_srqs = 0; u32 extra_qps = 0; + u32 fast_qpmd_qps; u8 pg_lvl = 1; int i, rc; @@ -8020,14 +8025,20 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; l2_qps = ctxm->qp_l2_entries; qp1_qps = ctxm->qp_qp1_entries; + fast_qpmd_qps = ctxm->qp_fast_qpmd_entries; max_qps = ctxm->max_entries; ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; srqs = ctxm->srq_l2_entries; max_srqs = ctxm->max_entries; + ena = 0; if ((bp->flags & BNXT_FLAG_ROCE_CAP) && !is_kdump_kernel()) { pg_lvl = 2; extra_qps = min_t(u32, 65536, max_qps - l2_qps - qp1_qps); + /* allocate extra qps if fw supports RoCE fast qp destroy feature */ + extra_qps += fast_qpmd_qps; extra_srqs = min_t(u32, 8192, max_srqs - srqs); + if (fast_qpmd_qps) + ena |= FUNC_BACKING_STORE_CFG_REQ_ENABLES_QP_FAST_QPMD; } ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; @@ -8057,7 +8068,6 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) if (rc) return rc; - ena = 0; if (!(bp->flags & BNXT_FLAG_ROCE_CAP)) goto skip_rdma; @@ -8074,7 +8084,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, num_mr + num_ah, 2); if (rc) return rc; - ena = FUNC_BACKING_STORE_CFG_REQ_ENABLES_MRAV; + ena |= FUNC_BACKING_STORE_CFG_REQ_ENABLES_MRAV; ctxm = &ctx->ctx_arr[BNXT_CTX_TIM]; rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, l2_qps + qp1_qps + extra_qps, 1);