Skip to content

Commit 09d4e15

Browse files
geliangtangKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
selftests: bpf: use MIN for TCP CC tests
Use macro MIN() in sys/param.h for TCP CC tests, instead of defining a new one. Signed-off-by: Geliang Tang <[email protected]>
1 parent 14e33f1 commit 09d4e15

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
#include <linux/err.h>
55
#include <netinet/tcp.h>
6+
#include <sys/param.h>
67
#include <test_progs.h>
78
#include "network_helpers.h"
89
#include "bpf_dctcp.skel.h"
910
#include "bpf_cubic.skel.h"
1011
#include "bpf_tcp_nogpl.skel.h"
1112
#include "bpf_dctcp_release.skel.h"
1213

13-
#define min(a, b) ((a) < (b) ? (a) : (b))
14-
1514
#ifndef ENOTSUPP
1615
#define ENOTSUPP 524
1716
#endif
@@ -53,7 +52,7 @@ static void *server(void *arg)
5352

5453
while (bytes < total_bytes && !READ_ONCE(stop)) {
5554
nr_sent = send(fd, &batch,
56-
min(total_bytes - bytes, sizeof(batch)), 0);
55+
MIN(total_bytes - bytes, sizeof(batch)), 0);
5756
if (nr_sent == -1 && errno == EINTR)
5857
continue;
5958
if (nr_sent == -1) {
@@ -146,7 +145,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
146145
/* recv total_bytes */
147146
while (bytes < total_bytes && !READ_ONCE(stop)) {
148147
nr_recv = recv(fd, &batch,
149-
min(total_bytes - bytes, sizeof(batch)), 0);
148+
MIN(total_bytes - bytes, sizeof(batch)), 0);
150149
if (nr_recv == -1 && errno == EINTR)
151150
continue;
152151
if (nr_recv == -1)

0 commit comments

Comments
 (0)