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

Function parse_table_entry

dpdk/examples/pipeline/cli.c:160–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160static struct rte_swx_table_entry *
161parse_table_entry(struct rte_swx_ctl_pipeline *p,
162 char *table_name,
163 char **tokens,
164 uint32_t n_tokens)
165{
166 struct rte_swx_table_entry *entry;
167 char *line;
168 uint32_t i;
169
170 /* Buffer allocation. */
171 line = malloc(MAX_LINE_SIZE);
172 if (!line)
173 return NULL;
174
175 /* Copy tokens to buffer. Since the tokens were initially part of a buffer of size
176 * MAX_LINE_LENGTH, it is guaranteed that putting back some of them into a buffer of the
177 * same size separated by a single space will not result in buffer overrun.
178 */
179 line[0] = 0;
180 for (i = 0; i < n_tokens; i++) {
181 if (i)
182 strcat(line, " ");
183
184 strcat(line, tokens[i]);
185 }
186
187 /* Read the table entry from the input buffer. */
188 entry = rte_swx_ctl_pipeline_table_entry_read(p, table_name, line, NULL);
189
190 /* Buffer free. */
191 free(line);
192
193 return entry;
194}
195
196static const char cmd_mempool_help[] =
197"mempool <mempool_name> "

Callers 5

cmd_pipeline_regrdFunction · 0.85
cmd_pipeline_regwrFunction · 0.85
cmd_pipeline_meter_resetFunction · 0.85
cmd_pipeline_meter_setFunction · 0.85
cmd_pipeline_meter_statsFunction · 0.85

Calls 4

mallocFunction · 0.85
strcatFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected