summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/devices
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-08-16 13:25:59 +0200
committerDave Barach <openvpp@barachs.net>2016-08-16 13:00:16 +0000
commitb022cd1ed745a39396128649d8ee0979ade760d0 (patch)
tree77977f06184262c94135525df61ddb38edc8b3ae /vnet/vnet/devices
parenta290d7c4f50270387e90091524e307c4dea88bd5 (diff)
Fix coverity issues in DPDK code, fixes VPP-189
Change-Id: Ie2ebb29451200158504bda8c616d57821edbd749 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet/vnet/devices')
-rw-r--r--vnet/vnet/devices/dpdk/dpdk_priv.h1
-rw-r--r--vnet/vnet/devices/dpdk/format.c2
-rw-r--r--vnet/vnet/devices/dpdk/init.c22
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 ac499432d4d..d4d14222de3 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 2d41221d247..075f35777b5 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 b690dec2732..239ae3bbed6 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);