| 126 | static rte_seqlock_t __rte_unused static_init_lock = RTE_SEQLOCK_INITIALIZER; |
| 127 | |
| 128 | static int |
| 129 | test_seqlock(void) |
| 130 | { |
| 131 | struct reader readers[RTE_MAX_LCORE]; |
| 132 | unsigned int num_lcores; |
| 133 | unsigned int num_readers; |
| 134 | struct data *data; |
| 135 | unsigned int i; |
| 136 | unsigned int lcore_id; |
| 137 | unsigned int reader_lcore_ids[RTE_MAX_LCORE]; |
| 138 | unsigned int worker_writer_lcore_id = 0; |
| 139 | int rc = TEST_SUCCESS; |
| 140 | |
| 141 | num_lcores = rte_lcore_count(); |
| 142 | |
| 143 | if (num_lcores < MIN_LCORE_COUNT) { |
| 144 | printf("Too few cores to run test. Skipping.\n"); |
| 145 | return TEST_SKIPPED; |
| 146 | } |
| 147 | |
| 148 | num_readers = num_lcores - NUM_WRITERS; |
| 149 | |
| 150 | data = rte_zmalloc(NULL, sizeof(struct data), 0); |
| 151 | |
| 152 | if (data == NULL) { |
| 153 | printf("Failed to allocate memory for seqlock data\n"); |
| 154 | return TEST_FAILED; |
| 155 | } |
| 156 | |
| 157 | i = 0; |
| 158 | RTE_LCORE_FOREACH_WORKER(lcore_id) { |
| 159 | if (i == 0) { |
| 160 | rte_eal_remote_launch(writer_run, data, lcore_id); |
| 161 | worker_writer_lcore_id = lcore_id; |
| 162 | } else { |
| 163 | unsigned int reader_idx = i - 1; |
| 164 | struct reader *reader = &readers[reader_idx]; |
| 165 | |
| 166 | reader->data = data; |
| 167 | reader->stop = 0; |
| 168 | |
| 169 | rte_eal_remote_launch(reader_run, reader, lcore_id); |
| 170 | reader_lcore_ids[reader_idx] = lcore_id; |
| 171 | } |
| 172 | i++; |
| 173 | } |
| 174 | |
| 175 | if (writer_run(data) != 0 || |
| 176 | rte_eal_wait_lcore(worker_writer_lcore_id) != 0) |
| 177 | rc = TEST_FAILED; |
| 178 | |
| 179 | for (i = 0; i < num_readers; i++) { |
| 180 | reader_stop(&readers[i]); |
| 181 | if (rte_eal_wait_lcore(reader_lcore_ids[i]) != 0) |
| 182 | rc = TEST_FAILED; |
| 183 | } |
| 184 | |
| 185 | rte_free(data); |
nothing calls this directly
no test coverage detected