[lustre-devel] [PATCH 05/24] lustre: lnet: add Multi-Rail and Discovery ping feature bits
NeilBrown
neilb at suse.com
Sun Oct 7 16:19:37 PDT 2018
From: Olaf Weber <olaf at sgi.com>
Claim ping features bit for Multi-Rail and Discovery.
Assert in lnet_ping_target_update() that no unknown bits will
be send over the wire.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9480
Signed-off-by: Olaf Weber <olaf at sgi.com>
Reviewed-on: https://review.whamcloud.com/25775
Reviewed-by: Olaf Weber <olaf.weber at hpe.com>
Reviewed-by: Amir Shehata <amir.shehata at intel.com>
Tested-by: Amir Shehata <amir.shehata at intel.com>
Signed-off-by: NeilBrown <neilb at suse.com>
---
.../staging/lustre/include/linux/lnet/lib-types.h | 16 ++++++++++++++++
drivers/staging/lustre/lnet/lnet/api-ni.c | 5 +++++
2 files changed, 21 insertions(+)
diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h
index d1d17ededd06..f4467a3bbfd1 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-types.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h
@@ -386,6 +386,22 @@ struct lnet_ni {
#define LNET_PING_FEAT_BASE BIT(0) /* just a ping */
#define LNET_PING_FEAT_NI_STATUS BIT(1) /* return NI status */
#define LNET_PING_FEAT_RTE_DISABLED BIT(2) /* Routing enabled */
+#define LNET_PING_FEAT_MULTI_RAIL BIT(3) /* Multi-Rail aware */
+#define LNET_PING_FEAT_DISCOVERY BIT(4) /* Supports Discovery */
+
+/*
+ * All ping feature bits fit to hit the wire.
+ * In lnet_assert_wire_constants() this is compared against its open-coded
+ * value, and in lnet_ping_target_update() it is used to verify that no
+ * unknown bits have been set.
+ * New feature bits can be added, just be aware that this does change the
+ * over-the-wire protocol.
+ */
+#define LNET_PING_FEAT_BITS (LNET_PING_FEAT_BASE | \
+ LNET_PING_FEAT_NI_STATUS | \
+ LNET_PING_FEAT_RTE_DISABLED | \
+ LNET_PING_FEAT_MULTI_RAIL | \
+ LNET_PING_FEAT_DISCOVERY)
#define LNET_PING_INFO_SIZE(NNIDS) \
offsetof(struct lnet_ping_info, pi_ni[NNIDS])
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
index ca28ad75fe2b..68af723bc6a1 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -1170,6 +1170,11 @@ lnet_ping_target_update(struct lnet_ping_buffer *pbuf,
if (!the_lnet.ln_routing)
pbuf->pb_info.pi_features |= LNET_PING_FEAT_RTE_DISABLED;
+
+ /* Ensure only known feature bits have been set. */
+ LASSERT(pbuf->pb_info.pi_features & LNET_PING_FEAT_BITS);
+ LASSERT(!(pbuf->pb_info.pi_features & ~LNET_PING_FEAT_BITS));
+
lnet_ping_target_install_locked(pbuf);
if (the_lnet.ln_ping_target) {
More information about the lustre-devel
mailing list