| 357 | } |
| 358 | |
| 359 | static int |
| 360 | devargs_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); |
| 392 | err: |
| 393 | free(scratch); |
| 394 | if (*ret < 0) |
| 395 | DRV_LOG(ERR, "Invalid mlx5 class options: %s.\n", class_names); |
| 396 | return *ret; |
| 397 | } |
| 398 | |
| 399 | static int |
| 400 | parse_class_options(const struct rte_devargs *devargs, |
nothing calls this directly
no test coverage detected