Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving tunnel_key_net_id when registering act_tunnel_key_ops. And then remove the walk and lookup hook functions in act_tunnel_key. Signed-off-by: Zhengchao Shao <shaozhengchao@xxxxxxxxxx> --- net/sched/act_tunnel_key.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 856dc23cef8c..47bc251c82ec 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -770,23 +770,6 @@ static int tunnel_key_dump(struct sk_buff *skb, struct tc_action *a, return -1; } -static int tunnel_key_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); - - return tcf_idr_search(tn, a, index); -} - static void tcf_tunnel_encap_put_tunnel(void *priv) { struct ip_tunnel_info *tunnel = priv; @@ -845,13 +828,12 @@ static int tcf_tunnel_key_offload_act_setup(struct tc_action *act, static struct tc_action_ops act_tunnel_key_ops = { .kind = "tunnel_key", .id = TCA_ID_TUNNEL_KEY, + .net_id = &tunnel_key_net_id, .owner = THIS_MODULE, .act = tunnel_key_act, .dump = tunnel_key_dump, .init = tunnel_key_init, .cleanup = tunnel_key_release, - .walk = tunnel_key_walker, - .lookup = tunnel_key_search, .offload_act_setup = tcf_tunnel_key_offload_act_setup, .size = sizeof(struct tcf_tunnel_key), }; -- 2.17.1