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 31241A0A0C; Mon, 5 Jul 2021 05:18:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D931540686; Mon, 5 Jul 2021 05:18:58 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id C6BC840141 for ; Mon, 5 Jul 2021 05:18:57 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GJ9mw5vgDzZnHB; Mon, 5 Jul 2021 11:15:44 +0800 (CST) Received: from dggema767-chm.china.huawei.com (10.1.198.209) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 5 Jul 2021 11:18:51 +0800 Received: from [10.66.74.184] (10.66.74.184) by dggema767-chm.china.huawei.com (10.1.198.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 5 Jul 2021 11:18:51 +0800 To: Thomas Monjalon CC: , , , References: <1620460836-38506-1-git-send-email-lihuisong@huawei.com> <1644089.D8zZfYZZjn@thomas> From: Huisong Li Message-ID: <62f7ec14-50a8-7404-d462-c40502c07348@huawei.com> Date: Mon, 5 Jul 2021 11:18:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <1644089.D8zZfYZZjn@thomas> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.66.74.184] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggema767-chm.china.huawei.com (10.1.198.209) X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [RFC] lib/ethdev: add dev configured flag 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 Sender: "dev" 在 2021/7/5 4:05, Thomas Monjalon 写道: > 08/05/2021 10:00, Huisong Li: >> Currently, if dev_configure is not invoked or fails to be invoked, users >> can still invoke dev_start successfully. This patch adds a "dev_configured" >> flag in "rte_eth_dev_data" to control whether dev_start can be invoked. > [...] >> --- a/lib/ethdev/rte_ethdev_core.h >> +++ b/lib/ethdev/rte_ethdev_core.h >> @@ -167,7 +167,11 @@ struct rte_eth_dev_data { >> scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */ >> all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ >> dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ >> - lro : 1; /**< RX LRO is ON(1) / OFF(0) */ >> + lro : 1, /**< RX LRO is ON(1) / OFF(0) */ >> + dev_configured : 1; >> + /**< Device configuration state: >> + * CONFIGURED(1) / NOT CONFIGURED(0). >> + */ > Why not using "enum rte_eth_dev_state"? > Because rte_eth_dev.state is not shared between processes? It doesn't feel right. "enum rte_eth_dev_state" is private to the primary and secondary processes and can be independently controlled. However, the secondary process does not make resource allocations and does not call dev_configure(). These are done by the primary process and  can be obtained or used by the secondary process. Like "dev_started" in struct rte_eth_dev_data. > > > > .