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 8C7E7426CE; Fri, 6 Oct 2023 11:03:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 854224068E; Fri, 6 Oct 2023 11:03:38 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id 4EEFE40648; Fri, 6 Oct 2023 11:03:37 +0200 (CEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id CAA885C02A0; Fri, 6 Oct 2023 05:03:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 06 Oct 2023 05:03:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1696583014; x=1696669414; bh=8SApw2jbfHyxFlPkjv/MZHrU0v9yhGmKvYF 13FonThc=; b=hTtOEzu8wJKE++H5UFciI4bB5Vbtnl5ifh8asP0HYay3ZCBZhyr xqXUnixbrDZC7BdDq9VQr3GNFzbjLCGdSYxUQj+QPXl0lT43phiUia4Fw11ERMxC SBg1ULYLuU3gI8wjzOKnantMoD532MIZB1/ysqmZd3fBw8XfqeLdWPEhF/my6CZd GAwJ9zCs66lRR3EFa+42UR+oLHV3xrNH5vqMdgANnG4TZGv7KSJJnMVgSRsLSC0t ATh8lJD8N3XK/MOqlnwlaLf1JlggYuDfId+F/zGCtVtiNes1AmA4F/5eEFioyFfT xnNbUkHGbgYLCNII7m2j7jfoJGBGmkvpzzQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1696583014; x=1696669414; bh=8SApw2jbfHyxFlPkjv/MZHrU0v9yhGmKvYF 13FonThc=; b=XOoF4idcT6VYECX5GZIor5Lr4uoeccQUVBXyy14EgiahrkzLjsU UMRQlY9W6FBQ4qsM8ouWn5gUHgKJ6pJt8dN+zCHwpLv4vtK11ZWVf+6eJYLXcZW9 sQsFZEQzmlSZth29iboldwneOFpY8It7JuGlQpk2XZOldiy6eYEzYmWyzSFY0mAw AzrT8OlK/QI0mNw4DpgEjebCzh6znudAhVMwX0JnxlbihrQXioxdZ253RaOefmbV jO/KeaAM866bFZV1iJqqgMZ3gQoKFW9OFNoKVt1RMN2guSNxAF+rxfOYvNPE6OmY L7yefaz+8kkiJjPJK+WZ8ploZSbeF3ceWFQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrgeeigddutdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfgjfhgggfgtsehtqhertddttdejnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepgedttdeljeejgeffkeekkedtjeevtdehvedtkeeivdeuuedviedu vdelveejueejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Oct 2023 05:03:31 -0400 (EDT) From: Thomas Monjalon To: Mattias =?ISO-8859-1?Q?R=F6nnblom?= Cc: techboard@dpdk.org, Mattias =?ISO-8859-1?Q?R=F6nnblom?= , dev@dpdk.org, Jerin Jacob , techboard@dpdk.org, harry.van.haaren@intel.com, Peter Nilsson , Heng Wang , Naga Harish K S V , Pavan Nikhilesh , Gujjar Abhinandan S , Erik Gabriel Carrillo , Shijith Thotton , Hemant Agrawal , Sachin Saxena , Liang Ma , Peter Mccarthy , Zhirun Yan , David Marchand Subject: Re: [PATCH v5 1/3] lib: introduce dispatcher library Date: Fri, 06 Oct 2023 11:03:29 +0200 Message-ID: <13795063.RDIVbhacDa@thomas> In-Reply-To: References: <20230922073825.351453-2-mattias.ronnblom@ericsson.com> <0c8eaf05-8dc7-4462-a893-2b7019d24fae@lysator.liu.se> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" 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 06/10/2023 10:46, David Marchand: > On Thu, Oct 5, 2023 at 12:09=E2=80=AFPM Mattias R=C3=B6nnblom wrote: > > >> +static int > > >> +evd_lookup_handler_idx(struct rte_dispatcher_lcore *lcore, > > >> + const struct rte_event *event) > > > > > > Wrt DPDK coding tyle, indent is a single tab. > > > Adding an extra tab is recommended when continuing control statements > > > like if()/for()/.. > > > > > > > Sure, but I don't understand why you mention this. >=20 > I wanted to remind the DPDK coding style which I try to more closely > enforce for new code. > indent is off in this file (especially for function prototypes with > multiple tabs used). >=20 > > > > > On the other hand, max accepted length for a line is 100 columns. > > > > > > Wdyt of a single line for this specific case? > > > > > > Are you asking why the evd_lookup_handler_idx() function prototype is > > not a single line? > > > > It would make it long, that's why. Even if 100 wide lines are allowed, > > it doesn't means the author is forced to use such long lines? >=20 > I find it more readable. > If you want to stick to 80 columns, please comply with a single tab for i= ndent. I think this is a case of continuation line, so it should be 2 tabs. We can make it clear in the doc. > > >> +static int > > >> +evd_set_service_runstate(struct rte_dispatcher *dispatcher, int sta= te) > > >> +{ > > >> + int rc; > > >> + > > >> + rc =3D rte_service_component_runstate_set(dispatcher->servic= e_id, > > >> + state); > > >> + > > >> + if (rc !=3D 0) { > > >> + RTE_EDEV_LOG_ERR("Unexpected error %d occurred while= setting " > > >> + "service component run state to %d\= n", rc, > > >> + state); > > >> + RTE_ASSERT(0); > > > > > > Why not propagating the error to callers? > > > > > > > > > > The root cause would be a programming error, hence an assertion is more > > appropriate way to deal with the situation. >=20 > Without building RTE_ENABLE_ASSERT (disabled by default), the code > later in this function will still be executed. Don't forget you are writing a library, so you shouldn't stop runtime because of an error. It is always better to return errors. Assert should be used only for debugging, that's why it is disabled by defa= ult.