1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Intel Corporation
6 #include "rte_rawdev.h"
7 #include "rte_ioat_rawdev.h"
9 int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
12 ioat_rawdev_test(uint16_t dev_id)
14 #define IOAT_TEST_RINGSIZE 512
15 struct rte_ioat_rawdev_config p = { .ring_size = -1 };
16 struct rte_rawdev_info info = { .dev_private = &p };
17 struct rte_rawdev_xstats_name *snames = NULL;
18 uint64_t *stats = NULL;
19 unsigned int *ids = NULL;
20 unsigned int nb_xstats;
23 rte_rawdev_info_get(dev_id, &info);
24 if (p.ring_size != 0) {
25 printf("Error, initial ring size is non-zero (%d)\n",
30 p.ring_size = IOAT_TEST_RINGSIZE;
31 if (rte_rawdev_configure(dev_id, &info) != 0) {
32 printf("Error with rte_rawdev_configure()\n");
35 rte_rawdev_info_get(dev_id, &info);
36 if (p.ring_size != IOAT_TEST_RINGSIZE) {
37 printf("Error, ring size is not %d (%d)\n",
38 IOAT_TEST_RINGSIZE, (int)p.ring_size);
42 if (rte_rawdev_start(dev_id) != 0) {
43 printf("Error with rte_rawdev_start()\n");
47 /* allocate memory for xstats names and values */
48 nb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
50 snames = malloc(sizeof(*snames) * nb_xstats);
52 printf("Error allocating xstat names memory\n");
55 rte_rawdev_xstats_names_get(dev_id, snames, nb_xstats);
57 ids = malloc(sizeof(*ids) * nb_xstats);
59 printf("Error allocating xstat ids memory\n");
62 for (i = 0; i < nb_xstats; i++)
65 stats = malloc(sizeof(*stats) * nb_xstats);
67 printf("Error allocating xstat memory\n");
71 rte_rawdev_xstats_get(dev_id, ids, stats, nb_xstats);
72 for (i = 0; i < nb_xstats; i++)
73 printf("%s: %"PRIu64" ", snames[i].name, stats[i]);