forked from mirrors/linux
		
	net: sched: act: add extack for lookup callback
This patch adds extack support for act lookup callback api. This prepares to handle extack support inside each specific act implementation. Cc: David Ahern <dsahern@gmail.com> Signed-off-by: Alexander Aring <aring@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									589dad6d71
								
							
						
					
					
						commit
						331a9295de
					
				
					 18 changed files with 37 additions and 19 deletions
				
			
		| 
						 | 
					@ -87,7 +87,8 @@ struct tc_action_ops {
 | 
				
			||||||
		       struct tcf_result *);
 | 
							       struct tcf_result *);
 | 
				
			||||||
	int     (*dump)(struct sk_buff *, struct tc_action *, int, int);
 | 
						int     (*dump)(struct sk_buff *, struct tc_action *, int, int);
 | 
				
			||||||
	void	(*cleanup)(struct tc_action *);
 | 
						void	(*cleanup)(struct tc_action *);
 | 
				
			||||||
	int     (*lookup)(struct net *net, struct tc_action **a, u32 index);
 | 
						int     (*lookup)(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								  struct netlink_ext_ack *extack);
 | 
				
			||||||
	int     (*init)(struct net *net, struct nlattr *nla,
 | 
						int     (*init)(struct net *net, struct nlattr *nla,
 | 
				
			||||||
			struct nlattr *est, struct tc_action **act, int ovr,
 | 
								struct nlattr *est, struct tc_action **act, int ovr,
 | 
				
			||||||
			int bind, struct netlink_ext_ack *extack);
 | 
								int bind, struct netlink_ext_ack *extack);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -901,7 +901,7 @@ static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla,
 | 
				
			||||||
		goto err_out;
 | 
							goto err_out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err = -ENOENT;
 | 
						err = -ENOENT;
 | 
				
			||||||
	if (ops->lookup(net, &a, index) == 0)
 | 
						if (ops->lookup(net, &a, index, extack) == 0)
 | 
				
			||||||
		goto err_mod;
 | 
							goto err_mod;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	module_put(ops->owner);
 | 
						module_put(ops->owner);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -374,7 +374,8 @@ static int tcf_bpf_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								  struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, bpf_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, bpf_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,7 +184,8 @@ static int tcf_connmark_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								       struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, connmark_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, connmark_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -638,7 +638,8 @@ static int tcf_csum_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								   struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, csum_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, csum_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -208,7 +208,8 @@ static int tcf_gact_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_gact_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_gact_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								   struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, gact_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, gact_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -831,7 +831,8 @@ static int tcf_ife_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								  struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, ife_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, ife_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -310,7 +310,8 @@ static int tcf_ipt_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								  struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, ipt_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, ipt_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -358,7 +359,8 @@ static int tcf_xt_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								 struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, xt_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, xt_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -272,7 +272,8 @@ static int tcf_mirred_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_mirred_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_mirred_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								     struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, mirred_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, mirred_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -285,7 +285,8 @@ static int tcf_nat_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								  struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, nat_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, nat_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -426,7 +426,8 @@ static int tcf_pedit_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								    struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, pedit_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, pedit_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -305,7 +305,8 @@ static int tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a,
 | 
				
			||||||
	return -1;
 | 
						return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_police_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_police_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								     struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, police_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, police_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,7 +209,8 @@ static int tcf_sample_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								     struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, sample_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, sample_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -177,7 +177,8 @@ static int tcf_simp_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								   struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, simp_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, simp_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -215,7 +215,8 @@ static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								      struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, skbedit_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, skbedit_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,8 @@ static int tcf_skbmod_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								     struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, skbmod_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, skbmod_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -298,7 +298,8 @@ static int tunnel_key_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								     struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -274,7 +274,8 @@ static int tcf_vlan_walker(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
	return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
						return tcf_generic_walker(tn, skb, cb, type, ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index)
 | 
					static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index,
 | 
				
			||||||
 | 
								   struct netlink_ext_ack *extack)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tc_action_net *tn = net_generic(net, vlan_net_id);
 | 
						struct tc_action_net *tn = net_generic(net, vlan_net_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue