From c8743d5f150107e11201fd56a8e89477a60336d1 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Thu, 13 Feb 2020 15:50:23 +0100 Subject: [PATCH] app/testpmd: add port check before manual detach User may try to run "port detach " for an already detached device. It has been decided to protect from such usage in testpmd, so a check was added to detach_port_device() in DPDK 19.11. This check might be removed to allow hotplug path detaching the device of a closed port. Whatever will be decided in future, this check is also added before the call to detach_port_device(). Signed-off-by: Thomas Monjalon Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index de7a695d74..99e4168103 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1497,10 +1497,12 @@ static void cmd_operate_detach_port_parsed(void *parsed_result, { struct cmd_operate_detach_port_result *res = parsed_result; - if (!strcmp(res->keyword, "detach")) + if (!strcmp(res->keyword, "detach")) { + RTE_ETH_VALID_PORTID_OR_RET(res->port_id); detach_port_device(res->port_id); - else + } else { printf("Unknown parameter\n"); + } } cmdline_parse_token_string_t cmd_operate_detach_port_port = -- 2.20.1