net/virtio: remove useless check on mempool

Message ID 1557389028-2462-1-git-send-email-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series net/virtio: remove useless check on mempool |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

David Marchand May 9, 2019, 8:03 a.m. UTC
  This .rx_queue_setup devop is called after ethdev already dereferenced
the mempool pointer.
No need to check and we can remove this rte_exit.

Fixes: 48cec290a3d2 ("net/virtio: move queue configure code to proper place")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/virtio/virtio_rxtx.c | 5 -----
 1 file changed, 5 deletions(-)
  

Comments

Jens Freimann May 9, 2019, 1:29 p.m. UTC | #1
On Thu, May 09, 2019 at 10:03:48AM +0200, David Marchand wrote:
>This .rx_queue_setup devop is called after ethdev already dereferenced
>the mempool pointer.
>No need to check and we can remove this rte_exit.
>
>Fixes: 48cec290a3d2 ("net/virtio: move queue configure code to proper place")
>Cc: stable@dpdk.org
>
>Signed-off-by: David Marchand <david.marchand@redhat.com>

Agree, the pointer is accessed before in the caller. That said, afaics the
pointer is never checked in rte_eth_rx_queue_setup() before it's
dereferenced...

Reviewed-by: Jens Freimann <jfreimann@redhat.com>
  
David Marchand May 17, 2019, 8:16 a.m. UTC | #2
On Thu, May 9, 2019 at 3:29 PM Jens Freimann <jfreimann@redhat.com> wrote:

> On Thu, May 09, 2019 at 10:03:48AM +0200, David Marchand wrote:
> >This .rx_queue_setup devop is called after ethdev already dereferenced
> >the mempool pointer.
> >No need to check and we can remove this rte_exit.
> >
> >Fixes: 48cec290a3d2 ("net/virtio: move queue configure code to proper
> place")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: David Marchand <david.marchand@redhat.com>
>
> Agree, the pointer is accessed before in the caller. That said, afaics the
> pointer is never checked in rte_eth_rx_queue_setup() before it's
> dereferenced...
>

Yep, sent a patch.
http://patchwork.dpdk.org/patch/53503/

Thanks for the review Jens.
  
Maxime Coquelin May 17, 2019, 3:08 p.m. UTC | #3
On 5/9/19 10:03 AM, David Marchand wrote:
> This .rx_queue_setup devop is called after ethdev already dereferenced
> the mempool pointer.
> No need to check and we can remove this rte_exit.
> 
> Fixes: 48cec290a3d2 ("net/virtio: move queue configure code to proper place")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>   drivers/net/virtio/virtio_rxtx.c | 5 -----
>   1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index 8c56f23..4f44360 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -889,11 +889,6 @@
>   	rxvq = &vq->rxq;
>   	rxvq->queue_id = queue_idx;
>   	rxvq->mpool = mp;
> -	if (rxvq->mpool == NULL) {
> -		rte_exit(EXIT_FAILURE,
> -			"Cannot allocate mbufs for rx virtqueue");
> -	}
> -
>   	dev->data->rx_queues[queue_idx] = rxvq;
>   
>   	return 0;
> 

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

Thanks,
Maxime
  
Maxime Coquelin June 5, 2019, 12:29 p.m. UTC | #4
On 5/9/19 10:03 AM, David Marchand wrote:
> This .rx_queue_setup devop is called after ethdev already dereferenced
> the mempool pointer.
> No need to check and we can remove this rte_exit.
> 
> Fixes: 48cec290a3d2 ("net/virtio: move queue configure code to proper place")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>   drivers/net/virtio/virtio_rxtx.c | 5 -----
>   1 file changed, 5 deletions(-)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 8c56f23..4f44360 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -889,11 +889,6 @@ 
 	rxvq = &vq->rxq;
 	rxvq->queue_id = queue_idx;
 	rxvq->mpool = mp;
-	if (rxvq->mpool == NULL) {
-		rte_exit(EXIT_FAILURE,
-			"Cannot allocate mbufs for rx virtqueue");
-	}
-
 	dev->data->rx_queues[queue_idx] = rxvq;
 
 	return 0;