From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05228C61D97 for ; Sun, 29 Jan 2023 18:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjA2Ssj (ORCPT ); Sun, 29 Jan 2023 13:48:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbjA2Ssf (ORCPT ); Sun, 29 Jan 2023 13:48:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 176BD1F4BA; Sun, 29 Jan 2023 10:48:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A4010B80CBB; Sun, 29 Jan 2023 18:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA412C433D2; Sun, 29 Jan 2023 18:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675018085; bh=wqWSHpwy3MUpVmsntNqQHtsxLsPh+QcU+TX0EB5Z+4c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Nz1tZKtoo2WWyX7mMEDJ0juSHAcoJaOdpTBcbcWkG+P8/FhbZM+UEhpuuleS+FLUd 4OzJ1t+ZdgzDeJ+nJ4yDp/amMYIlrdWBGOEzygjP42g2g245qB9D3YSX7Pbdh7NvOW 5G4KuVbsuWWQ0KnKKM0iPK/t2i+ekATc7EwjAmIiuv6cHg1mOiOx/9Ws+QUbW+Wz9U iOyZMdtrQfBGEEPLquar3kg/yHDyqjMVltQbV/uB/96KSSE2RytjjXyE4kAIQ1je0/ KSX1gPVLOhpWEHgNY+q/tEpVTXmBZVKNPWb4FJ1+jipdegmwISU77c+1qKZg14IB+2 gkfbLrJHYVGKg== Date: Sun, 29 Jan 2023 19:48:01 +0100 From: Lorenzo Bianconi To: Alexei Starovoitov Cc: bpf , Network Development , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Jesper Dangaard Brouer , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , Kumar Kartikeya Dwivedi , Marek Majtyka , Saeed Mahameed , anthony.l.nguyen@intel.com, Andy Gospodarek , vladimir.oltean@nxp.com, Felix Fietkau , john@phrozen.org, Leon Romanovsky , Simon Horman , Ariel Elior , christophe.jaillet@wanadoo.fr, ecree.xilinx@gmail.com, "Michael S. Tsirkin" , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , "Karlsson, Magnus" , "Fijalkowski, Maciej" , intel-wired-lan , Lorenzo Bianconi , Martin KaFai Lau , Stanislav Fomichev Subject: Re: [PATCH v4 bpf-next 8/8] selftests/bpf: introduce XDP compliance test tool Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Nx0wHPKtgW7QyJuF" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org --Nx0wHPKtgW7QyJuF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jan 28, Alexei Starovoitov wrote: > On Sat, Jan 28, 2023 at 6:07 AM Lorenzo Bianconi wro= te: > > diff --git a/tools/testing/selftests/bpf/xdp_features.h b/tools/testing= /selftests/bpf/xdp_features.h > > new file mode 100644 > > index 000000000000..28d7614c4f02 > > --- /dev/null > > +++ b/tools/testing/selftests/bpf/xdp_features.h > > @@ -0,0 +1,33 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > + > > +/* test commands */ > > +enum test_commands { > > + CMD_STOP, /* CMD */ > > + CMD_START, /* CMD + xdp feature */ > > + CMD_ECHO, /* CMD */ > > + CMD_ACK, /* CMD + data */ > > + CMD_GET_XDP_CAP, /* CMD */ > > + CMD_GET_STATS, /* CMD */ > > +}; > > + > > +#define DUT_CTRL_PORT 12345 > > +#define DUT_ECHO_PORT 12346 > > + > > +struct tlv_hdr { > > + __be16 type; > > + __be16 len; > > + __be32 data[]; > > +}; > > + > > +enum { > > + XDP_FEATURE_ABORTED, > > + XDP_FEATURE_DROP, > > + XDP_FEATURE_PASS, > > + XDP_FEATURE_TX, > > + XDP_FEATURE_REDIRECT, > > + XDP_FEATURE_NDO_XMIT, > > + XDP_FEATURE_XSK_ZEROCOPY, > > + XDP_FEATURE_HW_OFFLOAD, > > + XDP_FEATURE_RX_SG, > > + XDP_FEATURE_NDO_XMIT_SG, > > +}; >=20 > This doesn't match the kernel. > How did you test this? > What should be the way to prevent such mistakes in the future? Hi Alexei, I added the XDP_FEATURE_* enum above since the XDP compliance test tool nee= ds to differentiate between actions in NETDEV_XDP_ACT_BASIC (e.g XDP_TX and XDP_PASS or XDP_REDIRECT are handled differently in the ebpf programs insta= lled on the tester and DUT devices). However, combining netdev_xdp_act and xdp_a= ction enum definitions, I think we can keep this logic in xdp_feature userspace p= art and we can get rid of the XDP_FEATURE_* enum above. I will fix it in v5. Regards, Lorenzo --Nx0wHPKtgW7QyJuF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCY9a/YQAKCRA6cBh0uS2t rA0MAQD14qKZyBuuTUx+gcvcXc9dncuAjpGH/LEYEmvcdZpjPgD/evMoa3V8P0ut zGEhB25aPtnf/qiDteYI2cvq8czggAw= =A3gE -----END PGP SIGNATURE----- --Nx0wHPKtgW7QyJuF--