From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH bpf 11/11] bpf: add selftest for tcpbpf Date: Tue, 19 Dec 2017 17:34:18 -0800 Message-ID: <0ca23aea-6cb7-6b32-7bd1-fdd777572eb6@fb.com> References: <20171219062200.372711-1-brakmo@fb.com> <20171219062200.372711-12-brakmo@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: Kernel Team , Blake Matheny , Daniel Borkmann To: Lawrence Brakmo , netdev Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:49290 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630AbdLTBej (ORCPT ); Tue, 19 Dec 2017 20:34:39 -0500 In-Reply-To: <20171219062200.372711-12-brakmo@fb.com> Sender: netdev-owner@vger.kernel.org List-ID: On 12/18/17 10:22 PM, Lawrence Brakmo wrote: > - sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o test_tracepoint.o > + sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o test_tracepoint.o \ > + test_tcpbpf_kern.o it won't apply. please base patches on bpf-next tree > +#!/usr/local/bin/python > +# > +# Copyright (c) 2017 Facebook > +# > +# This program is free software; you can redistribute it and/or > +# modify it under the terms of version 2 of the GNU General Public > +# License as published by the Free Software Foundation. the license should be in SPDX format. > +++ b/tools/testing/selftests/bpf/test_tcpbpf_kern.c > @@ -0,0 +1,133 @@ > +/* Copyright (c) 2017 Facebook > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of version 2 of the GNU General Public > + * License as published by the Free Software Foundation. > + */ same here. > + case BPF_SOCK_OPS_STATE_CB: > + if (skops->args[1] == 7) { > + __u32 key = 0; > + struct globals g, *gp; > + > + gp = bpf_map_lookup_elem(&global_map, &key); > + if (gp == NULL) { > + } else { > + g = *gp; > + g.total_retrans = skops->total_retrans; > + g.data_segs_in = skops->data_segs_in; you can reduce indent by doing if (!gp) break; g = *gp; g.total_retrans = skops->total_retrans; > +++ b/tools/testing/selftests/bpf/test_tcpbpf_user.c > @@ -0,0 +1,119 @@ > +/* Copyright (c) 2017 Facebook > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of version 2 of the GNU General Public > + * License as published by the Free Software Foundation. > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +//#include "bpf_load.h" please remove left over comments.