Parse tokens for indirect action destroy command. */
| 7942 | |
| 7943 | /** Parse tokens for indirect action destroy command. */ |
| 7944 | static int |
| 7945 | parse_qia_destroy(struct context *ctx, const struct token *token, |
| 7946 | const char *str, unsigned int len, |
| 7947 | void *buf, unsigned int size) |
| 7948 | { |
| 7949 | struct buffer *out = buf; |
| 7950 | uint32_t *action_id; |
| 7951 | |
| 7952 | /* Token name must match. */ |
| 7953 | if (parse_default(ctx, token, str, len, NULL, 0) < 0) |
| 7954 | return -1; |
| 7955 | /* Nothing else to do if there is no buffer. */ |
| 7956 | if (!out) |
| 7957 | return len; |
| 7958 | if (!out->command || out->command == QUEUE) { |
| 7959 | if (ctx->curr != QUEUE_INDIRECT_ACTION_DESTROY) |
| 7960 | return -1; |
| 7961 | if (sizeof(*out) > size) |
| 7962 | return -1; |
| 7963 | out->command = ctx->curr; |
| 7964 | ctx->objdata = 0; |
| 7965 | ctx->object = out; |
| 7966 | ctx->objmask = NULL; |
| 7967 | out->args.ia_destroy.action_id = |
| 7968 | (void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1), |
| 7969 | sizeof(double)); |
| 7970 | return len; |
| 7971 | } |
| 7972 | switch (ctx->curr) { |
| 7973 | case QUEUE_INDIRECT_ACTION: |
| 7974 | out->command = ctx->curr; |
| 7975 | ctx->objdata = 0; |
| 7976 | ctx->object = out; |
| 7977 | ctx->objmask = NULL; |
| 7978 | return len; |
| 7979 | case QUEUE_INDIRECT_ACTION_DESTROY_ID: |
| 7980 | action_id = out->args.ia_destroy.action_id |
| 7981 | + out->args.ia_destroy.action_id_n++; |
| 7982 | if ((uint8_t *)action_id > (uint8_t *)out + size) |
| 7983 | return -1; |
| 7984 | ctx->objdata = 0; |
| 7985 | ctx->object = action_id; |
| 7986 | ctx->objmask = NULL; |
| 7987 | return len; |
| 7988 | case QUEUE_INDIRECT_ACTION_DESTROY_POSTPONE: |
| 7989 | return len; |
| 7990 | default: |
| 7991 | return -1; |
| 7992 | } |
| 7993 | } |
| 7994 | |
| 7995 | /** Parse tokens for meter policy action commands. */ |
| 7996 | static int |
nothing calls this directly
no test coverage detected