mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	xfrm: policy: remove garbage_collect callback
Just call xfrm_garbage_collect_deferred() directly. This gets rid of a write to afinfo in register/unregister and allows to constify afinfo later on. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
		
							parent
							
								
									2b61997aa0
								
							
						
					
					
						commit
						3d7d25a68e
					
				
					 4 changed files with 5 additions and 7 deletions
				
			
		| 
						 | 
					@ -282,7 +282,6 @@ struct xfrm_dst;
 | 
				
			||||||
struct xfrm_policy_afinfo {
 | 
					struct xfrm_policy_afinfo {
 | 
				
			||||||
	unsigned short		family;
 | 
						unsigned short		family;
 | 
				
			||||||
	struct dst_ops		*dst_ops;
 | 
						struct dst_ops		*dst_ops;
 | 
				
			||||||
	void			(*garbage_collect)(struct net *net);
 | 
					 | 
				
			||||||
	struct dst_entry	*(*dst_lookup)(struct net *net,
 | 
						struct dst_entry	*(*dst_lookup)(struct net *net,
 | 
				
			||||||
					       int tos, int oif,
 | 
										       int tos, int oif,
 | 
				
			||||||
					       const xfrm_address_t *saddr,
 | 
										       const xfrm_address_t *saddr,
 | 
				
			||||||
| 
						 | 
					@ -1169,6 +1168,7 @@ static inline void xfrm_sk_free_policy(struct sock *sk)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void xfrm_garbage_collect(struct net *net);
 | 
					void xfrm_garbage_collect(struct net *net);
 | 
				
			||||||
 | 
					void xfrm_garbage_collect_deferred(struct net *net);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -219,7 +219,7 @@ static inline int xfrm4_garbage_collect(struct dst_ops *ops)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct net *net = container_of(ops, struct net, xfrm.xfrm4_dst_ops);
 | 
						struct net *net = container_of(ops, struct net, xfrm.xfrm4_dst_ops);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xfrm4_policy_afinfo.garbage_collect(net);
 | 
						xfrm_garbage_collect_deferred(net);
 | 
				
			||||||
	return (dst_entries_get_slow(ops) > ops->gc_thresh * 2);
 | 
						return (dst_entries_get_slow(ops) > ops->gc_thresh * 2);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -220,7 +220,7 @@ static inline int xfrm6_garbage_collect(struct dst_ops *ops)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct net *net = container_of(ops, struct net, xfrm.xfrm6_dst_ops);
 | 
						struct net *net = container_of(ops, struct net, xfrm.xfrm6_dst_ops);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xfrm6_policy_afinfo.garbage_collect(net);
 | 
						xfrm_garbage_collect_deferred(net);
 | 
				
			||||||
	return dst_entries_get_fast(ops) > ops->gc_thresh * 2;
 | 
						return dst_entries_get_fast(ops) > ops->gc_thresh * 2;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2733,10 +2733,11 @@ void xfrm_garbage_collect(struct net *net)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(xfrm_garbage_collect);
 | 
					EXPORT_SYMBOL(xfrm_garbage_collect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xfrm_garbage_collect_deferred(struct net *net)
 | 
					void xfrm_garbage_collect_deferred(struct net *net)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	flow_cache_flush_deferred(net);
 | 
						flow_cache_flush_deferred(net);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(xfrm_garbage_collect_deferred);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xfrm_init_pmtu(struct dst_entry *dst)
 | 
					static void xfrm_init_pmtu(struct dst_entry *dst)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -2873,8 +2874,6 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
 | 
				
			||||||
			dst_ops->link_failure = xfrm_link_failure;
 | 
								dst_ops->link_failure = xfrm_link_failure;
 | 
				
			||||||
		if (likely(dst_ops->neigh_lookup == NULL))
 | 
							if (likely(dst_ops->neigh_lookup == NULL))
 | 
				
			||||||
			dst_ops->neigh_lookup = xfrm_neigh_lookup;
 | 
								dst_ops->neigh_lookup = xfrm_neigh_lookup;
 | 
				
			||||||
		if (likely(afinfo->garbage_collect == NULL))
 | 
					 | 
				
			||||||
			afinfo->garbage_collect = xfrm_garbage_collect_deferred;
 | 
					 | 
				
			||||||
		rcu_assign_pointer(xfrm_policy_afinfo[afinfo->family], afinfo);
 | 
							rcu_assign_pointer(xfrm_policy_afinfo[afinfo->family], afinfo);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spin_unlock(&xfrm_policy_afinfo_lock);
 | 
						spin_unlock(&xfrm_policy_afinfo_lock);
 | 
				
			||||||
| 
						 | 
					@ -2901,7 +2900,6 @@ void xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo)
 | 
				
			||||||
	dst_ops->check = NULL;
 | 
						dst_ops->check = NULL;
 | 
				
			||||||
	dst_ops->negative_advice = NULL;
 | 
						dst_ops->negative_advice = NULL;
 | 
				
			||||||
	dst_ops->link_failure = NULL;
 | 
						dst_ops->link_failure = NULL;
 | 
				
			||||||
	afinfo->garbage_collect = NULL;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(xfrm_policy_unregister_afinfo);
 | 
					EXPORT_SYMBOL(xfrm_policy_unregister_afinfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue