[PATCH v1 1/2] net/ntnic: fix incorrect error message

Stephen Hemminger stephen at networkplumber.org
Fri Nov 22 18:01:13 CET 2024


On Fri, 22 Nov 2024 17:50:21 +0100
Serhii Iliushyk <sil-plv at napatech.com> wrote:

> diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c
> index d4993eb58a..fd470ddd35 100644
> --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c
> +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c
> @@ -81,6 +81,20 @@ static const struct {
>  	/* 27 */ { "Internal creation of a tunnel end point port failed" },
>  	/* 28 */ { "Unknown or unsupported flow action received" },
>  	/* 29 */ { "Removing flow failed" },
> +	/* 30 */ { "No output queue specified. Ignore this flow offload and uses default queue"},
> +	/* 31 */ { "No output queue found"},
> +	/* 32 */ { "Unsupported EtherType or rejected caused by offload policy"},
> +	/* 33 */ { "Destination port specified is invalid or not reachable from this NIC"},
> +	/* 34 */ { "Partial offload is not supported in this configuration"},
> +	/* 35 */ { "Match failed because of CAT CAM exhausted"},
> +	/* 36 */ { "Match failed because of CAT CAM Key clashed with an existing KCC Key"},
> +	/* 37 */ { "Match failed because of CAT CAM write failed"},
> +	/* 38 */ { "Partial flow mark too big for device"},
> +	/* 39 */ { "Invalid priority value"},
> +	/* 40 */ { "Multiple port_id actions for one flow is not supported"},
> +	/* 41 */ { "Too long hash key for RSS"},
> +	/* 42 */ { "Action AGE is not supported for flow in group 0"},
> +	/* 43 */ { "Unknown error"},
>  };
>  

Tables like this often get out of sync. Some suggestions.

Use index base initializers, like:

const char *dbg_res_descr[] = {
	[ RES_QUEUE] = "RES_QUEUE",
	[ RES_CAT_CFN] =  "RES_CAT_CFN",

PS, why is this string table not static?

Still have to handle NULL string if table ends up missing an element.

Should also check that table has all the strings:

Like:
static_assert(RTE_DIM(err_msg) == ERR_MSG_NO_MSG);

void flow_nic_set_error(enum flow_nic_err_msg_e msg, struct rte_flow_error *error)
{
	assert(msg < ERR_MSG_NO_MSG);



1. 


More information about the dev mailing list