| 540 | static uint64_t start; |
| 541 | |
| 542 | static inline int |
| 543 | poll_burst(void *args) |
| 544 | { |
| 545 | #define MAX_IDLE (10000) |
| 546 | unsigned lcore_id; |
| 547 | struct rte_mbuf **pkts_burst; |
| 548 | uint64_t diff_tsc, cur_tsc; |
| 549 | uint16_t next[RTE_MAX_ETHPORTS]; |
| 550 | struct lcore_conf *conf; |
| 551 | uint32_t pkt_per_port = *((uint32_t *)args); |
| 552 | unsigned i, portid, nb_rx = 0; |
| 553 | uint64_t total; |
| 554 | uint64_t timeout = MAX_IDLE; |
| 555 | int num[RTE_MAX_ETHPORTS]; |
| 556 | |
| 557 | lcore_id = rte_lcore_id(); |
| 558 | conf = &lcore_conf[lcore_id]; |
| 559 | if (conf->status != LCORE_USED) |
| 560 | return 0; |
| 561 | |
| 562 | total = pkt_per_port * conf->nb_ports; |
| 563 | printf("start to receive total expect %"PRIu64"\n", total); |
| 564 | |
| 565 | pkts_burst = (struct rte_mbuf **) |
| 566 | rte_calloc_socket("poll_burst", |
| 567 | total, sizeof(void *), |
| 568 | RTE_CACHE_LINE_SIZE, conf->socketid); |
| 569 | if (!pkts_burst) |
| 570 | return -1; |
| 571 | |
| 572 | for (i = 0; i < conf->nb_ports; i++) { |
| 573 | portid = conf->portlist[i]; |
| 574 | next[portid] = i * pkt_per_port; |
| 575 | num[portid] = pkt_per_port; |
| 576 | } |
| 577 | |
| 578 | rte_wait_until_equal_64(&start, 1, __ATOMIC_ACQUIRE); |
| 579 | |
| 580 | cur_tsc = rte_rdtsc(); |
| 581 | while (total) { |
| 582 | for (i = 0; i < conf->nb_ports; i++) { |
| 583 | portid = conf->portlist[i]; |
| 584 | nb_rx = rte_eth_rx_burst(portid, 0, |
| 585 | &pkts_burst[next[portid]], |
| 586 | RTE_MIN(MAX_PKT_BURST, num[portid])); |
| 587 | if (unlikely(nb_rx == 0)) { |
| 588 | timeout--; |
| 589 | if (unlikely(timeout == 0)) |
| 590 | goto timeout; |
| 591 | continue; |
| 592 | } |
| 593 | next[portid] += nb_rx; |
| 594 | num[portid] -= nb_rx; |
| 595 | total -= nb_rx; |
| 596 | } |
| 597 | } |
| 598 | timeout: |
| 599 | diff_tsc = rte_rdtsc() - cur_tsc; |
nothing calls this directly
no test coverage detected