• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/sys/dev/ioat/

Lines Matching refs:test

60 MALLOC_DEFINE(M_IOAT_TEST, "ioat_test", "ioat test allocations");
69 struct ioat_test *test;
77 MTX_SYSINIT(ioat_test_lk, &ioat_test_lk, "test coordination mtx", MTX_DEF);
88 struct ioat_test *test;
91 test = tx->test;
95 if (test->testkind == IOAT_TEST_DMA_8K)
107 test_transaction *ioat_test_transaction_create(struct ioat_test *test,
117 tx->length = test->buffer_size;
120 if (test->testkind == IOAT_TEST_DMA_8K)
121 tx->buf[i] = malloc(test->buffer_size, M_IOAT_TEST,
124 tx->buf[i] = contigmalloc(test->buffer_size,
151 struct ioat_test *test;
155 test = tx->test;
161 if (test->testkind == IOAT_TEST_FILL) {
168 } else if (test->testkind == IOAT_TEST_DMA) {
171 } else if (test->testkind == IOAT_TEST_RAW_DMA) {
172 if (test->raw_write)
173 dst = test->raw_vtarget;
184 struct ioat_test *test;
190 test = tx->test;
192 if (test->verify && !ioat_compare_ok(tx)) {
194 atomic_add_32(&test->status[IOAT_TEST_MISCOMPARE], tx->depth);
195 } else if (!test->too_late)
196 atomic_add_32(&test->status[IOAT_TEST_OK], tx->depth);
199 TAILQ_REMOVE(&test->pend_q, tx, entry);
200 TAILQ_INSERT_TAIL(&test->free_q, tx, entry);
201 wakeup(&test->free_q);
206 ioat_test_prealloc_memory(struct ioat_test *test, int index)
211 for (i = 0; i < test->transactions; i++) {
212 tx = ioat_test_transaction_create(test, test->chain_depth * 2);
215 test->status[IOAT_TEST_NO_MEMORY]++;
219 TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
221 tx->test = test;
222 tx->depth = test->chain_depth;
228 for (k = 0; k < test->chain_depth; k++) {
238 ioat_test_release_memory(struct ioat_test *test)
242 TAILQ_FOREACH_SAFE(tx, &test->free_q, entry, s)
244 TAILQ_INIT(&test->free_q);
246 TAILQ_FOREACH_SAFE(tx, &test->pend_q, entry, s)
248 TAILQ_INIT(&test->pend_q);
252 ioat_test_submit_1_tx(struct ioat_test *test, bus_dmaengine_t dma)
264 while (TAILQ_EMPTY(&test->free_q))
265 msleep(&test->free_q, &ioat_test_lk, 0, "test_submit", 0);
267 tx = TAILQ_FIRST(&test->free_q);
268 TAILQ_REMOVE(&test->free_q, tx, entry);
269 TAILQ_INSERT_HEAD(&test->pend_q, tx, entry);
272 if (test->testkind != IOAT_TEST_MEMCPY)
275 if (test->testkind == IOAT_TEST_MEMCPY) {
285 if (test->testkind == IOAT_TEST_RAW_DMA) {
286 if (test->raw_write)
287 dest = test->raw_target;
289 src = test->raw_target;
300 if (test->testkind == IOAT_TEST_DMA ||
301 test->testkind == IOAT_TEST_RAW_DMA)
304 else if (test->testkind == IOAT_TEST_FILL) {
308 } else if (test->testkind == IOAT_TEST_DMA_8K) {
316 } else if (test->testkind == IOAT_TEST_DMA_8K_PB) {
324 } else if (test->testkind == IOAT_TEST_DMA_CRC) {
331 } else if (test->testkind == IOAT_TEST_DMA_CRC_COPY) {
342 if (test->testkind == IOAT_TEST_MEMCPY)
352 atomic_add_32(&test->status[IOAT_TEST_NO_DMA_ENGINE], tx->depth);
354 TAILQ_REMOVE(&test->pend_q, tx, entry);
355 TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
364 struct ioat_test *test;
369 test = arg;
370 memset(__DEVOLATILE(void *, test->status), 0, sizeof(test->status));
372 if ((test->testkind == IOAT_TEST_DMA_8K ||
373 test->testkind == IOAT_TEST_DMA_8K_PB) &&
374 test->buffer_size != 2 * PAGE_SIZE) {
375 ioat_test_log(0, "Asked for 8k test and buffer size isn't 8k\n");
376 test->status[IOAT_TEST_INVALID_INPUT]++;
380 if (test->buffer_size > 1024 * 1024) {
382 test->status[IOAT_TEST_NO_MEMORY]++;
386 if (test->chain_depth * 2 > IOAT_MAX_BUFS) {
389 test->status[IOAT_TEST_NO_MEMORY]++;
393 if (btoc((uint64_t)test->buffer_size * test->chain_depth *
394 test->transactions) > (physmem / 4)) {
395 ioat_test_log(0, "Sanity check failed -- test would "
397 test->status[IOAT_TEST_NO_MEMORY]++;
401 if ((uint64_t)test->transactions * test->chain_depth > (1<<16)) {
402 ioat_test_log(0, "Sanity check failed -- test would "
404 test->status[IOAT_TEST_NO_MEMORY]++;
408 if (test->testkind >= IOAT_NUM_TESTKINDS) {
410 (unsigned)test->testkind);
411 test->status[IOAT_TEST_INVALID_INPUT]++;
415 dmaengine = ioat_get_dmaengine(test->channel_index, M_NOWAIT);
418 test->status[IOAT_TEST_NO_DMA_ENGINE]++;
423 if (test->testkind == IOAT_TEST_FILL &&
427 "Hardware doesn't support block fill, aborting test\n");
428 test->status[IOAT_TEST_INVALID_INPUT]++;
432 if (test->coalesce_period > ioat->intrdelay_max) {
435 (unsigned)test->coalesce_period);
436 test->status[IOAT_TEST_INVALID_INPUT]++;
439 error = ioat_set_interrupt_coalesce(dmaengine, test->coalesce_period);
440 if (error == ENODEV && test->coalesce_period == 0)
444 test->status[IOAT_TEST_INVALID_INPUT]++;
448 if (test->zero_stats)
451 if (test->testkind == IOAT_TEST_RAW_DMA) {
452 if (test->raw_is_virtual) {
453 test->raw_vtarget = (void *)test->raw_target;
454 test->raw_target = vtophys(test->raw_vtarget);
456 test->raw_vtarget = pmap_mapdev(test->raw_target,
457 test->buffer_size);
462 TAILQ_INIT(&test->free_q);
463 TAILQ_INIT(&test->pend_q);
465 if (test->duration == 0)
467 index, test->transactions);
471 rc = ioat_test_prealloc_memory(test, index);
478 test->too_late = false;
480 end = start + (((sbintime_t)test->duration * hz) / 1000);
483 if (test->duration == 0 && loops >= test->transactions)
485 else if (test->duration != 0 && time_after(ticks, end)) {
486 test->too_late = true;
490 ioat_test_submit_1_tx(test, dmaengine);
497 while (!TAILQ_EMPTY(&test->pend_q))
498 msleep(&test->free_q, &ioat_test_lk, 0, "ioattestcompl", hz);
504 ioat_test_release_memory(test);
506 if (test->testkind == IOAT_TEST_RAW_DMA && !test->raw_is_virtual)
507 pmap_unmapdev((vm_offset_t)test->raw_vtarget,
508 test->buffer_size);