net: add rte prefix to ether defines
[dpdk.git] / lib / librte_kni / rte_kni.c
index c9726d4..e6507b0 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#ifndef RTE_EXEC_ENV_LINUXAPP
+#ifndef RTE_EXEC_ENV_LINUX
 #error "KNI is not supported"
 #endif
 
@@ -21,7 +21,7 @@
 #include <rte_tailq.h>
 #include <rte_rwlock.h>
 #include <rte_eal_memconfig.h>
-#include <exec-env/rte_kni_common.h>
+#include <rte_kni_common.h>
 #include "rte_kni_fifo.h"
 
 #define MAX_MBUF_BURST_NUM            32
@@ -234,7 +234,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
                goto kni_fail;
        }
 
-       snprintf(kni->name, RTE_KNI_NAMESIZE, "%s", conf->name);
+       strlcpy(kni->name, conf->name, RTE_KNI_NAMESIZE);
 
        if (ops)
                memcpy(&kni->ops, ops, sizeof(struct rte_kni_ops));
@@ -253,9 +253,9 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
        dev_info.mbuf_size = conf->mbuf_size;
        dev_info.mtu = conf->mtu;
 
-       memcpy(dev_info.mac_addr, conf->mac_addr, ETHER_ADDR_LEN);
+       memcpy(dev_info.mac_addr, conf->mac_addr, RTE_ETHER_ADDR_LEN);
 
-       snprintf(dev_info.name, RTE_KNI_NAMESIZE, "%s", conf->name);
+       strlcpy(dev_info.name, conf->name, RTE_KNI_NAMESIZE);
 
        RTE_LOG(INFO, KNI, "pci: %02x:%02x:%02x \t %02x:%02x\n",
                dev_info.bus, dev_info.devid, dev_info.function,
@@ -400,7 +400,7 @@ rte_kni_release(struct rte_kni *kni)
        if (te == NULL)
                goto unlock;
 
-       snprintf(dev_info.name, sizeof(dev_info.name), "%s", kni->name);
+       strlcpy(dev_info.name, kni->name, sizeof(dev_info.name));
        if (ioctl(kni_fd, RTE_KNI_IOCTL_RELEASE, &dev_info) < 0) {
                RTE_LOG(ERR, KNI, "Fail to release kni device\n");
                goto unlock;
@@ -451,7 +451,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
        RTE_LOG(INFO, KNI, "Configure mac address of %d", port_id);
 
        ret = rte_eth_dev_default_mac_addr_set(port_id,
-                                              (struct ether_addr *)mac_addr);
+                                       (struct rte_ether_addr *)mac_addr);
        if (ret < 0)
                RTE_LOG(ERR, KNI, "Failed to config mac_addr for port %d\n",
                        port_id);
@@ -483,7 +483,7 @@ int
 rte_kni_handle_request(struct rte_kni *kni)
 {
        unsigned ret;
-       struct rte_kni_request *req;
+       struct rte_kni_request *req = NULL;
 
        if (kni == NULL)
                return -1;