MCPcopy Create free account
hub / github.com/F-Stack/f-stack / parse_mp

Function parse_mp

dpdk/app/test-pmd/cmdline_flow.c:7996–8034  ·  view source on GitHub ↗

Parse tokens for meter policy action commands. */

Source from the content-addressed store, hash-verified

7994
7995/** Parse tokens for meter policy action commands. */
7996static int
7997parse_mp(struct context *ctx, const struct token *token,
7998 const char *str, unsigned int len,
7999 void *buf, unsigned int size)
8000{
8001 struct buffer *out = buf;
8002
8003 /* Token name must match. */
8004 if (parse_default(ctx, token, str, len, NULL, 0) < 0)
8005 return -1;
8006 /* Nothing else to do if there is no buffer. */
8007 if (!out)
8008 return len;
8009 if (!out->command) {
8010 if (ctx->curr != ITEM_POL_POLICY)
8011 return -1;
8012 if (sizeof(*out) > size)
8013 return -1;
8014 out->command = ctx->curr;
8015 ctx->objdata = 0;
8016 ctx->object = out;
8017 ctx->objmask = NULL;
8018 out->args.vc.data = (uint8_t *)out + size;
8019 return len;
8020 }
8021 switch (ctx->curr) {
8022 case ACTION_POL_G:
8023 out->args.vc.actions =
8024 (void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
8025 sizeof(double));
8026 out->command = ctx->curr;
8027 ctx->objdata = 0;
8028 ctx->object = out;
8029 ctx->objmask = NULL;
8030 return len;
8031 default:
8032 return -1;
8033 }
8034}
8035
8036/** Parse tokens for validate/create commands. */
8037static int

Callers

nothing calls this directly

Calls 1

parse_defaultFunction · 0.85

Tested by

no test coverage detected