Re: [PATCH net-next 01/22] net: sched: act_api: implement generic walker and search for tc action

From: Jamal Hadi Salim
Date: Fri Sep 02 2022 - 10:27:01 EST


On Fri, Sep 2, 2022 at 7:22 AM Zhengchao Shao <shaozhengchao@xxxxxxxxxx> wrote:
>
> Being able to get tc_action_net by using net_id stored in tc_action_ops
> and execute the generic walk/search function, add __tcf_generic_walker()
> and __tcf_idr_search() helpers.
>

These are nice cleanups.
Can you please run all tdc tests for all changes you are making to
the tc subsystem? Maybe do a kindness and add more tests.

Just small opinions below. Otherwise you can add my ACK.

> Signed-off-by: Zhengchao Shao <shaozhengchao@xxxxxxxxxx>
> ---
> include/net/act_api.h | 1 +
> net/sched/act_api.c | 48 +++++++++++++++++++++++++++++++++++++------
> 2 files changed, 43 insertions(+), 6 deletions(-)
>
> diff --git a/include/net/act_api.h b/include/net/act_api.h
> index 9cf6870b526e..a79d6e58519e 100644
\

> @@ -926,7 +945,8 @@ int tcf_register_action(struct tc_action_ops *act,
> struct tc_action_ops *a;
> int ret;
>
> - if (!act->act || !act->dump || !act->init || !act->walk || !act->lookup)
> + if (!act->act || !act->dump || !act->init ||
> + (!act->net_id && (!act->walk || !act->lookup)))

I can understand net_id, but why && (!act->walk || !act->lookup) ?
Assumedly they are now optional, no?


> + if (ops->walk) {
> + err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack);
> + } else {
> + err = __tcf_generic_walker(net, skb, &dcb, RTM_DELACTION, ops, extack);
> + }

Bikeshed mod: those braces.

cheers,
jamal