lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 22 Jan 2020 22:17:24 +0000
From:   Martin Lau <kafai@...com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
CC:     bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
        "Daniel Borkmann" <daniel@...earbox.net>,
        David Miller <davem@...emloft.net>,
        "Eric Dumazet" <edumazet@...gle.com>,
        Kernel Team <Kernel-team@...com>,
        Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 bpf-next 3/3] bpf: tcp: Add bpf_cubic example

On Wed, Jan 22, 2020 at 01:53:45PM -0800, Andrii Nakryiko wrote:
> On Tue, Jan 21, 2020 at 10:42 PM Martin KaFai Lau <kafai@...com> wrote:
> >
> > This patch adds a bpf_cubic example.  Some highlights:
> > 1. CONFIG_HZ .kconfig map is used.
> > 2. In bictcp_update(), calculation is changed to use usec
> >    resolution (i.e. USEC_PER_JIFFY) instead of using jiffies.
> >    Thus, usecs_to_jiffies() is not used in the bpf_cubic.c.
> > 3. In bitctcp_update() [under tcp_friendliness], the original
> >    "while (ca->ack_cnt > delta)" loop is changed to the equivalent
> >    "ca->ack_cnt / delta" operation.
> >
> > Signed-off-by: Martin KaFai Lau <kafai@...com>
> > ---
> 
> just my few cents below...
> 
> [...]
> 
> >
> > +static void test_cubic(void)
> > +{
> > +       struct bpf_cubic *cubic_skel;
> > +       struct bpf_link *link;
> > +
> > +       cubic_skel = bpf_cubic__open_and_load();
> > +       if (CHECK(!cubic_skel, "bpf_cubic__open_and_load", "failed\n"))
> > +               return;
> > +
> > +       link = bpf_map__attach_struct_ops(cubic_skel->maps.cubic);
> 
> we should probably teach bpftool and libbpf to generate a link for
> struct_ops map and also auto-attach it as part of skeleton's attach...
> I'll add it if noone gets to it sooner
It is in my TODO list.  I am happy to be beaten though ;)

> 
> > +       if (CHECK(IS_ERR(link), "bpf_map__attach_struct_ops", "err:%ld\n",
> > +                 PTR_ERR(link))) {
> > +               bpf_cubic__destroy(cubic_skel);
> > +               return;
> > +       }
> > +
> > +       do_test("bpf_cubic");
> > +
> > +       bpf_link__destroy(link);
> > +       bpf_cubic__destroy(cubic_skel);
> > +}
> > +
> 
> [...]
> 
> > +
> > +extern unsigned long CONFIG_HZ __kconfig __weak;
> 
> you probably don't want __weak, if CONFIG_HZ is not defined in
> Kconfig, then something wrong is going on, probably, so it's better to
> error out early
Thanks for pointing it out.  Will do.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ