From patchwork Tue Nov 30 06:07:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Sekhar T K X-Patchwork-Id: 104771 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 54D88A0C58; Tue, 30 Nov 2021 07:09:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4175E40DF7; Tue, 30 Nov 2021 07:09:06 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7BC0F4068B for ; Tue, 30 Nov 2021 07:09:04 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1ATNsHTk026068 for ; Mon, 29 Nov 2021 22:09:03 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=JLLrV6h1X5R2upnTPkHAE+fcN9ILkZBWbDV1gs+hsWc=; b=HukX+vprKON1CpHAMGtBFkHtZ9iQiUAmSD8EFohsSQZsAs1H+uJdsMdv+WerLxL1Jb1M oEdsmmF70sJnJB00FsJst3NL5jexL/kGxPv4Amlk5z4Wpfh1pRHv9jlYIIiQDzvUB1It NusFxbJEATps5/DfF0d9fOqR8wSSdLd1JV5DoeZDwavUCrm8zFsaD2eMJvrmqzkKbJxX taXBx/k/W839YOSfh37+3uonpYX4ADBsQXvo+w1g4zOsHg0fapPODDwBGrBH6hchsxrR shnoJ3FI5mxTjqkoj3e8CjQX1cUPkCghN+IZOefW7UJ5W0fxciRnBLx1knOlrzd7lFec oA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3cn23wu3v6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 29 Nov 2021 22:09:03 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 29 Nov 2021 22:09:01 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 29 Nov 2021 22:09:01 -0800 Received: from lab-ci-142.marvell.com (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id 923D53F7073; Mon, 29 Nov 2021 22:08:58 -0800 (PST) From: Ashwin Sekhar T K To: CC: , , , , , , , , , Subject: [PATCH 1/3] common/cnxk: add support to wait for pool filling Date: Tue, 30 Nov 2021 11:37:00 +0530 Message-ID: <20211130060702.2697517-2-asekhar@marvell.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211130060702.2697517-1-asekhar@marvell.com> References: <20211130060702.2697517-1-asekhar@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: eEEUcgkucjtvdV-IdOzb1fg12A-I-Rs2 X-Proofpoint-GUID: eEEUcgkucjtvdV-IdOzb1fg12A-I-Rs2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-30_05,2021-11-28_01,2020-04-07_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add roc_npa_aura_op_available_wait() API which can be used to wait until an NPA pool gets filled up to a certain count of pointers. Signed-off-by: Ashwin Sekhar T K --- drivers/common/cnxk/roc_npa.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h index 46350fdb48..d05c5c4af4 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -155,6 +155,32 @@ roc_npa_aura_op_available(uint64_t aura_handle) return reg & 0xFFFFFFFFF; } +/* Wait for a given timeout, repeatedly checking whether the available + * pointers has reached the given count. Returns the available pointer + * count if it has reached the given count or if timeout has expired + */ +static inline uint32_t +roc_npa_aura_op_available_wait(uint64_t aura_handle, uint32_t count, + uint32_t tmo_ms) +{ +#define OP_AVAIL_WAIT_MS_DEFAULT (100) +#define OP_AVAIL_CHECK_INTERVAL_MS (1) + uint32_t op_avail; + int retry; + + tmo_ms = tmo_ms ? tmo_ms : OP_AVAIL_WAIT_MS_DEFAULT; + + retry = tmo_ms / OP_AVAIL_CHECK_INTERVAL_MS; + op_avail = roc_npa_aura_op_available(aura_handle); + while (retry && (op_avail < count)) { + plt_delay_ms(OP_AVAIL_CHECK_INTERVAL_MS); + op_avail = roc_npa_aura_op_available(aura_handle); + retry--; + } + + return op_avail; +} + static inline uint64_t roc_npa_pool_op_performance_counter(uint64_t aura_handle, const int drop) { From patchwork Tue Nov 30 06:07:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Sekhar T K X-Patchwork-Id: 104772 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4ECEDA0C58; Tue, 30 Nov 2021 07:09:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6B4D411AE; Tue, 30 Nov 2021 07:09:10 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E0CEC411CB for ; Tue, 30 Nov 2021 07:09:08 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1AU3fANb017736 for ; Mon, 29 Nov 2021 22:09:08 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=3IS5WPhG+UZr0WAA3vQL5kHl/NVPxgYNygwzkbFVq5g=; b=WYBeqcS9NNHxjVoMvsVPQovgq1xV+4x868OKyaGFQGsb5RZTW4eVwYC//Htd+eUlroGn Jqu1VHtpB9sAYM9TH0qznUBcHxbmZm7BOwdJ3fAYjIZ7sRj/82FenjUySc3GIiLWBsii Zz5oB5bcWGKYLiHesKfL6gL1kcIxl8DDRm0ciPUcLS+h0y3utwbhKN9o49jJ5ljyEURO 464Ut3/qf0xZwSDqdrh0wxA4RicOUrRtQkceyZauTn6NU5h7xFrQBkGBaRSkol8w14Cy W+i1+Or9nH0B1IxahKTt5M1HyP9hIoUzZMtbj6MZsd0EcSsc7mCQyJgHEA0cQC09+qLD pA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3cmtkpmsqr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 29 Nov 2021 22:09:08 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 29 Nov 2021 22:09:05 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 29 Nov 2021 22:09:06 -0800 Received: from lab-ci-142.marvell.com (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id 17E033F7073; Mon, 29 Nov 2021 22:09:02 -0800 (PST) From: Ashwin Sekhar T K To: CC: , , , , , , , , , Subject: [PATCH 2/3] common/cnxk: wait for sqb pool to fill Date: Tue, 30 Nov 2021 11:37:01 +0530 Message-ID: <20211130060702.2697517-3-asekhar@marvell.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211130060702.2697517-1-asekhar@marvell.com> References: <20211130060702.2697517-1-asekhar@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: bZ6Af05Ba9vwIG0z7F1W4RNHewX07Tz9 X-Proofpoint-ORIG-GUID: bZ6Af05Ba9vwIG0z7F1W4RNHewX07Tz9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-30_05,2021-11-28_01,2020-04-07_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Wait for SQB pool to get filled with the freed pointers before proceeding. Signed-off-by: Ashwin Sekhar T K --- drivers/common/cnxk/roc_nix_queue.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c index c8c8401d81..c638cd43e4 100644 --- a/drivers/common/cnxk/roc_nix_queue.c +++ b/drivers/common/cnxk/roc_nix_queue.c @@ -638,11 +638,21 @@ sqb_pool_populate(struct roc_nix *roc_nix, struct roc_nix_sq *sq) roc_npa_aura_op_free(sq->aura_handle, 0, iova); iova += blk_sz; } + + if (roc_npa_aura_op_available_wait(sq->aura_handle, NIX_MAX_SQB, 0) != + NIX_MAX_SQB) { + plt_err("Failed to free all pointers to the pool"); + rc = NIX_ERR_NO_MEM; + goto npa_fail; + } + roc_npa_aura_op_range_set(sq->aura_handle, (uint64_t)sq->sqe_mem, iova); roc_npa_aura_limit_modify(sq->aura_handle, sq->nb_sqb_bufs); sq->aura_sqb_bufs = NIX_MAX_SQB; return rc; +npa_fail: + plt_free(sq->sqe_mem); nomem: roc_npa_pool_destroy(sq->aura_handle); fail: From patchwork Tue Nov 30 06:07:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Sekhar T K X-Patchwork-Id: 104773 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BDF2A0C58; Tue, 30 Nov 2021 07:09:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0636411E6; Tue, 30 Nov 2021 07:09:14 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 247A24068B for ; Tue, 30 Nov 2021 07:09:12 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1ATNsHTl026068 for ; Mon, 29 Nov 2021 22:09:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=1HC9FHVz8iHAfOKttK8kEyv47ne3bOJgQryz0fQmkD4=; b=Kco0rwm+eoLPRD1wMocwJM0pDXUZoonxJNtKRI5LkIynrZodwj9awxQcPN6zHtoHiS6m lQXPw+SJfN2QcAjoSWPchlDYbKbEBT8iH56hOjqu4Ra3WVcBeLdYB4f0DajUxTt1Eux7 rHyr5skrSYc/cDuVK6e8EM/56HhfA+kIUo5QPineZzRwvRa8ajg6227pyVph3sTeZ9+b +hcvnRCRN8ikCso6DP9pyqgYC0XqWrMpWp9wGJkWqFJPpMl+9J6sEI9VDeHvREksk00M 0ziWMUFHCqV1/q1kZBU1geg1ScZgQvN/M80u+SYXdqfx42IlIycKD1yrXMiiflvw5XhY Yg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3cn23wu3w2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 29 Nov 2021 22:09:12 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 29 Nov 2021 22:09:10 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 29 Nov 2021 22:09:10 -0800 Received: from lab-ci-142.marvell.com (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id 8B3C05C68E1; Mon, 29 Nov 2021 22:09:07 -0800 (PST) From: Ashwin Sekhar T K To: CC: , , , , , , , , , Subject: [PATCH 3/3] common/cnxk: wait for xaq pool to fill Date: Tue, 30 Nov 2021 11:37:02 +0530 Message-ID: <20211130060702.2697517-4-asekhar@marvell.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211130060702.2697517-1-asekhar@marvell.com> References: <20211130060702.2697517-1-asekhar@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 3LTgJCl_1tshOMYC8NtiTsq5IqO0R7Gx X-Proofpoint-GUID: 3LTgJCl_1tshOMYC8NtiTsq5IqO0R7Gx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-30_05,2021-11-28_01,2020-04-07_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Wait for XAQ pool to get filled with the freed pointers before proceeding. Signed-off-by: Ashwin Sekhar T K --- drivers/common/cnxk/roc_sso.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c index 45ff16ca0e..c1aa3324be 100644 --- a/drivers/common/cnxk/roc_sso.c +++ b/drivers/common/cnxk/roc_sso.c @@ -453,6 +453,13 @@ sso_hwgrp_init_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq, } roc_npa_aura_op_range_set(xaq->aura_handle, (uint64_t)xaq->mem, iova); + if (roc_npa_aura_op_available_wait(xaq->aura_handle, xaq->nb_xaq, 0) != + xaq->nb_xaq) { + plt_err("Failed to free all pointers to the pool"); + rc = -ENOMEM; + goto npa_fill_fail; + } + /* When SW does addwork (enqueue) check if there is space in XAQ by * comparing fc_addr above against the xaq_lmt calculated below. * There should be a minimum headroom of 7 XAQs per HWGRP for SSO @@ -461,6 +468,8 @@ sso_hwgrp_init_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq, xaq->xaq_lmt = xaq->nb_xaq - (nb_hwgrp * SSO_XAQ_CACHE_CNT); return 0; +npa_fill_fail: + roc_npa_pool_destroy(xaq->aura_handle); npa_fail: plt_free(xaq->mem); free_fc: