LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH net-next 01/12] net: add dst_get_noref and refdst_ptr helpers

To: Simon Horman <horms@xxxxxxxxxxxx>
Subject: [PATCH net-next 01/12] net: add dst_get_noref and refdst_ptr helpers
Cc: lvs-devel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx
From: Julian Anastasov <ja@xxxxxx>
Date: Wed, 6 Mar 2013 10:42:11 +0200
        Needed to hide refdst details.

Signed-off-by: Julian Anastasov <ja@xxxxxx>
---
 include/net/dst.h |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index 853cda1..967f42a 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -264,10 +264,22 @@ static inline struct dst_entry *dst_clone(struct 
dst_entry *dst)
 
 extern void dst_release(struct dst_entry *dst);
 
+/* Get noref version of dst */
+static inline struct dst_entry *dst_get_noref(struct dst_entry *dst)
+{
+       return (struct dst_entry *) ((unsigned long) dst | SKB_DST_NOREF);
+}
+
+/* Return dst pointer from refdst */
+static inline struct dst_entry *refdst_ptr(unsigned long refdst)
+{
+       return (struct dst_entry *)(refdst & SKB_DST_PTRMASK);
+}
+
 static inline void refdst_drop(unsigned long refdst)
 {
        if (!(refdst & SKB_DST_NOREF))
-               dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK));
+               dst_release(refdst_ptr(refdst));
 }
 
 /**
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>