[dpdk-dev] [PATCH v4] ip_pipeline: configuration file parser cleanup

2016-06-08 Thread Thomas Monjalon
clang compilation fails:
examples/ip_pipeline/config_parse.c:852:11: error:
implicit conversion from enumeration type 'enum app_pktq_out_type'
to different enumeration type 'enum app_pktq_in_type'


[dpdk-dev] [PATCH v4] ip_pipeline: configuration file parser cleanup

2016-06-08 Thread Singh, Jasvinder


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, June 8, 2016 3:48 PM
> To: Singh, Jasvinder 
> Cc: dev at dpdk.org; Dumitrescu, Cristian 
> Subject: Re: [dpdk-dev] [PATCH v4] ip_pipeline: configuration file parser
> cleanup
> 
> clang compilation fails:
>   examples/ip_pipeline/config_parse.c:852:11: error:
>   implicit conversion from enumeration type 'enum
> app_pktq_out_type'
>   to different enumeration type 'enum app_pktq_in_type'

Thanks, Thomas. V5 has been sent fixing this error.


[dpdk-dev] [PATCH v4] ip_pipeline: configuration file parser cleanup

2016-05-30 Thread Jasvinder Singh
This commit adds following changes to configuration file parsing of
the ip pipeline application;

1. Parsing routines related to packet queues (pktq_in/out fields in the
PIPELINE section) and message queues (msgq_in/out fields of in the MSGQ
Section) are updated.

In the parsing routines, function "strtok_r()" is used for parsing the
string instead of manually checking the string termination, white
spaces, tabs etc., between the string tokens. Each call to strtok_r()
returns a pointer to a null-terminated string containing the next token.
If no more tokens are found, strtok_r() returns NULL. As a result of
using strtok_r(), the code size of the parsing routines is reduced
significantly.

2. Replace PARSER_PARAM_ADD_CHECK macro by more specific macros such as
PARSE_CHECK_DUPLICATE_SECTION, PARSE_CHECK_DUPLICATE_SECTION_EAL to detect
duplicate entries in the various sections of the configuration file

3. Add new macros PARSER_ERROR_NO_ELEMENTS and PARSE_ERROR_TOO_MANY_ELEMENTS
for detecting no element and more elements than allowed situations
respectively, in the section entry.

4. Add new macros APP_PARAM_ADD_LINK_FOR_RXQ, APP_PARAM_ADD_LINK_FOR_TXQ
and APP_PARAM_ADD_LINK_FOR_TM which add corresponding nic ports entry to
the application param structure while parsing rx/tx queues, TM (Traffic
Manager) port sections and pktq_in/out entries of pipeline sections

Signed-off-by: Jasvinder Singh 
Acked-by: Cristian Dumitrescu 
---
v4
- update the commit message
- move APP_PARAM_ADD macro from app.h to config_parse.c as it is only used
  by the routines defined in this file
- remove extra newline character from error message display
- rebased on top of ip_pipeline CLI patchset
  (http://dpdk.org/dev/patchwork/patch/12911/) and NULL packet processing
  fix patch (http://dpdk.org/dev/patchwork/patch/12807/)

v3
- add check on the number of pktq_in/out entries
- add check on the number of msgq_in/out entries

v2
- update the commit message
- change the local variable name from "token" to "name"

 examples/ip_pipeline/app.h  |  25 +-
 examples/ip_pipeline/config_parse.c | 472 +++-
 2 files changed, 196 insertions(+), 301 deletions(-)

diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h
index e775024..05d608b 100644
--- a/examples/ip_pipeline/app.h
+++ b/examples/ip_pipeline/app.h
@@ -50,6 +50,7 @@

 #define APP_PARAM_NAME_SIZE  PIPELINE_NAME_SIZE
 #define APP_LINK_PCI_BDF_SIZE16
+
 struct app_mempool_params {
char *name;
uint32_t parsed;
@@ -370,6 +371,8 @@ struct app_eal_params {
/* Support running on Xen dom0 without hugetlbfs */
uint32_t xen_dom0_present;
int xen_dom0;
+
+   uint32_t parsed;
 };

 #ifndef APP_APPNAME_SIZE
@@ -529,28 +532,6 @@ do 
\
sscanf(obj->name, prefix "%" SCNu32, );  
\
 while (0)  \

-#define APP_PARAM_ADD(obj_array, obj_name) \
-({ \
-   ssize_t obj_idx;\
-   const ssize_t obj_count = RTE_DIM(obj_array);   \
-   \
-   obj_idx = APP_PARAM_FIND(obj_array, obj_name);  \
-   if (obj_idx < 0) {  \
-   for (obj_idx = 0; obj_idx < obj_count; obj_idx++) { \
-   if (!APP_PARAM_VALID(&((obj_array)[obj_idx])))  \
-   break;  \
-   }   \
-   \
-   if (obj_idx < obj_count) {  \
-   (obj_array)[obj_idx].name = strdup(obj_name);   \
-   if ((obj_array)[obj_idx].name == NULL)  \
-   obj_idx = -EINVAL;  \
-   } else  \
-   obj_idx = -ENOMEM;  \
-   }   \
-   obj_idx;\
-})
-
 #defineAPP_CHECK(exp, fmt, ...)
\
 do {   \
if (!(exp)) {   \
diff --git a/examples/ip_pipeline/config_parse.c 
b/examples/ip_pipeline/config_parse.c
index 3951e1d..53130a0 100644
--- a/examples/ip_pipeline/config_parse.c
+++ b/examples/ip_pipeline/config_parse.c
@@ -1,4 +1,4 @@
-/*-
+?/*-
  *