Skip to content

Commit

Permalink
Merge "DPDK: minor changes"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Sep 7, 2015
2 parents d674332 + 2246525 commit b7d439c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 32 deletions.
31 changes: 14 additions & 17 deletions dpdk/dpdk_vrouter.c
Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 9 additions & 5 deletions dpdk/vr_dpdk_interface.c
Expand Up @@ -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)
*/
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down
9 changes: 9 additions & 0 deletions dpdk/vr_dpdk_knidev.c
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions dpdk/vr_dpdk_virtio.c
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 0 additions & 4 deletions dpdk/vr_dpdk_virtio.h
Expand Up @@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions dpdk/vr_uvhost_msg.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion include/vr_dpdk.h
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b7d439c

Please sign in to comment.