From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 990AB235 for ; Mon, 3 Dec 2018 17:20:23 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181203162022euoutp02f86bd1efafe07c5fbb089bc8b2406308~s3w22IAep0141401414euoutp02k for ; Mon, 3 Dec 2018 16:20:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181203162022euoutp02f86bd1efafe07c5fbb089bc8b2406308~s3w22IAep0141401414euoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543854022; bh=DNF9gXwEN9hotEuxbeyLRRcVV9fntClx2+vBGekRDGw=; h=From:To:Cc:Subject:Date:References:From; b=UTWvCNwZ6GRKL/qL+MmbJGLAJAJD0FV5wH/GZOHrNl2LKs2mcBcTBGSWyF3AFBxZL VBnED+3tn6cA3L9161gg5hHu4xT4GDC2JNxO/U2qHdsNTNrzFOSX3pd1fhBcDHXNM8 vceA/Vvp/k9zkD+y8HxdjRrX8PrYWxILmJXAWbtc= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181203162021eucas1p175ca7a5bbdc5150f4034dd626a6dd4bb~s3w2ZR8aR1239212392eucas1p1J; Mon, 3 Dec 2018 16:20:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 22.43.04806.5C7550C5; Mon, 3 Dec 2018 16:20:21 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181203162020eucas1p137dab9f1790df9966f73c3b296a2cbce~s3w1lqrAO2763827638eucas1p1W; Mon, 3 Dec 2018 16:20:20 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181203162020eusmtrp1abae78f7675227025932736eea019642~s3w1Tqim31756817568eusmtrp1M; Mon, 3 Dec 2018 16:20:20 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-b9-5c0557c56271 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B5.81.04284.4C7550C5; Mon, 3 Dec 2018 16:20:20 +0000 (GMT) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181203162020eusmtip2c01863b9ad7b8288d8cf5308fc8bc99c~s3w02U8T90404904049eusmtip21; Mon, 3 Dec 2018 16:20:20 +0000 (GMT) From: Ilya Maximets To: dev@dpdk.org Cc: Maxime Coquelin , Tiwei Bie , Zhihong Wang , Ilya Maximets Date: Mon, 3 Dec 2018 19:20:13 +0300 Message-Id: <20181203162013.17310-1-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsWy7djPc7pHw1ljDC6/UrB492k7k8WV9p/s Fsc697BYbG34z2Sx+eIkJgdWj18LlrJ6LN7zksnj/b6rbB59W1YxBrBEcdmkpOZklqUW6dsl cGXs3vaZsWAVf8XqxedZGxgv8XQxcnJICJhIfDl3k7GLkYtDSGAFo8S0M3OZIZwvjBKbd7ew QjifGSV+XZzNDtPybOUCqKrljBK3l3WxQTg/GCUeHN7GDFLFJqAjcWr1EUYQW0RAQOJz52Kw ImaBJYwSB56eBUsIC7hKzJwxGcxmEVCVeNrfzQZi8wpYS0z+OJkJYp28xOoNB8DWSQgcYJM4 +fgOC0TCReJVzxuoImGJV8e3QN0nI3F6cg9UTb3E/ZaXjBDNHYwS0w/9g2qwl9jy+hxQAwfQ SZoS63fpQ4Q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igts58z3zfMMXLF5U/k3++dp5pgfXvF1mHnbjQ3Li7nmyHB5XtwomxPPE2nem 7Dvx7tiyb2p/DbIK3faYvfqf4pKssGm7tFLWu/zAh9Z/+18eKi35c3yHcWNysUf5isXfBKuO zPxUMnuycYfTCc4zPec+GXyLZzob4XVQiaU4I9FQi7moOBEAu6og0koCAAA= X-CMS-MailID: 20181203162020eucas1p137dab9f1790df9966f73c3b296a2cbce X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181203162020eucas1p137dab9f1790df9966f73c3b296a2cbce X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181203162020eucas1p137dab9f1790df9966f73c3b296a2cbce References: Subject: [dpdk-dev] [PATCH] net/virtio: move bytes accounting to common function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 16:20:23 -0000 There is no need to count 'bytes' separately. Signed-off-by: Ilya Maximets --- 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