[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW6wPdTGpY4-iicW+7T=+6M8ZFdQpdXV6Fx+fe7qy27Z2A@mail.gmail.com>
Date: Mon, 24 Feb 2020 16:12:49 -0800
From: Song Liu <song@...nel.org>
To: Martin KaFai Lau <kafai@...com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>,
Kernel Team <kernel-team@...com>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/4] inet_diag: Refactor inet_sk_diag_fill(),
dump(), and dump_one()
On Fri, Feb 21, 2020 at 10:47 AM Martin KaFai Lau <kafai@...com> wrote:
>
> In a latter patch, there is a need to update "cb->min_dump_alloc"
> in inet_sk_diag_fill() as it learns the diffierent bpf_sk_storages
> stored in a sk while dumping all sk(s) (e.g. tcp_hashinfo).
>
> The inet_sk_diag_fill() currently does not take the "cb" as an argument.
> One of the reason is inet_sk_diag_fill() is used by both dump_one()
> and dump() (which belong to the "struct inet_diag_handler". The dump_one()
> interface does not pass the "cb" along.
>
> This patch is to make dump_one() pass a "cb". The "cb" is created in
> inet_diag_cmd_exact(). The "nlh" and "in_skb" are stored in "cb" as
> the dump() interface does. The total number of args in
> inet_sk_diag_fill() is also cut from 10 to 7 and
> that helps many callers to pass fewer args.
>
> In particular,
> "struct user_namespace *user_ns", "u32 pid", and "u32 seq"
> can be replaced by accessing "cb->nlh" and "cb->skb".
>
> A similar argument reduction is also made to
> inet_twsk_diag_fill() and inet_req_diag_fill().
>
> inet_csk_diag_dump() and inet_csk_diag_fill() are also removed.
> They are mostly equivalent to inet_sk_diag_fill(). Their repeated
> usages are very limited. Thus, inet_sk_diag_fill() is directly used
> in those occasions.
>
> Signed-off-by: Martin KaFai Lau <kafai@...com>
Acked-by: Song Liu <songliubraving@...com>
Powered by blists - more mailing lists