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

Function cmd_mempool

dpdk/examples/ip_pipeline/cli.c:60–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58" cpu <cpu_id>\n";
59
60static void
61cmd_mempool(char **tokens,
62 uint32_t n_tokens,
63 char *out,
64 size_t out_size)
65{
66 struct mempool_params p;
67 char *name;
68 struct mempool *mempool;
69
70 if (n_tokens != 10) {
71 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
72 return;
73 }
74
75 name = tokens[1];
76
77 if (strcmp(tokens[2], "buffer") != 0) {
78 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "buffer");
79 return;
80 }
81
82 if (parser_read_uint32(&p.buffer_size, tokens[3]) != 0) {
83 snprintf(out, out_size, MSG_ARG_INVALID, "buffer_size");
84 return;
85 }
86
87 if (strcmp(tokens[4], "pool") != 0) {
88 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pool");
89 return;
90 }
91
92 if (parser_read_uint32(&p.pool_size, tokens[5]) != 0) {
93 snprintf(out, out_size, MSG_ARG_INVALID, "pool_size");
94 return;
95 }
96
97 if (strcmp(tokens[6], "cache") != 0) {
98 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cache");
99 return;
100 }
101
102 if (parser_read_uint32(&p.cache_size, tokens[7]) != 0) {
103 snprintf(out, out_size, MSG_ARG_INVALID, "cache_size");
104 return;
105 }
106
107 if (strcmp(tokens[8], "cpu") != 0) {
108 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cpu");
109 return;
110 }
111
112 if (parser_read_uint32(&p.cpu_id, tokens[9]) != 0) {
113 snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id");
114 return;
115 }
116
117 mempool = mempool_create(name, &p);

Callers 1

cli_processFunction · 0.70

Calls 4

snprintfFunction · 0.85
strcmpFunction · 0.85
mempool_createFunction · 0.85
parser_read_uint32Function · 0.70

Tested by

no test coverage detected