[v3,4/5] app/testpmd: add jansson library

Message ID 20211011181528.517-5-viacheslavo@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: introduce configurable flexible item |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Slava Ovsiienko Oct. 11, 2021, 6:15 p.m. UTC
  From: Gregory Etelson <getelson@nvidia.com>

Testpmd interactive mode provides CLI to configure application
commands. Testpmd reads CLI command and parameters from STDIN, and
converts input into C objects with internal parser.
The patch adds jansson dependency to testpmd.
With jansson, testpmd can read input in JSON format from STDIN or input
file and convert it into C object using jansson library calls.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 app/test-pmd/meson.build | 5 +++++
 app/test-pmd/testpmd.h   | 3 +++
 2 files changed, 8 insertions(+)
  

Comments

Ori Kam Oct. 12, 2021, 7:56 a.m. UTC | #1
Hi Gregory,

> -----Original Message-----
> From: Slava Ovsiienko <viacheslavo@nvidia.com>
> Sent: Monday, October 11, 2021 9:15 PM
> Subject: [PATCH v3 4/5] app/testpmd: add jansson library
> 
> From: Gregory Etelson <getelson@nvidia.com>
> 
> Testpmd interactive mode provides CLI to configure application commands. Testpmd reads CLI command
> and parameters from STDIN, and converts input into C objects with internal parser.
> The patch adds jansson dependency to testpmd.
> With jansson, testpmd can read input in JSON format from STDIN or input file and convert it into C object
> using jansson library calls.
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>  app/test-pmd/meson.build | 5 +++++
>  app/test-pmd/testpmd.h   | 3 +++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index 98f3289bdf..3a8babd604
> 100644
> --- a/app/test-pmd/meson.build
> +++ b/app/test-pmd/meson.build
> @@ -61,3 +61,8 @@ if dpdk_conf.has('RTE_LIB_BPF')
>      sources += files('bpf_cmd.c')
>      deps += 'bpf'
>  endif
> +jansson_dep = dependency('jansson', required: false, method:
> +'pkg-config') if jansson_dep.found()
> +    dpdk_conf.set('RTE_HAS_JANSSON', 1)
> +    ext_deps += jansson_dep
> +endif
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 5863b2f43f..876a341cf0 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -14,6 +14,9 @@
>  #include <rte_os_shim.h>
>  #include <cmdline.h>
>  #include <sys/queue.h>
> +#ifdef RTE_HAS_JANSSON
> +#include <jansson.h>
> +#endif
> 
>  #define RTE_PORT_ALL            (~(portid_t)0x0)
> 
> --
> 2.18.1

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  

Patch

diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 98f3289bdf..3a8babd604 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -61,3 +61,8 @@  if dpdk_conf.has('RTE_LIB_BPF')
     sources += files('bpf_cmd.c')
     deps += 'bpf'
 endif
+jansson_dep = dependency('jansson', required: false, method: 'pkg-config')
+if jansson_dep.found()
+    dpdk_conf.set('RTE_HAS_JANSSON', 1)
+    ext_deps += jansson_dep
+endif
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 5863b2f43f..876a341cf0 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -14,6 +14,9 @@ 
 #include <rte_os_shim.h>
 #include <cmdline.h>
 #include <sys/queue.h>
+#ifdef RTE_HAS_JANSSON
+#include <jansson.h>
+#endif
 
 #define RTE_PORT_ALL            (~(portid_t)0x0)