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 96391A0679 for ; Fri, 5 Apr 2019 00:01:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 36C0C1B1EE; Fri, 5 Apr 2019 00:01:44 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 8F0D71B1E9 for ; Fri, 5 Apr 2019 00:01:42 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 08A4725A96; Thu, 4 Apr 2019 18:01:42 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 04 Apr 2019 18:01:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=CxVIKx0CCXCB4cLufxRUmDJizBFKKojqnGOToSEyr3g=; b=U/JjLT1Mb898 LmmuMfSAtyAhndZCSeXSgmfquuZLng3S2T2kpC+YoPWpcISYJoggvKyHZ16vP8aY UTspLn7x4HFTOXYtSBrZshrXDdjq9T3BK1sT/XZbqGOW02sonVTbt+gls4WfifKt +Yn/yuksObwe8bQwPtJZ0hpwIJk9Ykk= 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-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=CxVIKx0CCXCB4cLufxRUmDJizBFKKojqnGOToSEyr 3g=; b=RF5Shj1/RDF14o0L9hqTMudHZEQEPAQGUCEOkQ4oA00oWuE/XoNDgpNY3 SYfYIKn9q555ozYF9EFowu2G9ogjiN/H3tTzek1ivcwr5R8nnEanaJYb8CVfGpO6 Mx/hGM/A9L7pv8i44l7NuPGnQSCi738KG4s8ppEzimYb5khdNlwP6Cfrv7rzcXcA CUAr4KO1OMeMXlSrtR3ml+gOIwlXEhV5cV5F70ks1r7ek349jci55bpWjBlR61hn UxBRwyFeMeNL4qt0VFlG82w2yvBmaJzYEaEOGe9K9M5lxf3L727s49YXTtLFJC9h 7DKXzrXMhoOQ1WPgdJMD2/jH0oEIw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrtdeigddtvdculddtuddrgedutddrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvden ucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrg hlohhnrdhnvghtqeenucfkphepjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhep mhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsth gvrhfuihiivgeptd X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 3DA161030F; Thu, 4 Apr 2019 18:01:39 -0400 (EDT) From: Thomas Monjalon To: Qi Zhang Cc: dev@dpdk.org, declan.doherty@intel.com, ferruh.yigit@intel.com, ktraynor@redhat.com, sthemmin@microsoft.com, benjamin.h.shelton@intel.com, narender.vangati@intel.com, david.marchand@redhat.com, arybchenko@solarflare.com Date: Fri, 05 Apr 2019 00:01:34 +0200 Message-ID: <777209833.n87rErGVB9@xps> In-Reply-To: <20190320045403.14594-1-qi.z.zhang@intel.com> References: <20190320045403.14594-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] ethdev: claim device reset as async 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" Message-ID: <20190404220134.Mppc-jd1IeC2L1RWRk0s6948S76Tt5ZdluBpW9q67XU@z> Hi, You forgot to Cc Andrew, co-maintainer of ethdev. 20/03/2019 05:54, Qi Zhang: > Device reset should be implemented in an async way since it is > possible to be invoked in interrupt thread and sometimes to reset a > device need to wait for some dependency, for example, a VF expects for > PF ready or a NIC function as part of a SOC wait for the whole system > reset complete, and all these time-consuming tasks will block the > interrupt thread. > The patch rename rte_eth_dev_reset to rte_eth_dev_reset_async and > rework the implementation. It will spawn a new thread which will call > ops->dev_reset, and when finished it will raise the event > RTE_ETH_EVENT_RESET_COMPLETE. The application should always wait for > this event before it continues to configure and restart the device. > > Signed-off-by: Qi Zhang > --- > - * When this function is called, it first stops the port and then calls the > - * PMD specific dev_uninit( ) and dev_init( ) to return the port to initial > - * state, in which no Tx and Rx queues are setup, as if the port has been > - * reset and not started. The port keeps the port id it had before the > - * function call. > - * > - * After calling rte_eth_dev_reset( ), the application should use > - * rte_eth_dev_configure( ), rte_eth_rx_queue_setup( ), > - * rte_eth_tx_queue_setup( ), and rte_eth_dev_start( ) > - * to reconfigure the device as appropriate. > - * > - * Note: To avoid unexpected behavior, the application should stop calling > - * Tx and Rx functions before calling rte_eth_dev_reset( ). For thread > - * safety, all these controlling functions should be called from the same > - * thread. > + * @note > + * Device reset may have the dependency, for example, a VF reset expects > + * PF ready, or a NIC function as a part of a SOC need to wait for other > + * parts of the system be ready, these are time-consuming tasks and will > + * block current thread. > + * > + * As the name, rte_eth_dev_reset_async is an async API, it will spwan a > + * new thread to call ops->dev_reset, once it is finished, it will raise > + * the RTE_ETH_EVENT_RESET_COMPLETE event to notify application. That makes > + * things easy for an application that want to reset the device from the > + * interrupt thread since typically a RTE_ETH_EVENT_INTR_RESET handler is > + * invoked in interrupt thread. The typical implementation of ops->dev_reset > + * will do some hardware reset operations through calling dev_uninit() and > + * dev_init(). > + * > + * Application should not assume device reset is finished after > + * rte_eth_dev_reset_async return, it should always wait for a > + * RTE_ETH_EVENT_RESET_COMPLETE event and check the reset result. > + * If reset success, application should call rte_eth_dev_configure( ), > + * rte_eth_rx_queue_setup( ), rte_eth_tx_queue_setup( ), > + * and rte_eth_dev_start( ) to reconfigure the device as appropriate. > + * > + * @Note > + * To avoid unexpected behavior, the application should stop calling > + * Tx and Rx functions before calling rte_eth_dev_reset_async( ). > * > * @param port_id > * The port identifier of the Ethernet device. > @@ -1880,12 +1892,10 @@ void rte_eth_dev_close(uint16_t port_id); > * - (0) if successful. > * - (-EINVAL) if port identifier is invalid. > * - (-ENOTSUP) if hardware doesn't support this function. > - * - (-EPERM) if not ran from the primary process. > - * - (-EIO) if re-initialisation failed or device is removed. > * - (-ENOMEM) if the reset failed due to OOM. > - * - (-EAGAIN) if the reset temporarily failed and should be retried later. > + * - (<0) other errors from low level driver. > */ > -int rte_eth_dev_reset(uint16_t port_id); > +int rte_eth_dev_reset_async(uint16_t port_id); Sorry I didn't check whether this API is better or not, but I know it cannot be accepted before proposing a deprecation notice. Perhaps you may keep the old API and just add the new one. Honestly, I never really agreed with the purpose of the reset API. So making it async or not, I have no real opinion... ... but spawning a new thread at each function call, I feel it is bad.