patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
To: Wei Huang <wei.huang@intel.com>
Cc: stable@dpdk.org, rosen.xu@intel.com, tianfei.zhang@intel.com
Subject: Re: [PATCH 19.11 2/2] raw/ifpga: unregister interrupt on close
Date: Mon, 11 Jul 2022 08:16:23 +0200	[thread overview]
Message-ID: <CAATJJ0Ki33dR-iMGpv_qLwktVPcezuDrz0ux6fiUYZocfHA3jg@mail.gmail.com> (raw)
In-Reply-To: <1657510853-9096-2-git-send-email-wei.huang@intel.com>

On Mon, Jul 11, 2022 at 5:32 AM Wei Huang <wei.huang@intel.com> wrote:
>
> [ upstream commit 2545683564aa15f36392be2b4ceead454064135b ]

Thanks, applied

> There is an API rte_pmd_ifpga_cleanup provided by ifpga driver to
> free the software resource used by ifpga card. The function call
> of rte_pmd_ifpga_cleanup is list below.
> rte_pmd_ifpga_cleanup()
>   ifpga_rawdev_cleanup()
>     rte_rawdev_pmd_release()
>       rte_rawdev_close()
>         ifpga_rawdev_close()
>
> The interrupts are unregistered in ifpga_rawdev_destroy instead of
> ifpga_rawdev_close function, so rte_pmd_ifpga_cleanup cannot free
> interrupt resource as expected.
>
> To fix such issue, interrupt unregistration is moved from
> ifpga_rawdev_destroy to ifpga_rawdev_close function. The change of
> function call of ifpga_rawdev_destroy is as below.
> ifpga_rawdev_destroy()
>   ifpga_unregister_msix_irq()  // removed
>     rte_rawdev_pmd_release()
>       rte_rawdev_close()
>         ifpga_rawdev_close()
>
> Fixes: e0a1aafe2af9 ("raw/ifpga: introduce IRQ functions")
> Cc: stable@dpdk.org
>
> Signed-off-by: Wei Huang <wei.huang@intel.com>
> Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
> Reviewed-by: Rosen Xu <rosen.xu@intel.com>
> ---
>  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 7f925c3..0d6119c 100644
> --- a/drivers/raw/ifpga/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga/ifpga_rawdev.c
> @@ -86,6 +86,7 @@ static int set_surprise_link_check_aer(
>  static int ifpga_pci_find_next_ext_capability(unsigned int fd,
>                 int start, int cap);
>  static int ifpga_pci_find_ext_capability(unsigned int fd, int cap);
> +static void fme_interrupt_handler(void *param);
>
>  struct ifpga_rawdev *
>  ifpga_rawdev_get(const struct rte_rawdev *rawdev)
> @@ -742,8 +743,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);
> @@ -758,12 +760,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
> @@ -1616,9 +1625,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!");
> @@ -1638,19 +1644,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);
> --
> 1.8.3.1
>


-- 
Christian Ehrhardt
Senior Staff Engineer, Ubuntu Server
Canonical Ltd

  reply	other threads:[~2022-07-11  6:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11  3:40 [PATCH 19.11 1/2] raw/ifpga: remove virtual devices " Wei Huang
2022-07-11  3:40 ` [PATCH 19.11 2/2] raw/ifpga: unregister interrupt " Wei Huang
2022-07-11  6:16   ` Christian Ehrhardt [this message]
2022-07-11  6:16 ` [PATCH 19.11 1/2] raw/ifpga: remove virtual devices " Christian Ehrhardt

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=CAATJJ0Ki33dR-iMGpv_qLwktVPcezuDrz0ux6fiUYZocfHA3jg@mail.gmail.com \
    --to=christian.ehrhardt@canonical.com \
    --cc=rosen.xu@intel.com \
    --cc=stable@dpdk.org \
    --cc=tianfei.zhang@intel.com \
    --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).