From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 823D3A00C2; Mon, 23 May 2022 16:37:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6828D4014F; Mon, 23 May 2022 16:37:02 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id F2A7640141; Mon, 23 May 2022 16:37:00 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7AF705C00A7; Mon, 23 May 2022 10:37:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 23 May 2022 10:37:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1653316620; x= 1653403020; bh=Hfbcdshqh5PMRBwoIHXTFdCxrNtXx/i/pveCV2AlGH0=; b=S He8Vjq4SreStCpNfj/purjqepZ/KlnFi0PTgzAePyrAZixNjJOErwjBSJmt3gJVl v8gKUttQP1AmX9FNvwHGkwGF1E71Mq/XuAF4ZGKf6NDeBVpD0FA6axAP2kdRNZGT 2O6rOZT+1VNi39na2pKEdEUPZbvOX+ZBX57XkGwZqCRQ9DpUhRLXxgTz/tTiJSfA CJMEOw6HZElh8JXvKq1V+DTsrpuMRigGQZyTVXMA0SoWxRF7e6Ks0l5EwwgZz4ql 8jafF/ENj8TQc9tkRH9ZueXBodVfYpDylWrBwNRtc67/mZ5cUytRAaJ96WgiPP5s xPxsSWXpKoi54jstx7z+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1653316620; x= 1653403020; bh=Hfbcdshqh5PMRBwoIHXTFdCxrNtXx/i/pveCV2AlGH0=; b=G fsYHiUov263VFktjHr+viIv2i28l9ggzY4qLrYqvvaM3VdxdowCD/4ttRs9qtPr/ WmCRz9N5dS78GObf9N/bUmmrE9O5aRWZ7G/vGRUPe+C/I8WN6w3a3PhIqTZ1pnNF kYkO0QGSwQIngerX2axxCl3E/3waQ8FXtaG8VRMnSiPtTEPoRRp+jcAkcFJT1e2b FwCjtuD+hBa0OYe6uLask4D4n9llkXGDSDBgrVmGjiFr8RV+Fjt8tyoYh57GLaU8 DDcA8LPaW38VucPVHfEyo/rL0vAFuAAWSzvz6Br1wnOXx8VJohsYF5ihmNm4F0Jo 0KgogcDWdS7JJPC/YJHmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrjedugdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnheptdejieeifeehtdffgfdvleetueeffeehueejgfeuteeftddtieek gfekudehtdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 May 2022 10:36:57 -0400 (EDT) From: Thomas Monjalon To: "Min Hu (Connor)" , Ferruh Yigit , Andrew Rybchenko , David Marchand Cc: dev , Huisong Li , dpdk stable , Bruce Richardson Subject: Re: [PATCH] ethdev: fix push new event Date: Mon, 23 May 2022 16:36:47 +0200 Message-ID: <2199956.o7ts2hSHzF@thomas> In-Reply-To: References: <20220521065549.33451-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 23/05/2022 11:51, David Marchand: > On Sat, May 21, 2022 at 8:57 AM Min Hu (Connor) wrote: > > > > From: Huisong Li > > > > The 'state' in struct rte_eth_dev may be used to update some information > > when app receive these events. For example, when app receives a new event, > > app may get the socket id of this port by calling rte_eth_dev_socket_id to > > setup the attached port. The 'state' is used in rte_eth_dev_socket_id. > > > > If the state isn't modified to RTE_ETH_DEV_ATTACHED before pushing the new > > event, app will get the socket id failed. So this patch moves pushing event > > operation after the state updated. > > > > Fixes: 99a2dd955fba ("lib: remove librte_ prefix from directory names") > > A patch moving code is unlikely to be at fault. > > > Looking at the patch which moved those notifications in this point of > the code, the state update was pushed after the notification on > purpose. > See be8cd210379a ("ethdev: fix port probing notification") > > ethdev: fix port probing notification > > The new device was notified as soon as it was allocated. > It leads to use a device which is not yet initialized. > > The notification must be published after the initialization is done > by the PMD, but before the state is changed, in order to let > notified entities taking ownership before general availability. > > > Do we need an intermediate state during probing? Possibly. Currently we have only 3 states: RTE_ETH_DEV_UNUSED RTE_ETH_DEV_ATTACHED RTE_ETH_DEV_REMOVED We may add RTE_ETH_DEV_ALLOCATED just before calling rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_NEW, NULL); Then we would need to check against RTE_ETH_DEV_ALLOCATED in some ethdev functions.