From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id DE03E1BBA5
 for <dev@dpdk.org>; Wed,  4 Jul 2018 00:44:47 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 756E421A21;
 Tue,  3 Jul 2018 18:44:46 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Tue, 03 Jul 2018 18:44:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:content-transfer-encoding:content-type:date:from:in-reply-to
 :message-id:mime-version:references:subject:to:x-me-sender
 :x-me-sender:x-sasl-enc; s=mesmtp; bh=RlWuiW+PXla9bH+7Hsr1QLXfNd
 7ZN5bp+3U1Tegz4N8=; b=L7zkhKXYtA03TJMofIbAlS0MQl60SVe4AbMPbFiR/+
 EGhJ9VQcS2DckNIN6X5QAfd3L1t784aVXx7MkUCM44kPqUHJvv/9o4yRaH2OKNWx
 iZYFSA8IN+Esh80lja9/hxVCUmhz/8th3gl/9JsY9iYkaLa1xoKMUzlTCZA1XNAP
 w=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=RlWuiW
 +PXla9bH+7Hsr1QLXfNd7ZN5bp+3U1Tegz4N8=; b=GZI4czh9Fh+lRqdJrMSoWz
 s7HVikCB5C+33X5/tIzbkoxABF+k36hI9gtEtPzlsTmSfoOr14MXduEzAeKUKoBf
 ETj5kDfBF17ZdRCgE+adOQi8UdKrAKRxRTMUUaWtBm565WMcGGYFtPr8+Ua4b7tM
 N4pg8iUFAaQzP2pdJr7AQyNQgFwG2puMk88LapQGYV3mbUUCAwE5jBilwPKFTFcb
 AP9uq6yac+71do6outQtSK6/W8X+CCvWw4/bPxVvKhGIDYdhGUBjBM/WIAOUzAxM
 JCqKGI0acDz0DxHgtEdXijaxNnG4TvNkXryU+vqrlYJ86+NUxsaYzDaBT5Oav7uA
 ==
X-ME-Proxy: <xmx:Xfw7WxCodorwqQ2KKPh25ZGG25hUZKP-uRWEvWMftHd-q1HJrf3CWQ>
 <xmx:Xfw7WwGG1Bmd2hqc3D5I7g_oGBS2bWtHd3StP4YBN1QYOd_fqE440A>
 <xmx:Xvw7W9wCq6oDpxbpUICbKsbL-yF2y-l6onQJUFSH8KSIBjUBo6lltw>
 <xmx:Xvw7W1f0apbDzPNe_DBVItwfBIWrRA9h2Dv36-e0xZggQuaVFBgVPg>
 <xmx:Xvw7W_be6LceniXmYMANq1NA0mdzC4udJ6HjXuR3ee05rokcmNAUYA>
 <xmx:Xvw7W7-d6AeqtHyL_OJTxCmDia8jfrYv0WLD1o4l2-fcR6pL_AcovQ>
X-ME-Sender: <xms:Xfw7W73LNh2qdOAljB9AoZoX3-bqfsDJXUlwgdCuG1doJcr4aNWRuA>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 1771CE446D;
 Tue,  3 Jul 2018 18:44:43 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: "Guo, Jia" <jia.guo@intel.com>
Cc: dev@dpdk.org, Matan Azrad <matan@mellanox.com>,
 "stephen@networkplumber.org" <stephen@networkplumber.org>,
 "bruce.richardson@intel.com" <bruce.richardson@intel.com>,
 "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
 "konstantin.ananyev@intel.com" <konstantin.ananyev@intel.com>,
 "gaetan.rivet@6wind.com" <gaetan.rivet@6wind.com>,
 "jingjing.wu@intel.com" <jingjing.wu@intel.com>,
 Mordechay Haimovsky <motih@mellanox.com>,
 "harry.van.haaren@intel.com" <harry.van.haaren@intel.com>,
 "qi.z.zhang@intel.com" <qi.z.zhang@intel.com>,
 "shaopeng.he@intel.com" <shaopeng.he@intel.com>,
 "bernard.iremonger@intel.com" <bernard.iremonger@intel.com>,
 "shreyansh.jain@nxp.com" <shreyansh.jain@nxp.com>,
 "helin.zhang@intel.com" <helin.zhang@intel.com>
Date: Wed, 04 Jul 2018 00:44:42 +0200
Message-ID: <2612071.aGzFhBPpOt@xps>
In-Reply-To: <07fb8f04-adee-fd0e-05b5-8d1bcca1338d@intel.com>
References: <1498711073-42917-1-git-send-email-jia.guo@intel.com>
 <VI1PR0501MB2608C7B8D4803C287E02B0F9D24C0@VI1PR0501MB2608.eurprd05.prod.outlook.com>
 <07fb8f04-adee-fd0e-05b5-8d1bcca1338d@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH V4 8/9] app/testpmd: show example to handle
	hot unplug
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jul 2018 22:44:48 -0000

03/07/2018 11:35, Guo, Jia:
> On 7/1/2018 3:46 PM, Matan Azrad wrote:
> > From: Jeff Guo
> >> --- a/app/test-pmd/testpmd.c
> >> +++ b/app/test-pmd/testpmd.c
> >> @@ -2206,9 +2209,12 @@ eth_dev_event_callback(char *device_name, enum
> >> rte_dev_event_type type,
> >>   	case RTE_DEV_EVENT_REMOVE:
> >>   		RTE_LOG(ERR, EAL, "The device: %s has been removed!\n",
> >>   			device_name);
> >> -		/* TODO: After finish failure handle, begin to stop
> >> -		 * packet forward, stop port, close port, detach port.
> >> -		 */
> >> +		ret = rte_eth_dev_get_port_by_name(device_name, &port_id);
> > As you probably know, 1 rte_device may be associated to more than one ethdev ports, so the ethdev port name can be different from rte_device name.
> > Looks like we need a new ethdev API to get all the ports associated to one rte_device.
> 
> agree, seems that the the old ethdev API have some issue when got all 
> port by device name. we could check with ethdev maintainer and fix it by 
> specific ethdev patch later.

This ethdev function could return an error if several ports match.

Ideally, we should not use this function at all.
If you want to manage an ethdev port, why are you using an EAL event?
There is an ethdev callback mechanism for port removal.