Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/xsk: declare test names in struct

Declare the test names statically in a struct so that we can refer to
them when adding the support to execute a single test in the next
commit. Before this patch, the names of them were not declared in a
single place which made it not possible to refer to them.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/r/20230914084900.492-6-magnus.karlsson@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Magnus Karlsson and committed by
Alexei Starovoitov
f20fbcd0 13c341c4

+55 -169
+51 -136
tools/testing/selftests/bpf/xskxceiver.c
··· 444 444 } 445 445 446 446 static void test_spec_init(struct test_spec *test, struct ifobject *ifobj_tx, 447 - struct ifobject *ifobj_rx, enum test_mode mode) 447 + struct ifobject *ifobj_rx, enum test_mode mode, 448 + const struct test_spec *test_to_run) 448 449 { 449 450 struct pkt_stream *tx_pkt_stream; 450 451 struct pkt_stream *rx_pkt_stream; ··· 467 466 ifobj->bind_flags |= XDP_COPY; 468 467 } 469 468 469 + strncpy(test->name, test_to_run->name, MAX_TEST_NAME_SIZE); 470 + test->test_func = test_to_run->test_func; 470 471 test->mode = mode; 471 472 __test_spec_init(test, ifobj_tx, ifobj_rx); 472 473 } ··· 476 473 static void test_spec_reset(struct test_spec *test) 477 474 { 478 475 __test_spec_init(test, test->ifobj_tx, test->ifobj_rx); 479 - } 480 - 481 - static void test_spec_set_name(struct test_spec *test, const char *name) 482 - { 483 - strncpy(test->name, name, MAX_TEST_NAME_SIZE); 484 476 } 485 477 486 478 static void test_spec_set_xdp_prog(struct test_spec *test, struct bpf_program *xdp_prog_rx, ··· 1722 1724 { 1723 1725 int i; 1724 1726 1725 - test_spec_set_name(test, "TEARDOWN"); 1726 1727 for (i = 0; i < MAX_TEARDOWN_ITER; i++) { 1727 1728 if (testapp_validate_traffic(test)) 1728 1729 return TEST_FAILURE; ··· 1743 1746 *ifobj2 = tmp_ifobj; 1744 1747 } 1745 1748 1746 - static int testapp_bidi(struct test_spec *test) 1749 + static int testapp_bidirectional(struct test_spec *test) 1747 1750 { 1748 1751 int res; 1749 1752 1750 - test_spec_set_name(test, "BIDIRECTIONAL"); 1751 1753 test->ifobj_tx->rx_on = true; 1752 1754 test->ifobj_rx->tx_on = true; 1753 1755 test->total_steps = 2; ··· 1775 1779 exit_with_error(errno); 1776 1780 } 1777 1781 1778 - static int testapp_bpf_res(struct test_spec *test) 1782 + static int testapp_xdp_prog_cleanup(struct test_spec *test) 1779 1783 { 1780 - test_spec_set_name(test, "BPF_RES"); 1781 1784 test->total_steps = 2; 1782 1785 test->nb_sockets = 2; 1783 1786 if (testapp_validate_traffic(test)) ··· 1788 1793 1789 1794 static int testapp_headroom(struct test_spec *test) 1790 1795 { 1791 - test_spec_set_name(test, "UMEM_HEADROOM"); 1792 1796 test->ifobj_rx->umem->frame_headroom = UMEM_HEADROOM_TEST_SIZE; 1793 1797 return testapp_validate_traffic(test); 1794 1798 } 1795 1799 1796 1800 static int testapp_stats_rx_dropped(struct test_spec *test) 1797 1801 { 1798 - test_spec_set_name(test, "STAT_RX_DROPPED"); 1799 1802 if (test->mode == TEST_MODE_ZC) { 1800 1803 ksft_test_result_skip("Can not run RX_DROPPED test for ZC mode\n"); 1801 1804 return TEST_SKIP; ··· 1809 1816 1810 1817 static int testapp_stats_tx_invalid_descs(struct test_spec *test) 1811 1818 { 1812 - test_spec_set_name(test, "STAT_TX_INVALID"); 1813 1819 pkt_stream_replace_half(test, XSK_UMEM__INVALID_FRAME_SIZE, 0); 1814 1820 test->ifobj_tx->validation_func = validate_tx_invalid_descs; 1815 1821 return testapp_validate_traffic(test); ··· 1816 1824 1817 1825 static int testapp_stats_rx_full(struct test_spec *test) 1818 1826 { 1819 - test_spec_set_name(test, "STAT_RX_FULL"); 1820 1827 pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS / 2, MIN_PKT_SIZE); 1821 1828 test->ifobj_rx->pkt_stream = pkt_stream_generate(test->ifobj_rx->umem, 1822 1829 DEFAULT_UMEM_BUFFERS, MIN_PKT_SIZE); ··· 1828 1837 1829 1838 static int testapp_stats_fill_empty(struct test_spec *test) 1830 1839 { 1831 - test_spec_set_name(test, "STAT_RX_FILL_EMPTY"); 1832 1840 pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS / 2, MIN_PKT_SIZE); 1833 1841 test->ifobj_rx->pkt_stream = pkt_stream_generate(test->ifobj_rx->umem, 1834 1842 DEFAULT_UMEM_BUFFERS, MIN_PKT_SIZE); ··· 1837 1847 return testapp_validate_traffic(test); 1838 1848 } 1839 1849 1840 - static int testapp_unaligned(struct test_spec *test) 1850 + static int testapp_send_receive_unaligned(struct test_spec *test) 1841 1851 { 1842 - test_spec_set_name(test, "UNALIGNED_MODE"); 1843 1852 test->ifobj_tx->umem->unaligned_mode = true; 1844 1853 test->ifobj_rx->umem->unaligned_mode = true; 1845 1854 /* Let half of the packets straddle a 4K buffer boundary */ ··· 1847 1858 return testapp_validate_traffic(test); 1848 1859 } 1849 1860 1850 - static int testapp_unaligned_mb(struct test_spec *test) 1861 + static int testapp_send_receive_unaligned_mb(struct test_spec *test) 1851 1862 { 1852 - test_spec_set_name(test, "UNALIGNED_MODE_9K"); 1853 1863 test->mtu = MAX_ETH_JUMBO_SIZE; 1854 1864 test->ifobj_tx->umem->unaligned_mode = true; 1855 1865 test->ifobj_rx->umem->unaligned_mode = true; ··· 1860 1872 { 1861 1873 struct pkt pkts[] = {{0, MIN_PKT_SIZE, 0, true}}; 1862 1874 1863 - test_spec_set_name(test, "SEND_RECEIVE_SINGLE_PKT"); 1864 1875 pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); 1865 1876 return testapp_validate_traffic(test); 1866 1877 } 1867 1878 1868 - static int testapp_multi_buffer(struct test_spec *test) 1879 + static int testapp_send_receive_mb(struct test_spec *test) 1869 1880 { 1870 - test_spec_set_name(test, "SEND_RECEIVE_9K_PACKETS"); 1871 1881 test->mtu = MAX_ETH_JUMBO_SIZE; 1872 1882 pkt_stream_replace(test, DEFAULT_PKT_CNT, MAX_ETH_JUMBO_SIZE); 1873 1883 ··· 1962 1976 struct xsk_xdp_progs *skel_rx = test->ifobj_rx->xdp_progs; 1963 1977 struct xsk_xdp_progs *skel_tx = test->ifobj_tx->xdp_progs; 1964 1978 1965 - test_spec_set_name(test, "XDP_DROP_HALF"); 1966 1979 test_spec_set_xdp_prog(test, skel_rx->progs.xsk_xdp_drop, skel_tx->progs.xsk_xdp_drop, 1967 1980 skel_rx->maps.xsk, skel_tx->maps.xsk); 1968 1981 ··· 1994 2009 1995 2010 static int testapp_poll_txq_tmout(struct test_spec *test) 1996 2011 { 1997 - test_spec_set_name(test, "POLL_TXQ_FULL"); 1998 - 1999 2012 test->ifobj_tx->use_poll = true; 2000 2013 /* create invalid frame by set umem frame_size and pkt length equal to 2048 */ 2001 2014 test->ifobj_tx->umem->frame_size = 2048; ··· 2003 2020 2004 2021 static int testapp_poll_rxq_tmout(struct test_spec *test) 2005 2022 { 2006 - test_spec_set_name(test, "POLL_RXQ_EMPTY"); 2007 2023 test->ifobj_rx->use_poll = true; 2008 2024 return testapp_validate_traffic_single_thread(test, test->ifobj_rx); 2009 2025 } ··· 2012 2030 struct pkt pkts[2 * XSK_DESC__MAX_SKB_FRAGS + 2] = {}; 2013 2031 u32 max_frags, i; 2014 2032 2015 - test_spec_set_name(test, "TOO_MANY_FRAGS"); 2016 2033 if (test->mode == TEST_MODE_ZC) 2017 2034 max_frags = test->ifobj_tx->xdp_zc_max_segs; 2018 2035 else ··· 2117 2136 2118 2137 static int testapp_send_receive(struct test_spec *test) 2119 2138 { 2120 - test_spec_set_name(test, "SEND_RECEIVE"); 2121 2139 return testapp_validate_traffic(test); 2122 2140 } 2123 2141 2124 2142 static int testapp_send_receive_2k_frame(struct test_spec *test) 2125 2143 { 2126 - test_spec_set_name(test, "SEND_RECEIVE_2K_FRAME_SIZE"); 2127 2144 test->ifobj_tx->umem->frame_size = 2048; 2128 2145 test->ifobj_rx->umem->frame_size = 2048; 2129 2146 pkt_stream_replace(test, DEFAULT_PKT_CNT, MIN_PKT_SIZE); ··· 2131 2152 static int testapp_poll_rx(struct test_spec *test) 2132 2153 { 2133 2154 test->ifobj_rx->use_poll = true; 2134 - test_spec_set_name(test, "POLL_RX"); 2135 2155 return testapp_validate_traffic(test); 2136 2156 } 2137 2157 2138 2158 static int testapp_poll_tx(struct test_spec *test) 2139 2159 { 2140 2160 test->ifobj_tx->use_poll = true; 2141 - test_spec_set_name(test, "POLL_TX"); 2142 2161 return testapp_validate_traffic(test); 2143 2162 } 2144 2163 2145 2164 static int testapp_aligned_inv_desc(struct test_spec *test) 2146 2165 { 2147 - test_spec_set_name(test, "ALIGNED_INV_DESC"); 2148 2166 return testapp_invalid_desc(test); 2149 2167 } 2150 2168 2151 2169 static int testapp_aligned_inv_desc_2k_frame(struct test_spec *test) 2152 2170 { 2153 - test_spec_set_name(test, "ALIGNED_INV_DESC_2K_FRAME_SIZE"); 2154 2171 test->ifobj_tx->umem->frame_size = 2048; 2155 2172 test->ifobj_rx->umem->frame_size = 2048; 2156 2173 return testapp_invalid_desc(test); ··· 2154 2179 2155 2180 static int testapp_unaligned_inv_desc(struct test_spec *test) 2156 2181 { 2157 - test_spec_set_name(test, "UNALIGNED_INV_DESC"); 2158 2182 test->ifobj_tx->umem->unaligned_mode = true; 2159 2183 test->ifobj_rx->umem->unaligned_mode = true; 2160 2184 return testapp_invalid_desc(test); ··· 2163 2189 { 2164 2190 u64 page_size, umem_size; 2165 2191 2166 - test_spec_set_name(test, "UNALIGNED_INV_DESC_4K1_FRAME_SIZE"); 2167 2192 /* Odd frame size so the UMEM doesn't end near a page boundary. */ 2168 2193 test->ifobj_tx->umem->frame_size = 4001; 2169 2194 test->ifobj_rx->umem->frame_size = 4001; ··· 2181 2208 2182 2209 static int testapp_aligned_inv_desc_mb(struct test_spec *test) 2183 2210 { 2184 - test_spec_set_name(test, "ALIGNED_INV_DESC_MULTI_BUFF"); 2185 2211 return testapp_invalid_desc_mb(test); 2186 2212 } 2187 2213 2188 2214 static int testapp_unaligned_inv_desc_mb(struct test_spec *test) 2189 2215 { 2190 - test_spec_set_name(test, "UNALIGNED_INV_DESC_MULTI_BUFF"); 2191 2216 test->ifobj_tx->umem->unaligned_mode = true; 2192 2217 test->ifobj_rx->umem->unaligned_mode = true; 2193 2218 return testapp_invalid_desc_mb(test); ··· 2193 2222 2194 2223 static int testapp_xdp_metadata(struct test_spec *test) 2195 2224 { 2196 - test_spec_set_name(test, "XDP_METADATA_COPY"); 2197 2225 return testapp_xdp_metadata_copy(test); 2198 2226 } 2199 2227 2200 2228 static int testapp_xdp_metadata_mb(struct test_spec *test) 2201 2229 { 2202 - test_spec_set_name(test, "XDP_METADATA_COPY_MULTI_BUFF"); 2203 2230 test->mtu = MAX_ETH_JUMBO_SIZE; 2204 2231 return testapp_xdp_metadata_copy(test); 2205 2232 } 2206 2233 2207 - static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_type type) 2234 + static void run_pkt_test(struct test_spec *test) 2208 2235 { 2209 - int ret = TEST_SKIP; 2236 + int ret; 2210 2237 2211 - switch (type) { 2212 - case TEST_TYPE_STATS_RX_DROPPED: 2213 - ret = testapp_stats_rx_dropped(test); 2214 - break; 2215 - case TEST_TYPE_STATS_TX_INVALID_DESCS: 2216 - ret = testapp_stats_tx_invalid_descs(test); 2217 - break; 2218 - case TEST_TYPE_STATS_RX_FULL: 2219 - ret = testapp_stats_rx_full(test); 2220 - break; 2221 - case TEST_TYPE_STATS_FILL_EMPTY: 2222 - ret = testapp_stats_fill_empty(test); 2223 - break; 2224 - case TEST_TYPE_TEARDOWN: 2225 - ret = testapp_teardown(test); 2226 - break; 2227 - case TEST_TYPE_BIDI: 2228 - ret = testapp_bidi(test); 2229 - break; 2230 - case TEST_TYPE_BPF_RES: 2231 - ret = testapp_bpf_res(test); 2232 - break; 2233 - case TEST_TYPE_RUN_TO_COMPLETION: 2234 - ret = testapp_send_receive(test); 2235 - break; 2236 - case TEST_TYPE_RUN_TO_COMPLETION_MB: 2237 - ret = testapp_multi_buffer(test); 2238 - break; 2239 - case TEST_TYPE_RUN_TO_COMPLETION_SINGLE_PKT: 2240 - ret = testapp_single_pkt(test); 2241 - break; 2242 - case TEST_TYPE_RUN_TO_COMPLETION_2K_FRAME: 2243 - ret = testapp_send_receive_2k_frame(test); 2244 - break; 2245 - case TEST_TYPE_RX_POLL: 2246 - ret = testapp_poll_rx(test); 2247 - break; 2248 - case TEST_TYPE_TX_POLL: 2249 - ret = testapp_poll_tx(test); 2250 - break; 2251 - case TEST_TYPE_POLL_TXQ_TMOUT: 2252 - ret = testapp_poll_txq_tmout(test); 2253 - break; 2254 - case TEST_TYPE_POLL_RXQ_TMOUT: 2255 - ret = testapp_poll_rxq_tmout(test); 2256 - break; 2257 - case TEST_TYPE_ALIGNED_INV_DESC: 2258 - ret = testapp_aligned_inv_desc(test); 2259 - break; 2260 - case TEST_TYPE_ALIGNED_INV_DESC_2K_FRAME: 2261 - ret = testapp_aligned_inv_desc_2k_frame(test); 2262 - break; 2263 - case TEST_TYPE_UNALIGNED_INV_DESC: 2264 - ret = testapp_unaligned_inv_desc(test); 2265 - break; 2266 - case TEST_TYPE_UNALIGNED_INV_DESC_4K1_FRAME: 2267 - ret = testapp_unaligned_inv_desc_4001_frame(test); 2268 - break; 2269 - case TEST_TYPE_ALIGNED_INV_DESC_MB: 2270 - ret = testapp_aligned_inv_desc_mb(test); 2271 - break; 2272 - case TEST_TYPE_UNALIGNED_INV_DESC_MB: 2273 - ret = testapp_unaligned_inv_desc_mb(test); 2274 - break; 2275 - case TEST_TYPE_UNALIGNED: 2276 - ret = testapp_unaligned(test); 2277 - break; 2278 - case TEST_TYPE_UNALIGNED_MB: 2279 - ret = testapp_unaligned_mb(test); 2280 - break; 2281 - case TEST_TYPE_HEADROOM: 2282 - ret = testapp_headroom(test); 2283 - break; 2284 - case TEST_TYPE_XDP_DROP_HALF: 2285 - ret = testapp_xdp_drop(test); 2286 - break; 2287 - case TEST_TYPE_XDP_METADATA_COUNT: 2288 - ret = testapp_xdp_metadata(test); 2289 - break; 2290 - case TEST_TYPE_XDP_METADATA_COUNT_MB: 2291 - ret = testapp_xdp_metadata_mb(test); 2292 - break; 2293 - case TEST_TYPE_TOO_MANY_FRAGS: 2294 - ret = testapp_too_many_frags(test); 2295 - break; 2296 - default: 2297 - break; 2298 - } 2238 + ret = test->test_func(test); 2299 2239 2300 2240 if (ret == TEST_PASS) 2301 2241 ksft_test_result_pass("PASS: %s %s%s\n", mode_string(test), busy_poll_string(test), ··· 2274 2392 return true; 2275 2393 } 2276 2394 2395 + static const struct test_spec tests[] = { 2396 + {.name = "SEND_RECEIVE", .test_func = testapp_send_receive}, 2397 + {.name = "SEND_RECEIVE_2K_FRAME", .test_func = testapp_send_receive_2k_frame}, 2398 + {.name = "SEND_RECEIVE_SINGLE_PKT", .test_func = testapp_single_pkt}, 2399 + {.name = "POLL_RX", .test_func = testapp_poll_rx}, 2400 + {.name = "POLL_TX", .test_func = testapp_poll_tx}, 2401 + {.name = "POLL_RXQ_FULL", .test_func = testapp_poll_rxq_tmout}, 2402 + {.name = "POLL_TXQ_FULL", .test_func = testapp_poll_txq_tmout}, 2403 + {.name = "SEND_RECEIVE_UNALIGNED", .test_func = testapp_send_receive_unaligned}, 2404 + {.name = "ALIGNED_INV_DESC", .test_func = testapp_aligned_inv_desc}, 2405 + {.name = "ALIGNED_INV_DESC_2K_FRAME_SIZE", .test_func = testapp_aligned_inv_desc_2k_frame}, 2406 + {.name = "UNALIGNED_INV_DESC", .test_func = testapp_unaligned_inv_desc}, 2407 + {.name = "UNALIGNED_INV_DESC_4001_FRAME_SIZE", 2408 + .test_func = testapp_unaligned_inv_desc_4001_frame}, 2409 + {.name = "UMEM_HEADROOM", .test_func = testapp_headroom}, 2410 + {.name = "TEARDOWN", .test_func = testapp_teardown}, 2411 + {.name = "BIDIRECTIONAL", .test_func = testapp_bidirectional}, 2412 + {.name = "STAT_RX_DROPPED", .test_func = testapp_stats_rx_dropped}, 2413 + {.name = "STAT_TX_INVALID", .test_func = testapp_stats_tx_invalid_descs}, 2414 + {.name = "STAT_RX_FULL", .test_func = testapp_stats_rx_full}, 2415 + {.name = "STAT_FILL_EMPTY", .test_func = testapp_stats_fill_empty}, 2416 + {.name = "XDP_PROG_CLEANUP", .test_func = testapp_xdp_prog_cleanup}, 2417 + {.name = "XDP_DROP_HALF", .test_func = testapp_xdp_drop}, 2418 + {.name = "XDP_METADATA_COPY", .test_func = testapp_xdp_metadata}, 2419 + {.name = "XDP_METADATA_COPY_MULTI_BUFF", .test_func = testapp_xdp_metadata_mb}, 2420 + {.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb}, 2421 + {.name = "SEND_RECEIVE_UNALIGNED_9K_PACKETS", 2422 + .test_func = testapp_send_receive_unaligned_mb}, 2423 + {.name = "ALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_aligned_inv_desc_mb}, 2424 + {.name = "UNALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_unaligned_inv_desc_mb}, 2425 + {.name = "TOO_MANY_FRAGS", .test_func = testapp_too_many_frags}, 2426 + }; 2427 + 2277 2428 int main(int argc, char **argv) 2278 2429 { 2279 2430 struct pkt_stream *rx_pkt_stream_default; ··· 2349 2434 init_iface(ifobj_rx, MAC1, MAC2, worker_testapp_validate_rx); 2350 2435 init_iface(ifobj_tx, MAC2, MAC1, worker_testapp_validate_tx); 2351 2436 2352 - test_spec_init(&test, ifobj_tx, ifobj_rx, 0); 2437 + test_spec_init(&test, ifobj_tx, ifobj_rx, 0, &tests[0]); 2353 2438 tx_pkt_stream_default = pkt_stream_generate(ifobj_tx->umem, DEFAULT_PKT_CNT, MIN_PKT_SIZE); 2354 2439 rx_pkt_stream_default = pkt_stream_generate(ifobj_rx->umem, DEFAULT_PKT_CNT, MIN_PKT_SIZE); 2355 2440 if (!tx_pkt_stream_default || !rx_pkt_stream_default) ··· 2358 2443 test.rx_pkt_stream_default = rx_pkt_stream_default; 2359 2444 2360 2445 if (opt_mode == TEST_MODE_ALL) { 2361 - ksft_set_plan(modes * TEST_TYPE_MAX); 2446 + ksft_set_plan(modes * ARRAY_SIZE(tests)); 2362 2447 } else { 2363 2448 if (opt_mode == TEST_MODE_DRV && modes <= TEST_MODE_DRV) { 2364 2449 ksft_print_msg("Error: XDP_DRV mode not supported.\n"); ··· 2369 2454 ksft_exit_xfail(); 2370 2455 } 2371 2456 2372 - ksft_set_plan(TEST_TYPE_MAX); 2457 + ksft_set_plan(ARRAY_SIZE(tests)); 2373 2458 } 2374 2459 2375 2460 for (i = 0; i < modes; i++) { 2376 2461 if (opt_mode != TEST_MODE_ALL && i != opt_mode) 2377 2462 continue; 2378 2463 2379 - for (j = 0; j < TEST_TYPE_MAX; j++) { 2380 - test_spec_init(&test, ifobj_tx, ifobj_rx, i); 2381 - run_pkt_test(&test, i, j); 2464 + for (j = 0; j < ARRAY_SIZE(tests); j++) { 2465 + test_spec_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]); 2466 + run_pkt_test(&test); 2382 2467 usleep(USLEEP_MAX); 2383 2468 2384 2469 if (test.fail)
+4 -33
tools/testing/selftests/bpf/xskxceiver.h
··· 34 34 #define MAX_INTERFACES 2 35 35 #define MAX_INTERFACE_NAME_CHARS 16 36 36 #define MAX_SOCKETS 2 37 - #define MAX_TEST_NAME_SIZE 32 37 + #define MAX_TEST_NAME_SIZE 48 38 38 #define MAX_TEARDOWN_ITER 10 39 39 #define PKT_HDR_SIZE (sizeof(struct ethhdr) + 2) /* Just to align the data in the packet */ 40 40 #define MIN_PKT_SIZE 64 ··· 64 64 TEST_MODE_DRV, 65 65 TEST_MODE_ZC, 66 66 TEST_MODE_ALL 67 - }; 68 - 69 - enum test_type { 70 - TEST_TYPE_RUN_TO_COMPLETION, 71 - TEST_TYPE_RUN_TO_COMPLETION_2K_FRAME, 72 - TEST_TYPE_RUN_TO_COMPLETION_SINGLE_PKT, 73 - TEST_TYPE_RX_POLL, 74 - TEST_TYPE_TX_POLL, 75 - TEST_TYPE_POLL_RXQ_TMOUT, 76 - TEST_TYPE_POLL_TXQ_TMOUT, 77 - TEST_TYPE_UNALIGNED, 78 - TEST_TYPE_ALIGNED_INV_DESC, 79 - TEST_TYPE_ALIGNED_INV_DESC_2K_FRAME, 80 - TEST_TYPE_UNALIGNED_INV_DESC, 81 - TEST_TYPE_UNALIGNED_INV_DESC_4K1_FRAME, 82 - TEST_TYPE_HEADROOM, 83 - TEST_TYPE_TEARDOWN, 84 - TEST_TYPE_BIDI, 85 - TEST_TYPE_STATS_RX_DROPPED, 86 - TEST_TYPE_STATS_TX_INVALID_DESCS, 87 - TEST_TYPE_STATS_RX_FULL, 88 - TEST_TYPE_STATS_FILL_EMPTY, 89 - TEST_TYPE_BPF_RES, 90 - TEST_TYPE_XDP_DROP_HALF, 91 - TEST_TYPE_XDP_METADATA_COUNT, 92 - TEST_TYPE_XDP_METADATA_COUNT_MB, 93 - TEST_TYPE_RUN_TO_COMPLETION_MB, 94 - TEST_TYPE_UNALIGNED_MB, 95 - TEST_TYPE_ALIGNED_INV_DESC_MB, 96 - TEST_TYPE_UNALIGNED_INV_DESC_MB, 97 - TEST_TYPE_TOO_MANY_FRAGS, 98 - TEST_TYPE_MAX 99 67 }; 100 68 101 69 struct xsk_umem_info { ··· 105 137 }; 106 138 107 139 struct ifobject; 140 + struct test_spec; 108 141 typedef int (*validation_func_t)(struct ifobject *ifobj); 109 142 typedef void *(*thread_func_t)(void *arg); 143 + typedef int (*test_func_t)(struct test_spec *test); 110 144 111 145 struct ifobject { 112 146 char ifname[MAX_INTERFACE_NAME_CHARS]; ··· 150 180 struct bpf_program *xdp_prog_tx; 151 181 struct bpf_map *xskmap_rx; 152 182 struct bpf_map *xskmap_tx; 183 + test_func_t test_func; 153 184 int mtu; 154 185 u16 total_steps; 155 186 u16 current_step;