[dpdk-dev] [PATCH v2 08/10] net/sfc: support action VXLAN ENCAP in MAE backend

Thomas Monjalon thomas at monjalon.net
Thu Apr 1 01:21:19 CEST 2021


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)

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?




More information about the dev mailing list