[dpdk-dev] [PATCH 3/5] net/mlx5: assert for un-successful memory registration

Nélio Laranjeiro nelio.laranjeiro at 6wind.com
Wed Jan 24 09:15:52 CET 2018


Hi Shahaf,

On Tue, Jan 23, 2018 at 07:08:21PM +0200, Shahaf Shuler wrote:
> Memory registration can fail, add the proper assert for such scenario
> for it at least to be visible in debug mode.
> 
> Signed-off-by: Shahaf Shuler <shahafs at mellanox.com>
> Signed-off-by: Xueming Li <xuemingl at mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_rxtx.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
> index 79cdfc793..2934f9fb3 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.h
> +++ b/drivers/net/mlx5/mlx5_rxtx.h
> @@ -589,6 +589,10 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
>  	if (mr) {
>  		rte_atomic32_inc(&mr->refcnt);
>  		return mr->lkey;
> +	} else {
> +		WARN("Failed to register mempool 0x%p(%s)",
> +		      (void *)mp, mp->name);
> +		assert(mr != NULL);

This assert seems wrong.

Why this assert, you don't trust the CPU to verify the pointer is NULL?

>  	}
>  	return (uint32_t)-1;
>  }
> -- 
> 2.12.0

Regards,

-- 
Nélio Laranjeiro
6WIND


More information about the dev mailing list