Whamcloud - gitweb
LU-7734 lnet: add LNET_PING_FEAT_MULTI_RAIL bit 96/21096/10
authorOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:22:40 +0000 (16:22 +0100)
committerOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:41:26 +0000 (16:41 +0100)
Claim a ping feature bit for Multi-Rail.

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: I6716f9175f413328cc1af30d01f33d3e5e8b56df

lnet/include/lnet/lib-types.h
lnet/lnet/api-ni.c

index 7632048..e6b49ad 100644 (file)
@@ -416,6 +416,20 @@ 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 */
+
+/*
+ * 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)
 
 typedef struct lnet_ping_info {
        __u32                   pi_magic;
index 0f50c65..0bbf5d9 100644 (file)
@@ -1209,6 +1209,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) {