Whamcloud - gitweb
LU-10391 socklnd: factor out key calculation for ksnd_peers
[fs/lustre-release.git] / lnet / include / uapi / linux / lnet / lnet-types.h
index f00d84f..da5b03c 100644 (file)
@@ -158,6 +158,16 @@ static inline int nid_same(const struct lnet_nid *n1,
                n1->nid_addr[3] == n2->nid_addr[3];
 }
 
                n1->nid_addr[3] == n2->nid_addr[3];
 }
 
+/* This can be used when we need to hash a nid */
+static inline unsigned long nidhash(lnet_nid_t nid)
+{
+       unsigned long hash = 0;
+
+       hash ^= LNET_NIDNET(nid);
+       hash ^= LNET_NIDADDR(nid);
+       return hash;
+}
+
 struct lnet_counters_health {
        __u32   lch_rst_alloc;
        __u32   lch_resend_count;
 struct lnet_counters_health {
        __u32   lch_rst_alloc;
        __u32   lch_resend_count;