4 * Copyright (C) Cavium, Inc 2017.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Cavium, Inc nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <sys/queue.h>
42 enum evt_test_result {
51 typedef bool (*evt_test_capability_check_t)(struct evt_options *opt);
52 typedef int (*evt_test_options_check_t)(struct evt_options *opt);
53 typedef void (*evt_test_options_dump_t)(struct evt_options *opt);
54 typedef int (*evt_test_setup_t)
55 (struct evt_test *test, struct evt_options *opt);
56 typedef int (*evt_test_mempool_setup_t)
57 (struct evt_test *test, struct evt_options *opt);
58 typedef int (*evt_test_ethdev_setup_t)
59 (struct evt_test *test, struct evt_options *opt);
60 typedef int (*evt_test_eventdev_setup_t)
61 (struct evt_test *test, struct evt_options *opt);
62 typedef int (*evt_test_launch_lcores_t)
63 (struct evt_test *test, struct evt_options *opt);
64 typedef int (*evt_test_result_t)
65 (struct evt_test *test, struct evt_options *opt);
66 typedef void (*evt_test_eventdev_destroy_t)
67 (struct evt_test *test, struct evt_options *opt);
68 typedef void (*evt_test_ethdev_destroy_t)
69 (struct evt_test *test, struct evt_options *opt);
70 typedef void (*evt_test_mempool_destroy_t)
71 (struct evt_test *test, struct evt_options *opt);
72 typedef void (*evt_test_destroy_t)
73 (struct evt_test *test, struct evt_options *opt);
76 evt_test_capability_check_t cap_check;
77 evt_test_options_check_t opt_check;
78 evt_test_options_dump_t opt_dump;
79 evt_test_setup_t test_setup;
80 evt_test_mempool_setup_t mempool_setup;
81 evt_test_ethdev_setup_t ethdev_setup;
82 evt_test_eventdev_setup_t eventdev_setup;
83 evt_test_launch_lcores_t launch_lcores;
84 evt_test_result_t test_result;
85 evt_test_eventdev_destroy_t eventdev_destroy;
86 evt_test_ethdev_destroy_t ethdev_destroy;
87 evt_test_mempool_destroy_t mempool_destroy;
88 evt_test_destroy_t test_destroy;
94 struct evt_test_ops ops;
97 struct evt_test_entry {
100 STAILQ_ENTRY(evt_test_entry) next;
103 void evt_test_register(struct evt_test_entry *test);
104 void evt_test_dump_names(void);
106 #define EVT_TEST_REGISTER(nm) \
107 static struct evt_test_entry _evt_test_entry_ ##nm; \
108 RTE_INIT(evt_test_ ##nm); \
109 static void evt_test_ ##nm(void) \
111 _evt_test_entry_ ##nm.test.name = RTE_STR(nm);\
112 memcpy(&_evt_test_entry_ ##nm.test.ops, &nm, \
113 sizeof(struct evt_test_ops)); \
114 evt_test_register(&_evt_test_entry_ ##nm); \
117 struct evt_test *evt_test_get(const char *name);
120 evt_test_priv(struct evt_test *test)
122 return test->test_priv;
125 #endif /* _EVT_TEST_ */