From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D70CCA05D3 for ; Mon, 20 May 2019 14:51:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9D4AD5A6A; Mon, 20 May 2019 14:51:00 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 9978E5A44 for ; Mon, 20 May 2019 14:50:59 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id c13so6776256pgt.1 for ; Mon, 20 May 2019 05:50:59 -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=UViqoRWKfSPI2Lb6qERVovIb5iSO3Drw/lFROuYckIM=; b=i6FzrWees/ibLEbj7k1xpxfaAX3iAk/DL3xxCRIpPRqO3iml69mcYMipy+AXOBMiVz 62PAsqmyG8bWI4t6eyzC9+XxkHCIqXX0+WuHjjL01m9z93NFLZkbyyXP7IOuhGiDXrKB FZnNbFCZAht2iUOsT78N3/1/Y9/GlEfrdK5LajEBXzm80TYoemveshT/XsRSQ0DRF+Ea OzsFxf+DNQOdhl+4C4F2dp9r2x0vRC8+ZKmxZLv+fdP14lV+ESn7l9jfb+sh/lOOgQId lH4pU1YV24TVTEUTD+uHe/cg3vLIxhkrl6pScU9fYN2d1ipMk23BEp/pyeCpZw5EwIG4 WP6w== 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=UViqoRWKfSPI2Lb6qERVovIb5iSO3Drw/lFROuYckIM=; b=AUcH8lmBBCqdw/hnqcw/xtcawBa0Qzz8xFmlLOZs06tKyB8InuDjEeR/rkKLzD+hBo el5tKehXHyc8BHyB7x5IhB01lErt0qGVANXQVp7kIxLZJlDPSmMXcCEKvmTmeuyPSBhl CwRKaVKyEQEKUi0vHU7nqjSF5575ft59htpUDPKv9aYgXJ823JqgZNLyyd+N8pJE263w ZiL/cjuJsaBVNb104NYFdFxuSzq7jcyhaCpMhIYIF3kZxk5usLxFbpi56AlHzSivCcr3 WplWPaaDjhwzlJaWxIojV4i+dJarmC/7udQKQZ74N6ZAMqn5dejDhE/AZ6FXBfXzMbAa 2zHw== X-Gm-Message-State: APjAAAU0GlX+Cd+cPz35DvQ0J6yAgeNNTiBpBNgkmFH/9pll9Ild1wHp dbrR9I96pa9ri4g5BPRLlyc= X-Google-Smtp-Source: APXvYqz3nB7R/9MchqawFiIEJ7+4lSaGPZq/gjmxXfTSveAUIXy/K0Y686OTJFiYw6iAFNaxGjgoMw== X-Received: by 2002:a63:a55:: with SMTP id z21mr75436023pgk.440.1558356658796; Mon, 20 May 2019 05:50:58 -0700 (PDT) Received: from gmail.com ([115.113.156.2]) by smtp.gmail.com with ESMTPSA id 140sm28514609pfw.123.2019.05.20.05.50.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 05:50:57 -0700 (PDT) Date: Mon, 20 May 2019 18:20:53 +0530 From: Nithin Dabilpuram To: Thomas Monjalon Cc: dev@dpdk.org, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Message-ID: <20190520125053.GA1399@gmail.com> References: <20190513112112.7069-1-ndabilpuram@marvell.com> <1750613.yctpDDeXOX@xps> <20190517085547.GA26094@gmail.com> <3849744.ELThORf4eq@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3849744.ELThORf4eq@xps> 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 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 " ? > > > 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. > >