Re: [PATCH net-next v12 03/15] net/sched: act_api: Update tc_action_ops to account for P4 actions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2024-02-25 at 11:54 -0500, Jamal Hadi Salim wrote:
> The initialisation of P4TC action instances require access to a struct
> p4tc_act (which appears in later patches) to help us to retrieve
> information like the P4 action parameters etc. In order to retrieve
> struct p4tc_act we need the pipeline name or id and the action name or id.
> Also recall that P4TC action IDs are P4 and are net namespace specific and
> not global like standard tc actions.
> The init callback from tc_action_ops parameters had no way of
> supplying us that information. To solve this issue, we decided to create a
> new tc_action_ops callback (init_ops), that provies us with the
> tc_action_ops  struct which then provides us with the pipeline and action
> name. 

The new init ops looks a bit unfortunate. I *think* it would be better
adding the new argument to the existing init op

> In addition we add a new refcount to struct tc_action_ops called
> dyn_ref, which accounts for how many action instances we have of a specific
> action.
> 
> Co-developed-by: Victor Nogueira <victor@xxxxxxxxxxxx>
> Signed-off-by: Victor Nogueira <victor@xxxxxxxxxxxx>
> Co-developed-by: Pedro Tammela <pctammela@xxxxxxxxxxxx>
> Signed-off-by: Pedro Tammela <pctammela@xxxxxxxxxxxx>
> Signed-off-by: Jamal Hadi Salim <jhs@xxxxxxxxxxxx>
> Reviewed-by: Vlad Buslov <vladbu@xxxxxxxxxx>
> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>
> ---
>  include/net/act_api.h |  6 ++++++
>  net/sched/act_api.c   | 14 +++++++++++---
>  2 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/include/net/act_api.h b/include/net/act_api.h
> index c839ff57c..69be5ed83 100644
> --- a/include/net/act_api.h
> +++ b/include/net/act_api.h
> @@ -109,6 +109,7 @@ struct tc_action_ops {
>  	char    kind[ACTNAMSIZ];
>  	enum tca_id  id; /* identifier should match kind */
>  	unsigned int	net_id;
> +	refcount_t p4_ref;
>  	size_t	size;
>  	struct module		*owner;
>  	int     (*act)(struct sk_buff *, const struct tc_action *,
> @@ -120,6 +121,11 @@ struct tc_action_ops {
>  			struct nlattr *est, struct tc_action **act,
>  			struct tcf_proto *tp,
>  			u32 flags, struct netlink_ext_ack *extack);
> +	/* This should be merged with the original init action */
> +	int     (*init_ops)(struct net *net, struct nlattr *nla,
> +			    struct nlattr *est, struct tc_action **act,
> +			   struct tcf_proto *tp, struct tc_action_ops *ops,

shouldn't the 'ops' argument be 'const'?

Thanks,

Paolo






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux