| 783 | } |
| 784 | |
| 785 | static int |
| 786 | test_run_enqueue_dequeue(struct rte_comp_op **ops, |
| 787 | struct rte_comp_op **ops_processed, |
| 788 | unsigned int num_bufs) |
| 789 | { |
| 790 | uint16_t num_enqd, num_deqd, num_total_deqd; |
| 791 | unsigned int deqd_retries = 0; |
| 792 | int res = 0; |
| 793 | |
| 794 | /* Enqueue and dequeue all operations */ |
| 795 | num_enqd = rte_compressdev_enqueue_burst(0, 0, ops, num_bufs); |
| 796 | if (num_enqd < num_bufs) { |
| 797 | RTE_LOG(ERR, USER1, |
| 798 | "Some operations could not be enqueued\n"); |
| 799 | res = -1; |
| 800 | } |
| 801 | |
| 802 | /* dequeue ops even on error (same number of ops as was enqueued) */ |
| 803 | |
| 804 | num_total_deqd = 0; |
| 805 | while (num_total_deqd < num_enqd) { |
| 806 | /* |
| 807 | * If retrying a dequeue call, wait for 10 ms to allow |
| 808 | * enough time to the driver to process the operations |
| 809 | */ |
| 810 | if (deqd_retries != 0) { |
| 811 | /* |
| 812 | * Avoid infinite loop if not all the |
| 813 | * operations get out of the device |
| 814 | */ |
| 815 | if (deqd_retries == MAX_DEQD_RETRIES) { |
| 816 | RTE_LOG(ERR, USER1, |
| 817 | "Not all operations could be dequeued\n"); |
| 818 | res = -1; |
| 819 | break; |
| 820 | } |
| 821 | usleep(DEQUEUE_WAIT_TIME); |
| 822 | } |
| 823 | num_deqd = rte_compressdev_dequeue_burst(0, 0, |
| 824 | &ops_processed[num_total_deqd], num_bufs); |
| 825 | num_total_deqd += num_deqd; |
| 826 | deqd_retries++; |
| 827 | |
| 828 | } |
| 829 | |
| 830 | return res; |
| 831 | } |
| 832 | |
| 833 | /** |
| 834 | * Arrays initialization. Input buffers preparation for compression. |
no test coverage detected