DPDK patches and discussions
 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>,
	"nipun.gupta@nxp.com" <nipun.gupta@nxp.com>,
	"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.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 v3 3/5] raw/ifpga: unregister interrupt in ifpga close function
Date: Fri, 27 May 2022 02:57:31 +0000	[thread overview]
Message-ID: <BN9PR11MB5483BEEA67672CA093AB77BBE3D89@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1653535974-1379-4-git-send-email-wei.huang@intel.com>



> -----Original Message-----
> From: Huang, Wei <wei.huang@intel.com>
> Sent: Thursday, May 26, 2022 11:33 AM
> To: dev@dpdk.org; thomas@monjalon.net; nipun.gupta@nxp.com;
> hemant.agrawal@nxp.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 v3 3/5] raw/ifpga: unregister interrupt in ifpga close function
> 
> In original implementation, interrupts are unregistered in ifpga_rawdev_destroy
> function. If application want to release the ifpga driver resource by calling
> rte_rawdev_pmd_release, interrupt resource will not be released.
> Now interrupt unregistration is moved from ifpga destroy function to ifpga close
> function, when rte_rawdev_pmd_release is called, rte_rawdev_close will be
> called, then interrupts are unregistered.
> 
> Signed-off-by: Wei Huang <wei.huang@intel.com>
> ---
> v2: update commit log
> ---
>  drivers/raw/ifpga/ifpga_rawdev.c | 29 +++++++++++------------------
>  1 file changed, 11 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/raw/ifpga/ifpga_rawdev.c
> b/drivers/raw/ifpga/ifpga_rawdev.c
> index fe3fc43..94df56c 100644
> --- a/drivers/raw/ifpga/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga/ifpga_rawdev.c
> @@ -78,6 +78,7 @@ static int set_surprise_link_check_aer(  static int
> ifpga_pci_find_next_ext_capability(unsigned int fd,
>  					      int start, uint32_t cap);
>  static int ifpga_pci_find_ext_capability(unsigned int fd, uint32_t cap);
> +static void fme_interrupt_handler(void *param);
> 
>  struct ifpga_rawdev *
>  ifpga_rawdev_get(const struct rte_rawdev *rawdev) @@ -740,8 +741,9 @@
> static int set_surprise_link_check_aer(  {
>  	struct ifpga_rawdev *ifpga_rdev = NULL;
>  	struct opae_adapter *adapter;
> +	struct opae_manager *mgr;
>  	char *vdev_name = NULL;
> -	int i = 0;
> +	int i, ret = 0;
> 
>  	if (dev) {
>  		ifpga_rdev = ifpga_rawdev_get(dev);
> @@ -756,12 +758,19 @@ static int set_surprise_link_check_aer(
>  		}
>  		adapter = ifpga_rawdev_get_priv(dev);
>  		if (adapter) {
> +			mgr = opae_adapter_get_mgr(adapter);
> +			if (ifpga_rdev && mgr) {
> +				if (ifpga_unregister_msix_irq(ifpga_rdev,
> +					IFPGA_FME_IRQ, 0,
> +					fme_interrupt_handler, mgr) < 0)
> +					ret = -EINVAL;
> +			}
>  			opae_adapter_destroy(adapter);
>  			opae_adapter_data_free(adapter->data);
>  		}
>  	}
> 
> -	return dev ? 0:1;
> +	return ret;
>  }
> 
>  static int
> @@ -1629,9 +1638,6 @@ static int fme_clean_fme_error(struct opae_manager
> *mgr)
>  	int ret;
>  	struct rte_rawdev *rawdev;
>  	char name[RTE_RAWDEV_NAME_MAX_LEN];
> -	struct opae_adapter *adapter;
> -	struct opae_manager *mgr;
> -	struct ifpga_rawdev *dev;
> 
>  	if (!pci_dev) {
>  		IFPGA_RAWDEV_PMD_ERR("Invalid pci_dev of the device!");
> @@ -1651,19 +1657,6 @@ static int fme_clean_fme_error(struct
> opae_manager *mgr)
>  		IFPGA_RAWDEV_PMD_ERR("Invalid device name (%s)", name);
>  		return -EINVAL;
>  	}
> -	dev = ifpga_rawdev_get(rawdev);
> -
> -	adapter = ifpga_rawdev_get_priv(rawdev);
> -	if (!adapter)
> -		return -ENODEV;
> -
> -	mgr = opae_adapter_get_mgr(adapter);
> -	if (!mgr)
> -		return -ENODEV;
> -
> -	if (ifpga_unregister_msix_irq(dev, IFPGA_FME_IRQ, 0,
> -				fme_interrupt_handler, mgr) < 0)
> -		return -EINVAL;
> 
>  	/* rte_rawdev_close is called by pmd_release */
>  	ret = rte_rawdev_pmd_release(rawdev);
> --

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

  parent reply	other threads:[~2022-05-27  2:57 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  6:28 [PATCH v1 0/4] Support OFS card Wei Huang
2022-05-17  6:28 ` [PATCH v1 1/4] raw/ifpga: remove experimental tag from ifpga APIs Wei Huang
2022-05-17  6:28 ` [PATCH v1 2/4] raw/ifpga: remove vdev when ifpga is closed Wei Huang
2022-05-17  6:28 ` [PATCH v1 3/4] raw/ifpga: unregister interrupt in ifpga close function Wei Huang
2022-05-17  6:28 ` [PATCH v1 4/4] raw/ifpga: support ofs card probe Wei Huang
2022-05-18  8:29   ` [PATCH v2 0/4] Support OFS card Wei Huang
2022-05-18  8:29     ` [PATCH v2 1/4] raw/ifpga: remove experimental tag from ifpga APIs Wei Huang
2022-05-25  3:22       ` Zhang, Tianfei
2022-05-18  8:29     ` [PATCH v2 2/4] raw/ifpga: remove vdev when ifpga is closed Wei Huang
2022-05-25  4:09       ` Zhang, Tianfei
2022-05-18  8:29     ` [PATCH v2 3/4] raw/ifpga: unregister interrupt in ifpga close function Wei Huang
2022-05-25  3:26       ` Zhang, Tianfei
2022-05-18  8:29     ` [PATCH v2 4/4] raw/ifpga: support ofs card probe Wei Huang
2022-05-26  3:32     ` [PATCH v3 0/5] Support OFS card Wei Huang
2022-05-26  3:32       ` [PATCH v3 1/5] raw/ifpga: remove experimental tag from ifpga APIs Wei Huang
2022-05-26  6:29         ` Xu, Rosen
2022-05-26  3:32       ` [PATCH v3 2/5] raw/ifpga: remove vdev when ifpga is closed Wei Huang
2022-05-26  6:34         ` Xu, Rosen
2022-05-26  3:32       ` [PATCH v3 3/5] raw/ifpga: unregister interrupt in ifpga close function Wei Huang
2022-05-26  6:41         ` Xu, Rosen
2022-05-27  2:57         ` Zhang, Tianfei [this message]
2022-05-26  3:32       ` [PATCH v3 4/5] raw/ifpga: support ofs card probe Wei Huang
2022-05-26  6:46         ` Xu, Rosen
2022-05-27  3:10         ` Zhang, Tianfei
2022-05-26  3:32       ` [PATCH v3 5/5] guides/rawdevs: add description of ofs in ifpga doc Wei Huang
2022-05-26  6:47         ` Xu, Rosen
2022-05-27  3:19         ` Zhang, Tianfei
2022-05-27  8:33       ` [PATCH v4 0/5] Support OFS card Wei Huang
2022-05-27  8:33         ` [PATCH v4 1/5] raw/ifpga: remove experimental tag from ifpga APIs Wei Huang
2022-05-27  8:33         ` [PATCH v4 2/5] raw/ifpga: remove vdev when ifpga is closed Wei Huang
2022-06-06  6:46           ` Zhang, Tianfei
2022-06-07  6:02           ` Xu, Rosen
2022-05-27  8:33         ` [PATCH v4 3/5] raw/ifpga: unregister interrupt in ifpga close function Wei Huang
2022-06-07  6:03           ` Xu, Rosen
2022-05-27  8:33         ` [PATCH v4 4/5] raw/ifpga: support ofs card probe Wei Huang
2022-06-07  6:04           ` Xu, Rosen
2022-05-27  8:33         ` [PATCH v4 5/5] guides/rawdevs: add description of ofs in ifpga doc Wei Huang
2022-05-31  0:24           ` Zhang, Tianfei
2022-06-06  6:45           ` Zhang, Tianfei
2022-06-07  9:07         ` [PATCH v5 0/5] Support OFS card Wei Huang
2022-06-07  9:07           ` [PATCH v5 1/5] raw/ifpga: remove experimental tag from ifpga APIs Wei Huang
2022-06-07  9:07           ` [PATCH v5 2/5] raw/ifpga: remove vdev when ifpga is closed Wei Huang
2022-06-07  9:07           ` [PATCH v5 3/5] raw/ifpga: unregister interrupt in ifpga close function Wei Huang
2022-06-07  9:07           ` [PATCH v5 4/5] raw/ifpga: support ofs card probe Wei Huang
2022-06-07  9:07           ` [PATCH v5 5/5] guides/rawdevs: add description of ofs in ifpga doc Wei Huang
2022-06-07 13:53           ` [PATCH v5 0/5] Support OFS card Thomas Monjalon
2022-05-25  3:18   ` [PATCH v1 4/4] raw/ifpga: support ofs card probe Zhang, Tianfei

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=BN9PR11MB5483BEEA67672CA093AB77BBE3D89@BN9PR11MB5483.namprd11.prod.outlook.com \
    --to=tianfei.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=nipun.gupta@nxp.com \
    --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).