From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81542A0353; Thu, 24 Feb 2022 10:58:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F132F411FB; Thu, 24 Feb 2022 10:58:42 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A727D4114D for ; Thu, 24 Feb 2022 10:58:41 +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 21O6TbVk024224 for ; Thu, 24 Feb 2022 01:58:41 -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-type; s=pfpt0220; bh=1OVS+Iw8f3KtM+GTtQiYC31qoC9q6L1z+DV+dlvunds=; b=SgXHBCo8cO5i6+H8M6etSTu0dOp5A9DUpp6wlUD1gl24xMJd+fyfS4ee6PU5OC+APRW9 uDnykVHNz9aYXa+5fXUR6hIhci7wA76r/cidwNBzaoiHJAyzkZa+4mCxnN+Leu0CZGRJ 8Qf+MXkhXtBVZN93ckL/lNxARQ3deoznav1Xv4MbEHcitBtl6nSW5HOfAjrRxq9BVTxu mmYz0XMqoAUT8z+uAE1oJISjmtACKsCwBLnZu4KqJVF6oX6fBQC7oZKfwnGtA7ZwvE2E 3NGwVGuP/eaTBjZrpo5Vxn5UY1NPPdqSr9KBH2J5WViquuPBEWDNNpChq+qgZtrNcApW 1Q== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3edjernwtr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 24 Feb 2022 01:58:41 -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; Thu, 24 Feb 2022 01:58:38 -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; Thu, 24 Feb 2022 01:58:39 -0800 Received: from cavium.localdomain (unknown [10.28.34.26]) by maili.marvell.com (Postfix) with ESMTP id 371573F70A5; Thu, 24 Feb 2022 01:58:36 -0800 (PST) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: Subject: [PATCH 3/3] common/cnxk: check SQ node before setting bp config Date: Thu, 24 Feb 2022 04:57:51 -0500 Message-ID: <1645696672-5518-3-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645696672-5518-1-git-send-email-skoteshwar@marvell.com> References: <1645696672-5518-1-git-send-email-skoteshwar@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: CB4gxpq7BtQlyB24JG7JH4M3poWYBL7P X-Proofpoint-GUID: CB4gxpq7BtQlyB24JG7JH4M3poWYBL7P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-02-24_01,2022-02-23_01,2022-02-23_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 From: Satha Rao Validate sq_node and parent before accessing their fields. SQ was created without any associated TM node, this is valid negative case, so return success while stopping TM without SQ node. Signed-off-by: Satha Rao --- drivers/common/cnxk/roc_nix_tm.c | 8 ++++++-- drivers/common/cnxk/roc_nix_tm_ops.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c index 5b23ecd..7a17780 100644 --- a/drivers/common/cnxk/roc_nix_tm.c +++ b/drivers/common/cnxk/roc_nix_tm.c @@ -325,14 +325,17 @@ struct mbox *mbox = (&nix->dev)->mbox; struct nix_txschq_config *req = NULL; struct nix_tm_node_list *list; + uint16_t link = nix->tx_link; struct nix_tm_node *sq_node; struct nix_tm_node *parent; struct nix_tm_node *node; uint8_t k = 0; - uint16_t link; int rc = 0; sq_node = nix_tm_node_search(nix, sq, nix->tm_tree); + if (!sq_node) + return -ENOENT; + parent = sq_node->parent; while (parent) { if (parent->lvl == ROC_TM_LVL_SCH2) @@ -340,9 +343,10 @@ parent = parent->parent; } + if (!parent) + return -ENOENT; list = nix_tm_node_list(nix, tree); - link = nix->tx_link; if (parent->rel_chan != NIX_TM_CHAN_INVALID && parent->rel_chan != tc) { rc = -EINVAL; diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c index 5a25b3e..1d9a02b 100644 --- a/drivers/common/cnxk/roc_nix_tm_ops.c +++ b/drivers/common/cnxk/roc_nix_tm_ops.c @@ -474,7 +474,7 @@ continue; rc = nix_tm_bp_config_set(roc_nix, sq->qid, 0, false); - if (rc) { + if (rc && rc != -ENOENT) { plt_err("Failed to disable backpressure, rc=%d", rc); goto cleanup; } -- 1.8.3.1