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>, Ray Kinsella <mdr@ashroe.eu>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 5/8] common/cnxk: handler to get rte tm error type
Date: Sat, 18 Sep 2021 10:31:55 -0400 [thread overview]
Message-ID: <1631975519-30924-6-git-send-email-skoteshwar@marvell.com> (raw)
In-Reply-To: <1631975519-30924-1-git-send-email-skoteshwar@marvell.com>
From: Satha Rao <skoteshwar@marvell.com>
Different TM handlers returns various platform specific errors,
this patch introduces new API to convert these internal error
types to RTE_TM* error types.
Also updated error message API with missed TM error types.
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
drivers/common/cnxk/cnxk_utils.c | 68 ++++++++++++++++++++++++++++++++++++++++
drivers/common/cnxk/cnxk_utils.h | 11 +++++++
drivers/common/cnxk/meson.build | 5 +++
drivers/common/cnxk/roc_utils.c | 6 ++++
drivers/common/cnxk/version.map | 1 +
5 files changed, 91 insertions(+)
create mode 100644 drivers/common/cnxk/cnxk_utils.c
create mode 100644 drivers/common/cnxk/cnxk_utils.h
diff --git a/drivers/common/cnxk/cnxk_utils.c b/drivers/common/cnxk/cnxk_utils.c
new file mode 100644
index 0000000..4e56adc
--- /dev/null
+++ b/drivers/common/cnxk/cnxk_utils.c
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#include <rte_log.h>
+#include <rte_tm_driver.h>
+
+#include "roc_api.h"
+#include "roc_priv.h"
+
+#include "cnxk_utils.h"
+
+int
+roc_nix_tm_err_to_rte_err(int errorcode)
+{
+ int err_type;
+
+ switch (errorcode) {
+ case NIX_ERR_TM_SHAPER_PKT_LEN_ADJUST:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN;
+ break;
+ case NIX_ERR_TM_INVALID_COMMIT_SZ:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE;
+ break;
+ case NIX_ERR_TM_INVALID_COMMIT_RATE:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE;
+ break;
+ case NIX_ERR_TM_INVALID_PEAK_SZ:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE;
+ break;
+ case NIX_ERR_TM_INVALID_PEAK_RATE:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE;
+ break;
+ case NIX_ERR_TM_INVALID_SHAPER_PROFILE:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+ break;
+ case NIX_ERR_TM_SHAPER_PROFILE_IN_USE:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
+ break;
+ case NIX_ERR_TM_INVALID_NODE:
+ err_type = RTE_TM_ERROR_TYPE_NODE_ID;
+ break;
+ case NIX_ERR_TM_PKT_MODE_MISMATCH:
+ err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+ break;
+ case NIX_ERR_TM_INVALID_PARENT:
+ case NIX_ERR_TM_PARENT_PRIO_UPDATE:
+ err_type = RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID;
+ break;
+ case NIX_ERR_TM_PRIO_ORDER:
+ case NIX_ERR_TM_MULTIPLE_RR_GROUPS:
+ err_type = RTE_TM_ERROR_TYPE_NODE_PRIORITY;
+ break;
+ case NIX_ERR_TM_PRIO_EXCEEDED:
+ err_type = RTE_TM_ERROR_TYPE_CAPABILITIES;
+ break;
+ default:
+ /**
+ * Handle general error (as defined in linux errno.h)
+ */
+ if (abs(errorcode) < 300)
+ err_type = errorcode;
+ else
+ err_type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
+ break;
+ }
+
+ return err_type;
+}
diff --git a/drivers/common/cnxk/cnxk_utils.h b/drivers/common/cnxk/cnxk_utils.h
new file mode 100644
index 0000000..5463cd4
--- /dev/null
+++ b/drivers/common/cnxk/cnxk_utils.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _CNXK_UTILS_H_
+#define _CNXK_UTILS_H_
+
+#include "roc_platform.h"
+
+int __roc_api roc_nix_tm_err_to_rte_err(int errorcode);
+
+#endif /* _CNXK_UTILS_H_ */
diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build
index 8a551d1..258429d 100644
--- a/drivers/common/cnxk/meson.build
+++ b/drivers/common/cnxk/meson.build
@@ -61,5 +61,10 @@ sources = files(
# Security common code
sources += files('cnxk_security.c')
+# common DPDK utilities code
+sources += files('cnxk_utils.c')
+
includes += include_directories('../../bus/pci')
includes += include_directories('../../../lib/net')
+includes += include_directories('../../../lib/ethdev')
+includes += include_directories('../../../lib/meter')
diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c
index 9cb8708..751486f 100644
--- a/drivers/common/cnxk/roc_utils.c
+++ b/drivers/common/cnxk/roc_utils.c
@@ -64,6 +64,9 @@
case NIX_ERR_TM_INVALID_SHAPER_PROFILE:
err_msg = "TM shaper profile invalid";
break;
+ case NIX_ERR_TM_PKT_MODE_MISMATCH:
+ err_msg = "shaper profile pkt mode mismatch";
+ break;
case NIX_ERR_TM_WEIGHT_EXCEED:
err_msg = "TM DWRR weight exceeded";
break;
@@ -88,6 +91,9 @@
case NIX_ERR_TM_SHAPER_PROFILE_EXISTS:
err_msg = "TM shaper profile exists";
break;
+ case NIX_ERR_TM_SHAPER_PKT_LEN_ADJUST:
+ err_msg = "length adjust invalid";
+ break;
case NIX_ERR_TM_INVALID_TREE:
err_msg = "TM tree invalid";
break;
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 388f938..776cabb 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -172,6 +172,7 @@ INTERNAL {
roc_nix_eeprom_info_get;
roc_nix_smq_flush;
roc_nix_tm_dump;
+ roc_nix_tm_err_to_rte_err;
roc_nix_tm_fini;
roc_nix_tm_free_resources;
roc_nix_tm_hierarchy_disable;
--
1.8.3.1
next prev parent reply other threads:[~2021-09-18 14:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 17:10 [dpdk-dev] [PATCH 1/8] common/cnxk: use different macros for sdp and lbk max frames skoteshwar
2021-09-01 17:10 ` [dpdk-dev] [PATCH 2/8] common/cnxk: flush smq skoteshwar
2021-09-01 17:10 ` [dpdk-dev] [PATCH 3/8] common/cnxk: increase sched weight and shaper burst limit skoteshwar
2021-09-01 17:10 ` [dpdk-dev] [PATCH 4/8] common/cnxk: handle packet mode shaper limits skoteshwar
2021-09-01 17:10 ` [dpdk-dev] [PATCH 5/8] common/cnxk: handler to get rte tm error type skoteshwar
2021-09-01 17:10 ` [dpdk-dev] [PATCH 6/8] common/cnxk: set of handlers to get tm hierarchy internals skoteshwar
2021-09-01 17:10 ` [dpdk-dev] [PATCH 7/8] net/cnxk: tm capabilities and queue rate limit handlers skoteshwar
2021-09-01 17:10 ` [dpdk-dev] [PATCH 8/8] net/cnxk: tm shaper and node operations skoteshwar
2021-09-16 7:17 ` [dpdk-dev] [PATCH 1/8] common/cnxk: use different macros for sdp and lbk max frames Jerin Jacob
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 0/8] Add TM Support for CN9K and CN10K skoteshwar
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 1/8] common/cnxk: use different macros for sdp and lbk max frames skoteshwar
2021-09-21 6:35 ` Jerin Jacob
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 2/8] common/cnxk: flush smq skoteshwar
2021-09-21 6:37 ` Jerin Jacob
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 3/8] common/cnxk: increase sched weight and shaper burst limit skoteshwar
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 4/8] common/cnxk: handle packet mode shaper limits skoteshwar
2021-09-18 14:31 ` skoteshwar [this message]
2021-09-21 6:41 ` [dpdk-dev] [PATCH v2 5/8] common/cnxk: handler to get rte tm error type Jerin Jacob
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 6/8] common/cnxk: set of handlers to get tm hierarchy internals skoteshwar
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 7/8] net/cnxk: tm capabilities and queue rate limit handlers skoteshwar
2021-09-21 6:43 ` Jerin Jacob
2021-09-18 14:31 ` [dpdk-dev] [PATCH v2 8/8] net/cnxk: tm shaper and node operations skoteshwar
2021-09-20 8:59 ` [dpdk-dev] [PATCH v2 0/8] Add TM Support for CN9K and CN10K nithind1988
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 " skoteshwar
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 1/8] common/cnxk: set appropriate max frame size for SDP and LBK skoteshwar
2021-09-27 13:29 ` Jerin Jacob
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 2/8] common/cnxk: support SMQ flush skoteshwar
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 3/8] common/cnxk: increase sched weight and shaper burst limit skoteshwar
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 4/8] common/cnxk: handle packet mode shaper limits skoteshwar
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 5/8] common/cnxk: support TM error type get skoteshwar
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 6/8] common/cnxk: set of handlers to get TM hierarchy internals skoteshwar
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 7/8] net/cnxk: TM capabilities and queue rate limit handlers skoteshwar
2021-09-22 6:11 ` [dpdk-dev] [PATCH v3 8/8] net/cnxk: TM shaper and node operations skoteshwar
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=1631975519-30924-6-git-send-email-skoteshwar@marvell.com \
--to=skoteshwar@marvell.com \
--cc=dev@dpdk.org \
--cc=kirankumark@marvell.com \
--cc=mdr@ashroe.eu \
--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).