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 D9F8AA0501 for ; Sat, 21 May 2022 08:57:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE949410F1; Sat, 21 May 2022 08:57:06 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 1B1EB40156; Sat, 21 May 2022 08:57:04 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L4vWW558kzjWwR; Sat, 21 May 2022 14:56:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 21 May 2022 14:57:00 +0800 From: "Min Hu (Connor)" To: CC: Huisong Li , , Min Hu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Bruce Richardson Subject: [PATCH] ethdev: fix push new event Date: Sat, 21 May 2022 14:55:48 +0800 Message-ID: <20220521065549.33451-1-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- lib/ethdev/rte_ethdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index cea2f0b498..f555647c7a 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -4816,9 +4816,8 @@ rte_eth_dev_probing_finish(struct rte_eth_dev *dev) if (rte_eal_process_type() == RTE_PROC_SECONDARY) eth_dev_fp_ops_setup(rte_eth_fp_ops + dev->data->port_id, dev); - rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_NEW, NULL); - dev->state = RTE_ETH_DEV_ATTACHED; + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_NEW, NULL); } int -- 2.33.0