DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: SteveX Yang <stevex.yang@intel.com>
Cc: qiming.yang@intel.com, beilei.xing@intel.com,
	jingjing.wu@intel.com, dev@dpdk.org,
	Qi Zhang <qi.z.zhang@intel.com>,
	ferruh.yigit@intel.com
Subject: Re: [dpdk-dev] [PATCH] net/iavf: release port upon close
Date: Sun, 13 Sep 2020 10:53:15 +0200	[thread overview]
Message-ID: <2832850.hRueZzFlNT@thomas> (raw)
In-Reply-To: <20200811072752.20813-1-stevex.yang@intel.com>

Hi,

SteveX Yang <stevex.yang@intel.com> wrote:
> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
> for the port can be freed by rte_eth_dev_close().
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>

I guess the X is not part of your name.

[...]
> -static int
> -iavf_dev_uninit(struct rte_eth_dev *dev)
> -{
> -       struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
> -
> -       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> -               return -EPERM;

All the code below is moved from iavf_dev_uninit() where it was
restricted to the primary process, to iavf_dev_close() which can be
called from the primary process.
It looks inconsistent.

> 
>         dev->dev_ops = NULL;
>         dev->rx_pkt_burst = NULL;
>         dev->tx_pkt_burst = NULL;
> 
> -       iavf_dev_close(dev);
> +
> +       if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
> +               if (vf->rss_lut) {
> +                       rte_free(vf->rss_lut);
> +                       vf->rss_lut = NULL;
> +               }
> +               if (vf->rss_key) {
> +                       rte_free(vf->rss_key);
> +                       vf->rss_key = NULL;
> +               }
> +       }
> 
>         rte_free(vf->vf_res);
>         vf->vsi_res = NULL;
> 
> @@ -1449,15 +1456,15 @@ iavf_dev_uninit(struct rte_eth_dev *dev)
> 
>         rte_free(vf->aq_resp);
>         vf->aq_resp = NULL;
> 
> +}
> 
> -       if (vf->rss_lut) {
> -               rte_free(vf->rss_lut);
> -               vf->rss_lut = NULL;
> -       }
> -       if (vf->rss_key) {
> -               rte_free(vf->rss_key);
> -               vf->rss_key = NULL;
> -       }
> +static int
> +iavf_dev_uninit(struct rte_eth_dev *dev)
> +{
> +       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> +               return -EPERM;
> +
> +       iavf_dev_close(dev);

Are you sure about what should be freed in the secondary process?
If iavf_dev_close() should not be called by the secondary process,
you should move the check inside the function,
because iavf_dev_close() is also called by rte_eth_dev_close().

> 
>         return 0;
>  
>  }



  parent reply	other threads:[~2020-09-13  8:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  7:27 SteveX Yang
2020-09-03 12:30 ` Zhang, Qi Z
2020-09-13  8:53 ` Thomas Monjalon [this message]
2020-09-13 22:25   ` Thomas Monjalon

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=2832850.hRueZzFlNT@thomas \
    --to=thomas@monjalon.net \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stevex.yang@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).