DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions
@ 2019-09-11 16:04 Thierry Herbelot
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with " Thierry Herbelot
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Thierry Herbelot @ 2019-09-11 16:04 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon

Two fixes in the vectorized functions of virtio.

Thibaut Collet (2):
  virtio: fix rx stats with vectorized functions
  virtio: get all pending rx packets with vectorized functions

 drivers/net/virtio/virtio_rxtx.c             |  2 +-
 drivers/net/virtio/virtio_rxtx.h             |  2 ++
 drivers/net/virtio/virtio_rxtx_simple_neon.c | 10 ++++++++--
 drivers/net/virtio/virtio_rxtx_simple_sse.c  | 10 ++++++++--
 4 files changed, 19 insertions(+), 5 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with vectorized functions
  2019-09-11 16:04 [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Thierry Herbelot
@ 2019-09-11 16:04 ` Thierry Herbelot
  2019-09-27  9:08   ` Maxime Coquelin
  2019-09-30 18:04   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with " Thierry Herbelot
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Thierry Herbelot @ 2019-09-11 16:04 UTC (permalink / raw)
  To: dev
  Cc: Thibaut Collet, Thomas Monjalon, stable, maxime.coquelin,
	tiwei.bie, zhihong.wang

From: Thibaut Collet <thibaut.collet@6wind.com>

With vectorized functions, only the rx stats for number of packets is
incremented.
Update also the other statistics.
Performance impact is about 2%

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Cc: maxime.coquelin@redhat.com
Cc: tiwei.bie@intel.com
Cc: zhihong.wang@intel.com

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
---
 drivers/net/virtio/virtio_rxtx.c             | 2 +-
 drivers/net/virtio/virtio_rxtx.h             | 2 ++
 drivers/net/virtio/virtio_rxtx_simple_neon.c | 5 +++++
 drivers/net/virtio/virtio_rxtx_simple_sse.c  | 5 +++++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 27ead19fbe81..6dd62bf51863 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -1083,7 +1083,7 @@ virtio_discard_rxbuf_inorder(struct virtqueue *vq, struct rte_mbuf *m)
 	}
 }
 
-static inline void
+void
 virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf)
 {
 	uint32_t s = mbuf->pkt_len;
diff --git a/drivers/net/virtio/virtio_rxtx.h b/drivers/net/virtio/virtio_rxtx.h
index 685cc4f8104c..1eb8dae227ee 100644
--- a/drivers/net/virtio/virtio_rxtx.h
+++ b/drivers/net/virtio/virtio_rxtx.h
@@ -59,5 +59,7 @@ struct virtnet_ctl {
 };
 
 int virtio_rxq_vec_setup(struct virtnet_rx *rxvq);
+void virtio_update_packet_stats(struct virtnet_stats *stats,
+				struct rte_mbuf *mbuf);
 
 #endif /* _VIRTIO_RXTX_H_ */
diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c
index cdc2a4d28ed5..70e89fc428e0 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_neon.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c
@@ -47,6 +47,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct vring_used_elem *rused;
 	struct rte_mbuf **sw_ring;
 	struct rte_mbuf **sw_ring_end;
+	struct rte_mbuf **ref_rx_pkts;
 	uint16_t nb_pkts_received = 0;
 
 	uint8x16_t shuf_msk1 = {
@@ -105,6 +106,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			virtqueue_notify(vq);
 	}
 
+	ref_rx_pkts = rx_pkts;
 	for (nb_pkts_received = 0;
 		nb_pkts_received < nb_used;) {
 		uint64x2_t desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
@@ -204,5 +206,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	vq->vq_used_cons_idx += nb_pkts_received;
 	vq->vq_free_cnt += nb_pkts_received;
 	rxvq->stats.packets += nb_pkts_received;
+	for (nb_used = 0; nb_used < nb_pkts_received; nb_used++)
+		virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]);
+
 	return nb_pkts_received;
 }
diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c b/drivers/net/virtio/virtio_rxtx_simple_sse.c
index af76708d66ae..cb1610e71563 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_sse.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c
@@ -48,6 +48,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct vring_used_elem *rused;
 	struct rte_mbuf **sw_ring;
 	struct rte_mbuf **sw_ring_end;
+	struct rte_mbuf **ref_rx_pkts;
 	uint16_t nb_pkts_received = 0;
 	__m128i shuf_msk1, shuf_msk2, len_adjust;
 
@@ -107,6 +108,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			virtqueue_notify(vq);
 	}
 
+	ref_rx_pkts = rx_pkts;
 	for (nb_pkts_received = 0;
 		nb_pkts_received < nb_used;) {
 		__m128i desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
@@ -190,5 +192,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	vq->vq_used_cons_idx += nb_pkts_received;
 	vq->vq_free_cnt += nb_pkts_received;
 	rxvq->stats.packets += nb_pkts_received;
+	for (nb_used = 0; nb_used < nb_pkts_received; nb_used++)
+		virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]);
+
 	return nb_pkts_received;
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with vectorized functions
  2019-09-11 16:04 [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Thierry Herbelot
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with " Thierry Herbelot
@ 2019-09-11 16:04 ` Thierry Herbelot
  2019-09-27  9:09   ` Maxime Coquelin
                     ` (2 more replies)
  2019-09-27  9:11 ` [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Maxime Coquelin
  2019-09-27  9:50 ` Maxime Coquelin
  3 siblings, 3 replies; 14+ messages in thread
From: Thierry Herbelot @ 2019-09-11 16:04 UTC (permalink / raw)
  To: dev
  Cc: Thibaut Collet, Thomas Monjalon, stable, maxime.coquelin,
	tiwei.bie, zhihong.wang, jerinj, gavin.hu

From: Thibaut Collet <thibaut.collet@6wind.com>

The loop to read packets does not take all packets as the number of
available packets (nb_used) is decremented in the loop.
Take all available packets provides a performance improvement of 3%.

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Cc: maxime.coquelin@redhat.com
Cc: tiwei.bie@intel.com
Cc: zhihong.wang@intel.com
Cc: jerinj@marvell.com
Cc: gavin.hu@arm.com

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
---
 drivers/net/virtio/virtio_rxtx_simple_neon.c | 5 +++--
 drivers/net/virtio/virtio_rxtx_simple_sse.c  | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c
index 70e89fc428e0..992e71f010eb 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_neon.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c
@@ -42,7 +42,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct virtnet_rx *rxvq = rx_queue;
 	struct virtqueue *vq = rxvq->vq;
 	struct virtio_hw *hw = vq->hw;
-	uint16_t nb_used;
+	uint16_t nb_used, nb_total;
 	uint16_t desc_idx;
 	struct vring_used_elem *rused;
 	struct rte_mbuf **sw_ring;
@@ -106,9 +106,10 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			virtqueue_notify(vq);
 	}
 
+	nb_total = nb_used;
 	ref_rx_pkts = rx_pkts;
 	for (nb_pkts_received = 0;
-		nb_pkts_received < nb_used;) {
+		nb_pkts_received < nb_total;) {
 		uint64x2_t desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
 		uint64x2_t mbp[RTE_VIRTIO_DESC_PER_LOOP / 2];
 		uint64x2_t pkt_mb[RTE_VIRTIO_DESC_PER_LOOP];
diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c b/drivers/net/virtio/virtio_rxtx_simple_sse.c
index cb1610e71563..f9ec4ae69986 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_sse.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c
@@ -43,7 +43,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct virtnet_rx *rxvq = rx_queue;
 	struct virtqueue *vq = rxvq->vq;
 	struct virtio_hw *hw = vq->hw;
-	uint16_t nb_used;
+	uint16_t nb_used, nb_total;
 	uint16_t desc_idx;
 	struct vring_used_elem *rused;
 	struct rte_mbuf **sw_ring;
@@ -108,9 +108,10 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			virtqueue_notify(vq);
 	}
 
+	nb_total = nb_used;
 	ref_rx_pkts = rx_pkts;
 	for (nb_pkts_received = 0;
-		nb_pkts_received < nb_used;) {
+		nb_pkts_received < nb_total;) {
 		__m128i desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
 		__m128i mbp[RTE_VIRTIO_DESC_PER_LOOP / 2];
 		__m128i pkt_mb[RTE_VIRTIO_DESC_PER_LOOP];
-- 
2.20.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with vectorized functions
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with " Thierry Herbelot
@ 2019-09-27  9:08   ` Maxime Coquelin
  2019-09-30 18:04   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
  1 sibling, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-09-27  9:08 UTC (permalink / raw)
  To: Thierry Herbelot, dev
  Cc: Thibaut Collet, Thomas Monjalon, stable, tiwei.bie, zhihong.wang



On 9/11/19 6:04 PM, Thierry Herbelot wrote:
> From: Thibaut Collet <thibaut.collet@6wind.com>
> 
> With vectorized functions, only the rx stats for number of packets is
> incremented.
> Update also the other statistics.
> Performance impact is about 2%
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Cc: stable@dpdk.org
> Cc: maxime.coquelin@redhat.com
> Cc: tiwei.bie@intel.com
> Cc: zhihong.wang@intel.com
> 
> Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
> ---
>  drivers/net/virtio/virtio_rxtx.c             | 2 +-
>  drivers/net/virtio/virtio_rxtx.h             | 2 ++
>  drivers/net/virtio/virtio_rxtx_simple_neon.c | 5 +++++
>  drivers/net/virtio/virtio_rxtx_simple_sse.c  | 5 +++++
>  4 files changed, 13 insertions(+), 1 deletion(-)
> 


Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with vectorized functions
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with " Thierry Herbelot
@ 2019-09-27  9:09   ` Maxime Coquelin
  2019-09-30 18:27   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
  2019-09-30 18:42   ` [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths David Christensen
  2 siblings, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-09-27  9:09 UTC (permalink / raw)
  To: Thierry Herbelot, dev
  Cc: Thibaut Collet, Thomas Monjalon, stable, tiwei.bie, zhihong.wang,
	jerinj, gavin.hu



On 9/11/19 6:04 PM, Thierry Herbelot wrote:
> From: Thibaut Collet <thibaut.collet@6wind.com>
> 
> The loop to read packets does not take all packets as the number of
> available packets (nb_used) is decremented in the loop.
> Take all available packets provides a performance improvement of 3%.
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Cc: stable@dpdk.org
> Cc: maxime.coquelin@redhat.com
> Cc: tiwei.bie@intel.com
> Cc: zhihong.wang@intel.com
> Cc: jerinj@marvell.com
> Cc: gavin.hu@arm.com
> 
> Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
> ---
>  drivers/net/virtio/virtio_rxtx_simple_neon.c | 5 +++--
>  drivers/net/virtio/virtio_rxtx_simple_sse.c  | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 


Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions
  2019-09-11 16:04 [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Thierry Herbelot
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with " Thierry Herbelot
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with " Thierry Herbelot
@ 2019-09-27  9:11 ` Maxime Coquelin
  2019-09-27  9:50 ` Maxime Coquelin
  3 siblings, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-09-27  9:11 UTC (permalink / raw)
  To: dev, David Christensen; +Cc: Thierry Herbelot, Thomas Monjalon

Hi David,

On 9/11/19 6:04 PM, Thierry Herbelot wrote:
> Two fixes in the vectorized functions of virtio.
> 
> Thibaut Collet (2):
>   virtio: fix rx stats with vectorized functions
>   virtio: get all pending rx packets with vectorized functions
> 
>  drivers/net/virtio/virtio_rxtx.c             |  2 +-
>  drivers/net/virtio/virtio_rxtx.h             |  2 ++
>  drivers/net/virtio/virtio_rxtx_simple_neon.c | 10 ++++++++--
>  drivers/net/virtio/virtio_rxtx_simple_sse.c  | 10 ++++++++--
>  4 files changed, 19 insertions(+), 5 deletions(-)
> 

Could you do the same fix for the new Power vectorized Rx path?

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions
  2019-09-11 16:04 [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Thierry Herbelot
                   ` (2 preceding siblings ...)
  2019-09-27  9:11 ` [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Maxime Coquelin
@ 2019-09-27  9:50 ` Maxime Coquelin
  3 siblings, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-09-27  9:50 UTC (permalink / raw)
  To: Thierry Herbelot, dev; +Cc: Thomas Monjalon



On 9/11/19 6:04 PM, Thierry Herbelot wrote:
> Two fixes in the vectorized functions of virtio.
> 
> Thibaut Collet (2):
>   virtio: fix rx stats with vectorized functions
>   virtio: get all pending rx packets with vectorized functions
> 
>  drivers/net/virtio/virtio_rxtx.c             |  2 +-
>  drivers/net/virtio/virtio_rxtx.h             |  2 ++
>  drivers/net/virtio/virtio_rxtx_simple_neon.c | 10 ++++++++--
>  drivers/net/virtio/virtio_rxtx_simple_sse.c  | 10 ++++++++--
>  4 files changed, 19 insertions(+), 5 deletions(-)
> 

Applied to dpdk-next-virtio/master.

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec vectorized functions
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with " Thierry Herbelot
  2019-09-27  9:08   ` Maxime Coquelin
@ 2019-09-30 18:04   ` David Christensen
  1 sibling, 0 replies; 14+ messages in thread
From: David Christensen @ 2019-09-30 18:04 UTC (permalink / raw)
  To: dev
  Cc: stable, thibaut.collet, maxime.coquelin, tiwei.bie, zhihong.wang,
	David Christensen

With vectorized functions, only the rx stats for number of packets is
incremented.
Update also the other statistics.
Performance impact is about 2%

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Cc: thibaut.collet@6wind.com
Cc: maxime.coquelin@redhat.com
Cc: tiwei.bie@intel.com
Cc: zhihong.wang@intel.com

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
index 1cd732dec..f856396ab 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
@@ -49,6 +49,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct vring_used_elem *rused;
 	struct rte_mbuf **sw_ring;
 	struct rte_mbuf **sw_ring_end;
+	struct rte_mbuf **ref_rx_pkts;
 	uint16_t nb_pkts_received = 0;
 	const vector unsigned char zero = {0};
 
@@ -108,6 +109,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			virtqueue_notify(vq);
 	}
 
+	ref_rx_pkts = rx_pkts;
 	for (nb_pkts_received = 0;
 		nb_pkts_received < nb_used;) {
 		vector unsigned char desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
@@ -199,5 +201,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	vq->vq_used_cons_idx += nb_pkts_received;
 	vq->vq_free_cnt += nb_pkts_received;
 	rxvq->stats.packets += nb_pkts_received;
+	for (nb_used = 0; nb_used < nb_pkts_received; nb_used++)
+		virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]);
+
 	return nb_pkts_received;
 }
-- 
2.18.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec vectorized functions
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with " Thierry Herbelot
  2019-09-27  9:09   ` Maxime Coquelin
@ 2019-09-30 18:27   ` David Christensen
  2019-10-01 10:00     ` Maxime Coquelin
  2019-10-16 11:11     ` Maxime Coquelin
  2019-09-30 18:42   ` [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths David Christensen
  2 siblings, 2 replies; 14+ messages in thread
From: David Christensen @ 2019-09-30 18:27 UTC (permalink / raw)
  To: dev
  Cc: stable, thibaut.collet, maxime.coquelin, tiwei.bie, zhihong.wang,
	jerinj, gavin.hu, David Christensen

With vectorized functions, only the rx stats for number of packets is
incremented.
Update also the other statistics.
Performance impact is about 2%

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Cc: thibaut.collet@6wind.com
Cc: maxime.coquelin@redhat.com
Cc: tiwei.bie@intel.com
Cc: zhihong.wang@intel.com

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
index 1cd732dec..f856396ab 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
@@ -49,6 +49,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct vring_used_elem *rused;
 	struct rte_mbuf **sw_ring;
 	struct rte_mbuf **sw_ring_end;
+	struct rte_mbuf **ref_rx_pkts;
 	uint16_t nb_pkts_received = 0;
 	const vector unsigned char zero = {0};
 
@@ -108,6 +109,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			virtqueue_notify(vq);
 	}
 
+	ref_rx_pkts = rx_pkts;
 	for (nb_pkts_received = 0;
 		nb_pkts_received < nb_used;) {
 		vector unsigned char desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
@@ -199,5 +201,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	vq->vq_used_cons_idx += nb_pkts_received;
 	vq->vq_free_cnt += nb_pkts_received;
 	rxvq->stats.packets += nb_pkts_received;
+	for (nb_used = 0; nb_used < nb_pkts_received; nb_used++)
+		virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]);
+
 	return nb_pkts_received;
 }
-- 
2.18.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths
  2019-09-11 16:04 ` [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with " Thierry Herbelot
  2019-09-27  9:09   ` Maxime Coquelin
  2019-09-30 18:27   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
@ 2019-09-30 18:42   ` David Christensen
  2019-10-01 10:06     ` Maxime Coquelin
  2019-10-16 11:11     ` Maxime Coquelin
  2 siblings, 2 replies; 14+ messages in thread
From: David Christensen @ 2019-09-30 18:42 UTC (permalink / raw)
  To: dev
  Cc: stable, thibaut.collet, maxime.coquelin, tiwei.bie, zhihong.wang,
	jerinj, gavin.hu, David Christensen

The loop to read packets does not take all packets as the number of
available packets (nb_used) is decremented in the loop.
Take all available packets provides a performance improvement of 3%.

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Cc: thibaut.collet@6wind.com
Cc: maxime.coquelin@redhat.com
Cc: tiwei.bie@intel.com
Cc: zhihong.wang@intel.com
Cc: jerinj@marvell.com
Cc: gavin.hu@arm.com

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
index f856396ab..47225f412 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
@@ -44,7 +44,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct virtnet_rx *rxvq = rx_queue;
 	struct virtqueue *vq = rxvq->vq;
 	struct virtio_hw *hw = vq->hw;
-	uint16_t nb_used;
+	uint16_t nb_used, nb_total;
 	uint16_t desc_idx;
 	struct vring_used_elem *rused;
 	struct rte_mbuf **sw_ring;
@@ -109,9 +109,10 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			virtqueue_notify(vq);
 	}
 
+	nb_total = nb_used;
 	ref_rx_pkts = rx_pkts;
 	for (nb_pkts_received = 0;
-		nb_pkts_received < nb_used;) {
+		nb_pkts_received < nb_total;) {
 		vector unsigned char desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
 		vector unsigned char mbp[RTE_VIRTIO_DESC_PER_LOOP / 2];
 		vector unsigned char pkt_mb[RTE_VIRTIO_DESC_PER_LOOP];
-- 
2.18.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec vectorized functions
  2019-09-30 18:27   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
@ 2019-10-01 10:00     ` Maxime Coquelin
  2019-10-16 11:11     ` Maxime Coquelin
  1 sibling, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-10-01 10:00 UTC (permalink / raw)
  To: David Christensen, dev
  Cc: stable, thibaut.collet, tiwei.bie, zhihong.wang, jerinj, gavin.hu

Thanks David for the fix,

On 9/30/19 8:27 PM, David Christensen wrote:
> With vectorized functions, only the rx stats for number of packets is
> incremented.
> Update also the other statistics.
> Performance impact is about 2%
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Cc: stable@dpdk.org
> Cc: thibaut.collet@6wind.com
> Cc: maxime.coquelin@redhat.com
> Cc: tiwei.bie@intel.com
> Cc: zhihong.wang@intel.com

The commit message seems like a copy-paste, so claim about performance
impact may be not true, same for the Fixes line, which points to a
commit when altivec was not here yet.


I'll fix that when appyling:

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  drivers/net/virtio/virtio_rxtx_simple_altivec.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> index 1cd732dec..f856396ab 100644
> --- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> +++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> @@ -49,6 +49,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	struct vring_used_elem *rused;
>  	struct rte_mbuf **sw_ring;
>  	struct rte_mbuf **sw_ring_end;
> +	struct rte_mbuf **ref_rx_pkts;
>  	uint16_t nb_pkts_received = 0;
>  	const vector unsigned char zero = {0};
>  
> @@ -108,6 +109,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  			virtqueue_notify(vq);
>  	}
>  
> +	ref_rx_pkts = rx_pkts;
>  	for (nb_pkts_received = 0;
>  		nb_pkts_received < nb_used;) {
>  		vector unsigned char desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
> @@ -199,5 +201,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	vq->vq_used_cons_idx += nb_pkts_received;
>  	vq->vq_free_cnt += nb_pkts_received;
>  	rxvq->stats.packets += nb_pkts_received;
> +	for (nb_used = 0; nb_used < nb_pkts_received; nb_used++)
> +		virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]);
> +
>  	return nb_pkts_received;
>  }
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths
  2019-09-30 18:42   ` [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths David Christensen
@ 2019-10-01 10:06     ` Maxime Coquelin
  2019-10-16 11:11     ` Maxime Coquelin
  1 sibling, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-10-01 10:06 UTC (permalink / raw)
  To: David Christensen, dev
  Cc: stable, thibaut.collet, tiwei.bie, zhihong.wang, jerinj, gavin.hu



On 9/30/19 8:42 PM, David Christensen wrote:
> The loop to read packets does not take all packets as the number of
> available packets (nb_used) is decremented in the loop.
> Take all available packets provides a performance improvement of 3%.
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Cc: stable@dpdk.org
> Cc: thibaut.collet@6wind.com
> Cc: maxime.coquelin@redhat.com
> Cc: tiwei.bie@intel.com
> Cc: zhihong.wang@intel.com
> Cc: jerinj@marvell.com
> Cc: gavin.hu@arm.com
> 
Same comments as for other patch, I'll fix that whiile applying.

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks!
Maxime

> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  drivers/net/virtio/virtio_rxtx_simple_altivec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> index f856396ab..47225f412 100644
> --- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> +++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> @@ -44,7 +44,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	struct virtnet_rx *rxvq = rx_queue;
>  	struct virtqueue *vq = rxvq->vq;
>  	struct virtio_hw *hw = vq->hw;
> -	uint16_t nb_used;
> +	uint16_t nb_used, nb_total;
>  	uint16_t desc_idx;
>  	struct vring_used_elem *rused;
>  	struct rte_mbuf **sw_ring;
> @@ -109,9 +109,10 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  			virtqueue_notify(vq);
>  	}
>  
> +	nb_total = nb_used;
>  	ref_rx_pkts = rx_pkts;
>  	for (nb_pkts_received = 0;
> -		nb_pkts_received < nb_used;) {
> +		nb_pkts_received < nb_total;) {
>  		vector unsigned char desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
>  		vector unsigned char mbp[RTE_VIRTIO_DESC_PER_LOOP / 2];
>  		vector unsigned char pkt_mb[RTE_VIRTIO_DESC_PER_LOOP];
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec vectorized functions
  2019-09-30 18:27   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
  2019-10-01 10:00     ` Maxime Coquelin
@ 2019-10-16 11:11     ` Maxime Coquelin
  1 sibling, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-10-16 11:11 UTC (permalink / raw)
  To: David Christensen, dev
  Cc: stable, thibaut.collet, tiwei.bie, zhihong.wang, jerinj, gavin.hu



On 9/30/19 8:27 PM, David Christensen wrote:
> With vectorized functions, only the rx stats for number of packets is
> incremented.
> Update also the other statistics.
> Performance impact is about 2%
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Cc: stable@dpdk.org
> Cc: thibaut.collet@6wind.com
> Cc: maxime.coquelin@redhat.com
> Cc: tiwei.bie@intel.com
> Cc: zhihong.wang@intel.com
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  drivers/net/virtio/virtio_rxtx_simple_altivec.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Applied to dpdk-next-virtio/master.

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths
  2019-09-30 18:42   ` [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths David Christensen
  2019-10-01 10:06     ` Maxime Coquelin
@ 2019-10-16 11:11     ` Maxime Coquelin
  1 sibling, 0 replies; 14+ messages in thread
From: Maxime Coquelin @ 2019-10-16 11:11 UTC (permalink / raw)
  To: David Christensen, dev
  Cc: stable, thibaut.collet, tiwei.bie, zhihong.wang, jerinj, gavin.hu



On 9/30/19 8:42 PM, David Christensen wrote:
> The loop to read packets does not take all packets as the number of
> available packets (nb_used) is decremented in the loop.
> Take all available packets provides a performance improvement of 3%.
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Cc: stable@dpdk.org
> Cc: thibaut.collet@6wind.com
> Cc: maxime.coquelin@redhat.com
> Cc: tiwei.bie@intel.com
> Cc: zhihong.wang@intel.com
> Cc: jerinj@marvell.com
> Cc: gavin.hu@arm.com
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  drivers/net/virtio/virtio_rxtx_simple_altivec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
Applied to dpdk-next-virtio/master.

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-10-16 11:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 16:04 [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Thierry Herbelot
2019-09-11 16:04 ` [dpdk-dev] [PATCH 1/2] virtio: fix rx stats with " Thierry Herbelot
2019-09-27  9:08   ` Maxime Coquelin
2019-09-30 18:04   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
2019-09-11 16:04 ` [dpdk-dev] [PATCH 2/2] virtio: get all pending rx packets with " Thierry Herbelot
2019-09-27  9:09   ` Maxime Coquelin
2019-09-30 18:27   ` [dpdk-dev] [PATCH] net/virtio: fix Rx stats with altivec " David Christensen
2019-10-01 10:00     ` Maxime Coquelin
2019-10-16 11:11     ` Maxime Coquelin
2019-09-30 18:42   ` [dpdk-dev] [PATCH] net/virtio: get all pending Rx packets in altivec vectorized paths David Christensen
2019-10-01 10:06     ` Maxime Coquelin
2019-10-16 11:11     ` Maxime Coquelin
2019-09-27  9:11 ` [dpdk-dev] [PATCH 0/2] Fixes in virtio vectorized functions Maxime Coquelin
2019-09-27  9:50 ` Maxime Coquelin

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).