• Paolo Abeni's avatar
    net: add dst_cache support · 911362c7
    Paolo Abeni authored
    This patch add a generic, lockless dst cache implementation.
    The need for lock is avoided updating the dst cache fields
    only in per cpu scope, and requiring that the cache manipulation
    functions are invoked with the local bh disabled.
    The refresh_ts and reset_ts fields are used to ensure the cache
    consistency in case of cuncurrent cache update (dst_cache_set*) and
    reset operation (dst_cache_reset).
    Consider the following scenario:
    CPU1:                                   	CPU2:
      <cache lookup with emtpy cache: it fails>
      <get dst via uncached route lookup>
    						<related configuration changes>
    The dst entry set passed to dst_cache_set() should not be used
    for later dst cache lookup, because it's obtained using old
    configuration values.
    Since the refresh_ts is updated only on dst_cache lookup, the
    cached value in the above scenario will be discarded on the next
    Signed-off-by: 's avatarPaolo Abeni <pabeni@redhat.com>
    Suggested-and-acked-by: 's avatarHannes Frederic Sowa <hannes@stressinduktion.org>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
dst_cache.h 2.49 KB