Whamcloud - gitweb
LU-16212 kfilnd: net and lnd tunables wrong 79/48779/4
authorRon Gredvig <ron.gredvig@hpe.com>
Wed, 24 Aug 2022 20:24:34 +0000 (15:24 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 19 May 2023 07:03:29 +0000 (07:03 +0000)
The kfilnd net and lnd tunables were not getting set properly in
many cases. Tunables not explcitly set were not set to the correct
default values.

Fixed logic in kfilnd_tunables_setup().

Improved error messages in kfilnd_startup() and
kfilnd_tunables_setup().

HPE-bug-id: LUS-11164
Test-Parameters: trivial
Signed-off-by: Ron Gredvig <ron.gredvig@hpe.com>
Change-Id: I49807b80466f5cbee65a9b3a7ee5ec2fe0c9e141
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48779
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Ian Ziemba <ian.ziemba@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/kfilnd/kfilnd.c
lnet/klnds/kfilnd/kfilnd_modparams.c

index 44c580d..1a311e0 100644 (file)
@@ -422,7 +422,11 @@ static int kfilnd_startup(struct lnet_ni *ni)
                return -EINVAL;
        }
 
-       kfilnd_tunables_setup(ni);
+       rc = kfilnd_tunables_setup(ni);
+       if (rc) {
+               CERROR("Can't configure tunable values, rc = %d\n", rc);
+               goto err;
+       }
 
        /* Only a single interface is supported. */
        if (!ni->ni_interface) {
index d27bc19..ac36cd7 100644 (file)
@@ -106,29 +106,40 @@ int kfilnd_tunables_setup(struct lnet_ni *ni)
        net_tunables = &ni->ni_net->net_tunables;
        kfilnd_tunables = &ni->ni_lnd_tunables.lnd_tun_u.lnd_kfi;
 
-       if (!ni->ni_net->net_tunables_set) {
+       if (net_tunables->lct_peer_timeout == -1)
+               net_tunables->lct_peer_timeout = peer_timeout;
+
+       if (net_tunables->lct_max_tx_credits == -1)
                net_tunables->lct_max_tx_credits = credits;
+
+       if (net_tunables->lct_peer_tx_credits == -1)
                net_tunables->lct_peer_tx_credits = peer_credits;
+
+       if (net_tunables->lct_peer_rtr_credits == -1)
                net_tunables->lct_peer_rtr_credits = peer_buffer_credits;
-               net_tunables->lct_peer_timeout = peer_timeout;
 
-               if (net_tunables->lct_peer_tx_credits >
-                   net_tunables->lct_max_tx_credits)
-                       net_tunables->lct_peer_tx_credits =
-                               net_tunables->lct_max_tx_credits;
-       }
+       if (net_tunables->lct_peer_tx_credits >
+               net_tunables->lct_max_tx_credits)
+               net_tunables->lct_peer_tx_credits =
+                       net_tunables->lct_max_tx_credits;
 
        kfilnd_tunables->lnd_version = KFILND_MSG_VERSION;
        if (!ni->ni_lnd_tunables_set) {
                kfilnd_tunables->lnd_prov_major_version = prov_major_version;
                kfilnd_tunables->lnd_prov_minor_version = prov_minor_version;
+               kfilnd_tunables->lnd_auth_key = auth_key;
+       }
 
-               /* Treat zero as uninitialized. */
-               if (ni->ni_lnd_tunables.lnd_tun_u.lnd_kfi.lnd_auth_key == 0)
-                       ni->ni_lnd_tunables.lnd_tun_u.lnd_kfi.lnd_auth_key =
-                               auth_key;
+       /* Treat kfilnd_tunables set to zero as uninitialized. */
+       if (kfilnd_tunables->lnd_prov_major_version == 0 &&
+               kfilnd_tunables->lnd_prov_major_version == 0) {
+               kfilnd_tunables->lnd_prov_major_version = prov_major_version;
+               kfilnd_tunables->lnd_prov_minor_version = prov_minor_version;
        }
 
+       if (kfilnd_tunables->lnd_auth_key == 0)
+               kfilnd_tunables->lnd_auth_key = auth_key;
+
        if (net_tunables->lct_max_tx_credits > KFILND_EP_KEY_MAX) {
                CERROR("Credits cannot exceed %lu\n", KFILND_EP_KEY_MAX);
                return -EINVAL;
@@ -139,6 +150,12 @@ int kfilnd_tunables_setup(struct lnet_ni *ni)
                return -EINVAL;
        }
 
+       if (kfilnd_tunables->lnd_prov_major_version > prov_major_version) {
+               CERROR("Provider major version greater than %d unsupported\n",
+                       prov_major_version);
+               return -EINVAL;
+       }
+
        return 0;
 }