Deleted Added
full compact
ioat_test.c (292044) ioat_test.c (292229)
1/*-
2 * Copyright (C) 2012 Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 2012 Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/ioat/ioat_test.c 292044 2015-12-10 02:05:35Z cem $");
28__FBSDID("$FreeBSD: head/sys/dev/ioat/ioat_test.c 292229 2015-12-14 22:02:01Z cem $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/conf.h>
34#include <sys/ioccom.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>

--- 295 unchanged lines hidden (view full) ---

332 TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
333 IT_UNLOCK();
334 }
335}
336
337static void
338ioat_dma_test(void *arg)
339{
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/conf.h>
34#include <sys/ioccom.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>

--- 295 unchanged lines hidden (view full) ---

332 TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
333 IT_UNLOCK();
334 }
335}
336
337static void
338ioat_dma_test(void *arg)
339{
340 struct ioat_softc *ioat;
340 struct ioat_test *test;
341 bus_dmaengine_t dmaengine;
342 uint32_t loops;
341 struct ioat_test *test;
342 bus_dmaengine_t dmaengine;
343 uint32_t loops;
343 int index, rc, start, end;
344 int index, rc, start, end, error;
344
345 test = arg;
346 memset(__DEVOLATILE(void *, test->status), 0, sizeof(test->status));
347
348 if (test->testkind == IOAT_TEST_DMA_8K &&
349 test->buffer_size != 2 * PAGE_SIZE) {
350 ioat_test_log(0, "Asked for 8k test and buffer size isn't 8k\n");
351 test->status[IOAT_TEST_INVALID_INPUT]++;

--- 36 unchanged lines hidden (view full) ---

388 }
389
390 dmaengine = ioat_get_dmaengine(test->channel_index);
391 if (dmaengine == NULL) {
392 ioat_test_log(0, "Couldn't acquire dmaengine\n");
393 test->status[IOAT_TEST_NO_DMA_ENGINE]++;
394 return;
395 }
345
346 test = arg;
347 memset(__DEVOLATILE(void *, test->status), 0, sizeof(test->status));
348
349 if (test->testkind == IOAT_TEST_DMA_8K &&
350 test->buffer_size != 2 * PAGE_SIZE) {
351 ioat_test_log(0, "Asked for 8k test and buffer size isn't 8k\n");
352 test->status[IOAT_TEST_INVALID_INPUT]++;

--- 36 unchanged lines hidden (view full) ---

389 }
390
391 dmaengine = ioat_get_dmaengine(test->channel_index);
392 if (dmaengine == NULL) {
393 ioat_test_log(0, "Couldn't acquire dmaengine\n");
394 test->status[IOAT_TEST_NO_DMA_ENGINE]++;
395 return;
396 }
397 ioat = to_ioat_softc(dmaengine);
396
397 if (test->testkind == IOAT_TEST_FILL &&
398
399 if (test->testkind == IOAT_TEST_FILL &&
398 (to_ioat_softc(dmaengine)->capabilities & IOAT_DMACAP_BFILL) == 0)
400 (ioat->capabilities & IOAT_DMACAP_BFILL) == 0)
399 {
400 ioat_test_log(0,
401 "Hardware doesn't support block fill, aborting test\n");
402 test->status[IOAT_TEST_INVALID_INPUT]++;
403 goto out;
404 }
405
401 {
402 ioat_test_log(0,
403 "Hardware doesn't support block fill, aborting test\n");
404 test->status[IOAT_TEST_INVALID_INPUT]++;
405 goto out;
406 }
407
408 if (test->coalesce_period > ioat->intrdelay_max) {
409 ioat_test_log(0,
410 "Hardware doesn't support intrdelay of %u us.\n",
411 (unsigned)test->coalesce_period);
412 test->status[IOAT_TEST_INVALID_INPUT]++;
413 goto out;
414 }
415 error = ioat_set_interrupt_coalesce(dmaengine, test->coalesce_period);
416 if (error == ENODEV && test->coalesce_period == 0)
417 error = 0;
418 if (error != 0) {
419 ioat_test_log(0, "ioat_set_interrupt_coalesce: %d\n", error);
420 test->status[IOAT_TEST_INVALID_INPUT]++;
421 goto out;
422 }
423
424 if (test->zero_stats)
425 memset(&ioat->stats, 0, sizeof(ioat->stats));
426
406 if (test->testkind == IOAT_TEST_RAW_DMA) {
407 if (test->raw_is_virtual) {
408 test->raw_vtarget = (void *)test->raw_target;
409 test->raw_target = vtophys(test->raw_vtarget);
410 } else {
411 test->raw_vtarget = pmap_mapdev(test->raw_target,
412 test->buffer_size);
413 }

--- 159 unchanged lines hidden ---
427 if (test->testkind == IOAT_TEST_RAW_DMA) {
428 if (test->raw_is_virtual) {
429 test->raw_vtarget = (void *)test->raw_target;
430 test->raw_target = vtophys(test->raw_vtarget);
431 } else {
432 test->raw_vtarget = pmap_mapdev(test->raw_target,
433 test->buffer_size);
434 }

--- 159 unchanged lines hidden ---