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 9D53AA0597; Wed, 8 Apr 2020 14:49:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B76D1C11D; Wed, 8 Apr 2020 14:49:28 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E5EA01C11A for ; Wed, 8 Apr 2020 14:49:26 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 804DA5C0257; Wed, 8 Apr 2020 08:49:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 08 Apr 2020 08:49:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=Af5xb8ZPlCGGEZX4SN8UicVe0B2dMSMlNgGpVMcy9Rs=; b=Dji+r6fgaigg edop2p28NaXbUwCQ6RYV+TP5QpbmFX/J1ZOHZxO1N8RRmqNvuCjvjz550TaXlsIT gg4eIOk4U8JtRjYZ+YcLw4oeGBrGhUbKFA28Zq6vyCjZ3M1+nosUF3MbtY8DE+w4 a24qQHce1varvqRVwEOir3dyDbqmmro= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Af5xb8ZPlCGGEZX4SN8UicVe0B2dMSMlNgGpVMcy9 Rs=; b=soTuFoSjj0x1lBcM+dD/fFEiVzIAXbU8A0+w6TJNdZxDyOpiHaJPHapNB vjXN4bD/kVEW9Fe5MrRntI94odeUL9QQHBm2vlSXLxNN9c35+iSMZYyaEYq8Z5RW xsRUFrDBKcS5VnNCHiHSsQ54LekAFq/q87T6GJYeQ0m5TdV1ADc4YkcP8Qfn+ZE5 C+qnZCzWewL7HLPFIYFu3TJ0NZ7msa4x6II8izUeNmsGEenYPz3EVGzFlxk/wRVp SySIFRmuF6Xz1BbPq8he1Xxt76fpSOD227H1kPsSRcez22T/dxCfuf2DcBVKpoGZ gArVTaU8p/24yQqMljb357AmoBwmg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejgdehiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 2F999328006C; Wed, 8 Apr 2020 08:49:25 -0400 (EDT) From: Thomas Monjalon To: Asaf Penso Cc: dev@dpdk.org, Ferruh Yigit , Andrew Rybchenko Date: Wed, 08 Apr 2020 14:49:20 +0200 Message-ID: <3105481.44csPzL39Z@thomas> In-Reply-To: References: <98CBD80474FA8B44BF855DF32C47DC35C60F3C@smartserver.smartshare.dk> <20200407222637.55289-2-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: deduplicate functions to get link infos 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" 08/04/2020 07:21, Asaf Penso: > From: Thomas Monjalon > > +static int > > +get_link_infos(uint16_t port_id, struct rte_eth_link *eth_link, int wait) > > I would recommend renaming to link_get_infos, to have the same naming > convention as rte_eth_*link_get* and rte_eth_*link_get*_nowait No strong opinion. get_link_infos looks more natural english. If others prefer to have a sort of consistency, fine. > > +{ > > + struct rte_eth_dev *dev; > > + > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > > + dev = &rte_eth_devices[port_id]; > > + > > + if (dev->data->dev_conf.intr_conf.lsc && > > + dev->data->dev_started) > > + rte_eth_linkstatus_get(dev, eth_link); > > + else { > > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > > >link_update, -ENOTSUP); > > + (*dev->dev_ops->link_update)(dev, wait); > > + *eth_link = dev->data->dev_link; > > + } > > + > > + return 0; > > Since it's a static function, I think it can return void, No, it cannot return void because some errors may be returned with the macros RTE_ETH_VALID_PORTID_OR_ERR_RET and RTE_FUNC_PTR_OR_ERR_RET. > and the calling functions can decide what to return, > but it's a matter of taste. > > Do we want to check that the return value for eth_link > is not NULL and return -1 in case it is? eth_link must not be NULL. It is allocated by the caller.