Whamcloud - gitweb
LU-15478 lnet: Check LNET_NID_IS_ANY in LNET_NID_NET 92/46292/3
authorChris Horn <chris.horn@hpe.com>
Mon, 24 Jan 2022 22:02:25 +0000 (16:02 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 31 Jan 2022 01:43:44 +0000 (01:43 +0000)
If LNET_NID_NET is passed the wildcard NID (LNET_ANY_NID) then we
should return the wildcard net (LNET_NET_ANY). This also allows NULL
to be used as an argument to LNET_NID_NET.

Fixes: 005bd7075c ("LU-10391 lnet: Change lnet_send() to take large-addr nids")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Change-Id: Ic2a7c9af31dcba285c266a872462cf179ab603fa
Reviewed-on: https://review.whamcloud.com/46292
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/uapi/linux/lnet/lnet-types.h

index ff02f24..d7fce9d 100644 (file)
@@ -120,7 +120,10 @@ static inline int nid_is_nid4(const struct lnet_nid *nid)
 
 static inline __u32 LNET_NID_NET(const struct lnet_nid *nid)
 {
-       return LNET_MKNET(nid->nid_type, __be16_to_cpu(nid->nid_num));
+       if (LNET_NID_IS_ANY(nid))
+               return LNET_NET_ANY;
+       else
+               return LNET_MKNET(nid->nid_type, __be16_to_cpu(nid->nid_num));
 }
 
 static inline void lnet_nid4_to_nid(lnet_nid_t nid4, struct lnet_nid *nid)