From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CF6A9A04DB; Wed, 14 Oct 2020 18:01:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 11CE01DB10; Wed, 14 Oct 2020 18:01:11 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C38B71DAF7; Wed, 14 Oct 2020 18:01:07 +0200 (CEST) IronPort-SDR: fgvLZkq3lK5agN59nZr54Yjy3QvFqcZTNlRl7M1high2PXA7zL5RShYn5tz6nA4AASjVb6YMfv /n5pE7WPr5Rw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="166197352" X-IronPort-AV: E=Sophos;i="5.77,375,1596524400"; d="scan'208";a="166197352" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 09:01:05 -0700 IronPort-SDR: J170cpJpa4cfc1LzEm/mntvVSey2ZvtMrZ3prwt2trmZWErEV3xcwZsIj4xfiXQzO6jVmDYwrv 6sSk2Nc2htbw== X-IronPort-AV: E=Sophos;i="5.77,375,1596524400"; d="scan'208";a="345711571" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.2.249]) ([10.252.2.249]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 09:01:03 -0700 To: Andrew Rybchenko , dev@dpdk.org Cc: Thomas Monjalon , "techboard@dpdk.org" References: <1602600818-7473-1-git-send-email-arybchenko@solarflare.com> <8f8907cf-d905-c867-cf42-694d16b0a0cf@intel.com> <236f87f5-c798-4d83-b821-abed61253191@oktetlabs.ru> <746882bb-79ee-a368-4dee-20846f4f9070@intel.com> From: Ferruh Yigit Message-ID: <175a319b-92a8-39bb-711f-e1cbddb6f1f6@intel.com> Date: Wed, 14 Oct 2020 17:01:00 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] ethdev: unify error code if port ID is invalid X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 10/14/2020 7:16 AM, Andrew Rybchenko wrote: > On 10/13/20 7:12 PM, Ferruh Yigit wrote: >> On 10/13/2020 4:39 PM, Andrew Rybchenko wrote: >>> On 10/13/20 6:32 PM, Ferruh Yigit wrote: >>>> On 10/13/2020 3:53 PM, Andrew Rybchenko wrote: >>>>> Use ENODEV as the error code if specified port ID is invalid. >>>>> >>>>> Signed-off-by: Andrew Rybchenko >>>>> --- >>>>>    lib/librte_ethdev/rte_ethdev.c | 44 ++++++++++++++++---------------- >>>>>    lib/librte_ethdev/rte_ethdev.h | 46 >>>>> +++++++++++++++++++++++----------- >>>>>    2 files changed, 54 insertions(+), 36 deletions(-) >>>>> >>>>> diff --git a/lib/librte_ethdev/rte_ethdev.c >>>>> b/lib/librte_ethdev/rte_ethdev.c >>>>> index 5b7979a3b8..1f862f918a 100644 >>>>> --- a/lib/librte_ethdev/rte_ethdev.c >>>>> +++ b/lib/librte_ethdev/rte_ethdev.c >>>>> @@ -784,7 +784,7 @@ rte_eth_dev_get_name_by_port(uint16_t port_id, >>>>> char *name) >>>>>    { >>>>>        char *tmp; >>>>>    -    RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); >>>>> +    RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >>>> >>>> Thanks Andrew, +1 to this error unification. >>>> >>>> This will be API change without deprecation notice, cc'ed techboard >>>> for it. >>> >>> Yes, thanks. >>> >>>> >>>> If this should (almost) always return '-ENODEV', does it make sense to >>>> make another wrapper macro for it, to prevent later other error types >>>> used again. >>> >>> Unlikely, since most likely the line will be simply copied. >>> RTE_ETH_VALID_PORTID_OR_ERR_RET will remain in any case, so >>> it will be possible to misuse it anyway. >>> >> >> Agree it won't prevent misuse completely but may help, anyway I don't >> have a strong opinion here, if you think that is not needed, that is OK. >> >>>> >>>> And there are a few instances returning '-1', are they left >>>> intentionally? >>> >>> Yes. Inside ethdev it is either socket_id or fd in these cases. >>> >> >> Can't those two also updated to return '-ENODEV' when 'port_id' is not >> valid? > > I think no. > 1. rte_eth_dev_socket_id() should not return -ENODEV since it > can return -1 even if port ID is valid if fact (I see > printouts from time to time if I'm not mistaken) and > typically handled as unspecified NUMA node ID. > 2. rte_eth_dev_rx_intr_ctl_q_get_fd() explicitly says that -1 > is returned on error. The function is still experimental > and we can change it, but I'd say that -1 match typical > behavior for functions returning file descriptor. > > Let's limit the changeset to switch from EINVAL to ENODEV. > OK. It looks like there is no objection on the API part, so I will proceed with it but will get as one of the last a few patches before -rc1 to prevent other existing ethdev patches to conflict.