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 00DEBA0C4C; Tue, 21 Sep 2021 08:41:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7621540DF7; Tue, 21 Sep 2021 08:41:45 +0200 (CEST) Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) by mails.dpdk.org (Postfix) with ESMTP id 1509E40683 for ; Tue, 21 Sep 2021 08:41:44 +0200 (CEST) Received: by mail-il1-f177.google.com with SMTP id x2so7024778ilm.2 for ; Mon, 20 Sep 2021 23:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/LG1wVu5Duaeu8W3dZNVKl2RRZCMnv5aixEyUFFPNNc=; b=E9hnSLyO3/KimTPBNLk0spmDAJ05tqEzXZMYwpEMZvJ4BCaY7cCnM+9UGyW1GLFI8U /NzoaXu/BLjVReacB0M2QQypHfeGDurWRg56nQaTKfiw1VDfHw54dPnD4Q9ELQ998XyX UvFilxXaoThq16du+zPCtso0bptaBeqDNm+oCLO2q0jyyj4a0iWyh55eLsiNTYoHLvsQ 83uJkZVHU5Uaa5aXcQQNcVNCr0Jcpy6DfhbZjtqIBrudequxNiQ3MsBQqhnLkgptgXwQ Nc9ZhO4Y4eVbA3ypgNDsaRLPhCC0/7+zV6DeROgG4I/dS0cP2oxXbHix9dfxfRp0W0E1 mgcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/LG1wVu5Duaeu8W3dZNVKl2RRZCMnv5aixEyUFFPNNc=; b=VurB5+UWAbvIdpvXtjx3rMp5x95l8fgILDpYM9NWX6UhtjnZqlmDruY2kF5hcTTAu3 S2WShWWbpK5ap1er6EcfqFPyKLdv4AgjhRoqjB8BW+fqP09Rx2D22E5NvCMo5xlGHumV W0yoagg34Z6crssYpdN95KOVUbv26JF0rln3DSkto3H25zFpsFCeRLfl0rr05lb5VFAM s1/kRRk9cNA6cwuv7eAKqtrST3s4VORhOog/cxAIYcfWiN5DdP/h/LAo23xhlgdsecBX gT0RMnzUfVNBnFSuzc21JoNE7af0A7GYnFoIXpMdjAJazjaZkpJpqLGP8vTTac0+infy vbLQ== X-Gm-Message-State: AOAM533GIMEWqFk8f1/3PuzlsoG7B2fbZFTyaorEKlwPX8COXh25nro6 MEdMRKhJAtwl6uZDF6liXn/+qNNKkeVktwkFYNE= X-Google-Smtp-Source: ABdhPJy3ijTPLMhAIr2khMo+KD73A5jGlaD8IWeerl08eJ4m8AAhJDqn4SW3XKgUa6yziVI8ZgPbUjak65J8JaoXrmc= X-Received: by 2002:a05:6e02:1d8b:: with SMTP id h11mr18741819ila.94.1632206503325; Mon, 20 Sep 2021 23:41:43 -0700 (PDT) MIME-Version: 1.0 References: <1630516236-10526-1-git-send-email-skoteshwar@marvell.com> <1631975519-30924-1-git-send-email-skoteshwar@marvell.com> <1631975519-30924-6-git-send-email-skoteshwar@marvell.com> In-Reply-To: <1631975519-30924-6-git-send-email-skoteshwar@marvell.com> From: Jerin Jacob Date: Tue, 21 Sep 2021 12:11:17 +0530 Message-ID: To: Satha Koteswara Rao Kottidi Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Ray Kinsella , dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2 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" On Sat, Sep 18, 2021 at 8:02 PM wrote: > > 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. Subject change suggestion: common/cnxk: support TM error type get > > 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 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 > +#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 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 >