- 
                Notifications
    
You must be signed in to change notification settings  - Fork 148
 
Commit 29080b5
committed
selftests/bpf: Add tests for bucket resume logic in UDP socket iterators
Introduce a set of tests that exercise various bucket resume scenarios:
* remove_seen resumes iteration after removing a socket from the bucket
  that we've already processed. Before, with the offset-based approach,
  this test would have skipped an unseen socket after resuming
  iteration. With the cookie-based approach, we now see all sockets
  exactly once.
* remove_unseen exercises the condition where the next socket that we
  would have seen is removed from the bucket before we resume iteration.
  This tests the scenario where we need to scan past the first cookie in
  our remembered cookies list to find the socket from which to resume
  iteration.
* remove_all exercises the condition where all sockets we remembered
  were removed from the bucket to make sure iteration terminates and
  returns no more results.
* add_some exercises the condition where a few, but not enough to
  trigger a realloc, sockets are added to the head of the current bucket
  between reads. Before, with the offset-based approach, this test would
  have repeated sockets we've already seen. With the cookie-based
  approach, we now see all sockets exactly once.
* force_realloc exercises the condition that we need to realloc the
  batch on a subsequent read, since more sockets than can be held in the
  current batch array were added to the current bucket. This exercies
  the logic inside bpf_iter_udp_realloc_batch that copies cookies into
  the new batch to make sure nothing is skipped or repeated.
Signed-off-by: Jordan Rife <[email protected]>1 parent c833177 commit 29080b5Copy full SHA for 29080b5
File tree
Expand file treeCollapse file tree
1 file changed
+414
-0
lines changedOpen diff view settings
Filter options
- tools/testing/selftests/bpf/prog_tests
 
Expand file treeCollapse file tree
1 file changed
+414
-0
lines changedOpen diff view settings
0 commit comments