From b022cd1ed745a39396128649d8ee0979ade760d0 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Tue, 16 Aug 2016 13:25:59 +0200 Subject: Fix coverity issues in DPDK code, fixes VPP-189 Change-Id: Ie2ebb29451200158504bda8c616d57821edbd749 Signed-off-by: Damjan Marion --- vnet/vnet/devices/dpdk/dpdk_priv.h | 1 - vnet/vnet/devices/dpdk/format.c | 2 +- vnet/vnet/devices/dpdk/init.c | 22 +++++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/vnet/vnet/devices/dpdk/dpdk_priv.h b/vnet/vnet/devices/dpdk/dpdk_priv.h index ac499432..d4d14222 100644 --- a/vnet/vnet/devices/dpdk/dpdk_priv.h +++ b/vnet/vnet/devices/dpdk/dpdk_priv.h @@ -36,7 +36,6 @@ #define foreach_eal_double_hyphen_predicate_arg \ _(no-shconf) \ _(no-hpet) \ -_(no-pci) \ _(no-huge) \ _(vmware-tsc-map) \ _(virtio-vhost) diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c index 2d41221d..075f3577 100644 --- a/vnet/vnet/devices/dpdk/format.c +++ b/vnet/vnet/devices/dpdk/format.c @@ -657,7 +657,7 @@ static inline u8 * format_dpdk_pkt_types (u8 * s, va_list * va) static inline u8 * format_dpdk_pkt_offload_flags (u8 * s, va_list * va) { - u16 *ol_flags = va_arg (*va, u16 *); + u64 *ol_flags = va_arg (*va, u64 *); uword indent = format_get_indent (s) + 2; if (!*ol_flags) diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index b690dec2..239ae3bb 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -1042,14 +1042,18 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) ; else if (unformat (input, "enable-vhost-user")) conf->use_virtio_vhost = 0; + else if (unformat (input, "no-pci")) + { + no_pci = 1; + tmp = format (0, "--no-pci%c", 0); + vec_add1 (conf->eal_init_args, tmp); + } else if (unformat (input, "poll-sleep %d", &dm->poll_sleep)) ; #define _(a) \ else if (unformat(input, #a)) \ { \ - if (!strncmp(#a, "no-pci", 6)) \ - no_pci = 1; \ tmp = format (0, "--%s%c", #a, 0); \ vec_add1 (conf->eal_init_args, tmp); \ } @@ -1170,8 +1174,11 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) struct stat sb_numa, sb_nonnuma; p = format(p, numa_path, c); - stat(numa_path, &sb_numa); - stat(nonnuma_path, &sb_nonnuma); + if (stat(numa_path, &sb_numa) < 0) + sb_numa.st_mode = 0; + + if (stat(nonnuma_path, &sb_nonnuma) < 0) + sb_nonnuma.st_mode = 0; if (S_ISDIR(sb_numa.st_mode)) { path = (char*)format((u8*)path, "%s%s", p, suffix); @@ -1609,10 +1616,15 @@ dpdk_process (vlib_main_t * vm, if (nlink > 0) { vnet_hw_interface_t * bhi; ethernet_interface_t * bei; + int rv; + /* Get MAC of 1st slave link */ rte_eth_macaddr_get(slink[0], (struct ether_addr *)addr); /* Set MAC of bounded interface to that of 1st slave link */ - rte_eth_bond_mac_address_set(i, (struct ether_addr *)addr); + rv = rte_eth_bond_mac_address_set(i, (struct ether_addr *)addr); + if (rv < 0) + clib_warning("Failed to set MAC address"); + /* Populate MAC of bonded interface in VPP hw tables */ bhi = vnet_get_hw_interface( vnm, dm->devices[i].vlib_hw_if_index); -- cgit 1.2.3-korg