> -----Original Message----- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Olivier Matz > Sent: Tuesday, January 28, 2014 4:07 PM > To: dev at dpdk.org > Subject: [dpdk-dev] [PATCH 03/11] 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 <olivier.matz at 6wind.com> > --- > lib/librte_kvargs/rte_kvargs.c | 13 ++++++------- > lib/librte_kvargs/rte_kvargs.h | 4 +--- > lib/librte_pmd_pcap/rte_eth_pcap.c | 4 +++- > lib/librte_pmd_ring/rte_eth_ring.c | 2 ++ > 4 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c > index 7a950d6..935698c 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 19485b1..804ea1d 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 e47afcb..2006b35 100644 > --- a/lib/librte_pmd_pcap/rte_eth_pcap.c > +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c > @@ -706,6 +706,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(); > @@ -714,7 +716,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 fa3ff72..abef2e8 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 { > -- > 1.8.4.rc3
Acked-by: Bruce Richardson <bruce.richardson at intel.com>