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