On 4/22/22 2:50 AM, Takshak Chahande wrote: [...]
+static void fetch_and_validate(int outer_map_fd, + __u32 *inner_map_fds, + struct bpf_map_batch_opts *opts, + __u32 batch_size, bool delete_entries) +{ + __u32 *fetched_keys, *fetched_values, fetched_entries = 0; + __u32 next_batch_key = 0, step_size = 5; + int err, retries = 0, max_retries = 3; + __u32 value_size = sizeof(__u32); + + fetched_keys = calloc(batch_size, value_size); + fetched_values = calloc(batch_size, value_size); + + while (fetched_entries < batch_size) { + err = delete_entries + ? bpf_map_lookup_and_delete_batch(outer_map_fd, + fetched_entries ? &next_batch_key : NULL, + &next_batch_key, + fetched_keys + fetched_entries, + fetched_values + fetched_entries, + &step_size, opts) + : bpf_map_lookup_batch(outer_map_fd, + fetched_entries ? &next_batch_key : NULL, + &next_batch_key, + fetched_keys + fetched_entries, + fetched_values + fetched_entries, + &step_size, opts); + CHECK((err < 0 && (errno != ENOENT && errno != ENOSPC)), + "lookup with steps failed", + "error: %s\n", strerror(errno)); + + fetched_entries += step_size; + /* retry for max_retries if ENOSPC */ + if (errno == ENOSPC) + ++retries; + + if (retries >= max_retries) + break; + } + + CHECK((fetched_entries != batch_size && err != ENOSPC), + "Unable to fetch expected entries !", + "fetched_entries(%d) and batch_size(%d) error: (%d):%s\n", + fetched_entries, batch_size, errno, strerror(errno)); +
Looks like BPF CI in test_maps trips right here: [...] test_lpm_trie_map_batch_ops:PASS batch_op is successful for batch_size(5) batch_op is successful for batch_size(10) test_map_in_map_batch_ops_array:PASS with inner ARRAY map batch_op is successful for batch_size(5) batch_op is successful for batch_size(10) test_map_in_map_batch_ops_array:PASS with inner HASH map fetch_and_validate(158):FAIL:Unable to fetch expected entries ! fetched_entries(8) and batch_size(5) error: (2):No such file or directory test_verifier - Testing test_verifier collect_status - Collect status shutdown - Shutdown Test Results: bpftool: PASS test_progs: PASS test_progs-no_alu32: PASS test_maps: FAIL (returned 255) test_verifier: PASS shutdown: CLEAN Error: Process completed with exit code 1.