[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b321412c-1b42-45a9-4dc6-cc268b55cd0d@gmail.com>
Date: Fri, 13 Dec 2019 17:59:54 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Martin KaFai Lau <kafai@...com>, bpf@...r.kernel.org
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>, kernel-team@...com,
netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next 09/13] bpf: Add BPF_FUNC_jiffies
On 12/13/19 4:47 PM, Martin KaFai Lau wrote:
> This patch adds a helper to handle jiffies. Some of the
> tcp_sock's timing is stored in jiffies. Although things
> could be deduced by CONFIG_HZ, having an easy way to get
> jiffies will make the later bpf-tcp-cc implementation easier.
>
...
> +
> +BPF_CALL_2(bpf_jiffies, u64, in, u64, flags)
> +{
> + if (!flags)
> + return get_jiffies_64();
> +
> + if (flags & BPF_F_NS_TO_JIFFIES) {
> + return nsecs_to_jiffies(in);
> + } else if (flags & BPF_F_JIFFIES_TO_NS) {
> + if (!in)
> + in = get_jiffies_64();
> + return jiffies_to_nsecs(in);
> + }
> +
> + return 0;
> +}
This looks a bit convoluted :)
Note that we could possibly change net/ipv4/tcp_cubic.c to no longer use jiffies at all.
We have in tp->tcp_mstamp an accurate timestamp (in usec) that can be converted to ms.
Have you thought of finding a way to not duplicate the code for cubic and dctcp, maybe
by including a template ?
Maintaining two copies means that future changes need more maintenance work.
Powered by blists - more mailing lists