~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/net/dst_cache.h

Version: ~ [ linux-5.14-rc3 ] ~ [ linux-5.13.5 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.53 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.135 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.198 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.240 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.276 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.276 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _NET_DST_CACHE_H
  2 #define _NET_DST_CACHE_H
  3 
  4 #include <linux/jiffies.h>
  5 #include <net/dst.h>
  6 #if IS_ENABLED(CONFIG_IPV6)
  7 #include <net/ip6_fib.h>
  8 #endif
  9 
 10 struct dst_cache {
 11         struct dst_cache_pcpu __percpu *cache;
 12         unsigned long reset_ts;
 13 };
 14 
 15 /**
 16  *      dst_cache_get - perform cache lookup
 17  *      @dst_cache: the cache
 18  *
 19  *      The caller should use dst_cache_get_ip4() if it need to retrieve the
 20  *      source address to be used when xmitting to the cached dst.
 21  *      local BH must be disabled.
 22  */
 23 struct dst_entry *dst_cache_get(struct dst_cache *dst_cache);
 24 
 25 /**
 26  *      dst_cache_get_ip4 - perform cache lookup and fetch ipv4 source address
 27  *      @dst_cache: the cache
 28  *      @saddr: return value for the retrieved source address
 29  *
 30  *      local BH must be disabled.
 31  */
 32 struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr);
 33 
 34 /**
 35  *      dst_cache_set_ip4 - store the ipv4 dst into the cache
 36  *      @dst_cache: the cache
 37  *      @dst: the entry to be cached
 38  *      @saddr: the source address to be stored inside the cache
 39  *
 40  *      local BH must be disabled.
 41  */
 42 void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst,
 43                        __be32 saddr);
 44 
 45 #if IS_ENABLED(CONFIG_IPV6)
 46 
 47 /**
 48  *      dst_cache_set_ip6 - store the ipv6 dst into the cache
 49  *      @dst_cache: the cache
 50  *      @dst: the entry to be cached
 51  *      @saddr: the source address to be stored inside the cache
 52  *
 53  *      local BH must be disabled.
 54  */
 55 void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
 56                        const struct in6_addr *addr);
 57 
 58 /**
 59  *      dst_cache_get_ip6 - perform cache lookup and fetch ipv6 source address
 60  *      @dst_cache: the cache
 61  *      @saddr: return value for the retrieved source address
 62  *
 63  *      local BH must be disabled.
 64  */
 65 struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache,
 66                                     struct in6_addr *saddr);
 67 #endif
 68 
 69 /**
 70  *      dst_cache_reset - invalidate the cache contents
 71  *      @dst_cache: the cache
 72  *
 73  *      This do not free the cached dst to avoid races and contentions.
 74  *      the dst will be freed on later cache lookup.
 75  */
 76 static inline void dst_cache_reset(struct dst_cache *dst_cache)
 77 {
 78         dst_cache->reset_ts = jiffies;
 79 }
 80 
 81 /**
 82  *      dst_cache_init - initialize the cache, allocating the required storage
 83  *      @dst_cache: the cache
 84  *      @gfp: allocation flags
 85  */
 86 int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp);
 87 
 88 /**
 89  *      dst_cache_destroy - empty the cache and free the allocated storage
 90  *      @dst_cache: the cache
 91  *
 92  *      No synchronization is enforced: it must be called only when the cache
 93  *      is unsed.
 94  */
 95 void dst_cache_destroy(struct dst_cache *dst_cache);
 96 
 97 #endif
 98 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp