From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stanislav Fomichev Subject: [PATCH bpf-next 0/3] support flow dissector in BPF_PROG_TEST_RUN Date: Mon, 3 Dec 2018 10:59:16 -0800 Message-ID: <20181203185919.187376-1-sdf@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, simon.horman@netronome.com, Stanislav Fomichev To: netdev@vger.kernel.org Return-path: Received: from mail-qt1-f202.google.com ([209.85.160.202]:39290 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbeLCS72 (ORCPT ); Mon, 3 Dec 2018 13:59:28 -0500 Received: by mail-qt1-f202.google.com with SMTP id u20so14336741qtk.6 for ; Mon, 03 Dec 2018 10:59:25 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: This patch series adds support for testing flow dissector BPF programs by extending already existing BPF_PROG_TEST_RUN. The goal is to have a packet as an input and `struct bpf_flow_key' as an output. That way we can easily test flow dissector programs' behavior. I've also modified existing test_progs.c test to do a simple flow dissector run as well. * first patch introduces new __skb_flow_bpf_dissect to simplify sharing between __skb_flow_bpf_dissect and BPF_PROG_TEST_RUN * second patch adds actual BPF_PROG_TEST_RUN support * third patch adds example usage to the selftests Stanislav Fomichev (3): net/flow_dissector: move bpf case into __skb_flow_bpf_dissect bpf: add BPF_PROG_TEST_RUN support for flow dissector selftests/bpf: add simple BPF_PROG_TEST_RUN examples for flow dissector include/linux/bpf.h | 3 + include/linux/skbuff.h | 5 ++ net/bpf/test_run.c | 76 +++++++++++++++-- net/core/filter.c | 1 + net/core/flow_dissector.c | 83 +++++++++++-------- tools/testing/selftests/bpf/Makefile | 3 + .../selftests/bpf/flow_dissector_load.c | 43 ++-------- .../selftests/bpf/flow_dissector_load.h | 55 ++++++++++++ tools/testing/selftests/bpf/test_progs.c | 76 ++++++++++++++++- 9 files changed, 265 insertions(+), 80 deletions(-) create mode 100644 tools/testing/selftests/bpf/flow_dissector_load.h -- 2.20.0.rc1.387.gf8505762e3-goog