[dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command
Qiu, Michael
michael.qiu at intel.com
Thu Mar 5 14:33:10 CET 2015
Hi, Tetsuya and Pablo
This is not a full fix, I have generate the full fix patch two days ago,
See below:
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 49be819..ec53923 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -384,6 +384,9 @@ port_infos_display(portid_t port_id)
int
port_id_is_invalid(portid_t port_id, enum print_warning warning)
{
+ if (port_id == (portid_t)RTE_PORT_ALL)
+ return 0;
+
if (ports[port_id].enabled)
return 0;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e556b4c..1c4c651 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1326,6 +1326,9 @@ start_port(portid_t pid)
return -1;
}
+ if (port_id_is_invalid(pid, ENABLED_WARN))
+ return 0;
+
if (init_fwd_streams() < 0) {
printf("Fail from init_fwd_streams()\n");
return -1;
@@ -1482,10 +1485,14 @@ stop_port(portid_t pid)
dcb_test = 0;
dcb_config = 0;
}
+
+ if (port_id_is_invalid(pid, ENABLED_WARN))
+ return;
+
printf("Stopping ports...\n");
FOREACH_PORT(pi, ports) {
- if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
+ if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;
port = &ports[pi];
@@ -1517,10 +1524,13 @@ close_port(portid_t pid)
return;
}
+ if (port_id_is_invalid(pid, ENABLED_WARN))
+ return;
+
printf("Closing ports...\n");
FOREACH_PORT(pi, ports) {
- if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
+ if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;
port = &ports[pi];
--
1.9.3
Thanks,
Michael
On 3/5/2015 3:31 PM, Tetsuya Mukawa wrote:
> When "port stop all" is executed, the command doesn't work as it should
> because of wrong port validation. The patch fixes this issue.
>
> Reported-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp>
> ---
> app/test-pmd/testpmd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 61291be..bb65342 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1484,7 +1484,7 @@ stop_port(portid_t pid)
> printf("Stopping ports...\n");
>
> FOREACH_PORT(pi, ports) {
> - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> + if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
> continue;
>
> port = &ports[pi];
More information about the dev
mailing list