From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED512A0542; Thu, 13 Feb 2020 15:50:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18D191C013; Thu, 13 Feb 2020 15:50:33 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id AB3921C00E for ; Thu, 13 Feb 2020 15:50:31 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C7F9E21EAD; Thu, 13 Feb 2020 09:50:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 13 Feb 2020 09:50:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=mesmtp; bh=DFPmQqdn2X2GiLBTCO6QsVy 3IHw9EDOz7djoLnbf4Co=; b=iDFNx8zlbz776BEniQhcmNRMEC0kN+CiJ/orHhz Mmc/oditxAj0hgVHEuS27yC3EK+K67tWIaWnRBn/bg3UB4uQBIG9uGTQ3zm1mIFo UBfiUxOFV6g36Zrvf7X0usN/NeyWQMoUc3PPNOAYkN1CyIsrsbMdeT5m28BkC3QI 1ZlE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=DFPmQqdn2X2GiLBTC O6QsVy3IHw9EDOz7djoLnbf4Co=; b=rDukvniO1MkPrCBcK2n2wX9bj78CH4eU2 B9NQvBZnVyCjFGY9FxVH5p4EQHSkGfgB50Jc0/7leOQCFz2luFQCbj91ImbIiaep pf3Mb0lESxaob1PoQyPMQO0Itv4YFIUf0BMSLklLctZZK1WB6hiiKrd4Rx07vzMT gqXi2QI3VpgyIFNULmeH64M24b8aVDdIekTW5RqyHJEK6DExGiq/gxN36RaPe7aB eWX4RM2HrcXWguCOxrUDFX/rsrPMWGjYme1CQlYgzuEMlIpmPmzs2ugqYmqQGvZR Dj6buy30RNDkAZswHs9Y10tO+fnRJm6YPhEz+LxjtZOTCEpgJ1ksw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieekgdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghsucfo ohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkphepje ejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 5186F3060A88; Thu, 13 Feb 2020 09:50:29 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: matan@mellanox.com, ferruh.yigit@intel.com, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Date: Thu, 13 Feb 2020 15:50:23 +0100 Message-Id: <20200213145024.1022480-1-thomas@monjalon.net> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] app/testpmd: add port check before manual detach X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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.25.0