DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <Ivan.Malov@oktetlabs.ru>
To: Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>
Cc: dev@dpdk.org, ferruh.yigit@intel.com
Subject: Re: [dpdk-dev] [PATCH v2 08/10] net/sfc: support action VXLAN ENCAP in MAE backend
Date: Thu, 1 Apr 2021 02:36:42 +0300	[thread overview]
Message-ID: <0959be74-a9ef-0530-0aaa-a5bfc9a06f73@oktetlabs.ru> (raw)
In-Reply-To: <5393460.v3xPdy9A3h@thomas>

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

  reply	other threads:[~2021-03-31 23:36 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  9:31 [dpdk-dev] [PATCH 01/10] ethdev: reuse header definition in flow pattern item ETH Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 02/10] ethdev: reuse header definition in flow pattern item VLAN Ivan Malov
2021-03-16 23:05   ` Ori Kam
2021-03-12  9:31 ` [dpdk-dev] [PATCH 03/10] net: clarify endianness of 32-bit fields in VXLAN headers Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 04/10] ethdev: reuse header definition in flow pattern item VXLAN Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 05/10] common/sfc_efx/base: support encap. header provisioning Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 06/10] common/sfc_efx/base: support adding action ENCAP to a set Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 07/10] net/sfc: change MAE rule actions parse API Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 08/10] net/sfc: support action VXLAN ENCAP in MAE backend Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 09/10] common/sfc_efx/base: support adding action DECAP to a set Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 10/10] net/sfc: support action VXLAN DECAP in transfer rules Ivan Malov
2021-03-12 11:07 ` [dpdk-dev] [PATCH v2 01/10] ethdev: reuse header definition in flow pattern item ETH Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 02/10] ethdev: reuse header definition in flow pattern item VLAN Ivan Malov
2021-03-16 16:58     ` Ferruh Yigit
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 03/10] net: clarify endianness of 32-bit fields in VXLAN headers Ivan Malov
2021-03-16 17:34     ` Ferruh Yigit
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 04/10] ethdev: reuse header definition in flow pattern item VXLAN Ivan Malov
2021-03-16 17:35     ` Ferruh Yigit
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 05/10] common/sfc_efx/base: support encap. header provisioning Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 06/10] common/sfc_efx/base: support adding action ENCAP to a set Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 07/10] net/sfc: change MAE rule actions parse API Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 08/10] net/sfc: support action VXLAN ENCAP in MAE backend Ivan Malov
2021-03-16 17:10     ` Ivan Malov
2021-03-16 17:15       ` Ferruh Yigit
2021-03-31 23:21     ` Thomas Monjalon
2021-03-31 23:36       ` Ivan Malov [this message]
2021-04-01  6:38         ` Andrew Rybchenko
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 09/10] common/sfc_efx/base: support adding action DECAP to a set Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 10/10] net/sfc: support action VXLAN DECAP in transfer rules Ivan Malov
2021-03-16 16:58   ` [dpdk-dev] [PATCH v2 01/10] ethdev: reuse header definition in flow pattern item ETH Ferruh Yigit
2021-03-16 17:38   ` Ferruh Yigit
2021-03-17  6:40     ` Andrew Rybchenko
2021-03-22  9:01       ` Ferruh Yigit
2021-03-22 10:10         ` Andrew Rybchenko
2021-03-22 16:49   ` Ferruh Yigit
2021-03-16 23:03 ` [dpdk-dev] [PATCH " Ori Kam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0959be74-a9ef-0530-0aaa-a5bfc9a06f73@oktetlabs.ru \
    --to=ivan.malov@oktetlabs.ru \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).