aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/bpf/test_maps.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index e7798dd97f4b..3c627771f965 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -45,7 +45,7 @@ static int map_flags;
45 } \ 45 } \
46}) 46})
47 47
48static void test_hashmap(int task, void *data) 48static void test_hashmap(unsigned int task, void *data)
49{ 49{
50 long long key, next_key, first_key, value; 50 long long key, next_key, first_key, value;
51 int fd; 51 int fd;
@@ -135,7 +135,7 @@ static void test_hashmap(int task, void *data)
135 close(fd); 135 close(fd);
136} 136}
137 137
138static void test_hashmap_sizes(int task, void *data) 138static void test_hashmap_sizes(unsigned int task, void *data)
139{ 139{
140 int fd, i, j; 140 int fd, i, j;
141 141
@@ -155,7 +155,7 @@ static void test_hashmap_sizes(int task, void *data)
155 } 155 }
156} 156}
157 157
158static void test_hashmap_percpu(int task, void *data) 158static void test_hashmap_percpu(unsigned int task, void *data)
159{ 159{
160 unsigned int nr_cpus = bpf_num_possible_cpus(); 160 unsigned int nr_cpus = bpf_num_possible_cpus();
161 BPF_DECLARE_PERCPU(long, value); 161 BPF_DECLARE_PERCPU(long, value);
@@ -282,7 +282,7 @@ static int helper_fill_hashmap(int max_entries)
282 return fd; 282 return fd;
283} 283}
284 284
285static void test_hashmap_walk(int task, void *data) 285static void test_hashmap_walk(unsigned int task, void *data)
286{ 286{
287 int fd, i, max_entries = 1000; 287 int fd, i, max_entries = 1000;
288 long long key, value, next_key; 288 long long key, value, next_key;
@@ -353,7 +353,7 @@ static void test_hashmap_zero_seed(void)
353 close(second); 353 close(second);
354} 354}
355 355
356static void test_arraymap(int task, void *data) 356static void test_arraymap(unsigned int task, void *data)
357{ 357{
358 int key, next_key, fd; 358 int key, next_key, fd;
359 long long value; 359 long long value;
@@ -408,7 +408,7 @@ static void test_arraymap(int task, void *data)
408 close(fd); 408 close(fd);
409} 409}
410 410
411static void test_arraymap_percpu(int task, void *data) 411static void test_arraymap_percpu(unsigned int task, void *data)
412{ 412{
413 unsigned int nr_cpus = bpf_num_possible_cpus(); 413 unsigned int nr_cpus = bpf_num_possible_cpus();
414 BPF_DECLARE_PERCPU(long, values); 414 BPF_DECLARE_PERCPU(long, values);
@@ -504,7 +504,7 @@ static void test_arraymap_percpu_many_keys(void)
504 close(fd); 504 close(fd);
505} 505}
506 506
507static void test_devmap(int task, void *data) 507static void test_devmap(unsigned int task, void *data)
508{ 508{
509 int fd; 509 int fd;
510 __u32 key, value; 510 __u32 key, value;
@@ -519,7 +519,7 @@ static void test_devmap(int task, void *data)
519 close(fd); 519 close(fd);
520} 520}
521 521
522static void test_queuemap(int task, void *data) 522static void test_queuemap(unsigned int task, void *data)
523{ 523{
524 const int MAP_SIZE = 32; 524 const int MAP_SIZE = 32;
525 __u32 vals[MAP_SIZE + MAP_SIZE/2], val; 525 __u32 vals[MAP_SIZE + MAP_SIZE/2], val;
@@ -577,7 +577,7 @@ static void test_queuemap(int task, void *data)
577 close(fd); 577 close(fd);
578} 578}
579 579
580static void test_stackmap(int task, void *data) 580static void test_stackmap(unsigned int task, void *data)
581{ 581{
582 const int MAP_SIZE = 32; 582 const int MAP_SIZE = 32;
583 __u32 vals[MAP_SIZE + MAP_SIZE/2], val; 583 __u32 vals[MAP_SIZE + MAP_SIZE/2], val;
@@ -642,7 +642,7 @@ static void test_stackmap(int task, void *data)
642#define SOCKMAP_PARSE_PROG "./sockmap_parse_prog.o" 642#define SOCKMAP_PARSE_PROG "./sockmap_parse_prog.o"
643#define SOCKMAP_VERDICT_PROG "./sockmap_verdict_prog.o" 643#define SOCKMAP_VERDICT_PROG "./sockmap_verdict_prog.o"
644#define SOCKMAP_TCP_MSG_PROG "./sockmap_tcp_msg_prog.o" 644#define SOCKMAP_TCP_MSG_PROG "./sockmap_tcp_msg_prog.o"
645static void test_sockmap(int tasks, void *data) 645static void test_sockmap(unsigned int tasks, void *data)
646{ 646{
647 struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break; 647 struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break;
648 int map_fd_msg = 0, map_fd_rx = 0, map_fd_tx = 0, map_fd_break; 648 int map_fd_msg = 0, map_fd_rx = 0, map_fd_tx = 0, map_fd_break;
@@ -1268,10 +1268,11 @@ static void test_map_large(void)
1268} 1268}
1269 1269
1270#define run_parallel(N, FN, DATA) \ 1270#define run_parallel(N, FN, DATA) \
1271 printf("Fork %d tasks to '" #FN "'\n", N); \ 1271 printf("Fork %u tasks to '" #FN "'\n", N); \
1272 __run_parallel(N, FN, DATA) 1272 __run_parallel(N, FN, DATA)
1273 1273
1274static void __run_parallel(int tasks, void (*fn)(int task, void *data), 1274static void __run_parallel(unsigned int tasks,
1275 void (*fn)(unsigned int task, void *data),
1275 void *data) 1276 void *data)
1276{ 1277{
1277 pid_t pid[tasks]; 1278 pid_t pid[tasks];
@@ -1312,7 +1313,7 @@ static void test_map_stress(void)
1312#define DO_UPDATE 1 1313#define DO_UPDATE 1
1313#define DO_DELETE 0 1314#define DO_DELETE 0
1314 1315
1315static void test_update_delete(int fn, void *data) 1316static void test_update_delete(unsigned int fn, void *data)
1316{ 1317{
1317 int do_update = ((int *)data)[1]; 1318 int do_update = ((int *)data)[1];
1318 int fd = ((int *)data)[0]; 1319 int fd = ((int *)data)[0];