From: "Singh, Aman Deep" <aman.deep.singh@intel.com>
To: <okaya@kernel.org>, Yuying Zhang <yuying.zhang@intel.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH] testpmd: unregister event callback
Date: Tue, 26 Sep 2023 21:20:07 +0530 [thread overview]
Message-ID: <c48b9b42-3ae9-1c51-ae75-358507928e4e@intel.com> (raw)
In-Reply-To: <20230915042633.151750-1-okaya@kernel.org>
On 9/15/2023 9:56 AM, okaya@kernel.org wrote:
> From: Sinan Kaya <okaya@kernel.org>
Header format doesn't requires to add "From: "
as author "Signed-off" is already present.
>
> Cleanup event registry during shutdown to prevent memory
> leaks.
>
> Signed-off-by: Sinan Kaya <okaya@kernel.org>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
> ---
> app/test-pmd/testpmd.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index c6ad9b18bf..1de7b7cd51 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -4009,6 +4009,28 @@ register_eth_event_callback(void)
> return 0;
> }
>
> +static int
> +unregister_eth_event_callback(void)
> +{
> + int ret;
> + enum rte_eth_event_type event;
> +
> + for (event = RTE_ETH_EVENT_UNKNOWN;
> + event < RTE_ETH_EVENT_MAX; event++) {
> + ret = rte_eth_dev_callback_unregister(RTE_ETH_ALL,
> + event,
> + eth_event_callback,
> + NULL);
> + if (ret != 0) {
> + TESTPMD_LOG(ERR, "Failed to unregister callback for "
> + "%s event\n", eth_event_desc[event]);
> + return -1;
> + }
> + }
> +
> + return 0;
> +}
> +
> /* This function is used by the interrupt thread */
> static void
> dev_event_callback(const char *device_name, enum rte_dev_event_type type,
> @@ -4737,6 +4759,11 @@ main(int argc, char** argv)
> rte_latencystats_uninit();
> #endif
>
> + ret = unregister_eth_event_callback();
> + if (ret != 0)
> + rte_exit(EXIT_FAILURE, "Cannot unregister for ethdev events");
> +
> +
> ret = rte_eal_cleanup();
> if (ret != 0)
> rte_exit(EXIT_FAILURE,
next prev parent reply other threads:[~2023-09-26 15:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 4:26 okaya
2023-09-26 15:50 ` Singh, Aman Deep [this message]
2023-09-27 17:52 ` Ferruh Yigit
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=c48b9b42-3ae9-1c51-ae75-358507928e4e@intel.com \
--to=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=okaya@kernel.org \
--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).