parse ops data entry (there can be more than 1 input entry, each will be * contained in a separate op_data_buf struct) */
| 450 | * contained in a separate op_data_buf struct) |
| 451 | */ |
| 452 | static int |
| 453 | parse_data_entry(const char *key_token, char *token, |
| 454 | struct test_bbdev_vector *vector, enum op_data_type type, |
| 455 | const char *prefix) |
| 456 | { |
| 457 | int ret; |
| 458 | uint32_t data_length = 0; |
| 459 | uint32_t *data = NULL; |
| 460 | unsigned int id; |
| 461 | struct op_data_buf *op_data; |
| 462 | unsigned int *nb_ops; |
| 463 | |
| 464 | if (type >= DATA_NUM_TYPES) { |
| 465 | printf("Unknown op type: %d!\n", type); |
| 466 | return -1; |
| 467 | } |
| 468 | |
| 469 | op_data = vector->entries[type].segments; |
| 470 | nb_ops = &vector->entries[type].nb_segments; |
| 471 | |
| 472 | if (*nb_ops >= RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) { |
| 473 | printf("Too many segments (code blocks defined): %u, max %d!\n", |
| 474 | *nb_ops, RTE_BBDEV_TURBO_MAX_CODE_BLOCKS); |
| 475 | return -1; |
| 476 | } |
| 477 | |
| 478 | if (sscanf(key_token + strlen(prefix), "%u", &id) != 1) { |
| 479 | printf("Missing ID of %s\n", prefix); |
| 480 | return -1; |
| 481 | } |
| 482 | if (id != *nb_ops) { |
| 483 | printf( |
| 484 | "Please order data entries sequentially, i.e. %s0, %s1, ...\n", |
| 485 | prefix, prefix); |
| 486 | return -1; |
| 487 | } |
| 488 | |
| 489 | /* Clear new op data struct */ |
| 490 | memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf)); |
| 491 | |
| 492 | ret = parse_values(token, &data, &data_length); |
| 493 | if (!ret) { |
| 494 | op_data[*nb_ops].addr = data; |
| 495 | op_data[*nb_ops].length = data_length; |
| 496 | ++(*nb_ops); |
| 497 | } |
| 498 | |
| 499 | return ret; |
| 500 | } |
| 501 | |
| 502 | /* parses turbo decoder parameters and assigns to global variable */ |
| 503 | static int |
no test coverage detected