All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Xueming Li <xuemingl@nvidia.com>, dev@dpdk.org
Cc: Matan Azrad <matan@nvidia.com>, Xia Chenbo <chenbo.xia@intel.com>
Subject: Re: [PATCH v2] vhost: add vDPA resource cleanup callback
Date: Thu, 10 Feb 2022 16:13:04 +0100	[thread overview]
Message-ID: <2de9347a-a259-2c50-1262-757f6d009546@redhat.com> (raw)
In-Reply-To: <20220127084535.673527-1-xuemingl@nvidia.com>



On 1/27/22 09:45, Xueming Li wrote:
> This patch adds vDPA device cleanup callback to release resources on
> vhost user connection close.
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>   lib/vhost/vdpa_driver.h | 3 +++
>   lib/vhost/vhost_user.c  | 6 ++++++
>   2 files changed, 9 insertions(+)
> 
> diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h
> index fc2d6acedd1..fddbd506523 100644
> --- a/lib/vhost/vdpa_driver.h
> +++ b/lib/vhost/vdpa_driver.h
> @@ -34,6 +34,9 @@ struct rte_vdpa_dev_ops {
>   	/** Driver close the device (Mandatory) */
>   	int (*dev_close)(int vid);
>   
> +	/** Connection closed, clean up resources */
> +	int (*dev_cleanup)(int vid);
> +
>   	/** Enable/disable this vring (Mandatory) */
>   	int (*set_vring_state)(int vid, int vring, int state);
>   
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 5eb1dd68123..798b0ca4c0d 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -220,6 +220,12 @@ free_mem_region(struct virtio_net *dev)
>   void
>   vhost_backend_cleanup(struct virtio_net *dev)
>   {
> +	struct rte_vdpa_device *vdpa_dev;
> +
> +	vdpa_dev = dev->vdpa_dev;
> +	if (vdpa_dev && vdpa_dev->ops->dev_cleanup != NULL)
> +		vdpa_dev->ops->dev_cleanup(dev->vid);
> +
>   	if (dev->mem) {
>   		free_mem_region(dev);
>   		rte_free(dev->mem);


Applied to dpdk-next-virtio/main.

Thanks,
Maxime


      parent reply	other threads:[~2022-02-10 15:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 11:39 [dpdk-dev] [PATCH] vhost: add vDPA resource cleanup callback Xueming Li
2021-10-21 12:00 ` Maxime Coquelin
2021-10-21 12:35   ` Xueming(Steven) Li
2021-11-03  8:41     ` Xia, Chenbo
2021-11-03  8:46       ` Maxime Coquelin
2021-11-03 13:45         ` Xueming(Steven) Li
2021-11-03 13:49           ` Maxime Coquelin
2022-01-26 10:03             ` Maxime Coquelin
2022-01-27  8:48               ` Xueming(Steven) Li
2021-11-03 13:42       ` [dpdk-dev] " Xueming(Steven) Li
2022-01-27  8:45 ` [PATCH v2] " Xueming Li
2022-02-03 13:47   ` Maxime Coquelin
2022-02-10 15:13   ` Maxime Coquelin [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=2de9347a-a259-2c50-1262-757f6d009546@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=xuemingl@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.