[dpdk-dev,v2] net/virtio: remove the redundant computing

Message ID 1487833902-20048-1-git-send-email-zhiyong.yang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yang, Zhiyong Feb. 23, 2017, 7:11 a.m. UTC
  The minor change aims to remove the redundant computing and make
it easier to understand the code.

Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---

v2 changes:
remove the prefix "fix" and fixline according to yuanhan's advice.

 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Yuanhan Liu Feb. 23, 2017, 7:34 a.m. UTC | #1
On Thu, Feb 23, 2017 at 03:11:42PM +0800, Zhiyong Yang wrote:
> The minor change aims to remove the redundant computing and make
> it easier to understand the code.
> 
> Cc: yuanhan.liu@linux.intel.com
> Cc: maxime.coquelin@redhat.com
> 
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>

Applied to dpdk-next-virtio.

Thanks.


	--yliu
  

Patch

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index cab6e8f..fcd9e93 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -793,7 +793,7 @@  virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 		rx_pkts[nb_rx++] = rxm;
 
-		rxvq->stats.bytes += rx_pkts[nb_rx - 1]->pkt_len;
+		rxvq->stats.bytes += rxm->pkt_len;
 		virtio_update_packet_stats(&rxvq->stats, rxm);
 	}