From: Marcin Kerlin <marcinx.kerlin@intel.com>
To: dev@dpdk.org
Cc: thomas.monjalon@6wind.com, pablo.de.lara.guarch@intel.com,
Marcin Kerlin <marcinx.kerlin@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/2] app/testpmd: improve handling of multiprocess
Date: Tue, 20 Sep 2016 16:31:35 +0200 [thread overview]
Message-ID: <1474381895-16066-3-git-send-email-marcinx.kerlin@intel.com> (raw)
In-Reply-To: <1474381895-16066-1-git-send-email-marcinx.kerlin@intel.com>
Added lookup for pool name because secondary process should attach to
mempool created by primary process rather than create new one.
Added function free_shared_dev_data() used at the exit of the testpmd.
This causes detach devices data from array rte_eth_dev_data[] shared
between all processes. This allows to have a up-to-date list of devices
data and run again secondary application with the same name.
Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
---
app/test-pmd/testpmd.c | 36 ++++++++++++++++++++++++++++++++++--
app/test-pmd/testpmd.h | 1 +
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 30749a4..51f6aee 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -452,8 +452,10 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
} else {
/* wrapper to rte_mempool_create() */
- rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
- mb_mempool_cache, 0, mbuf_seg_size, socket_id);
+ rte_mp = rte_mempool_lookup(pool_name);
+ if (rte_mp == NULL)
+ rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
+ mb_mempool_cache, 0, mbuf_seg_size, socket_id);
}
}
@@ -1609,6 +1611,35 @@ detach_port(uint8_t port_id)
return;
}
+void free_shared_dev_data(portid_t pid)
+{
+ portid_t pi;
+
+ if (port_id_is_invalid(pid, ENABLED_WARN))
+ return;
+
+ /* free data only if the secondary process exits */
+ if (rte_eal_process_type() != RTE_PROC_SECONDARY)
+ return;
+
+ printf("Cleaning device data...\n");
+
+ FOREACH_PORT(pi, ports)
+ {
+ if (pid != pi && pid != (portid_t) RTE_PORT_ALL)
+ continue;
+
+ if (!port_is_closed(pi)) {
+ printf("Port %d is not closed now\n", pi);
+ continue;
+ }
+
+ if (rte_eth_dev_release_dev_data(pi) < 0)
+ return;
+ }
+ printf("Done\n");
+}
+
void
pmd_test_exit(void)
{
@@ -1624,6 +1655,7 @@ pmd_test_exit(void)
fflush(stdout);
stop_port(pt_id);
close_port(pt_id);
+ free_shared_dev_data(pt_id);
}
}
printf("\nBye...\n");
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2b281cc..3915a06 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -553,6 +553,7 @@ void attach_port(char *identifier);
void detach_port(uint8_t port_id);
int all_ports_stopped(void);
int port_is_started(portid_t port_id);
+void free_shared_dev_data(portid_t pid);
void pmd_test_exit(void);
void fdir_get_infos(portid_t port_id);
void fdir_set_flex_mask(portid_t port_id,
--
1.9.1
next prev parent reply other threads:[~2016-09-20 14:42 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 8:58 [dpdk-dev] [PATCH 0/2] app/testpmd: improve multiprocess support Marcin Kerlin
2016-09-02 8:58 ` [dpdk-dev] [PATCH 1/2] librte_ether: ensure not overwrite device data in mp app Marcin Kerlin
2016-09-11 12:23 ` Yuanhan Liu
2016-09-20 14:06 ` [dpdk-dev] [PATCH v2 0/2] app/testpmd: improve multiprocess support Marcin Kerlin
2016-09-20 14:31 ` Marcin Kerlin
2016-09-20 14:31 ` [dpdk-dev] [PATCH v2 1/2] librte_ether: ensure not overwrite device data in mp app Marcin Kerlin
2016-09-20 16:14 ` Pattan, Reshma
2016-09-22 14:11 ` Kerlin, MarcinX
2016-09-23 14:12 ` Thomas Monjalon
2016-09-26 15:07 ` Kerlin, MarcinX
2016-09-20 16:48 ` Pattan, Reshma
2016-09-22 14:21 ` Kerlin, MarcinX
2016-09-26 14:53 ` [dpdk-dev] [PATCH v3 0/2] app/testpmd: improve multiprocess support Marcin Kerlin
2016-09-26 14:53 ` [dpdk-dev] [PATCH v3 1/2] librte_ether: ensure not overwrite device data in mp app Marcin Kerlin
2016-09-27 3:06 ` Yuanhan Liu
2016-09-27 10:01 ` Kerlin, MarcinX
2016-09-27 10:29 ` [dpdk-dev] [PATCH v4 0/2] app/testpmd: improve multiprocess support Marcin Kerlin
2016-09-27 11:13 ` Marcin Kerlin
2016-09-27 11:13 ` [dpdk-dev] [PATCH v4 1/2] librte_ether: add protection against overwrite device data Marcin Kerlin
2016-09-28 11:00 ` Pattan, Reshma
2016-09-28 14:03 ` Pattan, Reshma
2016-09-29 13:41 ` Kerlin, MarcinX
2016-09-30 14:00 ` [dpdk-dev] [PATCH v5 0/2] app/testpmd: improve multiprocess support Marcin Kerlin
2016-09-30 14:00 ` [dpdk-dev] [PATCH v5 1/2] librte_ether: add protection against overwrite device data Marcin Kerlin
2016-09-30 15:00 ` Pattan, Reshma
2016-10-06 9:41 ` Thomas Monjalon
2016-10-06 13:57 ` Kerlin, MarcinX
2016-10-06 14:20 ` Thomas Monjalon
2016-10-06 14:52 ` Thomas Monjalon
2016-10-07 12:23 ` Kerlin, MarcinX
2016-10-11 8:52 ` Thomas Monjalon
2016-09-30 14:24 ` [dpdk-dev] [PATCH v5 2/2] app/testpmd: improve handling of multiprocess Marcin Kerlin
2016-09-30 15:02 ` Pattan, Reshma
2016-09-30 15:03 ` [dpdk-dev] [PATCH v5 0/2] app/testpmd: improve multiprocess support Pattan, Reshma
2016-10-18 7:57 ` Sergio Gonzalez Monroy
2016-09-27 11:13 ` [dpdk-dev] [PATCH v4 2/2] app/testpmd: improve handling of multiprocess Marcin Kerlin
2016-09-28 10:57 ` Pattan, Reshma
2016-09-28 11:34 ` Kerlin, MarcinX
2016-09-28 12:08 ` Pattan, Reshma
2016-09-26 14:53 ` [dpdk-dev] [PATCH v3 " Marcin Kerlin
2016-09-20 14:31 ` Marcin Kerlin [this message]
2016-09-02 8:58 ` [dpdk-dev] [PATCH " Marcin Kerlin
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=1474381895-16066-3-git-send-email-marcinx.kerlin@intel.com \
--to=marcinx.kerlin@intel.com \
--cc=dev@dpdk.org \
--cc=pablo.de.lara.guarch@intel.com \
--cc=thomas.monjalon@6wind.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).