Re: [PATCH bpf-next V1 3/7] selftests/bpf: xdp_hw_metadata track more timestamps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 17/03/2023 22.09, Stanislav Fomichev wrote:
diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
index 4c55b4d79d3d..f2a3b70a9882 100644
--- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
+++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
@@ -69,9 +69,11 @@ int rx(struct xdp_md *ctx)
          return XDP_PASS;
      }

-    if (!bpf_xdp_metadata_rx_timestamp(ctx, &meta->rx_timestamp))
-        bpf_printk("populated rx_timestamp with %llu", meta->rx_timestamp);
-    else
+    if (!bpf_xdp_metadata_rx_timestamp(ctx, &meta->rx_timestamp)) {
+        meta->xdp_timestamp = bpf_ktime_get_tai_ns();
+        bpf_printk("populated rx_timestamp with  %llu", meta->rx_timestamp);
+        bpf_printk("populated xdp_timestamp with %llu", meta->xdp_timestamp);
+    } else
          meta->rx_timestamp = 0; /* Used by AF_XDP as not avail signal */

Nit: curly braces around else {} block as well?

Good point, fixed in V2




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux