patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Xueming(Steven) Li" <xuemingl@nvidia.com>
To: Dmitry Kozlyuk <dkozlyuk@nvidia.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Cc: Luca Boccassi <bluca@debian.org>,
	Slava Ovsiienko <viacheslavo@nvidia.com>
Subject: RE: [PATCH] net/mlx5: fix MPRQ pool registration
Date: Mon, 15 Aug 2022 07:51:30 +0000	[thread overview]
Message-ID: <DM4PR12MB537394D0A530777685F5A51EA1689@DM4PR12MB5373.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220815072630.165931-1-dkozlyuk@nvidia.com>

It's 20.11 LTS patch, applied and thanks!

> -----Original Message-----
> From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> Sent: Monday, August 15, 2022 3:27 PM
> To: stable@dpdk.org
> Cc: Xueming(Steven) Li <xuemingl@nvidia.com>; Luca Boccassi <bluca@debian.org>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Subject: [PATCH] net/mlx5: fix MPRQ pool registration
> 
> mlx5_mr_update_mp() was checking pktmbuf pool private flags.
> However, this function may be passed an MPRQ pool, which is not a pktmbuf pool and has no private data.
> Random data is accessed instead of pktmbuf flags, causing a crash.
> Move the flags check to the RxQ start and only for pools that are known to be of pktmbuf type.
> 
> Fixes: 23b584d6cc85 ("net/mlx5: fix external buffer pool registration for Rx queue")
> 
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_mr.c      | 11 -----------
>  drivers/net/mlx5/mlx5_trigger.c | 21 +++++++++++++++++++--
>  2 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index 1dd14ddfe5..2a7fac8ad3 100644
> --- a/drivers/net/mlx5/mlx5_mr.c
> +++ b/drivers/net/mlx5/mlx5_mr.c
> @@ -444,18 +444,7 @@ mlx5_mr_update_mp(struct rte_eth_dev *dev, struct mlx5_mr_ctrl *mr_ctrl,
>  		.mr_ctrl = mr_ctrl,
>  		.ret = 0,
>  	};
> -	uint32_t flags = rte_pktmbuf_priv_flags(mp);
> 
> -	if (flags & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) {
> -		/*
> -		 * The pinned external buffer should be registered for DMA
> -		 * operations by application. The mem_list of the pool contains
> -		 * the list of chunks with mbuf structures w/o built-in data
> -		 * buffers and DMA actually does not happen there, no need
> -		 * to create MR for these chunks.
> -		 */
> -		return 0;
> -	}
>  	DRV_LOG(DEBUG, "Port %u Rx queue registering mp %s "
>  		       "having %u chunks.", dev->data->port_id,
>  		       mp->name, mp->nb_mem_chunks);
> diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index c8dc0398ea..9b82ee40fd 100644
> --- a/drivers/net/mlx5/mlx5_trigger.c
> +++ b/drivers/net/mlx5/mlx5_trigger.c
> @@ -156,12 +156,29 @@ mlx5_rxq_start(struct rte_eth_dev *dev)
>  				mlx5_mr_update_mp(dev, &rxq_ctrl->rxq.mr_ctrl,
>  						  rxq_ctrl->rxq.mprq_mp);
>  			} else {
> +				struct rte_mempool *mp;
> +				uint32_t flags;
>  				uint32_t s;
> 
> -				for (s = 0; s < rxq_ctrl->rxq.rxseg_n; s++)
> +				/*
> +				 * The pinned external buffer should be
> +				 * registered for DMA operations by application.
> +				 * The mem_list of the pool contains
> +				 * the list of chunks with mbuf structures
> +				 * w/o built-in data buffers
> +				 * and DMA actually does not happen there,
> +				 * no need to create MR for these chunks.
> +				 */
> +				for (s = 0; s < rxq_ctrl->rxq.rxseg_n; s++) {
> +					mp = rxq_ctrl->rxq.rxseg[s].mp;
> +					flags = rte_pktmbuf_priv_flags(mp);
> +					if (flags &
> +					    RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF)
> +						continue;
>  					mlx5_mr_update_mp
>  						(dev, &rxq_ctrl->rxq.mr_ctrl,
> -						rxq_ctrl->rxq.rxseg[s].mp);
> +						 mp);
> +				}
>  			}
>  			ret = rxq_alloc_elts(rxq_ctrl);
>  			if (ret)
> --
> 2.25.1


      reply	other threads:[~2022-08-15  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15  7:26 Dmitry Kozlyuk
2022-08-15  7:51 ` Xueming(Steven) Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM4PR12MB537394D0A530777685F5A51EA1689@DM4PR12MB5373.namprd12.prod.outlook.com \
    --to=xuemingl@nvidia.com \
    --cc=bluca@debian.org \
    --cc=dkozlyuk@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).