From: <skoteshwar@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 3/3] common/cnxk: check SQ node before setting bp config
Date: Thu, 24 Feb 2022 04:57:51 -0500 [thread overview]
Message-ID: <1645696672-5518-3-git-send-email-skoteshwar@marvell.com> (raw)
In-Reply-To: <1645696672-5518-1-git-send-email-skoteshwar@marvell.com>
From: Satha Rao <skoteshwar@marvell.com>
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 <skoteshwar@marvell.com>
---
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
next prev parent reply other threads:[~2022-02-24 9:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 9:57 [PATCH 1/3] common/cnxk: enable packet marking skoteshwar
2022-02-24 9:57 ` [PATCH 2/3] net/cnxk: event/cnxk: enable packet marking callbacks skoteshwar
2022-02-24 9:57 ` skoteshwar [this message]
2022-02-24 19:36 ` [PATCH 1/3] common/cnxk: enable packet marking Jerin Jacob
2022-02-25 4:59 ` [PATCH v2 " skoteshwar
2022-02-25 4:59 ` [PATCH v2 2/3] net/cnxk: event/cnxk: enable packet marking callbacks skoteshwar
2022-02-25 4:59 ` [PATCH v2 3/3] common/cnxk: check SQ node before setting bp config skoteshwar
2022-02-25 7:48 ` [PATCH v2 1/3] common/cnxk: enable packet marking Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1645696672-5518-3-git-send-email-skoteshwar@marvell.com \
--to=skoteshwar@marvell.com \
--cc=dev@dpdk.org \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).