aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/netmap
Commit message (Collapse)AuthorAgeFilesLines
* tests/sys/netmap: use require.kmods property instead of ad-hoc checksSiva Mahadevan2025-09-052-7/+1
| | | | | | | Signed-off-by: Siva Mahadevan <me@svmhdvn.name> Sponsored by: The FreeBSD Foundation Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1780
* netmap: Disable a buggy and unsafe test (sync_kloop_conflict)John Baldwin2025-03-061-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test starts two threads to verify that two concurrent threads cannot enter the kernel loop on the same netmap context. The test even has a comment about a potential race condition where the first thread enters the loop and is stopped before the second thread tries to enter the loop. It claims it is fixed by the use of a semaphore. Unfortunately, the semaphore doesn't close the race. In the CI setup for CHERI, we run the testsuite once a week against various architectures using single CPU QEMU instances. Across multiple recent runs of the plain "aarch64" test the job ran for an entire day before QEMU was killed by a timeout. The last messages logged were from this test: 734.881045 [1182] generic_netmap_attach Emulated adapter for tap3312 created (prev was NULL) 734.882340 [ 321] generic_netmap_register Emulated adapter for tap3312 activated 734.882675 [2224] netmap_csb_validate csb_init for kring tap3312 RX0: head 0, cur 0, hwcur 0, hwtail 0 734.883042 [2224] netmap_csb_validate csb_init for kring tap3312 TX0: head 0, cur 0, hwcur 0, hwtail 1023 734.915397 [ 820] netmap_sync_kloop kloop busy_wait 1, direct_tx 0, direct_rx 0, na_could_sleep 0 736.901945 [ 820] netmap_sync_kloop kloop busy_wait 1, direct_tx 0, direct_rx 0, na_could_sleep 0 From the timestamps, the synchronous kloop was entered twice 2 seconds apart. This corresponds to the 2 second timeout on the semaphore in the test. What appears to have happened is that th1 started and entered the kernel where it spun in an endless busy loop. This starves th2 so it _never_ runs. Once the semaphore times out, th1 is preempted to run the main thread which invokes the ioctl to stop the busy loop. th1 then exits the loop and returns to userland to exit. Only after this point does th2 actually run and execute the ioctl to enter the kernel. Since th1 has already exited, th2 doesn't error and enters its own happy spin loop. The main thread hangs forever in pthread_join, and the process is unkillable (the busy loop in the kernel doesn't check for any pending signals so kill -9 is ignored and ineffective). I don't see a way to fix this test, so I've just disabled it. There is no good way to ensurce concurrency on a single CPU system when one thread wants to sit in a spin loop. Someone should fix the netmap kloop to respond to kill -9 in which case kyua could perhaps at least timeout the individual test process and kill it. Reviewed by: vmaffione Obtained from: CheriBSD Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D49220
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* netmap: fix unit testsVincenzo Maffione2023-12-291-2/+0
| | | | | | | | After ad874544d9f018bf8eef4053b5ca7b856c4674cb, interface name validation has been removed, resulting in two unit tests failures. Drop the failing tests since they no longer apply. Reported by: markj
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* netmap: fix copyin/copyout of nmreq options listVincenzo Maffione2023-03-211-2/+21
| | | | | | | | | | | | | | | | | | | The previous code unsuccesfully attempted to report a precise error for each option in the user list. Moreover, commit 253b2ec199b broke some ctrl-api-test (see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260547). With this patch we bail out as soon as an unrecoverable error is detected and we properly check for copy boundaries. EOPNOTSUPP no longer immediately returns an error, so that any other option in the list may be examined by the caller code and a precise report of the (un)supported options can be returned to the user. With this patch, all ctrl-api-test unit tests pass again. PR: 260547 Submitted by: giuseppe.lettieri@unipi.it Reviewed by: vmaffione MFC after: 14 days
* netmap tests: Reset ctx->nmctx to NULL in nmreq_parsing.John Baldwin2022-12-051-0/+1
| | | | | | | | This avoids leaking a pointer to the on-stack test_nmctx which triggers a -Wdangling-pointer warning from GCC. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D37536
* netmap: update unit tests with libnetmap testsVincenzo Maffione2021-04-022-13/+309
|
* netmap: several typo fixesVincenzo Maffione2021-04-021-0/+10
| | | | No functional changes intended.
* Do a sweep and remove most WARNS=6 settingsKyle Evans2020-10-011-2/+0
| | | | | | | | | | | | | | | Repeating the default WARNS here makes it slightly more difficult to experiment with default WARNS changes, e.g. if we did something absolutely bananas and introduced a WARNS=7 and wanted to try lifting the default to that. Drop most of them; there is one in the blake2 kernel module, but I suspect it should be dropped -- the default WARNS in the rest of the build doesn't currently apply to kernel modules, and I haven't put too much thought into whether it makes sense to make it so. Notes: svn path=/head/; revision=366304
* netmap: add test cases for multiple host ringsVincenzo Maffione2019-04-131-24/+53
| | | | | | | | | | Extend the netmap unit tests with new test cases for the multiple-host-rings feature introduced by r345269. MFC after: 1 week Notes: svn path=/head/; revision=346184
* Polish netmap(4) testcases a bitEnji Cooper2019-04-092-2/+4
| | | | | | | | | | | | | | | | | | | | | 1. Not all kernels have netmap(4) support. Check for netmap(4) support before attempting to run the tests via the `PLAIN_REQUIRE_KERNEL_MODULE(..)` macro. 2. Libraries shouldn't be added to LDFLAGS; they should be added to LIBADD instead. This allows the build system to evaluate dependencies for sanity. 3. Sort some of the Makefile variables per bsd.README. 1., in particular, will resolve failures when running this testcase on kernels lacking netmap(4) support, e.g., the i386 GENERIC kernels on ^/stable/11 and ^/stable/12. PR: 237129 Reviewed by: vmaffione Approved by: emaste (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19864 Notes: svn path=/head/; revision=346061
* Skip this test if if_tap module is not availableOlivier Cochard2019-03-282-0/+11
| | | | | | | | | | PR: 236842 Approved by: asomers MFC after: 1 month Sponsored by: Netflix Notes: svn path=/head/; revision=345644
* netmap: update unit testsVincenzo Maffione2019-03-201-22/+68
| | | | | | | | | | | | | Revision r345269 introduced changes that triggered a regression on netmap unit tests (tests/sys/netmap/ctrl-api-test.c). This change updates the unit tests to remove the regression. Reported by: lwhsu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19639 Notes: svn path=/head/; revision=345323
* netmap: unit tests: fix issues found by coverity scanVincenzo Maffione2019-01-031-46/+53
| | | | | | | | | Reported by: asomers MFC after: 1 week Sponsored by: Sunny Valley Networks Notes: svn path=/head/; revision=342737
* netmap: fix warnings on unit testsVincenzo Maffione2018-12-311-9/+13
| | | | | | | | | | | Fix some printf() format string warnings raised for ctrl-api-test.c on some architectures. MFC after: 1 week Sponsored by: Sunny Valley Networks Notes: svn path=/head/; revision=342650
* netmap: add suite of unit testsVincenzo Maffione2018-12-312-0/+1919
Import the unit tests from upstream (https://github.com/luigirizzo/netmap ba02539859d46d33), and make them ready for use with Kyua. There are currently 38 regression tests, which test the kernel control ABI exposed by netmap to userspace applications: 1: test for port info get 2-5: tests for basic port registration 6-9: tests for VALE 10-11: tests for getting netmap allocator info 12-15: tests for netmap pipes 16: test on polling mode 17-18: tests on options 19-27: tests for sync-kloop subsystem 28-39: tests for null ports 31-38: tests for the legacy NIOCREGIF registers Reviewed by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18490 Notes: svn path=/head/; revision=342649