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 277A5A0C56; Wed, 1 Sep 2021 19:11:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FF8E41142; Wed, 1 Sep 2021 19:11:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 2726741137 for ; Wed, 1 Sep 2021 19:11:20 +0200 (CEST) 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 SMTP id 181EgUUA026661; Wed, 1 Sep 2021 10:11:18 -0700 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=KB3e49kD5vSbqpZkkftw9YAz80m+ELkwiiQJfzqtk/E=; b=PDUp0jhOOmfCXaS6BRAcMT6XneDsGHPeOFzlcOpCxCFuhcR3UhgORyVJkFGsbxWE16XW YBv/c09c5vdkACpZthjjvXYRk0ZOK0MMDmcaGqxkqao2lmco7Al+gJa4gL7S5yRPcM67 0S4BHhCRPVNvd3TY+o/0tSsBhI0udbBc3N0oOwDfAEoFERxKfgzGAnIMEJqmFHUEZ8Fg xDeFdt0zVfbbeffVOlMnp6a8TCK30rNxhB/Az/z51x4jHZKY28nBnWymGuzEXrdbrJDc GFYXmQt8gu/6AY/IaQqCpqfFJDc549tHzgpRDr8v8v9CHJRgJOAfDdFx68SSy5dJ5lR9 aA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3at34ptvtc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 01 Sep 2021 10:11:17 -0700 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.18; Wed, 1 Sep 2021 10:11:16 -0700 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; Wed, 1 Sep 2021 10:11:16 -0700 Received: from cavium.marvell.com (cavium.marvell.com [10.28.34.244]) by maili.marvell.com (Postfix) with ESMTP id B099F3F7071; Wed, 1 Sep 2021 10:11:14 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: Date: Wed, 1 Sep 2021 13:10:33 -0400 Message-ID: <1630516236-10526-5-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1630516236-10526-1-git-send-email-skoteshwar@marvell.com> References: <1630516236-10526-1-git-send-email-skoteshwar@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: hjyN_ykhEayUqe4KslBFtfZi9U5fui7P X-Proofpoint-GUID: hjyN_ykhEayUqe4KslBFtfZi9U5fui7P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-01_05,2021-09-01_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH 5/8] common/cnxk: handler to get rte tm error type 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 Sender: "dev" From: Satha Rao 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 --- 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 0000000000..4e56adc659 --- /dev/null +++ b/drivers/common/cnxk/cnxk_utils.c @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2021 Marvell. + */ +#include +#include + +#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 0000000000..5463cd49c4 --- /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 6a7849f31c..3a0399dffa 100644 --- a/drivers/common/cnxk/meson.build +++ b/drivers/common/cnxk/meson.build @@ -60,5 +60,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 9cb8708a74..751486f503 100644 --- a/drivers/common/cnxk/roc_utils.c +++ b/drivers/common/cnxk/roc_utils.c @@ -64,6 +64,9 @@ roc_error_msg_get(int errorcode) 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 @@ roc_error_msg_get(int errorcode) 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 6705d13edf..dc739b573d 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -167,6 +167,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; -- 2.25.1