summaryrefslogtreecommitdiff
path: root/drivers/net/virtio/virtio_rxtx.c
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2018-12-03 19:20:13 +0300
committerFerruh Yigit <ferruh.yigit@intel.com>2018-12-13 18:17:42 +0000
commit81e5cdf19e583c742040d3be83b8cc79b451e243 (patch)
treee73a69c9c7f29433351648dd0faa010c247e71c1 /drivers/net/virtio/virtio_rxtx.c
parent4a5140ab17d29e77eefa47b5cb514238e8e0c132 (diff)
downloaddpdk-81e5cdf19e583c742040d3be83b8cc79b451e243.zip
dpdk-81e5cdf19e583c742040d3be83b8cc79b451e243.tar.gz
dpdk-81e5cdf19e583c742040d3be83b8cc79b451e243.tar.xz
net/virtio: move bytes accounting to common function
There is no need to count 'bytes' separately. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Diffstat (limited to 'drivers/net/virtio/virtio_rxtx.c')
-rw-r--r--drivers/net/virtio/virtio_rxtx.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index eb89143..cb8f89f 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -775,6 +775,8 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf)
uint32_t s = mbuf->pkt_len;
struct ether_addr *ea;
+ stats->bytes += s;
+
if (s == 64) {
stats->size_bins[1]++;
} else if (s > 64 && s < 1024) {
@@ -806,7 +808,6 @@ virtio_rx_stats_updated(struct virtnet_rx *rxvq, struct rte_mbuf *m)
{
VIRTIO_DUMP_PACKET(m, m->data_len);
- rxvq->stats.bytes += m->pkt_len;
virtio_update_packet_stats(&rxvq->stats, m);
}
@@ -1310,7 +1311,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,
VIRTIO_DUMP_PACKET(rx_pkts[nb_rx],
rx_pkts[nb_rx]->data_len);
- rxvq->stats.bytes += rx_pkts[nb_rx]->pkt_len;
virtio_update_packet_stats(&rxvq->stats, rx_pkts[nb_rx]);
nb_rx++;
}
@@ -1423,7 +1423,6 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
virtqueue_enqueue_xmit(txvq, txm, slots, use_indirect,
can_push, 0);
- txvq->stats.bytes += txm->pkt_len;
virtio_update_packet_stats(&txvq->stats, txm);
}
@@ -1498,7 +1497,6 @@ virtio_xmit_pkts_inorder(void *tx_queue,
inorder_pkts[nb_inorder_pkts] = txm;
nb_inorder_pkts++;
- txvq->stats.bytes += txm->pkt_len;
virtio_update_packet_stats(&txvq->stats, txm);
continue;
}
@@ -1529,7 +1527,6 @@ virtio_xmit_pkts_inorder(void *tx_queue,
/* Enqueue Packet buffers */
virtqueue_enqueue_xmit(txvq, txm, slots, 0, 0, 1);
- txvq->stats.bytes += txm->pkt_len;
virtio_update_packet_stats(&txvq->stats, txm);
}