From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 02CE7695D for ; Thu, 20 Sep 2018 15:02:41 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9795321F69; Thu, 20 Sep 2018 09:02:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 20 Sep 2018 09:02:41 -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=vKZttgn/7zsCIOCdKp8u46IoUz V2OY3If7BzH5bWpNg=; b=WQ4iZrCl/HgE8GDhKUZKypqVdfLS8+vn5JhPBAmT6K USoj8YXMBV5Jir+Vgdd/F6wHo/HK4rmqvdlDPapL5091o0dBfNek4cFjUjdbh5EM fO5LndmCYD8lkDp2xfPTPQzE4aoq6bkUcjUtQJibsxgPonrjd5tsmVJveeab70DK I= 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=vKZttg n/7zsCIOCdKp8u46IoUzV2OY3If7BzH5bWpNg=; b=Pu33BAXfxZUI0rNKKnqs14 AemgYzP8KIehre6t5gA4kQw0VI0gcSZa7WYd3EPb8Tu1QEAAZ8NWWV8+064sydVM t4sQRe2AaNdVi7Dz99u10MXqOrhp8sKACIon1wxD4Di5B+tCKZ0OTHRBZDVLAMJk l2hjH7ioboK4dBLeJt0Rx6sTsRyf3yD7ey5UU96s2W2z92LhF8Pj368Lwg380U0E SziYr1+uCIA79QS0yv+okdcNAdWeLOBG3z/STNTDGRVsSdikhzACiwxY2geFWe8q zZSltSVxyi5I2kg71SSaFjjvpTCFbB+c9eNRApLFdoOaldaPNkk6AYVjijW5inLg == X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 962B9102E6; Thu, 20 Sep 2018 09:02:39 -0400 (EDT) From: Thomas Monjalon To: Hideyuki Yamashita Cc: dev@dpdk.org, =?ISO-8859-1?Q?Ga=EBtan?= Rivet Date: Thu, 20 Sep 2018 15:02:38 +0200 Message-ID: <69884841.TAV26K5Juc@xps> In-Reply-To: <20180920090919.qigxfgy4qaw6p5om@bidouze.vm.6wind.com> References: <201809200846.w8K8kbJW030890@ccmail04.silk.ntt-tx.co.jp> <20180920090919.qigxfgy4qaw6p5om@bidouze.vm.6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Subject: Re: [dpdk-dev] How to replace rte_eth_dev_attach with rte_eal_hotplug_add 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: , X-List-Received-Date: Thu, 20 Sep 2018 13:02:42 -0000 20/09/2018 11:09, Ga=EBtan Rivet: > On Thu, Sep 20, 2018 at 05:46:37PM +0900, Hideyuki Yamashita wrote: > > Hello, > >=20 > > From dpdk 18.08 release rte_eth_dev_attach and=20 > > rte_eth_dev_detach becom deprecated API and=20 > > it is recommended to replace with rte_eal_hotplug_add > > and rte_eal_hotplug_remove. > >=20 > > My program uses above mentioned deprecated APIs > > and have to replace those. > > Note that my program uses attach to attach vhost, pcap pmd. > >=20 > > My question is whether it is correct to replace those as following: > > find rte_eth_dev_attach function in rte_ethdev.c and > > migrate those content into my program. > >=20 > > e.g.=20 > > lib/librte_ethdev/rte_ethdev.c line 643-686 for attach > > lib/librte_ethdev/rte_ethdev.c line 690-720 for detach > >=20 > > Your advice/guidance are much appreciated. > > Thanks! >=20 > Hello Hideyuki, >=20 > You could use this code for guidance, while leaving the ethdev > specificities such as verifying the eth_dev_count_total(). The hotplug > function would already return an error if the PMD was not able to create > the necessary devices. >=20 > The main issue might be to find the port_id of your new port. > You won't be able to use eth_dev_last_created_port, so you would have to > iterate over the ethdev using RTE_ETH_FOREACH_DEV and find the one > matching your parameters (you might for example match the rte_device > name with the name you used in hotplug_add, as there is no standard > naming scheme at the ethdev level). It is recommended to register a callback to receive the notifications of new ethdev ports. So it may be a change of programming style: sync vs async. > An possible issue with the deprecation planned for those two functions is > that the hotplug API is also meant to evolve [1] this release (not in a b= ig > way however, it would mostly simplify your usage of it). >=20 > [1]: https://mails.dpdk.org/archives/dev/2018-September/111142.html I will probably not change the existing functions. A v2 will be sent soon, with new simple functions.