Whamcloud - gitweb
LU-9480 lnet: add Multi-Rail and Discovery ping feature bits 75/25775/23
authorOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:22:40 +0000 (16:22 +0100)
committerAmir Shehata <amir.shehata@intel.com>
Tue, 22 Aug 2017 16:21:44 +0000 (16:21 +0000)
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.

Test-Parameters: trivial
Signed-off-by: Olaf Weber <olaf@sgi.com>
Change-Id: Ie84b155f1ae45e3c228a4e49dc898160b81efb94
Reviewed-on: https://review.whamcloud.com/25775
Reviewed-by: Olaf Weber <olaf.weber@hpe.com>
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Tested-by: Amir Shehata <amir.shehata@intel.com>
lnet/include/lnet/lib-types.h
lnet/lnet/api-ni.c

index 2887414..77e57af 100644 (file)
@@ -416,6 +416,22 @@ typedef struct lnet_ni {
 #define LNET_PING_FEAT_BASE            (1 << 0)        /* just a ping */
 #define LNET_PING_FEAT_NI_STATUS       (1 << 1)        /* return NI status */
 #define LNET_PING_FEAT_RTE_DISABLED    (1 << 2)        /* Routing enabled */
+#define LNET_PING_FEAT_MULTI_RAIL      (1 << 3)        /* Multi-Rail aware */
+#define LNET_PING_FEAT_DISCOVERY       (1 << 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)
 
 typedef struct lnet_ping_info {
        __u32                   pi_magic;
index 0bdcbad..25bac83 100644 (file)
@@ -1237,6 +1237,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) {