[v2,4/5] test/bpf: move to examples folder

Message ID 20190219145308.65668-5-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series consolidate testing apps to app dir |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson Feb. 19, 2019, 2:53 p.m. UTC
  The bpf folder didn't actual contain a test application, but instead
basic examples of BPF code for use with testpmd. Therefore we can
move it to the `examples` folder. Being different, it also needs
a README with it, explaining what it is and how to use it. References
to the code from the testpmd docs are suitably updated.

CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 MAINTAINERS                                 | 2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++----
 examples/bpf/README                         | 8 ++++++++
 {test => examples}/bpf/dummy.c              | 0
 {test => examples}/bpf/mbuf.h               | 0
 examples/bpf/meson.build                    | 6 ++++++
 {test => examples}/bpf/t1.c                 | 0
 {test => examples}/bpf/t2.c                 | 0
 {test => examples}/bpf/t3.c                 | 0
 9 files changed, 19 insertions(+), 5 deletions(-)
 create mode 100644 examples/bpf/README
 rename {test => examples}/bpf/dummy.c (100%)
 rename {test => examples}/bpf/mbuf.h (100%)
 create mode 100644 examples/bpf/meson.build
 rename {test => examples}/bpf/t1.c (100%)
 rename {test => examples}/bpf/t2.c (100%)
 rename {test => examples}/bpf/t3.c (100%)
  

Comments

Ananyev, Konstantin Feb. 20, 2019, 9:35 a.m. UTC | #1
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Tuesday, February 19, 2019 2:53 PM
> To: dev@dpdk.org; thomas@monjalon.net
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [PATCH v2 4/5] test/bpf: move to examples folder
> 
> The bpf folder didn't actual contain a test application, but instead
> basic examples of BPF code for use with testpmd.

Might be the better to create app/test-pmf/bpf directory
and move them into it.
Konstantin

> Therefore we can
> move it to the `examples` folder. Being different, it also needs
> a README with it, explaining what it is and how to use it. References
> to the code from the testpmd docs are suitably updated.
> 
> CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  MAINTAINERS                                 | 2 +-
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++----
>  examples/bpf/README                         | 8 ++++++++
>  {test => examples}/bpf/dummy.c              | 0
>  {test => examples}/bpf/mbuf.h               | 0
>  examples/bpf/meson.build                    | 6 ++++++
>  {test => examples}/bpf/t1.c                 | 0
>  {test => examples}/bpf/t2.c                 | 0
>  {test => examples}/bpf/t3.c                 | 0
>  9 files changed, 19 insertions(+), 5 deletions(-)
>  create mode 100644 examples/bpf/README
>  rename {test => examples}/bpf/dummy.c (100%)
>  rename {test => examples}/bpf/mbuf.h (100%)
>  create mode 100644 examples/bpf/meson.build
>  rename {test => examples}/bpf/t1.c (100%)
>  rename {test => examples}/bpf/t2.c (100%)
>  rename {test => examples}/bpf/t3.c (100%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c4619174a..6d1d0aea7 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1230,7 +1230,7 @@ F: doc/guides/howto/telemetry.rst
>  BPF - EXPERIMENTAL
>  M: Konstantin Ananyev <konstantin.ananyev@intel.com>
>  F: lib/librte_bpf/
> -F: test/bpf/
> +F: examples/bpf/
>  F: test/test/test_bpf.c
>  F: doc/guides/prog_guide/bpf_lib.rst
> 
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 029148041..b079c60d9 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -4503,20 +4503,20 @@ For example:
> 
>  .. code-block:: console
> 
> -   cd test/bpf
> +   cd examples/bpf
>     clang -O2 -target bpf -c t1.c
> 
>  Then to load (and JIT compile) t1.o at RX queue 0, port 1::
> 
>  .. code-block:: console
> 
> -   testpmd> bpf-load rx 1 0 J ./dpdk.org/test/bpf/t1.o
> +   testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
> 
>  To load (not JITed) t1.o at TX queue 0, port 0::
> 
>  .. code-block:: console
> 
> -   testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
> +   testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
> 
>  bpf-unload
>  ~~~~~~~~~~
> @@ -4529,4 +4529,4 @@ For example to unload BPF filter from TX queue 0, port 0:
> 
>  .. code-block:: console
> 
> -   testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
> +   testpmd> bpf-unload tx 0 0
> diff --git a/examples/bpf/README b/examples/bpf/README
> new file mode 100644
> index 000000000..d714180a5
> --- /dev/null
> +++ b/examples/bpf/README
> @@ -0,0 +1,8 @@
> +This folder contains example BPF programs for use with the DPDK bpf
> +library. To get details of each program and how to compile it, see
> +the header on the '.c' file itself.
> +
> +Once compiled, these example programs can be loaded into `testpmd`
> +for execution on a packet stream. See `bpf-load` and `bpf-unload`
> +commands documented in the `Testpmd Application User Guide` for
> +details on how to do so.
> diff --git a/test/bpf/dummy.c b/examples/bpf/dummy.c
> similarity index 100%
> rename from test/bpf/dummy.c
> rename to examples/bpf/dummy.c
> diff --git a/test/bpf/mbuf.h b/examples/bpf/mbuf.h
> similarity index 100%
> rename from test/bpf/mbuf.h
> rename to examples/bpf/mbuf.h
> diff --git a/examples/bpf/meson.build b/examples/bpf/meson.build
> new file mode 100644
> index 000000000..0a817aaea
> --- /dev/null
> +++ b/examples/bpf/meson.build
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2019 Intel Corporation
> +
> +# This contains BPF example code for use in testing BPF with testpmd,
> +# therefore it should not be built as part of a meson build.
> +build=false
> diff --git a/test/bpf/t1.c b/examples/bpf/t1.c
> similarity index 100%
> rename from test/bpf/t1.c
> rename to examples/bpf/t1.c
> diff --git a/test/bpf/t2.c b/examples/bpf/t2.c
> similarity index 100%
> rename from test/bpf/t2.c
> rename to examples/bpf/t2.c
> diff --git a/test/bpf/t3.c b/examples/bpf/t3.c
> similarity index 100%
> rename from test/bpf/t3.c
> rename to examples/bpf/t3.c
> --
> 2.20.1
  
Bruce Richardson Feb. 20, 2019, 9:39 a.m. UTC | #2
On Wed, Feb 20, 2019 at 09:35:02AM +0000, Ananyev, Konstantin wrote:
> 
> 
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Tuesday, February 19, 2019 2:53 PM
> > To: dev@dpdk.org; thomas@monjalon.net
> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> > Subject: [PATCH v2 4/5] test/bpf: move to examples folder
> > 
> > The bpf folder didn't actual contain a test application, but instead
> > basic examples of BPF code for use with testpmd.
> 
> Might be the better to create app/test-pmf/bpf directory
> and move them into it.
> Konstantin
> 
Assume "test-pmd" in the path, right? I actually think they are better in
examples, myself, but no strong opinions. Anyone else have thoughts?
[Thomas, you are generally a good man for having your say - any input
here?]

/Bruce
  
Ananyev, Konstantin Feb. 20, 2019, 9:42 a.m. UTC | #3
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Wednesday, February 20, 2019 9:40 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net
> Subject: Re: [PATCH v2 4/5] test/bpf: move to examples folder
> 
> On Wed, Feb 20, 2019 at 09:35:02AM +0000, Ananyev, Konstantin wrote:
> >
> >
> > > -----Original Message-----
> > > From: Richardson, Bruce
> > > Sent: Tuesday, February 19, 2019 2:53 PM
> > > To: dev@dpdk.org; thomas@monjalon.net
> > > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> > > Subject: [PATCH v2 4/5] test/bpf: move to examples folder
> > >
> > > The bpf folder didn't actual contain a test application, but instead
> > > basic examples of BPF code for use with testpmd.
> >
> > Might be the better to create app/test-pmf/bpf directory
> > and move them into it.
> > Konstantin
> >
> Assume "test-pmd" in the path, right?

Yes :)

> I actually think they are better in
> examples, myself, but no strong opinions. Anyone else have thoughts?
> [Thomas, you are generally a good man for having your say - any input
> here?]
> 
> /Bruce
  
Thomas Monjalon Feb. 20, 2019, 10:35 a.m. UTC | #4
20/02/2019 10:39, Bruce Richardson:
> On Wed, Feb 20, 2019 at 09:35:02AM +0000, Ananyev, Konstantin wrote:
> > From: Richardson, Bruce
> > > 
> > > The bpf folder didn't actual contain a test application, but instead
> > > basic examples of BPF code for use with testpmd.
> > 
> > Might be the better to create app/test-pmf/bpf directory
> > and move them into it.
> > Konstantin
> > 
> Assume "test-pmd" in the path, right? I actually think they are better in
> examples, myself, but no strong opinions. Anyone else have thoughts?
> [Thomas, you are generally a good man for having your say - any input
> here?]

Those BPF programs can be used by any app having BPF loading support, right?
So I think the examples/ directory is the right place.
  
Ananyev, Konstantin Feb. 25, 2019, 4:22 p.m. UTC | #5
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Tuesday, February 19, 2019 2:53 PM
> To: dev@dpdk.org; thomas@monjalon.net
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [PATCH v2 4/5] test/bpf: move to examples folder
> 
> The bpf folder didn't actual contain a test application, but instead
> basic examples of BPF code for use with testpmd. Therefore we can
> move it to the `examples` folder. Being different, it also needs
> a README with it, explaining what it is and how to use it. References
> to the code from the testpmd docs are suitably updated.
> 
> CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  MAINTAINERS                                 | 2 +-
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++----
>  examples/bpf/README                         | 8 ++++++++
>  {test => examples}/bpf/dummy.c              | 0
>  {test => examples}/bpf/mbuf.h               | 0
>  examples/bpf/meson.build                    | 6 ++++++
>  {test => examples}/bpf/t1.c                 | 0
>  {test => examples}/bpf/t2.c                 | 0
>  {test => examples}/bpf/t3.c                 | 0
>  9 files changed, 19 insertions(+), 5 deletions(-)
>  create mode 100644 examples/bpf/README
>  rename {test => examples}/bpf/dummy.c (100%)
>  rename {test => examples}/bpf/mbuf.h (100%)
>  create mode 100644 examples/bpf/meson.build
>  rename {test => examples}/bpf/t1.c (100%)
>  rename {test => examples}/bpf/t2.c (100%)
>  rename {test => examples}/bpf/t3.c (100%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c4619174a..6d1d0aea7 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1230,7 +1230,7 @@ F: doc/guides/howto/telemetry.rst
>  BPF - EXPERIMENTAL
>  M: Konstantin Ananyev <konstantin.ananyev@intel.com>
>  F: lib/librte_bpf/
> -F: test/bpf/
> +F: examples/bpf/
>  F: test/test/test_bpf.c
>  F: doc/guides/prog_guide/bpf_lib.rst
> 
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 029148041..b079c60d9 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -4503,20 +4503,20 @@ For example:
> 
>  .. code-block:: console
> 
> -   cd test/bpf
> +   cd examples/bpf
>     clang -O2 -target bpf -c t1.c
> 
>  Then to load (and JIT compile) t1.o at RX queue 0, port 1::
> 
>  .. code-block:: console
> 
> -   testpmd> bpf-load rx 1 0 J ./dpdk.org/test/bpf/t1.o
> +   testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
> 
>  To load (not JITed) t1.o at TX queue 0, port 0::
> 
>  .. code-block:: console
> 
> -   testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
> +   testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
> 
>  bpf-unload
>  ~~~~~~~~~~
> @@ -4529,4 +4529,4 @@ For example to unload BPF filter from TX queue 0, port 0:
> 
>  .. code-block:: console
> 
> -   testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
> +   testpmd> bpf-unload tx 0 0
> diff --git a/examples/bpf/README b/examples/bpf/README
> new file mode 100644
> index 000000000..d714180a5
> --- /dev/null
> +++ b/examples/bpf/README
> @@ -0,0 +1,8 @@
> +This folder contains example BPF programs for use with the DPDK bpf
> +library. To get details of each program and how to compile it, see
> +the header on the '.c' file itself.
> +
> +Once compiled, these example programs can be loaded into `testpmd`
> +for execution on a packet stream. See `bpf-load` and `bpf-unload`
> +commands documented in the `Testpmd Application User Guide` for
> +details on how to do so.
> diff --git a/test/bpf/dummy.c b/examples/bpf/dummy.c
> similarity index 100%
> rename from test/bpf/dummy.c
> rename to examples/bpf/dummy.c
> diff --git a/test/bpf/mbuf.h b/examples/bpf/mbuf.h
> similarity index 100%
> rename from test/bpf/mbuf.h
> rename to examples/bpf/mbuf.h
> diff --git a/examples/bpf/meson.build b/examples/bpf/meson.build
> new file mode 100644
> index 000000000..0a817aaea
> --- /dev/null
> +++ b/examples/bpf/meson.build
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2019 Intel Corporation
> +
> +# This contains BPF example code for use in testing BPF with testpmd,
> +# therefore it should not be built as part of a meson build.
> +build=false
> diff --git a/test/bpf/t1.c b/examples/bpf/t1.c
> similarity index 100%
> rename from test/bpf/t1.c
> rename to examples/bpf/t1.c
> diff --git a/test/bpf/t2.c b/examples/bpf/t2.c
> similarity index 100%
> rename from test/bpf/t2.c
> rename to examples/bpf/t2.c
> diff --git a/test/bpf/t3.c b/examples/bpf/t3.c
> similarity index 100%
> rename from test/bpf/t3.c
> rename to examples/bpf/t3.c
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.20.1
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index c4619174a..6d1d0aea7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1230,7 +1230,7 @@  F: doc/guides/howto/telemetry.rst
 BPF - EXPERIMENTAL
 M: Konstantin Ananyev <konstantin.ananyev@intel.com>
 F: lib/librte_bpf/
-F: test/bpf/
+F: examples/bpf/
 F: test/test/test_bpf.c
 F: doc/guides/prog_guide/bpf_lib.rst
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 029148041..b079c60d9 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4503,20 +4503,20 @@  For example:
 
 .. code-block:: console
 
-   cd test/bpf
+   cd examples/bpf
    clang -O2 -target bpf -c t1.c
 
 Then to load (and JIT compile) t1.o at RX queue 0, port 1::
 
 .. code-block:: console
 
-   testpmd> bpf-load rx 1 0 J ./dpdk.org/test/bpf/t1.o
+   testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
 
 To load (not JITed) t1.o at TX queue 0, port 0::
 
 .. code-block:: console
 
-   testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
+   testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
 
 bpf-unload
 ~~~~~~~~~~
@@ -4529,4 +4529,4 @@  For example to unload BPF filter from TX queue 0, port 0:
 
 .. code-block:: console
 
-   testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
+   testpmd> bpf-unload tx 0 0
diff --git a/examples/bpf/README b/examples/bpf/README
new file mode 100644
index 000000000..d714180a5
--- /dev/null
+++ b/examples/bpf/README
@@ -0,0 +1,8 @@ 
+This folder contains example BPF programs for use with the DPDK bpf
+library. To get details of each program and how to compile it, see
+the header on the '.c' file itself.
+
+Once compiled, these example programs can be loaded into `testpmd`
+for execution on a packet stream. See `bpf-load` and `bpf-unload`
+commands documented in the `Testpmd Application User Guide` for
+details on how to do so.
diff --git a/test/bpf/dummy.c b/examples/bpf/dummy.c
similarity index 100%
rename from test/bpf/dummy.c
rename to examples/bpf/dummy.c
diff --git a/test/bpf/mbuf.h b/examples/bpf/mbuf.h
similarity index 100%
rename from test/bpf/mbuf.h
rename to examples/bpf/mbuf.h
diff --git a/examples/bpf/meson.build b/examples/bpf/meson.build
new file mode 100644
index 000000000..0a817aaea
--- /dev/null
+++ b/examples/bpf/meson.build
@@ -0,0 +1,6 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# This contains BPF example code for use in testing BPF with testpmd,
+# therefore it should not be built as part of a meson build.
+build=false
diff --git a/test/bpf/t1.c b/examples/bpf/t1.c
similarity index 100%
rename from test/bpf/t1.c
rename to examples/bpf/t1.c
diff --git a/test/bpf/t2.c b/examples/bpf/t2.c
similarity index 100%
rename from test/bpf/t2.c
rename to examples/bpf/t2.c
diff --git a/test/bpf/t3.c b/examples/bpf/t3.c
similarity index 100%
rename from test/bpf/t3.c
rename to examples/bpf/t3.c