DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ilya Maximets <i.maximets@samsung.com>
To: dev@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Tiwei Bie <tiwei.bie@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>,
	Ilya Maximets <i.maximets@samsung.com>
Subject: [dpdk-dev] [PATCH] net/virtio: move bytes accounting to common function
Date: Mon,  3 Dec 2018 19:20:13 +0300	[thread overview]
Message-ID: <20181203162013.17310-1-i.maximets@samsung.com> (raw)
In-Reply-To: <CGME20181203162020eucas1p137dab9f1790df9966f73c3b296a2cbce@eucas1p1.samsung.com>

There is no need to count 'bytes' separately.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 drivers/net/virtio/virtio_rxtx.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index eb891433e..cb8f89f18 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);
 	}
 
-- 
2.17.1

       reply	other threads:[~2018-12-03 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181203162020eucas1p137dab9f1790df9966f73c3b296a2cbce@eucas1p1.samsung.com>
2018-12-03 16:20 ` Ilya Maximets [this message]
2018-12-10  2:52   ` Tiwei Bie
2018-12-11 18:33   ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181203162013.17310-1-i.maximets@samsung.com \
    --to=i.maximets@samsung.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).