librte_cfgfile (rte_cfgfile.h): modify the macros values
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 librte_cfgfile (rte_cfgfile.h): modify the macros values
This patch refers to the ABI change proposed for librte_cfgfile (rte_cfgfile.h).
In order to allow for longer names and values, the new values of macros CFG_NAME_LEN and CFG_NAME_VAL are set.
--- doc/guides/rel_notes/deprecation.rst | 4 ---- lib/librte_cfgfile/Makefile | 2 +- lib/librte_cfgfile/rte_cfgfile.h | 9 +++++++-- 3 files changed, 8 insertions(+), 7 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -86,10 +86,6 @@ Deprecation Notices be removed as well as the associated functions rte_acl_ipv4vlan_add_rules and rte_acl_ipv4vlan_build. -* librte_cfgfile: In order to allow for longer names and values, - the value of macros CFG_NAME_LEN and CFG_NAME_VAL will be increased. - Most likely, the new values will be 64 and 256, respectively. - * librte_port: Macros to access the packet meta-data stored within the packet buffer will be adjusted to cover the packet mbuf structure as well, as currently they are able to access any packet buffer location except the
lib/librte_cfgfile/Makefile +1 -1
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_cfgfile_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y
lib/librte_cfgfile/rte_cfgfile.h +7 -2
@@ -47,8 +47,13 @@ extern "C" {* ***/ -#define CFG_NAME_LEN 32 -#define CFG_VALUE_LEN 64 +#ifndef CFG_NAME_LEN +#define CFG_NAME_LEN 64 +#endif + +#ifndef CFG_VALUE_LEN +#define CFG_VALUE_LEN 256 +#endif /** Configuration file */ struct rte_cfgfile ;
Signature · 1 line
2.1.0
2015-09-03 15:18, Jasvinder Singh:
Quoted 2 lines
This patch refers to the ABI change proposed for
librte_cfgfile(rte_cfgfile.h).
In order to allow for longer names and values, the new values of macrosCFG_NAME_LENandCFG_NAME_VALare set.
Please wrap the commit message.CFG_NAME_VAL should be CFG_VALUE_LEN.
The title should start with "cfgfile:".
Instead of talking about macros changes, saying "increase maximum" would give more clue about the goal of the change.
Quoted 6 lines
Signed-off-by Jasvinder Singh <[email protected]>--- doc/guides/rel_notes/deprecation.rst | 4 ---- lib/librte_cfgfile/Makefile | 2 +- lib/librte_cfgfile/rte_cfgfile.h | 9 +++++++-- 3 files changed, 8 insertions(+), 7 deletions(-)
You have forgotten to update doc/guides/rel_notes/release_2_2.rst.
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Thursday, September 3, 2015 3:34 PM
To: Singh, Jasvinder
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2]librte_cfgfile(rte_cfgfile.h): modify the macros values
Quoted 6 lines
Quoted 4 lines
doc/guides/rel_notes/deprecation.rst | 4 ---- lib/librte_cfgfile/Makefile | 2 +- lib/librte_cfgfile/rte_cfgfile.h | 9 +++++++-- 3 files changed, 8 insertions(+), 7 deletions(-)You have forgotten to update
doc/guides/rel_notes/release_2_2.rst.
The new release notes file hasn't been merged yet.
John.
2015-09-03 15:46, Mcnamara, John:
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Thursday, September 3, 2015 3:34 PM
To: Singh, Jasvinder
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2]librte_cfgfile(rte_cfgfile.h): modify the macros values
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
doc/guides/rel_notes/deprecation.rst | 4 ---- lib/librte_cfgfile/Makefile | 2 +- lib/librte_cfgfile/rte_cfgfile.h | 9 +++++++-- 3 files changed, 8 insertions(+), 7 deletions(-)You have forgotten to update
doc/guides/rel_notes/release_2_2.rst.The new release notes file hasn't been merged yet.
Right! It will be merged shortly.
PATCH v3 1/1 librte_cfgfile(rte_cfgfile.h): modify the macros values
In reply to Jasvinder SinghThis patch refers to the ABI change proposed for librte_cfgfile (rte_cfgfile.h). In order to allow for longer names and values, the new values of macros CFG_NAME_LEN and CFG_NAME_VAL are set.
--- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_2_2.rst | 7 ++++++- lib/librte_cfgfile/Makefile | 2 +- lib/librte_cfgfile/rte_cfgfile.h | 9 +++++++-- 4 files changed, 14 insertions(+), 8 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -53,10 +53,6 @@ Deprecation Notices * The scheduler statistics structure will change to allow keeping track of RED actions. -* librte_cfgfile: In order to allow for longer names and values, - the value of macros CFG_NAME_LEN and CFG_NAME_VAL will be increased. - Most likely, the new values will be 64 and 256, respectively. - * librte_port: Macros to access the packet meta-data stored within the packet buffer will be adjusted to cover the packet mbuf structure as well, as currently they are able to access any packet buffer location except the
doc/guides/rel_notes/release_2_2.rst +6 -1
@@ -44,6 +44,11 @@ ABI Changes * The LPM structure is changed. The deprecated field mem_location is removed. +* librte_cfgfile: In order to allow for longer names and values, + the value of macros CFG_NAME_LEN and CFG_NAME_VAL is increased, + the new values are 64 and 256, respectively + + Shared Library Versions -----------------------
@@ -54,7 +59,7 @@ The libraries prepended with a plus sign were incremented in this version. + libethdev.so.2 + librte_acl.so.2 - librte_cfgfile.so.1 + + librte_cfgfile.so.2 librte_cmdline.so.1 librte_distributor.so.1 + librte_eal.so.2
lib/librte_cfgfile/Makefile +1 -1
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_cfgfile_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y
lib/librte_cfgfile/rte_cfgfile.h +7 -2
@@ -47,8 +47,13 @@ extern "C" {* ***/ -#define CFG_NAME_LEN 32 -#define CFG_VALUE_LEN 64 +#ifndef CFG_NAME_LEN +#define CFG_NAME_LEN 64 +#endif + +#ifndef CFG_VALUE_LEN +#define CFG_VALUE_LEN 256 +#endif /** Configuration file */ struct rte_cfgfile ;
Signature · 1 line
2.1.0
Re: [PATCH v3] librte_cfgfile(rte_cfgfile.h): modify the macros values
Quoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jasvinder Singh
Sent: Friday, September 4, 2015 1:59 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v3]librte_cfgfile(rte_cfgfile.h): modify the macros values
Quoted 6 lines
This patch refers to the ABI change proposed for
librte_cfgfile(rte_cfgfile.h). In order to allow for longer names and values, the new values of macrosCFG_NAME_LENandCFG_NAME_VALare set.Signed-off-by Jasvinder Singh <[email protected]>---
Re: [PATCH v3] librte_cfgfile(rte_cfgfile.h): modify the macros values
In reply to Jasvinder Singh2015-09-04 11:58, Jasvinder Singh:
lib/librte_cfgfile/rte_cfgfile.h extern "C" { · line 52
Quoted 5 lines
lib/librte_cfgfile/rte_cfgfile.h +3
-2-#define CFG_NAME_LEN 32 -#define CFG_VALUE_LEN 64 +#ifndef CFG_NAME_LEN +#define CFG_NAME_LEN 64 +#endif
Build fails:examples/qos_sched/cfg_file.h:40:0: error: "CFG_NAME_LEN" redefined
v4 cover cfgfile: modify the macros values
In reply to Jasvinder SinghThis patchset is modifying two macros in rte_cfgfile library thus ABI needs versioning. To meet requirements of ABI compatibility release notes and Makefile is also modified. Additionally a fix for qos_sched application is send as previously it was incomplete in 2.1 and application was redefining that macros.
v2:
*changed commit message
*removed deprecation notice
*updated makefile
v3:
*updated release note.
v4:
*fixed build error for qos_sched sample app.
*supplement incomplete implementation in 2.1
Michal Jastrzebski (1):
qos_sched: fix example modification to use librte_cfgfile
Jasvinder Singh (1):
librte_cfgfile(rte_cfgfile.h): modify the macros values
doc/guides/rel_notes/deprecation.rst | 4 - doc/guides/rel_notes/release_2_2.rst | 6 +- examples/qos_sched/cfg_file.c | 183 ----------------------------------- examples/qos_sched/cfg_file.h | 29 ------ lib/librte_cfgfile/Makefile | 2 +- lib/librte_cfgfile/rte_cfgfile.h | 9 +- 6 files changed, 13 insertions(+), 220 deletions(-)
Signature · 1 line
2.1.0
PATCH v4 1/2 qos_sched: fix example modification to use librte_cfgfile
From: Michal Jastrzebski <[email protected]>
This is a supplement for previous patch that was incomplete. Previous commit message: This is a modification of qos_sched example to use librte_cfgfile for parsing configuration file.
--- examples/qos_sched/cfg_file.c | 183 ------------------------------------------ examples/qos_sched/cfg_file.h | 29 ------- 2 files changed, 212 deletions(-)
examples/qos_sched/cfg_file.c +0 -183
@@ -49,189 +49,6 @@* for new entries do we add in */ #define CFG_ALLOC_ENTRY_BATCH 16 -static unsigned -_strip (char *str,unsigned len) -{ -int newlen = len; -if (len ==0 ) -return 0 ; - -if (isspace (str[len-1 ])) { -/* strip trailing whitespace */ -while (newlen >0 &&isspace (str[newlen -1 ])) - str[--newlen] ='\0' ; - } - -if (isspace (str[0 ])) { -/* strip leading whitespace */ -int i,start =1 ; -while (isspace (str[start]) && start < newlen) - start++ - ;/* do nothing */ - newlen -= start; -for (i =0 ; i < newlen; i++) - str[i] = str[i+start]; - str[i] ='\0' ; - } -return newlen; -} - -struct cfg_file * -cfg_load (const char *filename,int flags) -{ -int allocated_sections =CFG_ALLOC_SECTION_BATCH ; -int allocated_entries =0 ; -int curr_section =-1 ; -int curr_entry =-1 ; -char buffer[256 ]; -int lineno =0 ; -struct cfg_file *cfg =NULL ; - -FILE *f =fopen (filename,"r" ); -if (f ==NULL ) -return NULL ; - - cfg =malloc (sizeof (*cfg) +sizeof (cfg->sections[0 ]) * allocated_sections); -if (cfg ==NULL ) - goto error2; - -memset (cfg->sections,0 ,sizeof (cfg->sections[0 ]) * allocated_sections); - -while (fgets (buffer,sizeof (buffer), f) !=NULL ) { -char *pos =NULL ; -size_t len =strnlen (buffer,sizeof (buffer)); - lineno++; -if (len >=sizeof (buffer) -1 && buffer[len-1 ] !='\n' ){ -printf ("Error line %d - no \\n found on string. " -"Check if line too long\n" , lineno); - goto error1; - } -if ((pos =memchr (buffer,';' ,sizeof (buffer))) !=NULL ) { - *pos ='\0' ; - len = pos - buffer; - } - - len =_strip (buffer, len); -if (buffer[0 ] !='[' &&memchr (buffer,'=' , len) ==NULL ) -continue ; - -if (buffer[0 ] =='[' ) { -/* section heading line */ -char *end =memchr (buffer,']' , len); -if (end ==NULL ) { -printf ("Error line %d - no terminating '[' found\n" , lineno); - goto error1; - } - *end ='\0' ; -_strip (&buffer[1 ], end - &buffer[1 ]); - -/* close off old section and add start new one */ -if (curr_section >=0 ) - cfg->sections[curr_section]->num_entries = curr_entry +1 ; - curr_section++; - -/* resize overall struct if we don't have room for more sections */ -if (curr_section == allocated_sections) { - allocated_sections +=CFG_ALLOC_SECTION_BATCH ; -struct cfg_file *n_cfg =realloc (cfg,sizeof (*cfg) + -sizeof (cfg->sections[0 ]) * allocated_sections); -if (n_cfg ==NULL ) { -printf ("Error - no more memory\n" ); - goto error1; - } - cfg = n_cfg; - } - -/* allocate space for new section */ - allocated_entries =CFG_ALLOC_ENTRY_BATCH ; - curr_entry =-1 ; - cfg->sections[curr_section] =malloc (sizeof (*cfg->sections[0 ]) + -sizeof (cfg->sections[0 ]->entries[0 ]) * allocated_entries); -if (cfg->sections[curr_section] ==NULL ) { -printf ("Error - no more memory\n" ); - goto error1; - } - -snprintf (cfg->sections[curr_section]->name, -sizeof (cfg->sections[0 ]->name), -"%s" , &buffer[1 ]); - } -else { -/* value line */ -if (curr_section <0 ) { -printf ("Error line %d - value outside of section\n" , lineno); - goto error1; - } - -struct cfg_section *sect = cfg->sections[curr_section]; -char *split[2 ]; -if (rte_strsplit (buffer,sizeof (buffer), split,2 ,'=' ) !=2 ) { -printf ("Error at line %d - cannot split string\n" , lineno); - goto error1; - } - - curr_entry++; -if (curr_entry == allocated_entries) { - allocated_entries +=CFG_ALLOC_ENTRY_BATCH ; -struct cfg_section *n_sect =realloc (sect,sizeof (*sect) + -sizeof (sect->entries[0 ]) * allocated_entries); -if (n_sect ==NULL ) { -printf ("Error - no more memory\n" ); - goto error1; - } - sect = cfg->sections[curr_section] = n_sect; - } - - sect->entries[curr_entry] =malloc (sizeof (*sect->entries[0 ])); -if (sect->entries[curr_entry] ==NULL ) { -printf ("Error - no more memory\n" ); - goto error1; - } - -struct cfg_entry *entry = sect->entries[curr_entry]; -snprintf (entry->name,sizeof (entry->name),"%s" , split[0 ]); -snprintf (entry->value,sizeof (entry->value),"%s" , split[1 ]); -_strip (entry->name,strnlen (entry->name,sizeof (entry->name))); -_strip (entry->value,strnlen (entry->value,sizeof (entry->value))); - } - } -fclose (f); - cfg->flags = flags; - cfg->sections[curr_section]->num_entries = curr_entry +1 ; - cfg->num_sections = curr_section +1 ; -return cfg; - -error1: -cfg_close (cfg); -error2: -fclose (f); -return NULL ; -} - - -int cfg_close (struct cfg_file *cfg) -{ -int i, j; - -if (cfg ==NULL ) -return -1 ; - -for (i =0 ; i < cfg->num_sections; i++) { -if (cfg->sections[i] !=NULL ) { -if (cfg->sections[i]->num_entries) { -for (j =0 ; j < cfg->sections[i]->num_entries; j++) { -if (cfg->sections[i]->entries[j] !=NULL ) -free (cfg->sections[i]->entries[j]); - } - } -free (cfg->sections[i]); - } - } -free (cfg); - -return 0 ; -} -int cfg_load_port (struct rte_cfgfile *cfg,struct rte_sched_port_params *port_params) {
examples/qos_sched/cfg_file.h +0 -29
@@ -37,39 +37,10 @@#include <rte_sched.h> #include <rte_cfgfile.h> -#define CFG_NAME_LEN 32 -#define CFG_VALUE_LEN 64 - -struct cfg_entry { -char name[CFG_NAME_LEN ]; -char value[CFG_VALUE_LEN ]; -}; - -struct cfg_section { -char name[CFG_NAME_LEN ]; -int num_entries; -struct cfg_entry *entries[0 ]; -}; - -struct cfg_file { -int flags; -int num_sections; -struct cfg_section *sections[0 ]; -}; - -int cfg_load_port (struct rte_cfgfile *cfg,struct rte_sched_port_params *port);int cfg_load_pipe (struct rte_cfgfile *cfg,struct rte_sched_pipe_params *pipe);int cfg_load_subport (struct rte_cfgfile *cfg,struct rte_sched_subport_params *subport); -/* reads a config file from disk and returns a handle to the config -* 'flags' is reserved for future use and must be 0 -*/ -struct cfg_file *cfg_load (const char *filename,int flags); - -/* cleans up memory allocated by cfg_load() */ -int cfg_close (struct cfg_file *cfg); -#endif
Signature · 1 line
2.1.0
PATCH v4 2/2 librte_cfgfile(rte_cfgfile.h): modify the macros values
In reply to Jasvinder SinghThis patch refers to the ABI change proposed for librte_cfgfile(rte_cfgfile.h). In order to allow for longer names and values, the values of macro CFG_NAME_LEN and CFG_VAL_LEN is increased.
--- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_2_2.rst | 6 +++++- lib/librte_cfgfile/Makefile | 2 +- lib/librte_cfgfile/rte_cfgfile.h | 9 +++++++-- 4 files changed, 13 insertions(+), 8 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -41,10 +41,6 @@ Deprecation Notices * The scheduler statistics structure will change to allow keeping track of RED actions. -* librte_cfgfile: In order to allow for longer names and values, - the value of macros CFG_NAME_LEN and CFG_NAME_VAL will be increased. - Most likely, the new values will be 64 and 256, respectively. - * librte_table: New functions for table entry bulk add/delete will be added to the table operations structure.
doc/guides/rel_notes/release_2_2.rst +5 -1
@@ -117,6 +117,10 @@ ABI Changes * librte_port: Macros to access the packet meta-data stored within the packet buffer has been adjusted to cover the packet mbuf structure. +* librte_cfgfile: In order to allow for longer names and values, + the value of macros CFG_NAME_LEN and CFG_VALUE_LEN is increased, + the new values are 64 and 256, respectively. + Shared Library Versions -----------------------
@@ -127,7 +131,7 @@ The libraries prepended with a plus sign were incremented in this version. + libethdev.so.2 + librte_acl.so.2 - librte_cfgfile.so.1 + librte_cfgfile.so.2 librte_cmdline.so.1 librte_distributor.so.1 + librte_eal.so.2
lib/librte_cfgfile/Makefile +1 -1
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_cfgfile_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y
lib/librte_cfgfile/rte_cfgfile.h +7 -2
@@ -47,8 +47,13 @@ extern "C" {* ***/ -#define CFG_NAME_LEN 32 -#define CFG_VALUE_LEN 64 +#ifndef CFG_NAME_LEN +#define CFG_NAME_LEN 64 +#endif + +#ifndef CFG_VALUE_LEN +#define CFG_VALUE_LEN 256 +#endif /** Configuration file */ struct rte_cfgfile ;
Signature · 1 line
2.1.0
Re: [PATCH v4 0/2] cfgfile: modify the macros values
In reply to Jasvinder SinghQuoted 5 lines
Michal Jastrzebski (1):
qos_sched: fix example modification to uselibrte_cfgfileJasvinder Singh (1):
librte_cfgfile(rte_cfgfile.h): modify the macros values
Applied with more meaningful titles:
examples/qos_sched: remove duplicated cfgfile library
cfgfile: increase entry name and value sizes
Re: [PATCH v4 0/2] cfgfile: modify the macros values
Quoted 12 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, October 22, 2015 5:36 PM
To: Singh, Jasvinder
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v4 0/2] cfgfile: modify the macros valuesQuoted 3 lines
Michal Jastrzebski (1):
qos_sched: fix example modification to uselibrte_cfgfile
Quoted 6 lines
Quoted 2 lines
Jasvinder Singh (1):
librte_cfgfile(rte_cfgfile.h): modify the macros valuesApplied with more meaningful titles:
examples/qos_sched: remove duplicated cfgfile library
cfgfile: increase entry name and value sizes
Thank you, Thomas. I will work on having more precise titles in future.