DPDK patches and discussions
 help / color / mirror / Atom feed
From: Feifei Wang <feifei.wang2@arm.com>
To: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Cc: dev@dpdk.org, nd@arm.com, Feifei Wang <feifei.wang2@arm.com>,
	Ruifeng Wang <ruifeng.wang@arm.com>
Subject: [PATCH v3 3/3] app/test-pipeline: add dev close operation
Date: Tue, 12 Sep 2023 14:39:03 +0800	[thread overview]
Message-ID: <20230912063903.1266245-4-feifei.wang2@arm.com> (raw)
In-Reply-To: <20230912063903.1266245-1-feifei.wang2@arm.com>

For test-pipeline, there is dev start operation, but when thread need to
exit, there is no dev close operation. This is not safe, to fix this,
add dev close operation.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test-pipeline/main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/app/test-pipeline/main.c b/app/test-pipeline/main.c
index 8633933fd9..73f6d31f82 100644
--- a/app/test-pipeline/main.c
+++ b/app/test-pipeline/main.c
@@ -55,6 +55,7 @@ int
 main(int argc, char **argv)
 {
 	uint32_t lcore;
+	uint32_t i;
 	int ret;
 
 	/* Init EAL */
@@ -85,6 +86,24 @@ main(int argc, char **argv)
 			return -1;
 	}
 
+	/*Close ports */
+	for (i = 0; i < app.n_ports; i++) {
+		uint16_t port;
+		int ret;
+
+		port = app.ports[i];
+		printf("Closing port %d...", port);
+		ret = rte_eth_dev_stop(port);
+		if (ret != 0)
+			printf("rte_eth_dev_stop: err=%d, port=%u\n",
+					 ret, port);
+		rte_eth_dev_close(port);
+		printf("Done\n");
+	}
+
+	/* Clean up the EAL */
+	rte_eal_cleanup();
+
 	return 0;
 }
 
-- 
2.25.1


  parent reply	other threads:[~2023-09-12  6:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  7:45 [PATCH] app/test-pipeline: relax RSS hash requirement Feifei Wang
2023-07-12 14:51 ` Thomas Monjalon
2023-07-14  7:50 ` lihuisong (C)
2023-07-14  8:07   ` Feifei Wang
2023-07-14  8:27 ` [PATCH v2] " Feifei Wang
2023-09-12  6:39 ` [PATCH v3 0/3] fix test-pipeline issues Feifei Wang
2023-09-12  6:39   ` [PATCH v3 1/3] app/test-pipeline: relax RSS hash requirement Feifei Wang
2023-09-12  6:39   ` [PATCH v3 2/3] app/test-pipeline: fix SIGINT handling issue Feifei Wang
2023-09-12  6:39   ` Feifei Wang [this message]
2023-10-17 20:01   ` [PATCH v3 0/3] fix test-pipeline issues Thomas Monjalon
2023-10-18 13:39   ` Dumitrescu, Cristian
2023-11-23  1:54     ` 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=20230912063903.1266245-4-feifei.wang2@arm.com \
    --to=feifei.wang2@arm.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.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).