* Initialization for interrupt test. */
| 60 | * Initialization for interrupt test. |
| 61 | */ |
| 62 | static int |
| 63 | test_interrupt_init(void) |
| 64 | { |
| 65 | struct rte_intr_handle *test_intr_handle; |
| 66 | int i; |
| 67 | |
| 68 | if (pipe(pfds.pipefd) < 0) |
| 69 | return -1; |
| 70 | |
| 71 | for (i = 0; i < TEST_INTERRUPT_HANDLE_MAX; i++) { |
| 72 | intr_handles[i] = |
| 73 | rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE); |
| 74 | if (!intr_handles[i]) |
| 75 | return -1; |
| 76 | } |
| 77 | |
| 78 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID]; |
| 79 | if (rte_intr_fd_set(test_intr_handle, -1)) |
| 80 | return -1; |
| 81 | if (rte_intr_type_set(test_intr_handle, RTE_INTR_HANDLE_UNKNOWN)) |
| 82 | return -1; |
| 83 | |
| 84 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID]; |
| 85 | if (rte_intr_fd_set(test_intr_handle, pfds.readfd)) |
| 86 | return -1; |
| 87 | if (rte_intr_type_set(test_intr_handle, RTE_INTR_HANDLE_UNKNOWN)) |
| 88 | return -1; |
| 89 | |
| 90 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO]; |
| 91 | if (rte_intr_fd_set(test_intr_handle, pfds.readfd)) |
| 92 | return -1; |
| 93 | if (rte_intr_type_set(test_intr_handle, RTE_INTR_HANDLE_UIO)) |
| 94 | return -1; |
| 95 | |
| 96 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM]; |
| 97 | if (rte_intr_fd_set(test_intr_handle, pfds.readfd)) |
| 98 | return -1; |
| 99 | if (rte_intr_type_set(test_intr_handle, RTE_INTR_HANDLE_ALARM)) |
| 100 | return -1; |
| 101 | |
| 102 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT]; |
| 103 | if (rte_intr_fd_set(test_intr_handle, pfds.readfd)) |
| 104 | return -1; |
| 105 | if (rte_intr_type_set(test_intr_handle, RTE_INTR_HANDLE_DEV_EVENT)) |
| 106 | return -1; |
| 107 | |
| 108 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1]; |
| 109 | if (rte_intr_fd_set(test_intr_handle, pfds.writefd)) |
| 110 | return -1; |
| 111 | if (rte_intr_type_set(test_intr_handle, RTE_INTR_HANDLE_UIO)) |
| 112 | return -1; |
| 113 | |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Deinitialization for interrupt test. |
no test coverage detected