* Parse ClassBench input trace (test vectors and expected results) file. * Expected format: * \ * */
| 481 | * <src_port> <space> <dst_port> <space> <proto> |
| 482 | */ |
| 483 | static int |
| 484 | parse_cb_ipv6_trace(char *str, struct ipv6_5tuple *v) |
| 485 | { |
| 486 | int32_t i, rc; |
| 487 | char *s, *sp, *in[CB_TRC_NUM]; |
| 488 | static const char *dlm = " \t\n"; |
| 489 | |
| 490 | s = str; |
| 491 | for (i = 0; i != RTE_DIM(in); i++) { |
| 492 | in[i] = strtok_r(s, dlm, &sp); |
| 493 | if (in[i] == NULL) |
| 494 | return -EINVAL; |
| 495 | s = NULL; |
| 496 | } |
| 497 | |
| 498 | /* get ip6 src address. */ |
| 499 | rc = parse_cb_ipv6_addr_trace(in[CB_TRC_SRC_ADDR], v->ip_src); |
| 500 | if (rc != 0) |
| 501 | return rc; |
| 502 | |
| 503 | /* get ip6 dst address. */ |
| 504 | rc = parse_cb_ipv6_addr_trace(in[CB_TRC_DST_ADDR], v->ip_dst); |
| 505 | if (rc != 0) |
| 506 | return rc; |
| 507 | |
| 508 | GET_CB_FIELD(in[CB_TRC_SRC_PORT], v->port_src, 0, UINT16_MAX, 0); |
| 509 | GET_CB_FIELD(in[CB_TRC_DST_PORT], v->port_dst, 0, UINT16_MAX, 0); |
| 510 | GET_CB_FIELD(in[CB_TRC_PROTO], v->proto, 0, UINT8_MAX, 0); |
| 511 | |
| 512 | /* convert to network byte order. */ |
| 513 | v->port_src = rte_cpu_to_be_16(v->port_src); |
| 514 | v->port_dst = rte_cpu_to_be_16(v->port_dst); |
| 515 | |
| 516 | return 0; |
| 517 | } |
| 518 | |
| 519 | /* Bypass comment and empty lines */ |
| 520 | static int |
no test coverage detected