common/cnxk: support TM error type get
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> Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
This commit is contained in:
parent
680078faf3
commit
1a362d745d
68
drivers/common/cnxk/cnxk_utils.c
Normal file
68
drivers/common/cnxk/cnxk_utils.c
Normal file
@ -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;
|
||||
}
|
11
drivers/common/cnxk/cnxk_utils.h
Normal file
11
drivers/common/cnxk/cnxk_utils.h
Normal file
@ -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_ */
|
@ -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')
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user