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 51532A0C3F; Thu, 15 Apr 2021 14:04:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C232A16221C; Thu, 15 Apr 2021 14:04:00 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 615E4162219 for ; Thu, 15 Apr 2021 14:03:59 +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) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id C4F9A7F523; Thu, 15 Apr 2021 15:03:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru C4F9A7F523 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1618488238; bh=yZxfvsXyTy77H3Al7lVkwuKgw+5APq57pGjN/+d8bPk=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=l2iwt1eINTL4V6EKVt02egmfaXUO1KH7DG7lHzEerSVaU2XhM8WO+vHhuybLQPEiU wi16mHZQ12Ktmcrsk2LqEJiHo5GxPWfE2zP0o1wdXpKObRSU55cotTKkg/boN/iGO6 3icSaYED46mWOm0ec+BYVgu+b12cOgDzut3dlas0= To: Thomas Monjalon Cc: "Min Hu (Connor)" , dev@dpdk.org, ferruh.yigit@intel.com References: <1618046334-39857-1-git-send-email-humin29@huawei.com> <1618447925-12168-1-git-send-email-humin29@huawei.com> <2252218.jVnlyW2HoW@thomas> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Thu, 15 Apr 2021 15:03:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <2252218.jVnlyW2HoW@thomas> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v4] ethdev: add sanity checks in control APIs 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 4/15/21 2:57 PM, Thomas Monjalon wrote: > 15/04/2021 10:15, Andrew Rybchenko: >>> RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP); >> In theory, the first argument is sufficient to make the ops >> check, but I think it is the right solution to keep it as is >> since current tendency is to check operation support when >> driver callback is really required and we're going to use it. >> However, if we do it just after port_id check, we'll have a >> way to check for callback support without any side effects >> if we provide invalid argument value. I.e. if -ENOTSUP is >> returned, callback is not supported, if -EINVAL, callback is >> supported (but argument is invalid and nothing done). >> However, it looks a bit fragile and not always possible. >> Thoughts on it are welcome. > Sorry I don't understand it fully. > You say we should check for ENOTSUP at the very beginning? I'm just trying to consider it and understand if it would be right or wrong.