From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.7 required=3.0 tests=BAYES_00,DKIM_ADSP_DISCARD, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D316C433EF for ; Fri, 17 Sep 2021 11:29:29 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 05AB9610E9 for ; Fri, 17 Sep 2021 11:29:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 05AB9610E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=oktetlabs.ru Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42AE8406B4; Fri, 17 Sep 2021 13:29:27 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id E733740689 for ; Fri, 17 Sep 2021 13:29:25 +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 7B2F57F4E2; Fri, 17 Sep 2021 14:29:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 7B2F57F4E2 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1631878165; bh=WLO4XZvYOLPRDADQDtEnh9gTLJCqRwPVYaNgqd002JY=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=FYRvOIz29089+8XA0cZpLQWsCRRCIX6Ncn6yEz9eWeJCAU0AVPl4PEqSnCW6snGbD BMUueAAnDgl+tu0aA3YIO6rTXvzUVl5ZohTMJ42461ZjYIObn32okYCVWpoY/+1J5J sbvFrliJEb102p6ohQPTKW9kTcLJOEWpoIPfrHRo= To: Xueming Li , dev@dpdk.org Cc: Ferruh Yigit , "\"Singh, Aman Deep" , Thomas Monjalon References: <20210727034134.20556-1-xuemingl@nvidia.com> <20210917093915.350863-1-xuemingl@nvidia.com> <20210917093915.350863-2-xuemingl@nvidia.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <781a12fa-8d14-465f-1cbe-0406a0ab0ae6@oktetlabs.ru> Date: Fri, 17 Sep 2021 14:29:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210917093915.350863-2-xuemingl@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 1/2] ethdev: queue release callback optional 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 9/17/21 12:39 PM, Xueming Li wrote: > Some drivers don't need Rx and Tx queue release callback, make it > optional. > > Signed-off-by: Xueming Li LGTM, but please, consider one nit below Reviewed-by: Andrew Rybchenko > --- > lib/ethdev/rte_ethdev.c | 48 +++++++++++++++++------------------------ > 1 file changed, 20 insertions(+), 28 deletions(-) > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index daf5ca9242..2f316d1646 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -905,12 +905,11 @@ eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) > return -(ENOMEM); > } > } else if (dev->data->rx_queues != NULL && nb_queues != 0) { /* re-configure */ > - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP); > - > rxq = dev->data->rx_queues; > > - for (i = nb_queues; i < old_nb_queues; i++) > - (*dev->dev_ops->rx_queue_release)(rxq[i]); > + if (dev->dev_ops->rx_queue_release != NULL) > + for (i = nb_queues; i < old_nb_queues; i++) > + (*dev->dev_ops->rx_queue_release)(rxq[i]); Since 'if' body has more than one line, I'd add curly brackets around to make it a bit easier to read and more robust against future changes. Similar note is applicable to many similar cases in the patch.