net/virtio: get all pending Rx packets in altivec vectorized paths

Message ID 20190930184216.21587-1-drc@linux.vnet.ibm.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series net/virtio: get all pending Rx packets in altivec vectorized paths |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

David Christensen Sept. 30, 2019, 6:42 p.m. UTC
  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(-)
  

Comments

Maxime Coquelin Oct. 1, 2019, 10:06 a.m. UTC | #1
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];
>
  
Maxime Coquelin Oct. 16, 2019, 11:11 a.m. UTC | #2
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
  

Patch

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];