From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC6A0C433EF for ; Wed, 22 Sep 2021 06:12:55 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 9A8F860F48 for ; Wed, 22 Sep 2021 06:12:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9A8F860F48 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB6E5411B5; Wed, 22 Sep 2021 08:12:36 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 33CB141184 for ; Wed, 22 Sep 2021 08:12:29 +0200 (CEST) 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 SMTP id 18LLFpF0022454; Tue, 21 Sep 2021 23:12:23 -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=hEl5MqErsPmpC9ACqbOTc1//5alCbPwdcPif4NZLfA4=; b=fotvsnd2FO4l+YBEID0BbjimZKhdIKtFy0xxGB3kpxnVmO088E5HsvbqXWusOMauH1dn 3n9wlHxaKnDoC74btgTlfdM1K6KoSdo86+Wd60c0dDlMv9eXfu0trzPa1s1wJ57O4qmp +ah4rpGexbfDVjcJV6WHcx4m0PvgOR18cp/UyL66wUzII4TER4ZhiLYO+JwnzxPceWuy gnMfmt1RaPQ8shl6GZ1VlM+mt2uv9Ep0RQ6aWJm3sdzMaa8xfa89qkTDKiITddA7BgN0 OO2t0f0mZTM5U9juTc88G9QA7ykY1fGA7B4+4xm1F5qjqI1glnaeiw29QVizYthxJxFz Cg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3b7q5dhe7g-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 21 Sep 2021 23:12:23 -0700 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.18; Tue, 21 Sep 2021 23:12:10 -0700 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.18 via Frontend Transport; Tue, 21 Sep 2021 23:12:10 -0700 Received: from cavium.marvell.com (cavium.marvell.com [10.28.34.244]) by maili.marvell.com (Postfix) with ESMTP id 0C3973F7078; Tue, 21 Sep 2021 23:12:08 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: Date: Wed, 22 Sep 2021 02:11:45 -0400 Message-ID: <1632291108-28780-6-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1632291108-28780-1-git-send-email-skoteshwar@marvell.com> References: <1630516236-10526-1-git-send-email-skoteshwar@marvell.com> <1632291108-28780-1-git-send-email-skoteshwar@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: ngM-k3lAQj441Q6l8yJP6c1DJ_Siefus X-Proofpoint-ORIG-GUID: ngM-k3lAQj441Q6l8yJP6c1DJ_Siefus 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-22_01,2021-09-20_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v3 5/8] common/cnxk: support TM error type get 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 Acked-by: Nithin Dabilpuram --- 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 8a551d15d6..258429d54b 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 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 388f9385e0..776cabbdef 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; -- 2.25.1