summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/devices/dpdk/device.c
diff options
context:
space:
mode:
authorShesha Sreenivasamurthy <shesha@cisco.com>2016-03-02 10:33:26 -0800
committerGerrit Code Review <gerrit@fd.io>2016-03-04 20:49:08 +0000
commit9455084c7f85d5930182c4ad5e060f648b21ccfa (patch)
tree5a7662547cfbdeb909345ac7ff4b7cdb97f3254b /vnet/vnet/devices/dpdk/device.c
parent8e94c2a08038a01d26eaec0b88858c1299398233 (diff)
Collect per Q stats for vhost-user interface
Change-Id: I394960c300ff7a81c4c8e05afd5a4175e66666eb Signed-off-by: Shesha Sreenivasamurthy <shesha@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/dpdk/device.c')
-rw-r--r--vnet/vnet/devices/dpdk/device.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index a93e9f4cf82..02703cc59b2 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -308,14 +308,24 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
#endif
if (PREDICT_TRUE(tx_head > tx_tail))
{
+ int i; u32 bytes = 0;
+ struct rte_mbuf **pkts = &tx_vector[tx_tail];
+ for (i = 0; i < (tx_head - tx_tail); i++) {
+ struct rte_mbuf *buff = pkts[i];
+ bytes += rte_pktmbuf_data_len(buff);
+ }
+
/* no wrap, transmit in one burst */
rv = rte_vhost_enqueue_burst(&xd->vu_vhost_dev, offset + VIRTIO_RXQ,
&tx_vector[tx_tail],
(uint16_t) (tx_head-tx_tail));
if (PREDICT_TRUE(rv > 0))
{
+ dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
+ vring->packets += rv;
+ vring->bytes += bytes;
+
if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_RXQ)) {
- dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
vring->n_since_last_int += rv;
f64 now = vlib_time_now (vm);
@@ -336,14 +346,23 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
* so we can try to transmit the rest. If we didn't transmit
* everything, stop now.
*/
+ int i; u32 bytes = 0;
+ struct rte_mbuf **pkts = &tx_vector[tx_tail];
+ for (i = 0; i < (DPDK_TX_RING_SIZE - tx_tail); i++) {
+ struct rte_mbuf *buff = pkts[i];
+ bytes += rte_pktmbuf_data_len(buff);
+ }
rv = rte_vhost_enqueue_burst(&xd->vu_vhost_dev, offset + VIRTIO_RXQ,
&tx_vector[tx_tail],
(uint16_t) (DPDK_TX_RING_SIZE - tx_tail));
if (PREDICT_TRUE(rv > 0))
{
+ dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
+ vring->packets += rv;
+ vring->bytes += bytes;
+
if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_RXQ)) {
- dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
vring->n_since_last_int += rv;
f64 now = vlib_time_now (vm);
@@ -825,6 +844,14 @@ static void dpdk_clear_hw_interface_counters (u32 instance)
memset (&xd->last_stats, 0, sizeof (xd->last_stats));
}
rte_eth_xstats_reset(xd->device_index);
+
+ if (PREDICT_FALSE(xd->dev_type == VNET_DPDK_DEV_VHOST_USER)) {
+ int i;
+ for (i = 0; i < xd->rx_q_used * VIRTIO_QNUM; i++) {
+ xd->vu_intf->vrings[i].packets = 0;
+ xd->vu_intf->vrings[i].bytes = 0;
+ }
+ }
}
#ifdef RTE_LIBRTE_KNI