Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2021 Marvell. 3 : : */ 4 : : #include <eal_export.h> 5 : : #include <rte_log.h> 6 : : #include <rte_tm_driver.h> 7 : : 8 : : #include "roc_api.h" 9 : : #include "roc_priv.h" 10 : : 11 : : #include "cnxk_utils.h" 12 : : 13 : : RTE_EXPORT_INTERNAL_SYMBOL(roc_nix_tm_err_to_rte_err) 14 : : int 15 : 0 : roc_nix_tm_err_to_rte_err(int errorcode) 16 : : { 17 : : int err_type; 18 : : 19 [ # # # # : 0 : switch (errorcode) { # # # # # # # # # ] 20 : : case NIX_ERR_TM_SHAPER_PKT_LEN_ADJUST: 21 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN; 22 : : break; 23 : 0 : case NIX_ERR_TM_INVALID_COMMIT_SZ: 24 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE; 25 : 0 : break; 26 : 0 : case NIX_ERR_TM_INVALID_COMMIT_RATE: 27 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE; 28 : 0 : break; 29 : 0 : case NIX_ERR_TM_INVALID_PEAK_SZ: 30 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE; 31 : 0 : break; 32 : 0 : case NIX_ERR_TM_INVALID_PEAK_RATE: 33 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE; 34 : 0 : break; 35 : 0 : case NIX_ERR_TM_INVALID_SHAPER_PROFILE: 36 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID; 37 : 0 : break; 38 : 0 : case NIX_ERR_TM_SHAPER_PROFILE_IN_USE: 39 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; 40 : 0 : break; 41 : 0 : case NIX_ERR_TM_INVALID_NODE: 42 : : err_type = RTE_TM_ERROR_TYPE_NODE_ID; 43 : 0 : break; 44 : 0 : case NIX_ERR_TM_PKT_MODE_MISMATCH: 45 : : err_type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID; 46 : 0 : break; 47 : 0 : case NIX_ERR_TM_INVALID_PARENT: 48 : : case NIX_ERR_TM_PARENT_PRIO_UPDATE: 49 : : err_type = RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID; 50 : 0 : break; 51 : 0 : case NIX_ERR_TM_PRIO_ORDER: 52 : : case NIX_ERR_TM_MULTIPLE_RR_GROUPS: 53 : : err_type = RTE_TM_ERROR_TYPE_NODE_PRIORITY; 54 : 0 : break; 55 : 0 : case NIX_ERR_TM_PRIO_EXCEEDED: 56 : : err_type = RTE_TM_ERROR_TYPE_CAPABILITIES; 57 : 0 : break; 58 : 0 : default: 59 : : /** 60 : : * Handle general error (as defined in linux errno.h) 61 : : */ 62 [ # # ]: 0 : if (abs(errorcode) < 300) 63 : : err_type = errorcode; 64 : : else 65 : : err_type = RTE_TM_ERROR_TYPE_UNSPECIFIED; 66 : : break; 67 : : } 68 : : 69 : 0 : return err_type; 70 : : }