diff mbox series

[42/50] lnet: Check LNET_NID_IS_ANY in LNET_NID_NET

Message ID 1647783064-20688-43-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS tree as of March 20, 2022 | expand

Commit Message

James Simmons March 20, 2022, 1:30 p.m. UTC
From: Chris Horn <chris.horn@hpe.com>

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: 6935d7108f ("lnet: Change lnet_send() to take large-addr nids")
WC-bug-id: https://jira.whamcloud.com/browse/LU-15478
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Reviewed-on: https://review.whamcloud.com/46292
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 include/uapi/linux/lnet/lnet-types.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/uapi/linux/lnet/lnet-types.h b/include/uapi/linux/lnet/lnet-types.h
index eacc401..c5fca5c 100644
--- a/include/uapi/linux/lnet/lnet-types.h
+++ b/include/uapi/linux/lnet/lnet-types.h
@@ -125,7 +125,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)