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 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81F90C433E1 for ; Wed, 24 Jun 2020 15:37:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E6C220706 for ; Wed, 24 Jun 2020 15:37:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593013052; bh=BLTpk1BJdDLwAiHdRWyO+yC7MM5BY7JdBYk57yhyizw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=ZZ2MssihOflixks49EKe71KhXvVgIwDFK7vJMPYH1EIs8sFM2Cmp+Il1qB+sj8eGp 8P74AFxQhGRDDwTkHqPH9jrQMQ0opeVpYqXRAyoFs46O0iB3WiJT6TwuLZuZmSXRA5 QvmP85X/VY16xC3oxOS8pM5QTW+NeKoEQDqbjaN8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404355AbgFXPhb (ORCPT ); Wed, 24 Jun 2020 11:37:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:33444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404302AbgFXPh3 (ORCPT ); Wed, 24 Jun 2020 11:37:29 -0400 Received: from localhost (unknown [151.48.138.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 673B1206FA; Wed, 24 Jun 2020 15:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593013049; bh=BLTpk1BJdDLwAiHdRWyO+yC7MM5BY7JdBYk57yhyizw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1mJUXgJDdRnbMEvPLpFSyc+cu+jOIG2PWMPVRg/og9be82zp89AnhdkRlcAm30H+u BPkXIvwkcJ/8R+e7fAVf7cBa6ZCgGnIwI3mum+oR+U06f7TlHuLrTkgNY67Gcr8AsC tWzxbCUznz5qzxa0pPMzyWwMyt4FHP43qkBqQE54= Date: Wed, 24 Jun 2020 17:37:23 +0200 From: Lorenzo Bianconi To: Andrii Nakryiko Cc: Networking , bpf , "David S. Miller" , Alexei Starovoitov , Jesper Dangaard Brouer , Daniel Borkmann , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , lorenzo.bianconi@redhat.com, David Ahern Subject: Re: [PATCH v3 bpf-next 9/9] selftest: add tests for XDP programs in CPUMAP entries Message-ID: <20200624153723.GA342397@localhost.localdomain> References: <81ff56ab7ba1f0e48cba821563d311fa8f7e2e28.1592947694.git.lorenzo@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > On Tue, Jun 23, 2020 at 2:40 PM Lorenzo Bianconi wro= te: > > > > Similar to what have been done for DEVMAP, introduce tests to verify [...] > > +SEC("xdp_cpumap/dummy_cm") > > +int xdp_dummy_cm(struct xdp_md *ctx) > > +{ > > + char fmt[] =3D "devmap redirect: dev %u len %u\n"; > > + void *data_end =3D (void *)(long)ctx->data_end; > > + void *data =3D (void *)(long)ctx->data; > > + unsigned int len =3D data_end - data; > > + > > + ingress_ifindex =3D ctx->ingress_ifindex; >=20 > Have you checked the generated BPF assembly to verify > ctx->ingress_ifindex is actually read? ingress_ifindex variable is > declared static, so I'm guessing Clang just optimized it away. If you > want to be sure this actually gets executed, make ingress_ifindex > global var. ack, thx for the review. I will fix it in v4. Regards, Lorenzo >=20 > > + > > + return XDP_PASS; > > +} > > + > > +char _license[] SEC("license") =3D "GPL"; > > -- > > 2.26.2 > > --ZPt4rx8FFjLCG7dd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCXvNzMAAKCRA6cBh0uS2t rFtuAQDTSy491GEwZuaw4L+opmPebWbjP7n1K/FJ/HJ5Z45PZwEA5pTG3B/LTL2v UNbZVjThhanw6tKAS0jUNarEytYsJg0= =I3GU -----END PGP SIGNATURE----- --ZPt4rx8FFjLCG7dd--