[PATCH] app/testpmd: register metadata dynfield on modify field

Ferruh Yigit ferruh.yigit at intel.com
Thu Mar 3 13:20:38 CET 2022


On 3/1/2022 11:51 AM, Dariusz Sosnowski wrote:
> This patch adds implicit registration of metadata dynamic field and flag

Hi Dariusz,

metaday dynamic field is explicitly registered when testpmd
command used to enable tx metadata, or rte flow rule created
with "set_meta" action.

Can you please document more when this implicit enablement
is required? And why that case doesn't cover above explicit
enable cases?

> whenever a modify_field action with META as source and/or destination
> field is used.
> 

According below code it is only registered in the DST_TYPE block,
not is 'else' (which seems src) leg, is this OK?

> Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
> Reviewed-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
> ---
>   app/test-pmd/cmdline_flow.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 4f7a9f17f9..dd38a635b0 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -8347,6 +8347,7 @@ parse_vc_modify_field_id(struct context *ctx, const struct token *token,
>   {
>   	struct rte_flow_action_modify_field *action_modify_field;
>   	unsigned int i;
> +	int ret;
>   
>   	(void)token;
>   	(void)buf;
> @@ -8362,9 +8363,15 @@ parse_vc_modify_field_id(struct context *ctx, const struct token *token,
>   	if (!ctx->object)
>   		return len;
>   	action_modify_field = ctx->object;
> -	if (ctx->curr == ACTION_MODIFY_FIELD_DST_TYPE_VALUE)
> +	if (ctx->curr == ACTION_MODIFY_FIELD_DST_TYPE_VALUE) {
>   		action_modify_field->dst.field = (enum rte_flow_field_id)i;
> -	else
> +		if (action_modify_field->dst.field == RTE_FLOW_FIELD_META) {
> +			ret = rte_flow_dynf_metadata_register();
> +			if (ret < 0)
> +				return -1;
> +		}
> +
> +	} else
>   		action_modify_field->src.field = (enum rte_flow_field_id)i;
>   	return len;
>   }



More information about the dev mailing list