DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: <wenxuanx.wu@intel.com>, <qiming.yang@intel.com>,
	<qi.z.zhang@intel.com>,  <xiaoyun.li@intel.com>,
	<aman.deep.singh@intel.com>, <yuying.zhang@intel.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH 2/2] lib/ethdev: add reverse macro to quit testpmd
Date: Fri, 18 Feb 2022 17:04:33 +0000	[thread overview]
Message-ID: <de87ae03-a26a-a9d3-da70-424335777371@intel.com> (raw)
In-Reply-To: <20220217101428.385751-3-wenxuanx.wu@intel.com>

On 2/17/2022 10:14 AM, wenxuanx.wu@intel.com wrote:
> From: wenxuan wu <wenxuanx.wu@intel.com>
> 
> There is a heap-free-after-use bug when quit testpmd
> with pf and vfs, stop and close ports in reverse order
> is a more reasonable approach.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: wenxuan wu <wenxuanx.wu@intel.com>
> ---
>   lib/ethdev/rte_ethdev.h | 14 +++++++++++++-

This patch should come before testpmd patch, because testpmd
is using macro defined here.

>   1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 2660e4f374..e080840b06 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -2185,9 +2185,13 @@ struct rte_eth_dev_owner {
>    * @return
>    *   Next valid port ID owned by owner_id, RTE_MAX_ETHPORTS if there is none.
>    */
> -uint64_t rte_eth_find_next_owned_by(uint16_t port_id,
> +uint64_t
> +rte_eth_find_next_owned_by(uint16_t port_id,
>   		const uint64_t owner_id);
>   
> +uint64_t
> +rte_eth_find_prev_owned_by(uint16_t port_id, const uint64_t owner_id);
> +

This function declared but not implemented, can remove above.

>   /**
>    * Macro to iterate over all enabled ethdev ports owned by a specific owner.
>    */
> @@ -2212,6 +2216,14 @@ uint16_t rte_eth_find_next(uint16_t port_id);
>   #define RTE_ETH_FOREACH_DEV(p) \
>   	RTE_ETH_FOREACH_DEV_OWNED_BY(p, RTE_ETH_DEV_NO_OWNER)
>   
> +/**
> + * Macro to iterate over all enabled and ownerless ethdev ports in reverse order, for quit purpose.

No need to add comment related to "quit purpose", macro can be
used for different reasons.

> + */
> +#define RTE_ETH_FOREACH_DEV_REVERSE(p) \
> +	for (p = (rte_eth_dev_count_total() - 1 >= 0) ? (rte_eth_dev_count_total() - 1) : 0; \

Below check already relies on 'p' is unsigned,
also 'rte_eth_dev_count_total()' returns unsigned,
if so above check is unnecessary, it can just have:
"p = rte_eth_dev_count_total() - 1"

> +	     p < rte_eth_dev_count_total(); \
> +	     p--)
> +
>   /**
>    * Iterates over ethdev ports of a specified device.
>    *


  parent reply	other threads:[~2022-02-18 17:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 10:14 [PATCH 0/2] app/testpmd: fix quit testpmd with vfs and pf wenxuanx.wu
2022-02-17 10:14 ` [PATCH 1/2] " wenxuanx.wu
2022-02-18  8:40   ` Zhang, Yuying
2022-02-18 16:58   ` Ferruh Yigit
2022-02-17 10:14 ` [PATCH 2/2] lib/ethdev: add reverse macro to quit testpmd wenxuanx.wu
2022-02-18  8:34   ` Zhang, Yuying
2022-02-18 17:04   ` Ferruh Yigit [this message]
2022-02-23 11:32     ` [PATCH 0/2] app/testpmd: fix testpmd quit with pf and vfs wenxuanx.wu
2022-02-23 11:32       ` [PATCH v2 1/2] lib/ethdev: add reverse macro to quit testpmd wenxuanx.wu
2022-02-23 11:32       ` [PATCH v2 2/2] app/testpmd:fix testpmd quit failure wenxuanx.wu
2022-02-23 12:09         ` Ferruh Yigit
2022-03-03 13:22         ` Wu, WenxuanX
2022-03-04 16:15           ` Ferruh Yigit
2022-03-09  3:07             ` Wu, WenxuanX
2022-03-10  7:02               ` Wu, WenxuanX
2022-02-24 11:04     ` [PATCH 2/2] lib/ethdev: add reverse macro to quit testpmd Wu, WenxuanX

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=de87ae03-a26a-a9d3-da70-424335777371@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=wenxuanx.wu@intel.com \
    --cc=xiaoyun.li@intel.com \
    --cc=yuying.zhang@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).