diff options
author | Wei Wang <weiwan@google.com> | 2017-06-17 19:42:38 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-18 04:54:00 +0200 |
commit | 52df157f17e564ec22afc3e4a89b21828220f576 (patch) | |
tree | 04030abb7cb283625d097342ecab4617e7316e3c /include/net/dst.h | |
parent | ipv6: get rid of icmp6 dst garbage collector (diff) | |
download | linux-52df157f17e564ec22afc3e4a89b21828220f576.tar.xz linux-52df157f17e564ec22afc3e4a89b21828220f576.zip |
xfrm: take refcnt of dst when creating struct xfrm_dst bundle
During the creation of xfrm_dst bundle, always take ref count when
allocating the dst. This way, xfrm_bundle_create() will form a linked
list of dst with dst->child pointing to a ref counted dst child. And
the returned dst pointer is also ref counted. This makes the link from
the flow cache to this dst now ref counted properly.
As the dst is always ref counted properly, we can safely mark
DST_NOGC flag so dst_release() will release dst based on refcnt only.
And dst gc is no longer needed and all dst_free() and its related
function calls should be replaced with dst_release() or
dst_release_immediate().
The special handling logic for dst->child in dst_destroy() can be
replaced with a simple dst_release_immediate() call on the child to
release the whole list linked by dst->child pointer.
Previously used DST_NOHASH flag is not needed anymore as well. The
reason that DST_NOHASH is used in the existing code is mainly to prevent
the dst inserted in the fib tree to be wrongly destroyed during the
deletion of the xfrm_dst bundle. So in the existing code, DST_NOHASH
flag is marked in all the dst children except the one which is in the
fib tree.
However, with this patch series to remove dst gc logic and release dst
only based on ref count, it is safe to release all the children from a
xfrm_dst bundle as long as the dst children are all ref counted
properly which is already the case in the existing code.
So, this patch removes the use of DST_NOHASH flag.
Signed-off-by: Wei Wang <weiwan@google.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dst.h')
-rw-r--r-- | include/net/dst.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index 11d779803c0d..88ebb87ad312 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -51,7 +51,6 @@ struct dst_entry { #define DST_HOST 0x0001 #define DST_NOXFRM 0x0002 #define DST_NOPOLICY 0x0004 -#define DST_NOHASH 0x0008 #define DST_NOCACHE 0x0010 #define DST_NOCOUNT 0x0020 #define DST_FAKE_RTABLE 0x0040 |