* [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified
@ 2015-02-27 7:16 Tetsuya Mukawa
2015-02-27 10:06 ` De Lara Guarch, Pablo
2015-02-28 5:41 ` Fu, JingguoX
0 siblings, 2 replies; 4+ messages in thread
From: Tetsuya Mukawa @ 2015-02-27 7:16 UTC (permalink / raw)
To: dev
If testpmd is invoked with portmask option like below, segmentation
fault will be occured. This patch fixes the issue.
Reported-by: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
app/test-pmd/testpmd.c | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 43329ed..61291be 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -579,20 +579,6 @@ init_config(void)
socket_num);
}
- /* Configuration of Ethernet ports. */
- ports = rte_zmalloc("testpmd: ports",
- sizeof(struct rte_port) * RTE_MAX_ETHPORTS,
- RTE_CACHE_LINE_SIZE);
- if (ports == NULL) {
- rte_exit(EXIT_FAILURE,
- "rte_zmalloc(%d struct rte_port) failed\n",
- RTE_MAX_ETHPORTS);
- }
-
- /* enabled allocated ports */
- for (pid = 0; pid < nb_ports; pid++)
- ports[pid].enabled = 1;
-
FOREACH_PORT(pid, ports) {
port = &ports[pid];
rte_eth_dev_info_get(pid, &port->dev_info);
@@ -1999,6 +1985,26 @@ init_port_dcb_config(portid_t pid,struct dcb_config *dcb_conf)
return 0;
}
+static void
+init_port(void)
+{
+ portid_t pid;
+
+ /* Configuration of Ethernet ports. */
+ ports = rte_zmalloc("testpmd: ports",
+ sizeof(struct rte_port) * RTE_MAX_ETHPORTS,
+ RTE_CACHE_LINE_SIZE);
+ if (ports == NULL) {
+ rte_exit(EXIT_FAILURE,
+ "rte_zmalloc(%d struct rte_port) failed\n",
+ RTE_MAX_ETHPORTS);
+ }
+
+ /* enabled allocated ports */
+ for (pid = 0; pid < nb_ports; pid++)
+ ports[pid].enabled = 1;
+}
+
int
main(int argc, char** argv)
{
@@ -2013,6 +2019,9 @@ main(int argc, char** argv)
if (nb_ports == 0)
RTE_LOG(WARNING, EAL, "No probed ethernet devices\n");
+ /* allocate port structures, and init them */
+ init_port();
+
set_def_fwd_config();
if (nb_lcores == 0)
rte_panic("Empty set of forwarding logical cores - check the "
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified
2015-02-27 7:16 [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified Tetsuya Mukawa
@ 2015-02-27 10:06 ` De Lara Guarch, Pablo
2015-02-27 23:25 ` Thomas Monjalon
2015-02-28 5:41 ` Fu, JingguoX
1 sibling, 1 reply; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2015-02-27 10:06 UTC (permalink / raw)
To: Tetsuya Mukawa, dev
> -----Original Message-----
> From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp]
> Sent: Friday, February 27, 2015 7:16 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo; Tetsuya Mukawa
> Subject: [PATCH] testpmd: Fix segmentation fault when portmask is
> specified
>
> If testpmd is invoked with portmask option like below, segmentation
> fault will be occured. This patch fixes the issue.
>
> Reported-by: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
> ---
> app/test-pmd/testpmd.c | 37 +++++++++++++++++++++++--------------
> 1 file changed, 23 insertions(+), 14 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 43329ed..61291be 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -579,20 +579,6 @@ init_config(void)
> socket_num);
> }
>
> - /* Configuration of Ethernet ports. */
> - ports = rte_zmalloc("testpmd: ports",
> - sizeof(struct rte_port) * RTE_MAX_ETHPORTS,
> - RTE_CACHE_LINE_SIZE);
> - if (ports == NULL) {
> - rte_exit(EXIT_FAILURE,
> - "rte_zmalloc(%d struct rte_port) failed\n",
> - RTE_MAX_ETHPORTS);
> - }
> -
> - /* enabled allocated ports */
> - for (pid = 0; pid < nb_ports; pid++)
> - ports[pid].enabled = 1;
> -
> FOREACH_PORT(pid, ports) {
> port = &ports[pid];
> rte_eth_dev_info_get(pid, &port->dev_info);
> @@ -1999,6 +1985,26 @@ init_port_dcb_config(portid_t pid,struct
> dcb_config *dcb_conf)
> return 0;
> }
>
> +static void
> +init_port(void)
> +{
> + portid_t pid;
> +
> + /* Configuration of Ethernet ports. */
> + ports = rte_zmalloc("testpmd: ports",
> + sizeof(struct rte_port) * RTE_MAX_ETHPORTS,
> + RTE_CACHE_LINE_SIZE);
> + if (ports == NULL) {
> + rte_exit(EXIT_FAILURE,
> + "rte_zmalloc(%d struct rte_port) failed\n",
> + RTE_MAX_ETHPORTS);
> + }
> +
> + /* enabled allocated ports */
> + for (pid = 0; pid < nb_ports; pid++)
> + ports[pid].enabled = 1;
> +}
> +
> int
> main(int argc, char** argv)
> {
> @@ -2013,6 +2019,9 @@ main(int argc, char** argv)
> if (nb_ports == 0)
> RTE_LOG(WARNING, EAL, "No probed ethernet devices\n");
>
> + /* allocate port structures, and init them */
> + init_port();
> +
> set_def_fwd_config();
> if (nb_lcores == 0)
> rte_panic("Empty set of forwarding logical cores - check the "
> --
> 1.9.1
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified
2015-02-27 10:06 ` De Lara Guarch, Pablo
@ 2015-02-27 23:25 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2015-02-27 23:25 UTC (permalink / raw)
To: Tetsuya Mukawa; +Cc: dev
> > If testpmd is invoked with portmask option like below, segmentation
> > fault will be occured. This patch fixes the issue.
> >
> > Reported-by: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> > Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified
2015-02-27 7:16 [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified Tetsuya Mukawa
2015-02-27 10:06 ` De Lara Guarch, Pablo
@ 2015-02-28 5:41 ` Fu, JingguoX
1 sibling, 0 replies; 4+ messages in thread
From: Fu, JingguoX @ 2015-02-28 5:41 UTC (permalink / raw)
To: Tetsuya Mukawa, dev
Tested-by: Jingguo Fu <jingguox.fu@intel.com>
- Tested Commit: 8a6f6d45d290a27ef923d10925c4893380697b31
- OS: Fedora20 3.11.10-301.fc20.x86_64
- GCC: gcc version 4.8.3 20140911
- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
- NIC: Intel Corporation Device [8086:1563]
- Default x86_64-native-linuxapp-gcc configuration
- Total 1 case, 1 passed, 0 failed
- Case: test_checksum_checking
Description: Check testpmd can be startup with cmdline for checksum
Command / instruction:
Start testpmd with command line as:
./x86_64-native-linuxapp-gcc/app/testpmd -c 0x1fffffffff -n 4 -- -i --coremask=0x400 --portmask=0x3 --nb-cores=2 --enable-rx-cksum --disable-hw-vlan --disable-rss --rxd=1024 --txd=1024 --rxfreet=0
Start ports:
set fwd cusm
start
Expected test result:
Testpmd can startup.
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tetsuya Mukawa
Sent: Friday, February 27, 2015 15:16
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified
If testpmd is invoked with portmask option like below, segmentation
fault will be occured. This patch fixes the issue.
Reported-by: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
app/test-pmd/testpmd.c | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 43329ed..61291be 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -579,20 +579,6 @@ init_config(void)
socket_num);
}
- /* Configuration of Ethernet ports. */
- ports = rte_zmalloc("testpmd: ports",
- sizeof(struct rte_port) * RTE_MAX_ETHPORTS,
- RTE_CACHE_LINE_SIZE);
- if (ports == NULL) {
- rte_exit(EXIT_FAILURE,
- "rte_zmalloc(%d struct rte_port) failed\n",
- RTE_MAX_ETHPORTS);
- }
-
- /* enabled allocated ports */
- for (pid = 0; pid < nb_ports; pid++)
- ports[pid].enabled = 1;
-
FOREACH_PORT(pid, ports) {
port = &ports[pid];
rte_eth_dev_info_get(pid, &port->dev_info);
@@ -1999,6 +1985,26 @@ init_port_dcb_config(portid_t pid,struct dcb_config *dcb_conf)
return 0;
}
+static void
+init_port(void)
+{
+ portid_t pid;
+
+ /* Configuration of Ethernet ports. */
+ ports = rte_zmalloc("testpmd: ports",
+ sizeof(struct rte_port) * RTE_MAX_ETHPORTS,
+ RTE_CACHE_LINE_SIZE);
+ if (ports == NULL) {
+ rte_exit(EXIT_FAILURE,
+ "rte_zmalloc(%d struct rte_port) failed\n",
+ RTE_MAX_ETHPORTS);
+ }
+
+ /* enabled allocated ports */
+ for (pid = 0; pid < nb_ports; pid++)
+ ports[pid].enabled = 1;
+}
+
int
main(int argc, char** argv)
{
@@ -2013,6 +2019,9 @@ main(int argc, char** argv)
if (nb_ports == 0)
RTE_LOG(WARNING, EAL, "No probed ethernet devices\n");
+ /* allocate port structures, and init them */
+ init_port();
+
set_def_fwd_config();
if (nb_lcores == 0)
rte_panic("Empty set of forwarding logical cores - check the "
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-28 5:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 7:16 [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified Tetsuya Mukawa
2015-02-27 10:06 ` De Lara Guarch, Pablo
2015-02-27 23:25 ` Thomas Monjalon
2015-02-28 5:41 ` Fu, JingguoX
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).