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 F0D25A034F; Thu, 1 Apr 2021 01:36:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 785F7140ED3; Thu, 1 Apr 2021 01:36:46 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 9C51240142 for ; Thu, 1 Apr 2021 01:36:44 +0200 (CEST) Received: from [192.168.45.100] (unknown [188.242.7.54]) (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 DF6FD7F5AD; Thu, 1 Apr 2021 02:36:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru DF6FD7F5AD DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1617233803; bh=cNyhM6pTpzOK/6nUcDywfNpOMYQMCmhYfKpUNaRd9Aw=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=YgpOh3X2+lKzARVZiyGhJBVBT5d+vwkq9WphGnhMgkkd+1/p4kqGjHiV/olq90W+d Gy5U2/HnsT2dMDtMK3vfotnfJu/doGZHDicK1h2rr/vUbRT4xKGNBrqE/BxmsL+3+o JVtsXy1r/cmy2hKoGWFkPoxdAxdsSamh9yMch35w= To: Thomas Monjalon , Andrew Rybchenko , Andy Moreton Cc: dev@dpdk.org, ferruh.yigit@intel.com References: <20210312093143.28186-1-ivan.malov@oktetlabs.ru> <20210312110745.31721-1-ivan.malov@oktetlabs.ru> <20210312110745.31721-8-ivan.malov@oktetlabs.ru> <5393460.v3xPdy9A3h@thomas> From: Ivan Malov Message-ID: <0959be74-a9ef-0530-0aaa-a5bfc9a06f73@oktetlabs.ru> Date: Thu, 1 Apr 2021 02:36:42 +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: <5393460.v3xPdy9A3h@thomas> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 08/10] net/sfc: support action VXLAN ENCAP in MAE backend 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" Hi, On 01/04/2021 02:21, Thomas Monjalon wrote: > 12/03/2021 12:07, Ivan Malov: >> +static int >> +sfc_mae_encap_header_add(struct sfc_adapter *sa, >> + const struct sfc_mae_bounce_eh *bounce_eh, >> + struct sfc_mae_encap_header **encap_headerp) >> +{ >> + struct sfc_mae_encap_header *encap_header; >> + struct sfc_mae *mae = &sa->mae; >> + >> + SFC_ASSERT(sfc_adapter_is_locked(sa)); >> + >> + encap_header = rte_zmalloc("sfc_mae_encap_header", >> + sizeof(*encap_header), 0); >> + if (encap_header == NULL) >> + return ENOMEM; >> + >> + encap_header->size = bounce_eh->size; >> + >> + encap_header->buf = rte_malloc("sfc_mae_encap_header_buf", >> + encap_header->size, 0); >> + if (encap_header->buf == NULL) { >> + rte_free(encap_header); >> + return ENOMEM; >> + } > > Are the error codes positives on purpose? > checkpatch is throwing this warning: > USE_NEGATIVE_ERRNO: return of an errno should typically be negative (ie: return -ENOMEM) Kind of yes, on purpose. It has been like that for a long time already; it's simpler to keep errors positive in all such small internal helpers and then negate the result in the place where rte_flow_error_set() is used. We understand the concern of yours; our code is tested for error path correctness every now and again. If there're some inconsistencies, we are ready to fix such in no time. > Also the base code has a lot of these warnings: > RETURN_PARENTHESES: return is not a function, parentheses are not required > > I guess you cannot do anything to avoid it in base code? Yes, your understanding is correct. Sorry for the inconvenience. -- Ivan M