diff --git a/dpdk/dpdk_vrouter.c b/dpdk/dpdk_vrouter.c index 582e06084..64b8bc749 100644 --- a/dpdk/dpdk_vrouter.c +++ b/dpdk/dpdk_vrouter.c @@ -296,17 +296,20 @@ dpdk_argv_update(void) if (vr_dpdk.vlan_tag != VLAN_ID_INVALID) { RTE_LOG(INFO, VROUTER, "Using VLAN TCI: %" PRIu16 "\n", vr_dpdk.vlan_tag); } - RTE_LOG(INFO, VROUTER, "Bridge Table limit: %" PRIu32 "\t" - "Bridge Table overflow limit: %" PRIu32 "\n", - vr_bridge_entries, vr_bridge_oentries); - RTE_LOG(INFO, VROUTER, "Flow Table limit: %" PRIu32 "\t" - "Flow Table overflow limit: %" PRIu32 "\n", - vr_flow_entries, vr_oflow_entries); - RTE_LOG(INFO, VROUTER, "MPLS labels limit: %" PRIu32 "\t" - "Nexthops limit: %" PRIu32 "\n", - vr_mpls_labels, vr_nexthops); - RTE_LOG(INFO, VROUTER, "VRF tables limit: %" PRIu32 "\n", - vr_vrfs); + RTE_LOG(INFO, VROUTER, "Bridge Table limit: %" PRIu32 "\n", + vr_bridge_entries); + RTE_LOG(INFO, VROUTER, "Bridge Table overflow limit: %" PRIu32 "\n", + vr_bridge_oentries); + RTE_LOG(INFO, VROUTER, "Flow Table limit: %" PRIu32 "\n", + vr_flow_entries); + RTE_LOG(INFO, VROUTER, "Flow Table overflow limit: %" PRIu32 "\n", + vr_oflow_entries); + RTE_LOG(INFO, VROUTER, "MPLS labels limit: %" PRIu32 "\n", + vr_mpls_labels); + RTE_LOG(INFO, VROUTER, "Nexthops limit: %" PRIu32 "\n", + vr_nexthops); + RTE_LOG(INFO, VROUTER, "VRF tables limit: %" PRIu32 "\n", + vr_vrfs); RTE_LOG(INFO, VROUTER, "EAL arguments:\n"); for (i = 1; i < dpdk_argc - 1; i += 2) { RTE_LOG(INFO, VROUTER, " %12s \"%s\"\n", dpdk_argv[i], dpdk_argv[i + 1]); @@ -355,12 +358,6 @@ dpdk_init(void) /* set default log level to INFO */ rte_set_log_level(RTE_LOG_INFO); - /* TODO: If the host does not support KNIs (i.e. RedHat), we'll get - * a panic here. - * So the initialization should be moved to vr_dpdk_knidev_init() - */ - rte_kni_init(VR_DPDK_MAX_KNI_INTERFACES); - ret = dpdk_mempools_create(); if (ret < 0) return ret; diff --git a/dpdk/vr_dpdk_interface.c b/dpdk/vr_dpdk_interface.c index 85f5f08b7..2e617a1a2 100644 --- a/dpdk/vr_dpdk_interface.c +++ b/dpdk/vr_dpdk_interface.c @@ -831,7 +831,7 @@ dpdk_get_ether_header_len(const void *data) * @param mtu_size MTU size * @param do_outer_ip_csum Whether calculate the outer IP checksum (in * software) - * @param lcore_id An ID of the core executing this function + * @param lcore_id An ID of the lcore executing this function * * @return Number of output fragments (packets) */ @@ -1245,10 +1245,12 @@ dpdk_port_stats_update(struct vr_interface *vif, unsigned lcore_id) if (queue->rxq_ops.f_stats(queue->q_queue_h, &rx_stats, 0) == 0) { if (queue->rxq_ops.f_rx == rte_port_ring_reader_ops.f_rx) { - stats->vis_queue_ipackets = rx_stats.n_pkts_in; + /* DPDK ports count dropped packets twice */ + stats->vis_queue_ipackets = rx_stats.n_pkts_in - rx_stats.n_pkts_drop; stats->vis_queue_ierrors = rx_stats.n_pkts_drop; } else { - stats->vis_port_ipackets = rx_stats.n_pkts_in; + /* DPDK ports count dropped packets twice */ + stats->vis_port_ipackets = rx_stats.n_pkts_in - rx_stats.n_pkts_drop; stats->vis_port_ierrors = rx_stats.n_pkts_drop; } } @@ -1266,10 +1268,12 @@ dpdk_port_stats_update(struct vr_interface *vif, unsigned lcore_id) if (queue->txq_ops.f_stats(queue->q_queue_h, &tx_stats, 0) == 0) { if (queue->txq_ops.f_tx == rte_port_ring_writer_ops.f_tx) { - stats->vis_queue_opackets = tx_stats.n_pkts_in; + /* DPDK ports count dropped packets twice */ + stats->vis_queue_opackets = tx_stats.n_pkts_in - tx_stats.n_pkts_drop; stats->vis_queue_oerrors = tx_stats.n_pkts_drop; } else { - stats->vis_port_opackets = tx_stats.n_pkts_in; + /* DPDK ports count dropped packets twice */ + stats->vis_port_opackets = tx_stats.n_pkts_in - tx_stats.n_pkts_drop; stats->vis_port_oerrors = tx_stats.n_pkts_drop; } } diff --git a/dpdk/vr_dpdk_knidev.c b/dpdk/vr_dpdk_knidev.c index cc53cba55..d543891a0 100644 --- a/dpdk/vr_dpdk_knidev.c +++ b/dpdk/vr_dpdk_knidev.c @@ -483,6 +483,15 @@ vr_dpdk_knidev_init(uint8_t port_id, struct vr_interface *vif) struct rte_kni_ops kni_ops; struct rte_kni *kni; + if (!vr_dpdk.kni_inited) { + /* + * If the host does not support KNIs (i.e. RedHat), we'll get + * a panic here. + */ + rte_kni_init(VR_DPDK_MAX_KNI_INTERFACES); + vr_dpdk.kni_inited = true; + } + /* get eth device info */ memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port_id, &dev_info); diff --git a/dpdk/vr_dpdk_virtio.c b/dpdk/vr_dpdk_virtio.c index aa611251d..511b6f5d2 100644 --- a/dpdk/vr_dpdk_virtio.c +++ b/dpdk/vr_dpdk_virtio.c @@ -335,7 +335,7 @@ vr_dpdk_virtio_rx_queue_init(unsigned int lcore_id, struct vr_interface *vif, /* Check input parameters */ if (queue_id >= vr_dpdk_virtio_nrxqs(vif)) { - RTE_LOG(ERR, VROUTER, " error creating virtio device %s RX queue%" + RTE_LOG(ERR, VROUTER, " error creating virtio device %s RX queue %" PRIu16 "\n", vif->vif_name, queue_id); return NULL; } @@ -356,7 +356,7 @@ vr_dpdk_virtio_rx_queue_init(unsigned int lcore_id, struct vr_interface *vif, }; rx_queue->q_queue_h = rx_queue->rxq_ops.f_create(&reader_params, socket_id); if (rx_queue->q_queue_h == NULL) { - RTE_LOG(ERR, VROUTER, " error creating virtio device %s RX queue%" + RTE_LOG(ERR, VROUTER, " error creating virtio device %s RX queue %" PRIu16 "\n", vif->vif_name, queue_id); return NULL; } @@ -432,7 +432,7 @@ vr_dpdk_virtio_tx_queue_init(unsigned int lcore_id, struct vr_interface *vif, }; tx_queue->q_queue_h = tx_queue->txq_ops.f_create(&writer_params, socket_id); if (tx_queue->q_queue_h == NULL) { - RTE_LOG(ERR, VROUTER, " error creating virtio device %s TX queue%" + RTE_LOG(ERR, VROUTER, " error creating virtio device %s TX queue %" PRIu16 "\n", vif->vif_name, queue_id); return NULL; } diff --git a/dpdk/vr_dpdk_virtio.h b/dpdk/vr_dpdk_virtio.h index 2f6c79bbd..7f977a1f9 100644 --- a/dpdk/vr_dpdk_virtio.h +++ b/dpdk/vr_dpdk_virtio.h @@ -16,10 +16,6 @@ * Burst size for packets to a VM */ #define VR_DPDK_VIRTIO_TX_BURST_SZ VR_DPDK_TX_BURST_SZ -/* - * Size of ring to send packets from virtio RX queue to lcore for forwarding - */ -#define VR_DPDK_VIRTIO_TX_RING_SZ (64 * VR_DPDK_TX_RING_SZ) /* * Maximum number of queues per virtio device */ diff --git a/dpdk/vr_uvhost_msg.c b/dpdk/vr_uvhost_msg.c index f840d34e1..9851d143c 100644 --- a/dpdk/vr_uvhost_msg.c +++ b/dpdk/vr_uvhost_msg.c @@ -389,7 +389,7 @@ vr_uvh_cl_call_handler(vr_uvh_client_t *vru_cl) } if (vr_uvhost_cl_msg_handlers[msg->request]) { - vr_uvhost_log("Client %s: calling handler for message %d\n", + vr_uvhost_log("Client %s: handling message %d\n", /* strip socket prefix */ vru_cl->vruc_path + strlen(VR_UVH_VIF_PREFIX), msg->request); if (vru_cl->vruc_num_fds_sent > 0) { @@ -604,7 +604,7 @@ vr_uvh_cl_msg_handler(int fd, void *arg) ret = vr_uvh_cl_call_handler(vru_cl); if (ret < 0) { - vr_uvhost_log("Error calling handler for message %d client %s\n", + vr_uvhost_log("Error handling message %d client %s\n", vru_cl->vruc_msg.request, vru_cl->vruc_path); ret = -1; goto cleanup; diff --git a/include/vr_dpdk.h b/include/vr_dpdk.h index b14a6af1a..b8ec5c61b 100644 --- a/include/vr_dpdk.h +++ b/include/vr_dpdk.h @@ -419,6 +419,8 @@ struct vr_dpdk_global { struct rte_ring *vlan_ring; /* VLAN forwarding KNI handler */ struct rte_kni *vlan_kni; + /* KNI module inited global flag */ + bool kni_inited; }; extern struct vr_dpdk_global vr_dpdk; @@ -549,7 +551,9 @@ int vr_dpdk_ulog(uint32_t level, uint32_t logtype, uint32_t *last_hash, #if (RTE_LOG_LEVEL == RTE_LOG_DEBUG) #define DPDK_DEBUG_VAR(v) v #define DPDK_UDEBUG(t, h, ...) \ - (void)(((RTE_LOGTYPE_ ## t & rte_logs.type)) ? \ + (void)(((RTE_LOG_DEBUG <= RTE_LOG_LEVEL) && \ + (RTE_LOG_DEBUG <= rte_logs.level) && \ + (RTE_LOGTYPE_ ## t & rte_logs.type)) ? \ vr_dpdk_ulog(RTE_LOG_DEBUG, \ RTE_LOGTYPE_ ## t, h, # t ": " __VA_ARGS__) : 0) #else