From f18b437dc934db4b960bc3c46d5e1c242ee5c8ef Mon Sep 17 00:00:00 2001 From: Olaf Weber Date: Fri, 27 Jan 2017 16:22:40 +0100 Subject: [PATCH] LU-9480 lnet: add Multi-Rail and Discovery ping feature bits 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 Change-Id: Ie84b155f1ae45e3c228a4e49dc898160b81efb94 Reviewed-on: https://review.whamcloud.com/25775 Reviewed-by: Olaf Weber Reviewed-by: Amir Shehata Tested-by: Amir Shehata --- lnet/include/lnet/lib-types.h | 16 ++++++++++++++++ lnet/lnet/api-ni.c | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index 2887414..77e57af 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -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; diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 0bdcbad..25bac83 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -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) { -- 1.8.3.1