From b5a03e1244be91b05209d4a53973393f021dd999 Mon Sep 17 00:00:00 2001 From: Sachin Saxena Date: Mon, 4 Mar 2013 10:24:19 +0000 Subject: net/ipv4: IPv4 Route Flush callback added. Signed-off-by: Sachin Saxena Change-Id: Ia9cc025e36b67beedad57f7fff5a4846be39ad10 Reviewed-on: http://git.am.freescale.net:8181/875 Reviewed-by: Fleming Andrew-AFLEMING Tested-by: Fleming Andrew-AFLEMING diff --git a/include/net/route.h b/include/net/route.h index 2ea40c1..fcbff36 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -306,6 +306,11 @@ static inline int inet_iif(const struct sk_buff *skb) return skb->skb_iif; } +#ifdef CONFIG_AS_FASTPATH +typedef void route_flush_hook(void); +void route_hook_fn_register(route_flush_hook *flush); +#endif + extern int sysctl_ip_default_ttl; static inline int ip4_dst_hoplimit(const struct dst_entry *dst) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a0fcc47..63354f5 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -199,6 +199,10 @@ const __u8 ip_tos2prio[16] = { }; EXPORT_SYMBOL(ip_tos2prio); +#ifdef CONFIG_AS_FASTPATH +static route_flush_hook *route_flush_fn; +#endif + static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); #define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field) @@ -445,6 +449,10 @@ static inline bool rt_is_expired(const struct rtable *rth) void rt_cache_flush(struct net *net) { rt_genid_bump(net); +#ifdef CONFIG_AS_FASTPATH + if (route_flush_fn) + route_flush_fn(); +#endif } static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, @@ -2111,6 +2119,14 @@ out: } EXPORT_SYMBOL_GPL(__ip_route_output_key); +#ifdef CONFIG_AS_FASTPATH +void route_hook_fn_register(route_flush_hook *flush) +{ + route_flush_fn = flush; +} +EXPORT_SYMBOL(route_hook_fn_register); +#endif + static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 cookie) { return NULL; -- cgit v0.10.2