From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Gushchin Subject: Re: [PATCH v3 bpf-next 10/10] selftests/bpf: cgroup local storage-based network counters Date: Fri, 28 Sep 2018 11:37:26 +0100 Message-ID: <20180928103717.GA12917@castle.DHCP.thefacebook.com> References: <20180926113326.29069-1-guro@fb.com> <20180926113326.29069-11-guro@fb.com> <20180928085356.56xe7javtd6cdfz6@ast-mbp.dhcp.thefacebook.com> <20180928100817.GC9018@castle.DHCP.thefacebook.com> <20180928102814.voj6bsuslxh6ms37@ast-mbp.dhcp.thefacebook.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: , Song Liu , , , Daniel Borkmann , Alexei Starovoitov To: Alexei Starovoitov Return-path: Content-Disposition: inline In-Reply-To: <20180928102814.voj6bsuslxh6ms37@ast-mbp.dhcp.thefacebook.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Fri, Sep 28, 2018 at 12:28:16PM +0200, Alexei Starovoitov wrote: > On Fri, Sep 28, 2018 at 11:08:29AM +0100, Roman Gushchin wrote: > > > > + /* Some packets can be still in per-cpu cache, but not more than > > > > + * MAX_PERCPU_PACKETS. > > > > + */ > > > > + packets = netcnt.packets; > > > > + for (cpu = 0; cpu < nproc; cpu++) { > > > > + if (percpu_netcnt[cpu].packets > 32) { > > > > > > pls use MAX_PERCPU_PACKETS in the above check. > > > could you also double check that if that #define is changed to 1k or so > > > the exact "!= 10000" check below still works as expected? > > > > Do you mean adding a new test with a different MAX_PERCPU_PACKETS? > > good idea! If it's easy to compile the same source twice with different > MAX_PERCPU_PACKETS that would certainly make the test stronger. > Not sure how feasible though. > > > > > > > > > > + printf("Unexpected percpu value: %llu\n", > > > > + percpu_netcnt[cpu].packets); > > > > + goto err; > > > > > > > + } > > > > + > > > > + packets += percpu_netcnt[cpu].packets; > > > > + } > > > > + > > > > + /* No packets should be lost */ > > > > + if (packets != 10000) { > > > > + printf("Unexpected packet count: %lu\n", packets); > > > > + goto err; > > > > + } > > > > + > > > > + /* Let's check that bytes counter value is reasonable */ > > > > + if (netcnt.bytes < packets * 500 || netcnt.bytes > packets * 1500) { > > > > > > since packet count is accurate why byte count would vary ? > > > > Tbh I'm not sure if the size of the packet here can vary depending > > on the environment. Is there a nice way to get the expected size? > > ping packets should be fixed size depending on v4 vs v6. > If 'ping -6' is used, it will force ipv6. > Are we ok to screw up kselftests on v4-only machines? Alternatively, I can send 1 packet, get the size and check that all other are of the same size.