patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Zhang, Tianfei" <tianfei.zhang@intel.com>
To: "Huang, Wei" <wei.huang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>
Cc: "stable@dpdk.org" <stable@dpdk.org>,
	"Xu, Rosen" <rosen.xu@intel.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>
Subject: RE: [PATCH v1] bus/ifpga: add fpga bus cleanup
Date: Mon, 20 Mar 2023 07:54:29 +0000	[thread overview]
Message-ID: <BN9PR11MB5483B36C04039CE094C989A2E3809@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230316204434.360283-1-wei.huang@intel.com>



> -----Original Message-----
> From: Huang, Wei <wei.huang@intel.com>
> Sent: Friday, March 17, 2023 4:45 AM
> To: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com
> Cc: stable@dpdk.org; Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Huang, Wei
> <wei.huang@intel.com>
> Subject: [PATCH v1] bus/ifpga: add fpga bus cleanup
> 
> In this patch, cleanup method is implemented for FPGA bus which will be called
> during eal_bus_cleanup().
> 
> Signed-off-by: Wei Huang <wei.huang@intel.com>
> ---
>  drivers/bus/ifpga/ifpga_bus.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index
> 07e316b..ffb0c61 100644
> --- a/drivers/bus/ifpga/ifpga_bus.c
> +++ b/drivers/bus/ifpga/ifpga_bus.c
> @@ -360,6 +360,41 @@ struct rte_afu_device *
>  	return ret;
>  }
> 
> +/*
> + * Cleanup the content of the Intel FPGA bus, and call the remove()
> +function
> + * for all registered devices.
> + */
> +static int
> +ifpga_cleanup(void)
> +{
> +	struct rte_afu_device *afu_dev, *tmp_dev;
> +	int error = 0;
> +
> +	RTE_TAILQ_FOREACH_SAFE(afu_dev, &ifpga_afu_dev_list, next, tmp_dev) {
> +		struct rte_afu_driver *drv = afu_dev->driver;
> +		int ret = 0;
> +
> +		if (drv == NULL || drv->remove == NULL)
> +			goto free;
> +
> +		ret = drv->remove(afu_dev);
> +		if (ret < 0) {
> +			rte_errno = errno;
> +			error = -1;
> +		}
> +		afu_dev->driver = NULL;
> +		afu_dev->device.driver = NULL;
> +
> +free:
> +		TAILQ_REMOVE(&ifpga_afu_dev_list, afu_dev, next);
> +		rte_devargs_remove(afu_dev->device.devargs);
> +		rte_intr_instance_free(afu_dev->intr_handle);
> +		free(afu_dev);
> +	}
> +
> +	return error;
> +}
> +
>  static int
>  ifpga_plug(struct rte_device *dev)
>  {
> @@ -470,6 +505,7 @@ struct rte_afu_device *  static struct rte_bus rte_ifpga_bus =
> {
>  	.scan        = ifpga_scan,
>  	.probe       = ifpga_probe,
> +	.cleanup     = ifpga_cleanup,
>  	.find_device = ifpga_find_device,
>  	.plug        = ifpga_plug,
>  	.unplug      = ifpga_unplug,
> --
> 1.8.3.1

This patch is based on EAL cleanup devices for shutdown.
https://github.com/DPDK/dpdk/commit/1cab1a40ea9b858821aaf4655486e31ca1b52456

It looks good for me,
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>


      parent reply	other threads:[~2023-03-20  7:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 20:44 Wei Huang
2023-03-20  6:45 ` Xu, Rosen
2023-03-20 15:59   ` Thomas Monjalon
2023-03-20  7:54 ` Zhang, Tianfei [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=BN9PR11MB5483B36C04039CE094C989A2E3809@BN9PR11MB5483.namprd11.prod.outlook.com \
    --to=tianfei.zhang@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=wei.huang@intel.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).