git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vhost: introduce vDPA device class
[dpdk.git]
/
examples
/
ip_pipeline
/
kni.c
diff --git
a/examples/ip_pipeline/kni.c
b/examples/ip_pipeline/kni.c
index
ed5f894
..
4519685
100644
(file)
--- a/
examples/ip_pipeline/kni.c
+++ b/
examples/ip_pipeline/kni.c
@@
-7,6
+7,7
@@
#include <rte_ethdev.h>
#include <rte_bus_pci.h>
#include <rte_ethdev.h>
#include <rte_bus_pci.h>
+#include <rte_string_fns.h>
#include "kni.h"
#include "mempool.h"
#include "kni.h"
#include "mempool.h"
@@
-85,7
+86,7
@@
kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
if (!rte_eth_dev_is_valid_port(port_id))
return -EINVAL;
if (!rte_eth_dev_is_valid_port(port_id))
return -EINVAL;
- if (new_mtu > ETHER_MAX_LEN)
+ if (new_mtu >
RTE_
ETHER_MAX_LEN)
return -EINVAL;
/* Set new MTU */
return -EINVAL;
/* Set new MTU */
@@
-108,6
+109,7
@@
kni_create(const char *name, struct kni_params *params)
struct rte_kni *k;
const struct rte_pci_device *pci_dev;
const struct rte_bus *bus = NULL;
struct rte_kni *k;
const struct rte_pci_device *pci_dev;
const struct rte_bus *bus = NULL;
+ int ret;
/* Check input params */
if ((name == NULL) ||
/* Check input params */
if ((name == NULL) ||
@@
-122,10
+124,12
@@
kni_create(const char *name, struct kni_params *params)
return NULL;
/* Resource create */
return NULL;
/* Resource create */
- rte_eth_dev_info_get(link->port_id, &dev_info);
+ ret = rte_eth_dev_info_get(link->port_id, &dev_info);
+ if (ret != 0)
+ return NULL;
memset(&kni_conf, 0, sizeof(kni_conf));
memset(&kni_conf, 0, sizeof(kni_conf));
- s
nprintf(kni_conf.name, RTE_KNI_NAMESIZE, "%s", name
);
+ s
trlcpy(kni_conf.name, name, RTE_KNI_NAMESIZE
);
kni_conf.force_bind = params->force_bind;
kni_conf.core_id = params->thread_id;
kni_conf.group_id = link->port_id;
kni_conf.force_bind = params->force_bind;
kni_conf.core_id = params->thread_id;
kni_conf.group_id = link->port_id;
@@
-153,7
+157,7
@@
kni_create(const char *name, struct kni_params *params)
return NULL;
/* Node fill in */
return NULL;
/* Node fill in */
- str
n
cpy(kni->name, name, sizeof(kni->name));
+ str
l
cpy(kni->name, name, sizeof(kni->name));
kni->k = k;
/* Node add to list */
kni->k = k;
/* Node add to list */