[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-+=91KJEV==jE0VLT=FBTyM+j5sLfovk-HTj_2BbCC2Hw@mail.gmail.com>
Date: Tue, 19 Mar 2019 22:14:43 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Stanislav Fomichev <sdf@...gle.com>
Cc: Network Development <netdev@...r.kernel.org>, bpf@...r.kernel.org,
David Miller <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
simon.horman@...ronome.com, Willem de Bruijn <willemb@...gle.com>,
Petar Penkov <peterpenkov96@...il.com>
Subject: Re: [RFC bpf-next v2 7/9] bpf: when doing BPF_PROG_TEST_RUN for flow
dissector use no-skb mode
On Tue, Mar 19, 2019 at 6:21 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> Now that we have __flow_bpf_dissect which works on raw data (by
> constructing temporary on-stack skb), use it when doing
> BPF_PROG_TEST_RUN for flow dissector.
>
> This should help us catch any possible bugs due to missing shinfo on
> the per-cpu skb.
>
> Note that existing __skb_flow_bpf_dissect swallows L2 headers and returns
> nhoff=0, we need to preserve the existing behavior.
>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---
> net/bpf/test_run.c | 48 ++++++++++++++--------------------------------
> 1 file changed, 14 insertions(+), 34 deletions(-)
>
> @@ -300,9 +277,13 @@ int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
> preempt_disable();
> time_start = ktime_get_ns();
> for (i = 0; i < repeat; i++) {
> - retval = bpf_flow_dissect_skb(prog, skb,
> - &flow_keys_dissector,
> - &flow_keys);
> + retval = bpf_flow_dissect(prog, data, eth->h_proto, ETH_HLEN,
> + size, &flow_keys_dissector,
> + &flow_keys);
> + if (flow_keys.nhoff >= ETH_HLEN)
> + flow_keys.nhoff -= ETH_HLEN;
> + if (flow_keys.thoff >= ETH_HLEN)
> + flow_keys.thoff -= ETH_HLEN;
why are these conditional?
Powered by blists - more mailing lists