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 589F8A0487 for ; Wed, 3 Jul 2019 07:05:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2910F4C8F; Wed, 3 Jul 2019 07:05:26 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id 566CE23D for ; Wed, 3 Jul 2019 07:05:25 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id d126so605251pfd.2 for ; Tue, 02 Jul 2019 22:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=20IcsbXY6qI5qHfzq0+Rns4I1PNZdGDfe7+bIMk4VdI=; b=A+z9YRVuWX/6Kc0hbOr8c1Egj0Mcl+8CPYGj06qGq1xpcdS9sOhLNHeqbT8PZ6xyKP 0xByFinkatik0NqutzlJbCoG2uGAvUHaQT/FYqffjI1qjtAT7l0lAPb7DbKmFpP5qg3J dr5NtXko7tfxrDARp3nCA0nfrPUMNH5JWT1o/qKfathAPM31F9cbMseJJQ/jbKS1UYc1 s52/Ubim+yQsiMvII/IqhEiedcDDNSj3S6D8pb3desXXcKxorpZuo3o4Yo5z64sX5YNE nLZ5VNKwVbZbDwFX3BtEI2JAIOpZ4V8HeYDcBEqJNOt3CHezkbB6/CrPuZ2df/+xHOAi aftQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=20IcsbXY6qI5qHfzq0+Rns4I1PNZdGDfe7+bIMk4VdI=; b=aF2Pg7R8WLyWyIsiHFHovFGDtSI8NhpAbd7lADfPPgdD5t99KtKczU14pwadknqnzI opCmg8T58tdAC+jtCzgqRy1tM0G1P2D5+NGcvp8q7UInRHKN5aD10onruW4sVnBvZ3XB L8zoS4JuC0yIa9xDPAZdEB9juQQRAmMjeu5wd2x0DPG48gZheOKl3nFQ0BbaPkHp9BCn ajP0DyhwZsMuPyOf9fneiEQKwRZGvc8pw4UbXxpk/+ghecwldc8iUXUz5Kj7Dd1+218H lNGe9lQkT+kIRBQPeLMr2MU8g+l7A3LQThMUw5eQOCvswV8HwPqtKTTh64ILwZj1KzEZ rNrQ== X-Gm-Message-State: APjAAAWL5OLSD1WcYpdCETZWuoPiRM65tlv+knRuDuROU1CmMhOMJH1v mht8rPk2UDuoBY181jdNnFk= X-Google-Smtp-Source: APXvYqy549WsEULlxCFqUFPKaK27ETKubDZCF5s18ycVTxUvMzSYUCYWhNLpWy88TSCBku8kYMKaTw== X-Received: by 2002:a17:90a:208d:: with SMTP id f13mr9885886pjg.68.1562130324481; Tue, 02 Jul 2019 22:05:24 -0700 (PDT) Received: from gmail.com ([115.113.156.2]) by smtp.gmail.com with ESMTPSA id s193sm726101pgc.32.2019.07.02.22.05.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jul 2019 22:05:23 -0700 (PDT) Date: Wed, 3 Jul 2019 10:35:14 +0530 From: Nithin Dabilpuram To: "Yigit, Ferruh" Cc: Thomas Monjalon , dev@dpdk.org, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , jerinj@marvell.com Message-ID: <20190703050513.GA2088@gmail.com> References: <20190513112112.7069-1-ndabilpuram@marvell.com> <1750613.yctpDDeXOX@xps> <20190517085547.GA26094@gmail.com> <3849744.ELThORf4eq@xps> <20190520125053.GA1399@gmail.com> <20190529081620.GA5044@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Subject: Re: [dpdk-dev] [PATCH] app/testpmd: change port detach interface 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" On Tue, Jul 02, 2019 at 04:58:17PM +0100, Yigit, Ferruh wrote: > On 5/29/2019 9:16 AM, Nithin Dabilpuram wrote: > > Hi Thomas, > > > > On Mon, May 20, 2019 at 06:20:53PM +0530, Nithin Dabilpuram wrote: > >> On Fri, May 17, 2019 at 10:59:38AM +0200, Thomas Monjalon wrote: > >>> 17/05/2019 10:55, Nithin Dabilpuram: > >>>> On Wed, May 15, 2019 at 09:27:22AM +0200, Thomas Monjalon wrote: > >>>>> 15/05/2019 08:52, Nithin Dabilpuram: > >>>>>> Hi Thomas, > >>>>>> On Tue, May 14, 2019 at 05:39:30PM +0200, Thomas Monjalon wrote: > >>>>>>> Hi, > >>>>>>> > >>>>>>> 13/05/2019 13:21, Nithin Dabilpuram: > >>>>>>>> With the latest published interface of > >>>>>>>> rte_eal_hotplug_[add,remove](), and rte_eth_dev_close(), > >>>>>>>> rte_eth_dev_close() would cleanup all the data structures of > >>>>>>>> port's eth dev leaving the device common resource intact > >>>>>>>> if RTE_ETH_DEV_CLOSE_REMOVE is set in dev flags. > >>>>>>>> So "port detach" (~hotplug remove) should be able to work, > >>>>>>>> with device identifier like "port attach" as eth_dev could have > >>>>>>>> been closed already and rte_eth_devices[port_id] reused. > >>>>>>> > >>>>>>> "port attach" uses devargs as identifier because there > >>>>>>> is no port id before creating it. But "detach port" uses > >>>>>>> logically the port id to close. > >>>>>> > >>>>>> But if "port close" was already called on that port, > >>>>>> eth_dev->state would be set as RTE_ETH_DEV_UNUSED and > >>>>>> that port id could be reused. > >>>>>> So after "port close" if we call "port detach", isn't it > >>>>>> incorrect to use the same port id ? > >>>>> > >>>>> Yes it is incorrect to close a port which is already closed :) > >>>>> > >>>>>>>> This change alters "port detach" cmdline interface to > >>>>>>>> work with device identifier like "port attach". > >>>>>>> > >>>>>>> The word "port" means an ethdev port, so it should be > >>>>>>> referenced with a port id. > >>>>>>> If you want to close an EAL rte_device, then you should > >>>>>>> rename the command. > >>>>>>> But testpmd purpose should be to work with ethdev ports only. > >>>>>> > >>>>>> Renaming the command to "detach " ? > >>>>> > >>>>> Yes something like that. > >>>>> But why do you want to manage rte_device in testpmd? > >>>>> Being able to close ports in not enough? > >>>>> Please describe a scenario. > >>>>> > >>>> > >>>> We just want to support testing hotplug detach along with > >>>> hotplug attach from testpmd. Currently there is no way to detach > >>>> if we close the port first. > >>> > >>> OK > >> So can I send next revision with command renamed to "detach " ? > > > > Any info on this ? I can even add it as another cmd without disturbing existing > > command if needed. > > This sounds better option to me. I see the need to remove device via > 'identifier' but also still it is easier to use 'port_id' for removal when > applicable, so I am for keeping it. Thanks. Will send out a patch for the same. > > What do you think adding a new command: > 'device detach' > > Also testpmd doesn't dead with 'device' much, it mainly works in port level, > because of this does it make sense to add another command something like: > "show device info all" Sure. Will add it. > > > > >>> > >>>> Another reason is that in our new PMD, for detaching one specific port, > >>>> we need more than one try as the PMD might return -EAGAIN. > >>>> So with the current "port detach" implementation, after closing the port, > >>>> if PMD returns -EAGAIN for rte_dev_remove() call, there is no way to > >>>> try it again. > >>> > >>> This is a bug. > >>> Should we catch -EAGAIN somewhere? > >> > >> It is already caught in local_dev_remove() and > >> rte_dev_remove() fails. Only problem as I said below is > >> in testpmd if first call to detach_port_device() i.e handler of "port detach", > >> rte_dev_remove() returns -EAGAIN and PMD cleaned up the resources partially like eth_dev > >> resources, the second time call cannot work port_id will not be valid anymore. > >> > >>> > >>> >