Display Meter Error Message */
| 21 | |
| 22 | /** Display Meter Error Message */ |
| 23 | static void |
| 24 | print_err_msg(struct rte_mtr_error *error) |
| 25 | { |
| 26 | static const char *const errstrlist[] = { |
| 27 | [RTE_MTR_ERROR_TYPE_NONE] = "no error", |
| 28 | [RTE_MTR_ERROR_TYPE_UNSPECIFIED] = "cause unspecified", |
| 29 | [RTE_MTR_ERROR_TYPE_METER_PROFILE_ID] = "meter profile id", |
| 30 | [RTE_MTR_ERROR_TYPE_METER_PROFILE] = "meter profile null", |
| 31 | [RTE_MTR_ERROR_TYPE_MTR_ID] = "meter id", |
| 32 | [RTE_MTR_ERROR_TYPE_MTR_PARAMS] = "meter params null", |
| 33 | [RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN] |
| 34 | = "policer action(green)", |
| 35 | [RTE_MTR_ERROR_TYPE_POLICER_ACTION_YELLOW] |
| 36 | = "policer action(yellow)", |
| 37 | [RTE_MTR_ERROR_TYPE_POLICER_ACTION_RED] |
| 38 | = "policer action(red)", |
| 39 | [RTE_MTR_ERROR_TYPE_STATS_MASK] = "stats mask", |
| 40 | [RTE_MTR_ERROR_TYPE_STATS] = "stats", |
| 41 | [RTE_MTR_ERROR_TYPE_SHARED] |
| 42 | = "shared meter", |
| 43 | [RTE_MTR_ERROR_TYPE_METER_POLICY_ID] = "meter policy id", |
| 44 | [RTE_MTR_ERROR_TYPE_METER_POLICY] = "meter policy null", |
| 45 | }; |
| 46 | |
| 47 | const char *errstr; |
| 48 | char buf[64]; |
| 49 | |
| 50 | if ((unsigned int)error->type >= RTE_DIM(errstrlist) || |
| 51 | !errstrlist[error->type]) |
| 52 | errstr = "unknown type"; |
| 53 | else |
| 54 | errstr = errstrlist[error->type]; |
| 55 | |
| 56 | if (error->cause) |
| 57 | snprintf(buf, sizeof(buf), "cause: %p, ", error->cause); |
| 58 | |
| 59 | fprintf(stderr, "%s: %s%s (error %d)\n", |
| 60 | errstr, error->cause ? buf : "", |
| 61 | error->message ? error->message : "(no stated reason)", |
| 62 | error->type); |
| 63 | } |
| 64 | |
| 65 | void |
| 66 | print_mtr_err_msg(struct rte_mtr_error *error) |
no test coverage detected