path: root/lib/librte_kvargs
AgeCommit message (Collapse)Author
2018-10-26kvargs: support list valueThomas Monjalon
If a value contains a comma, rte_kvargs_tokenize() will split here. In order to support list syntax [a,b] as value, an extra parsing of the square brackets is added. Signed-off-by: Thomas Monjalon <>
2018-10-24kvargs: fix processing a null listThomas Monjalon
In the doxygen description of rte_kvargs_process(), it is said: If *kvlist* is NULL function does nothing. It has been added by mistake here instead of rte_kvargs_free(). Anyway, null list should be correctly handled in both functions. Comments are fixed in both functions and NULL handling is added to rte_kvargs_process(). Fixes: c34af7424e09 ("kvargs: fix freeing behaviour for null") Cc: Signed-off-by: Thomas Monjalon <> Acked-by: Olivier Matz <>
2018-07-26kvargs: fix building with meson outside source treeBruce Richardson
When building DPDK with meson with the <builddir> being outside the source directory, an error was generated as the path to the EAL headers was not found. The path specified for the includes backed out unnecessarily far and so broke when the build directory was not in the expected location of just inside the source dir. Changing the path to be shorter, just going down one level and then into EAL builds for both cases - where builddir is in source directory, and also when it's outside it. Fixes: 092ee516496d ("kvargs: build before EAL") Reported-by: Anatoly Burakov <> Signed-off-by: Bruce Richardson <> Tested-by: Anatoly Burakov <>
2018-07-15kvargs: add generic string matching callbackGaetan Rivet
This function can be used as a callback to rte_kvargs_process. This should reduce code duplication. Signed-off-by: Gaetan Rivet <>
2018-07-15kvargs: introduce a more flexible parsing functionGaetan Rivet
This function permits defining additional terminating characters, ending the parsing to arbitrary delimiters. Signed-off-by: Gaetan Rivet <> Acked-by: Thomas Monjalon <> Acked-by: Shreyansh Jain <>
2018-07-15kvargs: build before EALGaetan Rivet
This library will be used by the EAL to parse parameters. Signed-off-by: Gaetan Rivet <>
2018-07-15kvargs: remove error logsGaetan Rivet
Error logs in kvargs parsing should be better handled in components calling the library. This library must be as lean as possible. Signed-off-by: Gaetan Rivet <> Acked-by: Thomas Monjalon <>
2018-05-25use SPDX tag for 6WIND copyrighted filesOlivier Matz
Signed-off-by: Olivier Matz <>
2018-03-28kvargs: fix syntax in commentsKeith Wiles
Use commas as separator, not semicolons. Fixes: a8b97e3a1db0 ("devargs: use a comma instead of semicolon to separate key/values") Cc: Signed-off-by: Keith Wiles <> Acked-by: Ferruh Yigit <>
2018-02-01kvargs: use SPDX tagsOlivier Matz
Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <> Acked-by: Thomas Monjalon <>
2018-01-30build: replace license text with SPDX tagBruce Richardson
Signed-off-by: Bruce Richardson <> Reviewed-by: Luca Boccassi <>
2018-01-30lib: build with mesonBruce Richardson
Add non-EAL libraries to DPDK build. The compat lib is a special case, along with the previously-added EAL, but all other libs can be build using the same set of commands, where the individual files only need to specify their dependencies, source files, header files and ABI versions. Signed-off-by: Bruce Richardson <> Reviewed-by: Harry van Haaren <> Acked-by: Keith Wiles <> Acked-by: Luca Boccassi <>
2017-10-24mk: do not generate LDLIBS from directory dependenciesOlivier Matz
The list of libraries in LDLIBS was generated from the DEPDIRS-xyz variable. This is valid when the subdirectory name match the library name, but it's not always the case, especially for PMDs. The patches removes this feature and explicitly adds the proper libraries in LDLIBS. Some DEPDIRS-xyz variables become useless, remove them. Reported-by: Gage Eads <> Signed-off-by: Olivier Matz <> Reviewed-by: Gage Eads <>
2017-03-27mk: optimize directory dependenciesOlivier Matz
Before this patch, the management of dependencies between directories had several issues: - the generation of .depdirs, done at configuration is slow: it can take more than one minute on some slow targets (usually ~10s on a standard PC without -j). - for instance, it is possible to express a dependency like: - app/foo depends on lib/librte_foo - and lib/librte_foo depends on app/bar But this won't work because the directories are traversed with a depth-first algorithm, so we have to choose between doing 'app' before or after 'lib'. - the script is too complex. - we cannot use "make -d" for debug, because the output of make is used for the generation of .depdirs. This patch moves the DEPDIRS-* variables in the upper Makefile, making the dependencies much easier to calculate. A DEPDIRS variable is still used to process library dependencies in LDLIBS. After this commit, "make config" is almost immediate. Signed-off-by: Olivier Matz <> Tested-by: Robin Jarry <> Tested-by: Jerin Jacob <>
2017-01-13kvargs: make pointers in string arrays constBruce Richardson
Change the parameters of functions from const char *valid[] to const char * const valid[]. This additional const is needed to allow us to fix some checkpatch warnings, as well as being good programming practice. For the checkpatch warnings, if we have a set of command line args that we want to check defined as: static const char *args[] = { "arg1", "arg2", NULL }; kvlist = rte_kvargs_parse(params, args); checkpatch will complain: WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const Adding the additional const to the definition of the args will then trigger a compiler error in the absence of this change to the kvargs library, as we lose the const in the call to kvargs_parse. Signed-off-by: Bruce Richardson <> Acked-by: Olivier Matz <>
2016-01-27remove unneeded tests for NULL when freeingDavid Marchand
free() already handles NULL pointer. Signed-off-by: David Marchand <>
2015-03-04kvargs: fix freeing behaviour for nullPawel Wodkowski
By convention free() functions should ignore NULL parameter. This patch add this behaviour for rte_kvargs_free(). Signed-off-by: Pawel Wodkowski <> Acked-by: Olivier Matz <>
2015-02-03mk: add library version extensionNeil Horman
To differentiate libraries that break ABI, we add a library version number suffix to the library, which must be incremented when a given libraries ABI is broken. This patch enforces that addition, sets the initial abi soname extension to 1 for each library and creates a symlink to the base SONAME so that the test applications will link properly. Signed-off-by: Neil Horman <> Acked-by: Sergio Gonzalez Monroy <>
2015-02-03lib: provide initial versioningNeil Horman
Add linker version script files to each DPDK library to put a stake in the ground from which we can start cleaning up API's Signed-off-by: Neil Horman <> Acked-by: Sergio Gonzalez Monroy <>
2014-06-17kvargs: fix build with gcc 4.5.1Min Cao
GCC 4.5.1 warns about an uninitialized pointer: error: 'ctx1' may be used uninitialized in this function Signed-off-by: Min Cao <> Acked-by: Jijiang Liu <> Tested-by: Waterman Cao <>
2014-04-10devargs: use a comma instead of semicolon to separate key/valuesOlivier Matz
This commit changes the API of --use-device command line argument. It changes the separators from ';' to ','. Indeed, ';' is not the best choice as this character is also used to separate shell commands, forcing the user to surround arguments with quotes. This commit impacts both devargs and kvargs as each of them define a separator in --use-device argument: - devargs defines the separator between the device name or pci_id and its arguments - kvargs defines the separator between each key/value pairs in arguments for drivers using the kvargs API to parse their arguments The modification of devargs and kvargs is done in one commit to keep the coherency of --use-device. Signed-off-by: Olivier Matz <> Acked-by: Thomas Monjalon <>
2014-02-26kvargs: make the NULL key to match all entriesOlivier Matz
In rte_kvargs_process() and rte_kvargs_count(), if the key_match argument is NULL, process all entries. Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: add the key in handler pametersOlivier Matz
This argument can be useful when rte_kvargs_process() is called with key=NULL, in this case the handler is invoked for all entries of the kvlist. Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: add const attribute in handler parametersOlivier Matz
The "value" argument is read-only and should be const. Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: be strict when matching a keyOlivier Matz
When we match a key in is_valid_key() and rte_kvargs_process(), do a strict comparison (strcmp()) instead of using strstr(s1, s2) which tries a find s1 in s2. This old behavior could lead to unexpected match, for instance "cola" match "chocolate". Surprisingly, no patch was needed on rte_kvargs_count() as it already used strcmp(). Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: simpler parsing and allow duplicated keysOlivier Matz
Remove the rte_kvargs_add_pair() function whose only role was to check if a key is duplicated. Having duplicated keys is now allowed by kvargs API. Also replace rte_strsplit() by more a standard function strtok_r() that is easier to understand for people already knowing the libc. It also avoids useless calls to strnlen(). The delimiters macros become strings instead of chars due to the strtok_r() API. Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: rework API to fix memory leakOlivier Matz
Before the patch, a call to rte_kvargs_tokenize() resulted in a call to strdup() to allocate a modifiable copy of the argument string. This string was never freed, excepted in the error cases of rte_kvargs_tokenize() where rte_free() was wrongly called instead of free(). In other cases, freeing this string was impossible as the pointer not saved. This patch introduces rte_kvargs_free() in order to free the structure properly. The pointer to the duplicated string is now kept in the rte_kvargs structure. A call to rte_kvargs_parse() directly allocates the structure, making rte_kvargs_init() useless. The only drawback of this API change is that a key/value associations cannot be added to an existing kvlist. But it's not used today, and there is not obvious use case for that. Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: remove useless size fieldOlivier Matz
This value was not very useful as the size of the table is fixed (equals RTE_KVARGS_MAX). By the way, the memset in the initialization function was wrong (size too short). Even if it was not really an issue since we rely on the "count" field, it is now fixed by this patch. Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: remove driver name in argumentsOlivier Matz
Now that rte_kvargs is a generic library, there is no need to have an argument for the driver name in rte_kvargs_tokenize() and rte_kvargs_parse() prototypes. This argument was only used to log the driver name in case of error. Instead, we can add a log in init function of pmd_pcap and pmd_ring. Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>
2014-02-26kvargs: add a new library to parse key/value argumentsOlivier Matz
Copy the code from rte_eth_pcap_arg_parser.[ch], without any functional modifications, only: - rename functions and structure - restyle (indentation) - add comments (doxygen style) - add "const" or "static" attributes, remove unneeded "inline" Signed-off-by: Olivier Matz <> Acked-by: Bruce Richardson <>