* [dpdk-dev] [PATCH] net/virtio: fix remove the redundant computing
@ 2017-02-23  4:28 Zhiyong Yang
  2017-02-23  6:20 ` Yuanhan Liu
  2017-02-23  7:11 ` [dpdk-dev] [PATCH v2] net/virtio: " Zhiyong Yang
  0 siblings, 2 replies; 5+ messages in thread
From: Zhiyong Yang @ 2017-02-23  4:28 UTC (permalink / raw)
  To: dev; +Cc: yuanhan.liu, maxime.coquelin, Zhiyong Yang
This is not a bug. The minor change aims to remove the redundant
computing and make it easier to understand the code.
Fixes:01ad44fd374f("net/virtio: split Rx/Tx queue")
Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/virtio/virtio_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index cab6e8f..14c88c0 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -791,9 +791,9 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 		VIRTIO_DUMP_PACKET(rxm, rxm->data_len);
 
-		rx_pkts[nb_rx++] = rxm;
+		rx_pkts[nb_rx] = rxm;
 
-		rxvq->stats.bytes += rx_pkts[nb_rx - 1]->pkt_len;
+		rxvq->stats.bytes += rx_pkts[nb_rx++]->pkt_len;
 		virtio_update_packet_stats(&rxvq->stats, rxm);
 	}
 
-- 
2.7.4
^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] net/virtio: fix remove the redundant computing
  2017-02-23  4:28 [dpdk-dev] [PATCH] net/virtio: fix remove the redundant computing Zhiyong Yang
@ 2017-02-23  6:20 ` Yuanhan Liu
  2017-02-23  6:31   ` Yang, Zhiyong
  2017-02-23  7:11 ` [dpdk-dev] [PATCH v2] net/virtio: " Zhiyong Yang
  1 sibling, 1 reply; 5+ messages in thread
From: Yuanhan Liu @ 2017-02-23  6:20 UTC (permalink / raw)
  To: Zhiyong Yang; +Cc: dev, maxime.coquelin
On Thu, Feb 23, 2017 at 12:28:33PM +0800, Zhiyong Yang wrote:
> This is not a bug.
Then adding "fix" prefix and fixline here doesn't seem proper to me.
> The minor change aims to remove the redundant
> computing and make it easier to understand the code.
> Fixes:01ad44fd374f("net/virtio: split Rx/Tx queue")
> Cc: yuanhan.liu@linux.intel.com
> Cc: maxime.coquelin@redhat.com
> 
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
>  drivers/net/virtio/virtio_rxtx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index cab6e8f..14c88c0 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -791,9 +791,9 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
>  
>  		VIRTIO_DUMP_PACKET(rxm, rxm->data_len);
>  
> -		rx_pkts[nb_rx++] = rxm;
> +		rx_pkts[nb_rx] = rxm;
>  
> -		rxvq->stats.bytes += rx_pkts[nb_rx - 1]->pkt_len;
> +		rxvq->stats.bytes += rx_pkts[nb_rx++]->pkt_len;
Why not use "rxm->pkt_len" directly?
	--yliu
^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] net/virtio: fix remove the redundant computing
  2017-02-23  6:20 ` Yuanhan Liu
@ 2017-02-23  6:31   ` Yang, Zhiyong
  0 siblings, 0 replies; 5+ messages in thread
From: Yang, Zhiyong @ 2017-02-23  6:31 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dev, maxime.coquelin
Hi,  yuanhan:
> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Thursday, February 23, 2017 2:21 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org; maxime.coquelin@redhat.com
> Subject: Re: [PATCH] net/virtio: fix remove the redundant computing
> 
> On Thu, Feb 23, 2017 at 12:28:33PM +0800, Zhiyong Yang wrote:
> > This is not a bug.
> 
> Then adding "fix" prefix and fixline here doesn't seem proper to me.
Ok. I will remove them. 
> 
> > The minor change aims to remove the redundant computing and make it
> > easier to understand the code.
> > Fixes:01ad44fd374f("net/virtio: split Rx/Tx queue")
> > Cc: yuanhan.liu@linux.intel.com
> > Cc: maxime.coquelin@redhat.com
> >
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> > ---
> >  drivers/net/virtio/virtio_rxtx.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/virtio/virtio_rxtx.c
> > b/drivers/net/virtio/virtio_rxtx.c
> > index cab6e8f..14c88c0 100644
> > --- a/drivers/net/virtio/virtio_rxtx.c
> > +++ b/drivers/net/virtio/virtio_rxtx.c
> > @@ -791,9 +791,9 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf
> > **rx_pkts, uint16_t nb_pkts)
> >
> >  		VIRTIO_DUMP_PACKET(rxm, rxm->data_len);
> >
> > -		rx_pkts[nb_rx++] = rxm;
> > +		rx_pkts[nb_rx] = rxm;
> >
> > -		rxvq->stats.bytes += rx_pkts[nb_rx - 1]->pkt_len;
> > +		rxvq->stats.bytes += rx_pkts[nb_rx++]->pkt_len;
> 
> Why not use "rxm->pkt_len" directly?
Good advice and it's better.
> 
> 	--yliu
^ permalink raw reply	[flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] net/virtio: remove the redundant computing
  2017-02-23  4:28 [dpdk-dev] [PATCH] net/virtio: fix remove the redundant computing Zhiyong Yang
  2017-02-23  6:20 ` Yuanhan Liu
@ 2017-02-23  7:11 ` Zhiyong Yang
  2017-02-23  7:34   ` Yuanhan Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Zhiyong Yang @ 2017-02-23  7:11 UTC (permalink / raw)
  To: dev; +Cc: yuanhan.liu, maxime.coquelin, Zhiyong Yang
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(-)
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);
 	}
 
-- 
2.7.4
^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/virtio: remove the redundant computing
  2017-02-23  7:11 ` [dpdk-dev] [PATCH v2] net/virtio: " Zhiyong Yang
@ 2017-02-23  7:34   ` Yuanhan Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuanhan Liu @ 2017-02-23  7:34 UTC (permalink / raw)
  To: Zhiyong Yang; +Cc: dev, maxime.coquelin
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
^ permalink raw reply	[flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-23  7:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23  4:28 [dpdk-dev] [PATCH] net/virtio: fix remove the redundant computing Zhiyong Yang
2017-02-23  6:20 ` Yuanhan Liu
2017-02-23  6:31   ` Yang, Zhiyong
2017-02-23  7:11 ` [dpdk-dev] [PATCH v2] net/virtio: " Zhiyong Yang
2017-02-23  7:34   ` Yuanhan Liu
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).