From: Olivier Matz Date: Tue, 28 Jan 2014 16:06:36 +0000 (+0100) Subject: kvargs: remove driver name in arguments X-Git-Tag: spdx-start~10969 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=991543e81569e3ed0983bd7f5ae290f34ed091f4;p=dpdk.git kvargs: remove driver name in arguments 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 --- diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c index 3acb895ca0..c3d65af780 100644 --- a/lib/librte_kvargs/rte_kvargs.c +++ b/lib/librte_kvargs/rte_kvargs.c @@ -91,8 +91,7 @@ rte_kvargs_add_pair(struct rte_kvargs *kvlist, char *key, char *val) * strtok() is used so the params string will be copied to be modified. */ static int -rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name, - const char *params) +rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params) { unsigned i, count; char *args; @@ -101,7 +100,7 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name, /* If params are empty, nothing to do */ if (params == NULL || params[0] == 0) { - RTE_LOG(ERR, PMD, "Couldn't parse %s device, empty arguments\n", name); + RTE_LOG(ERR, PMD, "Cannot parse empty arguments\n"); return -1; } @@ -110,7 +109,7 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name, */ args = strdup(params); if(args == NULL){ - RTE_LOG(ERR, PMD, "Couldn't parse %s device \n", name); + RTE_LOG(ERR, PMD, "Cannot parse arguments: not enough memory\n"); return -1; } @@ -127,7 +126,8 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name, if (pair[0] == NULL || pair[1] == NULL || pair[0][0] == 0 || pair[1][0] == 0) { RTE_LOG(ERR, PMD, - "Couldn't parse %s device, wrong key or value \n", name); + "Cannot parse arguments: wrong key or value\n" + "params=<%s>\n", params); goto error; } @@ -230,14 +230,13 @@ rte_kvargs_process(const struct rte_kvargs *kvlist, */ int rte_kvargs_parse(struct rte_kvargs *kvlist, - const char *name, const char *args, const char *valid_keys[]) { int ret; - ret = rte_kvargs_tokenize(kvlist, name, args); + ret = rte_kvargs_tokenize(kvlist, args); if (ret < 0) return ret; diff --git a/lib/librte_kvargs/rte_kvargs.h b/lib/librte_kvargs/rte_kvargs.h index bf32ce21a8..288e05f5c9 100644 --- a/lib/librte_kvargs/rte_kvargs.h +++ b/lib/librte_kvargs/rte_kvargs.h @@ -100,8 +100,6 @@ int rte_kvargs_init(struct rte_kvargs *kvlist); * * @param kvlist * The rte_kvargs structure - * @param name - * The name of the driver * @param args * The input string containing the key/value associations * @param valid_keys @@ -112,7 +110,7 @@ int rte_kvargs_init(struct rte_kvargs *kvlist); * - 0 on success * - Negative on error */ -int rte_kvargs_parse(struct rte_kvargs *kvlist, const char *name, +int rte_kvargs_parse(struct rte_kvargs *kvlist, const char *args, const char *valid_keys[]); /** diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c index 11ad6c94a9..3b2843d25c 100644 --- a/lib/librte_pmd_pcap/rte_eth_pcap.c +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c @@ -674,6 +674,8 @@ rte_pmd_pcap_init(const char *name, const char *params) struct rx_pcaps pcaps; struct tx_pcaps dumpers; + RTE_LOG(INFO, PMD, "Initializing pmd_pcap for %s\n", name); + rte_kvargs_init(&kvlist); numa_node = rte_socket_id(); @@ -682,7 +684,7 @@ rte_pmd_pcap_init(const char *name, const char *params) start_cycles = rte_get_timer_cycles(); hz = rte_get_timer_hz(); - if (rte_kvargs_parse(&kvlist, name, params, valid_arguments) < 0) + if (rte_kvargs_parse(&kvlist, params, valid_arguments) < 0) return -1; /* diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c index 5ddecc57be..1fed8d3872 100644 --- a/lib/librte_pmd_ring/rte_eth_ring.c +++ b/lib/librte_pmd_ring/rte_eth_ring.c @@ -384,6 +384,8 @@ rte_eth_ring_pair_attach(const char *name, const unsigned numa_node) int rte_pmd_ring_init(const char *name, const char *params) { + RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name); + if (params == NULL) eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE); else {