From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-x34.google.com (mail-oa1-x34.google.com [IPv6:2001:4860:4864:20::34]) by mail.toke.dk (Postfix) with ESMTPS id A4FBD9C2782 for ; Tue, 15 Nov 2022 19:37:58 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=V0rZ4d85 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-13b103a3e5dso17250366fac.2 for ; Tue, 15 Nov 2022 10:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QhMUoKXVcMHmZEBz9MdS5zopFN48S1PqhhOi5SQP8d8=; b=V0rZ4d85Xqc2HRJ94PzmtFOnpPbAaBdwVWu/3Iev1I5GTwtDLKyuG1FwKqZDzphhWF PmzT8Mue1qsX/T/wISpvNwvtp01Vxrj3doz0SdUrjfD/F0YlP82djlWuq0Uq9Xy3uaXR mIM3dwXPUGMJU+MPYWN3x4Rpr5p99iyI24oWzxlEpyvnqAtPb28hjXr1WhWWU/4LwOc9 Qnnxs4THCRLdL5NuyM7LyBq2bigQxiVWi4zbf2+4BD5Jl9Y4CjRmr9ZQydCnd0Jaq6aP VYR+eMLieAydf9FplWWfG7K8aUEXGDJ5ockZvspK2jsEbZYmIs0KDROCsjBybfTdB2gn p3hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QhMUoKXVcMHmZEBz9MdS5zopFN48S1PqhhOi5SQP8d8=; b=TxfkUQUoqMmBPoYKQGP3vmwPb4aHL8VODx7Gk03s91OZT6VAOHgTsIgzuWn1JhKP1T cdsZMkDUf8y9mBPC12MqOdlx+FUtsWN+5pa5ryeZxy+d1rf3vDQCsqkE7FFglDmuXrhv BIxl8ZaLgDHwTIPn4b6r6HT/ANR9b8csGr+j6TGSNUe6DXYxyEjlqxgX6pSjsb9aKzva QdiDpSYd5rn0zx7msUSB+Q8css80Ab5mTg954bbWkyOI0Qvr4+8Cz2b86OKA9hoAbjlB LVS/2GL2/P9wIh3WGsqVMDVqxarmcRYpFR0uYdsjl/WKmYgO8T57m1JE0C63LeUOLsDP 4hzg== X-Gm-Message-State: ANoB5pkAyVwiw/tDQKAf0i0c+LksGT4mkoKN+E4LviqaJLYUEJ7Ilvr4 U3e+X320H1jmUwZ704MHKMHfE1OI59sj55OrmoGeXg== X-Google-Smtp-Source: AA0mqf41NxdjStkZGmG9M30H6U1J1P0O9gnXmxLWefGJiEvgAFmccBPxAM9KsLI4KXvYYOU+yHPWdMvsDvJODX86Ef8= X-Received: by 2002:a05:6870:9624:b0:13b:be90:a68a with SMTP id d36-20020a056870962400b0013bbe90a68amr1856335oaq.181.1668537474926; Tue, 15 Nov 2022 10:37:54 -0800 (PST) MIME-Version: 1.0 References: <20221115030210.3159213-1-sdf@google.com> <20221115030210.3159213-6-sdf@google.com> <87h6z0i449.fsf@toke.dk> In-Reply-To: <87h6z0i449.fsf@toke.dk> From: Stanislav Fomichev Date: Tue, 15 Nov 2022 10:37:43 -0800 Message-ID: To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PNEU5G3HVLSYXUXB4VD5LQKL5CCEHZLR X-Message-ID-Hash: PNEU5G3HVLSYXUXB4VD5LQKL5CCEHZLR X-MailFrom: sdf@google.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: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.6 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next 05/11] veth: Support rx timestamp metadata for xdp List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, Nov 15, 2022 at 8:17 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > Stanislav Fomichev writes: > > > The goal is to enable end-to-end testing of the metadata > > for AF_XDP. Current rx_timestamp kfunc returns current > > time which should be enough to exercise this new functionality. > > > > Cc: John Fastabend > > Cc: David Ahern > > Cc: Martin KaFai Lau > > Cc: Jakub Kicinski > > Cc: Willem de Bruijn > > Cc: Jesper Dangaard Brouer > > Cc: Anatoly Burakov > > Cc: Alexander Lobakin > > Cc: Magnus Karlsson > > Cc: Maryam Tahhan > > Cc: xdp-hints@xdp-project.net > > Cc: netdev@vger.kernel.org > > Signed-off-by: Stanislav Fomichev > > --- > > drivers/net/veth.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/drivers/net/veth.c b/drivers/net/veth.c > > index 2a4592780141..c626580a2294 100644 > > --- a/drivers/net/veth.c > > +++ b/drivers/net/veth.c > > @@ -25,6 +25,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > #define DRV_NAME "veth" > > @@ -1659,6 +1660,18 @@ static int veth_xdp(struct net_device *dev, stru= ct netdev_bpf *xdp) > > } > > } > > > > +static void veth_unroll_kfunc(const struct bpf_prog *prog, u32 func_id= , > > + struct bpf_patch *patch) > > +{ > > + if (func_id =3D=3D xdp_metadata_kfunc_id(XDP_METADATA_KFUNC_RX_TI= MESTAMP_SUPPORTED)) { > > + /* return true; */ > > + bpf_patch_append(patch, BPF_MOV64_IMM(BPF_REG_0, 1)); > > + } else if (func_id =3D=3D xdp_metadata_kfunc_id(XDP_METADATA_KFUN= C_RX_TIMESTAMP)) { > > + /* return ktime_get_mono_fast_ns(); */ > > + bpf_patch_append(patch, BPF_EMIT_CALL(ktime_get_mono_fast= _ns)); > > + } > > +} > > So these look reasonable enough, but would be good to see some examples > of kfunc implementations that don't just BPF_CALL to a kernel function > (with those helper wrappers we were discussing before). Let's maybe add them if/when needed as we add more metadata support? xdp_metadata_export_to_skb has an example, and rfc 1/2 have more examples, so it shouldn't be a problem to resurrect them back at some point?