summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOlivier Matz <olivier.matz@6wind.com>2014-01-28 17:06:36 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-02-04 15:40:31 +0100
commit1ca8892c0d463c40f0daf0855fd4f61d229e33a9 (patch)
tree1f48992a69a53ba7f71ecb593a27fa694eb919ca /lib
parent9d5752d80fe355d5d044b496f75bdb3d18740bcc (diff)
downloaddpdk-1ca8892c0d463c40f0daf0855fd4f61d229e33a9.zip
dpdk-1ca8892c0d463c40f0daf0855fd4f61d229e33a9.tar.gz
dpdk-1ca8892c0d463c40f0daf0855fd4f61d229e33a9.tar.xz
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@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_kvargs/rte_kvargs.c13
-rw-r--r--lib/librte_kvargs/rte_kvargs.h4
-rw-r--r--lib/librte_pmd_pcap/rte_eth_pcap.c4
-rw-r--r--lib/librte_pmd_ring/rte_eth_ring.c2
4 files changed, 12 insertions, 11 deletions
diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c
index 3acb895..c3d65af 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 bf32ce2..288e05f 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 {