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

Function devargs_class_handler

dpdk/drivers/common/mlx5/mlx5_common.c:359–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359static int
360devargs_class_handler(__rte_unused const char *key,
361 const char *class_names, void *opaque)
362{
363 int *ret = opaque;
364 int class_val;
365 char *scratch;
366 char *found;
367 char *refstr = NULL;
368
369 *ret = 0;
370 scratch = strdup(class_names);
371 if (scratch == NULL) {
372 *ret = -ENOMEM;
373 return *ret;
374 }
375 found = strtok_r(scratch, ":", &refstr);
376 if (found == NULL)
377 /* Empty string. */
378 goto err;
379 do {
380 /* Extract each individual class name. Multiple
381 * classes can be supplied as class=net:regex:foo:bar.
382 */
383 class_val = class_name_to_value(found);
384 /* Check if its a valid class. */
385 if (class_val < 0) {
386 *ret = -EINVAL;
387 goto err;
388 }
389 *ret |= class_val;
390 found = strtok_r(NULL, ":", &refstr);
391 } while (found != NULL);
392err:
393 free(scratch);
394 if (*ret < 0)
395 DRV_LOG(ERR, "Invalid mlx5 class options: %s.\n", class_names);
396 return *ret;
397}
398
399static int
400parse_class_options(const struct rte_devargs *devargs,

Callers

nothing calls this directly

Calls 3

strdupFunction · 0.85
class_name_to_valueFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected