From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mail.toke.dk (Postfix) with ESMTPS id 3BB2E9FF635 for ; Wed, 19 Apr 2023 18:41:13 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ba43gNVp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681922471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlv123C+B2XbuevZfH+qzPUIEfiKhtHnPAxff1XZ5EU=; b=ba43gNVprZwzC1UbM1HAf/gOoYeDJr5AFvnGiimlH7qmMCK5aIGsl7yCq+rChmfdkumc9S RRp78pljMV7vwIxjKOnAMMaZb4Z3AFbJTSRyN8PGXtGg+0ZRaEWU/Nm/R/Iiuj6ZastjUu DcXsjbDF2RL7E3R+eWBtCE0GNcuEMMY= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-K88ngkR0PIeo1DzMLKUvqw-1; Wed, 19 Apr 2023 12:41:10 -0400 X-MC-Unique: K88ngkR0PIeo1DzMLKUvqw-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5054bd98964so82400a12.3 for ; Wed, 19 Apr 2023 09:41:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681922469; x=1684514469; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hlv123C+B2XbuevZfH+qzPUIEfiKhtHnPAxff1XZ5EU=; b=FpEXHgxOkeKAvahLH5npTtSHn8zJue/Z8V+upr7/PvqqYVkBbK2SZ6TUeBQ1aScTC2 ysbAtRUpL3gItnRDUiQdQJphIhJaUnaHMX/9979YIQTtNALYfhHgReRqIkt2dNICncOI NU55GjoIU1yImugidIL/m0oOqLJ3uBRXP0tmMFozW1tzM8kfj7ZoXJad534GSJGiM8Nx yzjLGRGNWaAd+WaVONr9UXq4M9DF2l0T6f1rIYbaUN4ZOR/FfbsuWPHoV6S/l1ZtJyeG ntjAT6jenI+x5/q6WKunRtz4GVyAGfSvqQAWW5PrEHba+O9vTFDctXjP9Q05JL0v9Z+j 6ydA== X-Gm-Message-State: AAQBX9faQeBzqk8ts7F9+uILvWK5HRVSlfaIwXNzdARl9lXyufwh12Kw EB+Mzo6AVqI2OTCB1k0+FVEEC5bdRAszZGkmcj4Ur6JFb+BAo1wHgNPtoFFy1ZiXlLJwxGT2u2k 2NbKpP+J/pHhQ9tg7hcWb X-Received: by 2002:aa7:d882:0:b0:506:747f:3bf0 with SMTP id u2-20020aa7d882000000b00506747f3bf0mr6496246edq.8.1681922469333; Wed, 19 Apr 2023 09:41:09 -0700 (PDT) X-Google-Smtp-Source: AKy350ZhK35CXjndGgF5Spba/Mxq6IuaaMO7jT05DPVMg1qXuVeYR2ehgm+jxdc2+5FsBIsBaAX16g== X-Received: by 2002:aa7:d882:0:b0:506:747f:3bf0 with SMTP id u2-20020aa7d882000000b00506747f3bf0mr6496218edq.8.1681922468996; Wed, 19 Apr 2023 09:41:08 -0700 (PDT) Received: from [192.168.42.222] (194-45-78-10.static.kviknet.net. [194.45.78.10]) by smtp.gmail.com with ESMTPSA id g3-20020aa7c843000000b005029c47f814sm8170544edt.49.2023.04.19.09.41.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 09:41:08 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <925c8354-f3ba-53fb-3950-ec02d41a12a7@redhat.com> Date: Wed, 19 Apr 2023 18:41:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 To: Stanislav Fomichev References: <168182460362.616355.14591423386485175723.stgit@firesoul> <168182466298.616355.2544377890818617459.stgit@firesoul> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: MZQAI4N5NAO765MRSGGX3K7MY6KCMEHZ X-Message-ID-Hash: MZQAI4N5NAO765MRSGGX3K7MY6KCMEHZ X-MailFrom: jbrouer@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: brouer@redhat.com, bpf@vger.kernel.org, =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , netdev@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, yoong.siang.song@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next V2 5/5] selftests/bpf: xdp_hw_metadata track more timestamps List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 18/04/2023 18.36, Stanislav Fomichev wrote: > On 04/18, Jesper Dangaard Brouer wrote: >> To correlate the hardware RX timestamp with something, add tracking of >> two software timestamps both clock source CLOCK_TAI (see description in >> man clock_gettime(2)). >> >> XDP metadata is extended with xdp_timestamp for capturing when XDP >> received the packet. Populated with BPF helper bpf_ktime_get_tai_ns(). I >> could not find a BPF helper for getting CLOCK_REALTIME, which would have >> been preferred. In userspace when AF_XDP sees the packet another >> software timestamp is recorded via clock_gettime() also clock source >> CLOCK_TAI. >> [...] >> More explanation of the output and how this can be used to identify >> clock drift for the HW clock can be seen here[1]: >> >> [1]https://github.com/xdp-project/xdp-project/blob/master/areas/hints/xdp_hints_kfuncs02_driver_igc.org >> >> Signed-off-by: Jesper Dangaard Brouer > Acked-by: Stanislav Fomichev > >> --- >> .../testing/selftests/bpf/progs/xdp_hw_metadata.c | 4 +- >> tools/testing/selftests/bpf/xdp_hw_metadata.c | 47 ++++++++++++++++++-- >> tools/testing/selftests/bpf/xdp_metadata.h | 1 >> 3 files changed, 46 insertions(+), 6 deletions(-) >> >> diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c >> index e1c787815e44..b2dfd7066c6e 100644 >> --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c >> +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c >> @@ -77,7 +77,9 @@ int rx(struct xdp_md *ctx) >> } >> >> err = bpf_xdp_metadata_rx_timestamp(ctx, &meta->rx_timestamp); >> - if (err) > [..] > >> + if (!err) >> + meta->xdp_timestamp = bpf_ktime_get_tai_ns(); > nit: why not set it unconditionally? Because userspace application doesn't use it for anything, when meta->rx_timestamp is zero. --Jesper