Subject: Re: [RFC net-next] net/flow_offload: allow user to offload tc action to net device

From: Ido Schimmel <[email-masked]>
Date: Thu, 29 Apr 2021 19:49:25 +0300

On Thu, Apr 29, 2021 at 10:10:14AM +0200, Simon Horman wrote:
> From: Baowen Zheng <[email-masked]>
> 
> Allow use of flow_indr_dev_register/flow_indr_dev_setup_offload to offload
> tc actions independent of flows.
> 
> The motivation for this work is to prepare for using TC police action
> instances to provide hardware offload of OVS metering feature - which calls
> for policers that may be used my multiple flows and whose lifecycle is

s/my/by/

> independent of any flows that use them.

Can you share an example of the tc commands? You might be able to
achieve what you want by patching NFP to take into account the policer
index in 'struct flow_action_entry'. Seems that it currently assumes
that each policer is a new policer.

FTR, I do support the overall plan to offload actions independent of
flows and to associate stats with actions.

> 
> This patch includes basic changes to offload drivers to return EOPNOTSUPP
> if this feature is used - it is not yet supported by any driver.
> 
> Signed-off-by: Baowen Zheng <[email-masked]>
> Signed-off-by: Louis Peens <[email-masked]>
> Signed-off-by: Simon Horman <[email-masked]>

[...]

> diff --git a/include/net/tc_act/tc_police.h b/include/net/tc_act/tc_police.h
> index 72649512dcdd..6309519bf9d4 100644
> --- a/include/net/tc_act/tc_police.h
> +++ b/include/net/tc_act/tc_police.h
> @@ -53,6 +53,11 @@ static inline bool is_tcf_police(const struct tc_action *act)
>  	return false;
>  }
>  
> +static inline u32 tcf_police_index(const struct tc_action *act)
> +{
> +	return act->tcfa_index;
> +}

Any reason this is part of the patch? Looks like nobody is using it.

> +
>  static inline u64 tcf_police_rate_bytes_ps(const struct tc_action *act)
>  {
>  	struct tcf_police *police = to_police(act);