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 E0A2DA034F; Thu, 1 Apr 2021 08:38:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F49740142; Thu, 1 Apr 2021 08:38:17 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 902084013F for ; Thu, 1 Apr 2021 08:38:15 +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 101FB7F5AC; Thu, 1 Apr 2021 09:38:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 101FB7F5AC DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1617259095; bh=tlXgDJZ6LPBCj7KIsKZrF4Uaxi0GMNGUVqvIr/keu+M=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Jz/53OniRI+YV8ER5oBomunoWKQn1VnOjA/r+Ytao/ppYlU0stEPDlByeLz0aOPaa QHQbGVFz7L2PTp36y+Pbvly/9LZbCYHr7zW/Eifs6elbi1rdzQ5JdxKP9KAPRm5beK ZlE0WqcajEpEF5hmvyl38CjgpXDuLSy3tW4lRHJU= To: Ivan Malov , Thomas Monjalon , 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> <0959be74-a9ef-0530-0aaa-a5bfc9a06f73@oktetlabs.ru> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Thu, 1 Apr 2021 09:38:14 +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: <0959be74-a9ef-0530-0aaa-a5bfc9a06f73@oktetlabs.ru> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US 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" On 4/1/21 2:36 AM, Ivan Malov wrote: > 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. Yes, unfortunately base driver uses positive error codes. The idea here is that interface between DPDK PMD and base driver is much wider than interface between DPDK PMD and ethdev. That's why it is much easier to care about converting from positive to negative on PMD-ethdev border. Also rte_errno is positive. >> Also the base code has a lot of these warnings: >> RETURN_PARENTHESES: return is not a function, parentheses are not >> required Base driver code was initially created for FreeBSD and Solaris which require parenthesis around return value. >> I guess you cannot do anything to avoid it in base code? > > Yes, your understanding is correct. Sorry for the inconvenience. >