X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fip_pipeline%2Fkni.c;h=45196859328e53d36a482ccae257a4804495323f;hb=383fb5a9c7f86931720a389335268b32fb9373a5;hp=7e5ff0543a35339bccdb4b85545ba744b8c23c81;hpb=7959831b4d1b52f6525acb63ce0d94eeeb396855;p=dpdk.git diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c index 7e5ff0543a..4519685932 100644 --- a/examples/ip_pipeline/kni.c +++ b/examples/ip_pipeline/kni.c @@ -86,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 (new_mtu > ETHER_MAX_LEN) + if (new_mtu > RTE_ETHER_MAX_LEN) return -EINVAL; /* Set new MTU */ @@ -109,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; + int ret; /* Check input params */ if ((name == NULL) || @@ -123,10 +124,12 @@ kni_create(const char *name, struct kni_params *params) 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)); - snprintf(kni_conf.name, RTE_KNI_NAMESIZE, "%s", name); + strlcpy(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;