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 AE0B6A0C4A; Wed, 7 Jul 2021 10:25:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E8C1406B4; Wed, 7 Jul 2021 10:25:22 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 4D72E4069D for ; Wed, 7 Jul 2021 10:25:21 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id B35F97F523; Wed, 7 Jul 2021 11:25:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru B35F97F523 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1625646320; bh=1O1Dli9fKm5ZJJboSBIDjzj9MjapJzkhzzeIfITgdfc=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=ghxsv+MQMnBzAfc40jK8+J1mq8WWka4xjToLlCJxu8oXdJR/MzjgsqewsXn2oFpD5 S/Sg/ziPxGspygH9SuQEBd0qutdBa6hm2gFbwt0lQg0C03L5B97VZVot2JfuAvl+df y1JNeNERv83CX/M4S95u0ih60aAJH6nQ4veo05D4= To: Huisong Li , dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, "david.marchand@redhat.com" , Ray Kinsella References: <1620460836-38506-1-git-send-email-lihuisong@huawei.com> <1625544608-30590-1-git-send-email-lihuisong@huawei.com> <966ec9cd-9142-b40d-b059-b63c8ece66bf@oktetlabs.ru> <759fb9f8-3068-a5a2-e7cb-2445581aa960@huawei.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Wed, 7 Jul 2021 11:25:20 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <759fb9f8-3068-a5a2-e7cb-2445581aa960@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH V2] 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" On 7/7/21 5:55 AM, Huisong Li wrote: > > 在 2021/7/6 16:36, Andrew Rybchenko 写道: >> @David, could you take a look at the ABI breakage warnings for >> the patch. May we ignore it since ABI looks backward >> compatible? Or should be marked as a minor change ABI >> which is backward compatible with DPDK_21? >> >> On 7/6/21 7:10 AM, Huisong Li wrote: >>> Currently, if dev_configure is not called or fails to be called, users >>> can still call dev_start successfully. So it is necessary to have a flag >>> which indicates whether the device is configured, to control whether >>> dev_start can be called and eliminate dependency on user invocation >>> order. >>> >>> The flag stored in "struct rte_eth_dev_data" is more reasonable than >>>   "enum rte_eth_dev_state". "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. So this patch >>> adds a "dev_configured" flag in "rte_eth_dev_data", like "dev_started". >>> >>> Signed-off-by: Huisong Li >> Reviewed-by: Andrew Rybchenko >> >>> --- >>> v1 -> v2: >>>    - adjusting the description of patch. >>> >>> --- >>>   lib/ethdev/rte_ethdev.c      | 16 ++++++++++++++++ >>>   lib/ethdev/rte_ethdev_core.h |  6 +++++- >>>   2 files changed, 21 insertions(+), 1 deletion(-) >>> >>> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c >>> index c607eab..6540432 100644 >>> --- a/lib/ethdev/rte_ethdev.c >>> +++ b/lib/ethdev/rte_ethdev.c >>> @@ -1356,6 +1356,13 @@ rte_eth_dev_configure(uint16_t port_id, >>> uint16_t nb_rx_q, uint16_t nb_tx_q, >>>           return -EBUSY; >>>       } >>>   +    /* >>> +     * Ensure that "dev_configured" is always 0 each time prepare to do >>> +     * dev_configure() to avoid any non-anticipated behaviour. >>> +     * And set to 1 when dev_configure() is executed successfully. >>> +     */ >>> +    dev->data->dev_configured = 0; >>> + >>>        /* Store original config, as rollback required on failure */ >>>       memcpy(&orig_conf, &dev->data->dev_conf, >>> sizeof(dev->data->dev_conf)); >>>   @@ -1606,6 +1613,8 @@ rte_eth_dev_configure(uint16_t port_id, >>> uint16_t nb_rx_q, uint16_t nb_tx_q, >>>       } >>>         rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, >>> dev_conf, 0); >>> +    dev->data->dev_configured = 1; >>> + >> I think it should be inserted before the trace, since tracing >> is intentionally put close to return without any empty lines >> in between. > All right. Do I need to send a patch V3? Since the patch is waiting for resolution for ABI warning, please, send v3 with my Reviewed-by and ack from Konstantin. It will be a bit easier to apply when it is OK to do it.