Lines Matching refs:test

57 MALLOC_DEFINE(M_IOAT_TEST, "ioat_test", "ioat test allocations");
66 struct ioat_test *test;
74 MTX_SYSINIT(ioat_test_lk, &ioat_test_lk, "test coordination mtx", MTX_DEF);
98 test_transaction *ioat_test_transaction_create(struct ioat_test *test,
108 tx->length = test->buffer_size;
111 if (test->testkind == IOAT_TEST_DMA_8K)
112 tx->buf[i] = malloc(test->buffer_size, M_IOAT_TEST,
115 tx->buf[i] = contigmalloc(test->buffer_size,
142 struct ioat_test *test;
146 test = tx->test;
152 if (test->testkind == IOAT_TEST_FILL) {
159 } else if (test->testkind == IOAT_TEST_DMA) {
162 } else if (test->testkind == IOAT_TEST_RAW_DMA) {
163 if (test->raw_write)
164 dst = test->raw_vtarget;
175 struct ioat_test *test;
181 test = tx->test;
183 if (test->verify && !ioat_compare_ok(tx)) {
185 atomic_add_32(&test->status[IOAT_TEST_MISCOMPARE], tx->depth);
186 } else if (!test->too_late)
187 atomic_add_32(&test->status[IOAT_TEST_OK], tx->depth);
190 TAILQ_REMOVE(&test->pend_q, tx, entry);
191 TAILQ_INSERT_TAIL(&test->free_q, tx, entry);
192 wakeup(&test->free_q);
197 ioat_test_prealloc_memory(struct ioat_test *test, int index)
202 for (i = 0; i < test->transactions; i++) {
203 tx = ioat_test_transaction_create(test, test->chain_depth * 2);
206 test->status[IOAT_TEST_NO_MEMORY]++;
210 TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
212 tx->test = test;
213 tx->depth = test->chain_depth;
219 for (k = 0; k < test->chain_depth; k++) {
229 ioat_test_release_memory(struct ioat_test *test)
233 TAILQ_FOREACH_SAFE(tx, &test->free_q, entry, s)
235 TAILQ_INIT(&test->free_q);
237 TAILQ_FOREACH_SAFE(tx, &test->pend_q, entry, s)
239 TAILQ_INIT(&test->pend_q);
243 ioat_test_submit_1_tx(struct ioat_test *test, bus_dmaengine_t dma)
255 while (TAILQ_EMPTY(&test->free_q))
256 msleep(&test->free_q, &ioat_test_lk, 0, "test_submit", 0);
258 tx = TAILQ_FIRST(&test->free_q);
259 TAILQ_REMOVE(&test->free_q, tx, entry);
260 TAILQ_INSERT_HEAD(&test->pend_q, tx, entry);
263 if (test->testkind != IOAT_TEST_MEMCPY)
266 if (test->testkind == IOAT_TEST_MEMCPY) {
276 if (test->testkind == IOAT_TEST_RAW_DMA) {
277 if (test->raw_write)
278 dest = test->raw_target;
280 src = test->raw_target;
291 if (test->testkind == IOAT_TEST_DMA ||
292 test->testkind == IOAT_TEST_RAW_DMA)
295 else if (test->testkind == IOAT_TEST_FILL) {
299 } else if (test->testkind == IOAT_TEST_DMA_8K) {
307 } else if (test->testkind == IOAT_TEST_DMA_8K_PB) {
315 } else if (test->testkind == IOAT_TEST_DMA_CRC) {
322 } else if (test->testkind == IOAT_TEST_DMA_CRC_COPY) {
333 if (test->testkind == IOAT_TEST_MEMCPY)
343 atomic_add_32(&test->status[IOAT_TEST_NO_DMA_ENGINE], tx->depth);
345 TAILQ_REMOVE(&test->pend_q, tx, entry);
346 TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
355 struct ioat_test *test;
360 test = arg;
361 memset(__DEVOLATILE(void *, test->status), 0, sizeof(test->status));
363 if ((test->testkind == IOAT_TEST_DMA_8K ||
364 test->testkind == IOAT_TEST_DMA_8K_PB) &&
365 test->buffer_size != 2 * PAGE_SIZE) {
366 ioat_test_log(0, "Asked for 8k test and buffer size isn't 8k\n");
367 test->status[IOAT_TEST_INVALID_INPUT]++;
371 if (test->buffer_size > 1024 * 1024) {
373 test->status[IOAT_TEST_NO_MEMORY]++;
377 if (test->chain_depth * 2 > IOAT_MAX_BUFS) {
380 test->status[IOAT_TEST_NO_MEMORY]++;
384 if (btoc((uint64_t)test->buffer_size * test->chain_depth *
385 test->transactions) > (physmem / 4)) {
386 ioat_test_log(0, "Sanity check failed -- test would "
388 test->status[IOAT_TEST_NO_MEMORY]++;
392 if ((uint64_t)test->transactions * test->chain_depth > (1<<16)) {
393 ioat_test_log(0, "Sanity check failed -- test would "
395 test->status[IOAT_TEST_NO_MEMORY]++;
399 if (test->testkind >= IOAT_NUM_TESTKINDS) {
401 (unsigned)test->testkind);
402 test->status[IOAT_TEST_INVALID_INPUT]++;
406 dmaengine = ioat_get_dmaengine(test->channel_index, M_NOWAIT);
409 test->status[IOAT_TEST_NO_DMA_ENGINE]++;
414 if (test->testkind == IOAT_TEST_FILL &&
418 "Hardware doesn't support block fill, aborting test\n");
419 test->status[IOAT_TEST_INVALID_INPUT]++;
423 if (test->coalesce_period > ioat->intrdelay_max) {
426 (unsigned)test->coalesce_period);
427 test->status[IOAT_TEST_INVALID_INPUT]++;
430 error = ioat_set_interrupt_coalesce(dmaengine, test->coalesce_period);
431 if (error == ENODEV && test->coalesce_period == 0)
435 test->status[IOAT_TEST_INVALID_INPUT]++;
439 if (test->zero_stats)
442 if (test->testkind == IOAT_TEST_RAW_DMA) {
443 if (test->raw_is_virtual) {
444 test->raw_vtarget = (void *)test->raw_target;
445 test->raw_target = vtophys(test->raw_vtarget);
447 test->raw_vtarget = pmap_mapdev(test->raw_target,
448 test->buffer_size);
453 TAILQ_INIT(&test->free_q);
454 TAILQ_INIT(&test->pend_q);
456 if (test->duration == 0)
458 index, test->transactions);
462 rc = ioat_test_prealloc_memory(test, index);
469 test->too_late = false;
471 end = start + (((sbintime_t)test->duration * hz) / 1000);
474 if (test->duration == 0 && loops >= test->transactions)
476 else if (test->duration != 0 && time_after(ticks, end)) {
477 test->too_late = true;
481 ioat_test_submit_1_tx(test, dmaengine);
488 while (!TAILQ_EMPTY(&test->pend_q))
489 msleep(&test->free_q, &ioat_test_lk, 0, "ioattestcompl", hz);
495 ioat_test_release_memory(test);
497 if (test->testkind == IOAT_TEST_RAW_DMA && !test->raw_is_virtual)
498 pmap_unmapdev(test->raw_vtarget, test->buffer_size);