Thread (7 messages) flat view 7 messages, 4 authors, 2020-09-25

Re: [PATCH bpf-next v3 2/2] selftests/bpf: Verifying real time helper function

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2020-09-24 15:34:16
Also in: bpf

On 9/24/20 4:25 AM, bimmy.pujari@intel.com wrote:
From: Bimmy Pujari <redacted>

Test xdping measures RTT from xdp using monotonic time helper.
Extending xdping test to use real time helper function in order
to verify this helper function.

Signed-off-by: Bimmy Pujari <redacted>
[...]
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/bpf/progs/xdping_realtime_kern.c b/tools/testing/selftests/bpf/progs/xdping_realtime_kern.c
new file mode 100644
index 000000000000..85f9d9bfc5b7
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/xdping_realtime_kern.c
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+#define REALTIME
+
Instead of moving everything into xdping_kern.h and then adding a REALTIME define just
for doing ...

   +#ifdef REALTIME
   +	recvtime = bpf_ktime_get_real_ns();
   +#else
   +	recvtime = bpf_ktime_get_ns();
   +#endif

... why not simply just provide a small inline helper with the bpf_ktime_*() implementation
instead so we can avoid the ugly ifdef altogether..
quoted hunk ↗ jump to hunk
+#include "xdping_kern.h"
diff --git a/tools/testing/selftests/bpf/test_xdping.sh b/tools/testing/selftests/bpf/test_xdping.sh
index c2f0ddb45531..3e357755b279 100755
--- a/tools/testing/selftests/bpf/test_xdping.sh
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help