diff options
-rw-r--r-- | vlib/vlib/unix/mc_socket.c | 1 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/cli.c | 2 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/device.c | 6 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/format.c | 5 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/init.c | 24 | ||||
-rw-r--r-- | vnet/vnet/devices/netmap/device.c | 17 | ||||
-rw-r--r-- | vnet/vnet/devices/netmap/node.c | 18 | ||||
-rw-r--r-- | vnet/vnet/l2/l2_input_acl.c | 2 | ||||
-rw-r--r-- | vppinfra/vppinfra/hash.c | 4 | ||||
-rw-r--r-- | vppinfra/vppinfra/sparse_vec.h | 2 |
10 files changed, 55 insertions, 26 deletions
diff --git a/vlib/vlib/unix/mc_socket.c b/vlib/vlib/unix/mc_socket.c index 2754b302875..9c12ad3b559 100644 --- a/vlib/vlib/unix/mc_socket.c +++ b/vlib/vlib/unix/mc_socket.c @@ -948,6 +948,7 @@ find_interface_ip4_address (char *if_name, u32 * ip4_address, u32 * mtu) if (ioctl (fd, SIOCGIFADDR, &ifr) < 0) { clib_unix_error ("ioctl(SIOCFIGADDR)"); + close (fd); return -1; } diff --git a/vnet/vnet/devices/dpdk/cli.c b/vnet/vnet/devices/dpdk/cli.c index c449eebd0a3..a40dcc7c9ad 100644 --- a/vnet/vnet/devices/dpdk/cli.c +++ b/vnet/vnet/devices/dpdk/cli.c @@ -332,7 +332,7 @@ show_efd (vlib_main_t * vm, dpdk_device_t * xd; u32 device_id = ~0; - unformat(input, "device %d", &device_id); + (void) unformat(input, "device %d", &device_id); vec_foreach (xd, dm->devices) { if ((xd->device_index == device_id) || (device_id == ~0)) { show_dpdk_device_stats(vm, xd); diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c index 66d4b6d4eed..61774f0f3e2 100644 --- a/vnet/vnet/devices/dpdk/device.c +++ b/vnet/vnet/devices/dpdk/device.c @@ -1028,7 +1028,11 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) else { xd->admin_up = 0; - rte_kni_release(xd->kni); + int kni_rv; + + kni_rv = rte_kni_release(xd->kni); + if (kni_rv < 0) + clib_warning ("rte_kni_release returned %d", kni_rv); } return 0; } diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c index 4c553655db6..2d41221d247 100644 --- a/vnet/vnet/devices/dpdk/format.c +++ b/vnet/vnet/devices/dpdk/format.c @@ -400,9 +400,12 @@ u8 * format_dpdk_device (u8 * s, va_list * args) struct rte_pci_device * pci; struct rte_eth_rss_conf rss_conf; int vlan_off; + int retval; rss_conf.rss_key = 0; - rte_eth_dev_rss_hash_conf_get(xd->device_index, &rss_conf); + retval = rte_eth_dev_rss_hash_conf_get(xd->device_index, &rss_conf); + if (retval < 0) + clib_warning ("rte_eth_dev_rss_hash_conf_get returned %d", retval); pci = di.pci_dev; if (pci) diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index 1f4629dafc6..b690dec2732 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -119,7 +119,11 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd) } if (xd->admin_up) { - rte_eth_dev_start (xd->device_index); + int rv; + rv = rte_eth_dev_start (xd->device_index); + if (rv < 0) + clib_warning ("rte_eth_dev_start %d returned %d", + xd->device_index, rv); } return 0; } @@ -189,7 +193,12 @@ static u32 dpdk_flag_change (vnet_main_t * vnm, rte_eth_dev_set_mtu(xd->device_index, hi->max_packet_bytes); if (xd->admin_up) - rte_eth_dev_start (xd->device_index); + { + int rv = rte_eth_dev_start (xd->device_index); + if (rv < 0) + clib_warning ("rte_eth_dev_start %d returned %d", + xd->device_index, rv); + } } } return old; @@ -391,7 +400,8 @@ dpdk_lib_init (dpdk_main_t * dm) if (!xd->pmd) { -#define _(s,f) else if (!strcmp(dev_info.driver_name, s)) \ +#define _(s,f) else if (dev_info.driver_name && \ + !strcmp(dev_info.driver_name, s)) \ xd->pmd = VNET_DPDK_PMD_##f; if (0) ; @@ -651,7 +661,7 @@ dpdk_lib_init (dpdk_main_t * dm) rv = dpdk_port_setup(dm, xd); - if (rv < 0) + if (rv) return rv; /* count the number of descriptors used for this device */ @@ -1199,6 +1209,12 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) vec_free(p); vec_free(path); })); + + if (mem_by_socket == 0) + { + error = clib_error_return (0, "mem_by_socket NULL"); + goto done; + } _vec_len (mem_by_socket) = c + 1; /* regenerate socket_mem string */ diff --git a/vnet/vnet/devices/netmap/device.c b/vnet/vnet/devices/netmap/device.c index a13326035de..751caf72aa8 100644 --- a/vnet/vnet/devices/netmap/device.c +++ b/vnet/vnet/devices/netmap/device.c @@ -119,14 +119,15 @@ netmap_interface_tx (vlib_main_t * vm, if (nm_tx_pending(ring)) { - ioctl(nif->fd, NIOCTXSYNC, NULL); - clib_cpu_time_wait(time_constant); - - if (nm_tx_pending(ring) && !n_free_slots) - { - cur_ring++; - continue; - } + if (ioctl(nif->fd, NIOCTXSYNC, NULL) < 0) + clib_unix_warning ("NIOCTXSYNC"); + clib_cpu_time_wait(time_constant); + + if (nm_tx_pending(ring) && !n_free_slots) + { + cur_ring++; + continue; + } } while (n_left && n_free_slots) diff --git a/vnet/vnet/devices/netmap/node.c b/vnet/vnet/devices/netmap/node.c index 9378dfd95bb..4a79fe0f979 100644 --- a/vnet/vnet/devices/netmap/node.c +++ b/vnet/vnet/devices/netmap/node.c @@ -210,13 +210,17 @@ netmap_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node, VLIB_BUFFER_TRACE_TRAJECTORY_INIT(first_b0); if (PREDICT_FALSE(n_trace > 0)) { - netmap_input_trace_t *tr; - vlib_trace_buffer (vm, node, next0, first_b0, /* follow_chain */ 0); - vlib_set_trace_count (vm, node, --n_trace); - tr = vlib_add_trace (vm, node, first_b0, sizeof (*tr)); - tr->next_index = next0; - tr->hw_if_index = nif->hw_if_index; - memcpy (&tr->slot, slot, sizeof (struct netmap_slot)); + if (PREDICT_TRUE(first_b0 != 0)) + { + netmap_input_trace_t *tr; + vlib_trace_buffer (vm, node, next0, first_b0, + /* follow_chain */ 0); + vlib_set_trace_count (vm, node, --n_trace); + tr = vlib_add_trace (vm, node, first_b0, sizeof (*tr)); + tr->next_index = next0; + tr->hw_if_index = nif->hw_if_index; + memcpy (&tr->slot, slot, sizeof (struct netmap_slot)); + } } /* enque and take next packet */ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, diff --git a/vnet/vnet/l2/l2_input_acl.c b/vnet/vnet/l2/l2_input_acl.c index d3038e8df1e..f8e77d7e58f 100644 --- a/vnet/vnet/l2/l2_input_acl.c +++ b/vnet/vnet/l2/l2_input_acl.c @@ -329,7 +329,7 @@ l2_inacl_node_fn (vlib_main_t * vm, t->sw_if_index = vnet_buffer(b0)->sw_if_index[VLIB_RX]; t->next_index = next0; t->table_index = t0 ? t0 - vcm->tables : ~0; - t->offset = e0 ? vnet_classify_get_offset (t0, e0): ~0; + t->offset = (t0 && e0) ? vnet_classify_get_offset (t0, e0): ~0; } /* verify speculative enqueue, maybe switch current next frame */ diff --git a/vppinfra/vppinfra/hash.c b/vppinfra/vppinfra/hash.c index c4d724935a5..cbb922edd5a 100644 --- a/vppinfra/vppinfra/hash.c +++ b/vppinfra/vppinfra/hash.c @@ -391,8 +391,8 @@ set_indirect (void * v, hash_pair_indirect_t * pi, uword key, if (new_len * hash_pair_bytes (h) > (1ULL << log2_bytes)) { pi->pairs = clib_mem_realloc (pi->pairs, - 1 << (log2_bytes + 1), - 1 << log2_bytes); + 1ULL << (log2_bytes + 1), + 1ULL << log2_bytes); log2_bytes++; } diff --git a/vppinfra/vppinfra/sparse_vec.h b/vppinfra/vppinfra/sparse_vec.h index 08e97f352a9..bf18ebd9e9b 100644 --- a/vppinfra/vppinfra/sparse_vec.h +++ b/vppinfra/vppinfra/sparse_vec.h @@ -87,7 +87,7 @@ sparse_vec_new (uword elt_bytes, uword sparse_index_bits) n = sparse_index_bits - min_log2 (BITS (uword)); if (n < 0) n = 0; - n = 1 << n; + n = 1ULL << n; vec_resize (h->is_member_bitmap, n); vec_resize (h->member_counts, n); |