Whamcloud - gitweb
LU-11300 lnet: Cache the routing feature 51/33451/30
authorAmir Shehata <ashehata@whamcloud.com>
Sat, 20 Oct 2018 01:24:39 +0000 (18:24 -0700)
committerAmir Shehata <ashehata@whamcloud.com>
Fri, 7 Jun 2019 18:13:55 +0000 (18:13 +0000)
When processing a REPLY or a PUSH for a discovery cache the
whether the routing feature is enabled or disabled as
reported by the peer.

Test-Parameters: forbuildonly
Signed-off-by: Amir Shehata <ashehata@whamcloud.com>
Change-Id: I69bd41fade196773af0e1004c2e7fff2fb91392d
Reviewed-on: https://review.whamcloud.com/33451
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Olaf Weber <olaf.weber@hpe.com>
Tested-by: Jenkins
lnet/include/lnet/lib-types.h
lnet/lnet/peer.c

index 96dafdc..2c0a5f4 100644 (file)
@@ -719,9 +719,13 @@ struct lnet_peer {
  *
  * A peer is marked NO_DISCOVERY if the LNET_PING_FEAT_DISCOVERY bit was
  * NOT set when the peer was pinged by discovery.
+ *
+ * A peer is marked ROUTER if it indicates so in the feature bit.
  */
 #define LNET_PEER_MULTI_RAIL   (1 << 0)        /* Multi-rail aware */
 #define LNET_PEER_NO_DISCOVERY (1 << 1)        /* Peer disabled discovery */
+#define LNET_PEER_ROUTER_ENABLED (1 << 2)      /* router feature enabled */
+
 /*
  * A peer is marked CONFIGURED if it was configured by DLC.
  *
@@ -735,28 +739,28 @@ struct lnet_peer {
  * A peer that was created as the result of inbound traffic will not
  * be marked at all.
  */
-#define LNET_PEER_CONFIGURED   (1 << 2)        /* Configured via DLC */
-#define LNET_PEER_DISCOVERED   (1 << 3)        /* Peer was discovered */
-#define LNET_PEER_REDISCOVER   (1 << 4)        /* Discovery was disabled */
+#define LNET_PEER_CONFIGURED   (1 << 3)        /* Configured via DLC */
+#define LNET_PEER_DISCOVERED   (1 << 4)        /* Peer was discovered */
+#define LNET_PEER_REDISCOVER   (1 << 5)        /* Discovery was disabled */
 /*
  * A peer is marked DISCOVERING when discovery is in progress.
  * The other flags below correspond to stages of discovery.
  */
-#define LNET_PEER_DISCOVERING  (1 << 5)        /* Discovering */
-#define LNET_PEER_DATA_PRESENT (1 << 6)        /* Remote peer data present */
-#define LNET_PEER_NIDS_UPTODATE        (1 << 7)        /* Remote peer info uptodate */
-#define LNET_PEER_PING_SENT    (1 << 8)        /* Waiting for REPLY to Ping */
-#define LNET_PEER_PUSH_SENT    (1 << 9)        /* Waiting for ACK of Push */
-#define LNET_PEER_PING_FAILED  (1 << 10)       /* Ping send failure */
-#define LNET_PEER_PUSH_FAILED  (1 << 11)       /* Push send failure */
+#define LNET_PEER_DISCOVERING  (1 << 6)        /* Discovering */
+#define LNET_PEER_DATA_PRESENT (1 << 7)        /* Remote peer data present */
+#define LNET_PEER_NIDS_UPTODATE        (1 << 8)        /* Remote peer info uptodate */
+#define LNET_PEER_PING_SENT    (1 << 9)        /* Waiting for REPLY to Ping */
+#define LNET_PEER_PUSH_SENT    (1 << 10)       /* Waiting for ACK of Push */
+#define LNET_PEER_PING_FAILED  (1 << 11)       /* Ping send failure */
+#define LNET_PEER_PUSH_FAILED  (1 << 12)       /* Push send failure */
 /*
  * A ping can be forced as a way to fix up state, or as a manual
  * intervention by an admin.
  * A push can be forced in circumstances that would normally not
  * allow for one to happen.
  */
-#define LNET_PEER_FORCE_PING   (1 << 12)       /* Forced Ping */
-#define LNET_PEER_FORCE_PUSH   (1 << 13)       /* Forced Push */
+#define LNET_PEER_FORCE_PING   (1 << 13)       /* Forced Ping */
+#define LNET_PEER_FORCE_PUSH   (1 << 14)       /* Forced Push */
 
 struct lnet_peer_net {
        /* chain on lp_peer_nets */
index 28bad27..8b80124 100644 (file)
@@ -2434,6 +2434,17 @@ static int lnet_peer_merge_data(struct lnet_peer *lp,
        if (pbuf->pb_info.pi_features & LNET_PING_FEAT_MULTI_RAIL)
                flags |= LNET_PEER_MULTI_RAIL;
 
+       /*
+        * Cache the routing feature for the peer; whether it is enabled
+        * for disabled as reported by the remote peer.
+        */
+       spin_lock(&lp->lp_lock);
+       if (!(pbuf->pb_info.pi_features & LNET_PING_FEAT_RTE_DISABLED))
+               lp->lp_state |= LNET_PEER_ROUTER_ENABLED;
+       else
+               lp->lp_state &= ~LNET_PEER_ROUTER_ENABLED;
+       spin_unlock(&lp->lp_lock);
+
        nnis = MAX(lp->lp_nnis, pbuf->pb_info.pi_nnis);
        LIBCFS_ALLOC(curnis, nnis * sizeof(*curnis));
        LIBCFS_ALLOC(addnis, nnis * sizeof(*addnis));