[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d5f8a177-836e-9e04-a68c-1a57b2e80f26@iogearbox.net>
Date: Thu, 24 Sep 2020 17:34:12 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: bimmy.pujari@...el.com, bpf@...r.kernel.org
Cc: netdev@...r.kernel.org, mchehab@...nel.org, ast@...nel.org,
kafai@...com, maze@...gle.com, ashkan.nikravesh@...el.com
Subject: Re: [PATCH bpf-next v3 2/2] selftests/bpf: Verifying real time helper
function
On 9/24/20 4:25 AM, bimmy.pujari@...el.com wrote:
> From: Bimmy Pujari <bimmy.pujari@...el.com>
>
> 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 <bimmy.pujari@...el.com>
[...]
> 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..
> +#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
[...]
Powered by blists - more mailing lists