Whamcloud - gitweb
LU-16197 kfilnd: Convert NID num to host order 00/48700/2
authorChris Horn <chris.horn@hpe.com>
Mon, 26 Sep 2022 18:59:38 +0000 (12:59 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 10 Oct 2022 05:39:10 +0000 (05:39 +0000)
The nid_num field in struct lnet_nid is stored in network byte order.
The nid_num field is used to generate the kfabric service string. The
underlying kfabric providers expect the service string to be in host
byte order not network byte order. This mismatch is preventing
multiple LNet NID indexes from being used.

Fix this by converting nid_num to host byte order.

Test-Parameters: trivial
HPE-bug-id: LUS-11254
Change-Id: I804daa6d66d775212a83e3ed013310b383b94974
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Signed-off-by: Ian Ziemba <ian.ziemba@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48700
Reviewed-by: Ron Gredvig <ron.gredvig@hpe.com>
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lnet/klnds/kfilnd/kfilnd_dom.c
lustre/tests/sanity-lnet.sh
lustre/tests/test-framework.sh

index 74cdc7f..a5149aa 100644 (file)
@@ -315,7 +315,7 @@ struct kfilnd_dom *kfilnd_dom_get(struct lnet_ni *ni, const char *node,
                goto err;
        }
 
-       service = kasprintf(GFP_KERNEL, "%u", ni->ni_nid.nid_num);
+       service = kasprintf(GFP_KERNEL, "%u", ntohs(ni->ni_nid.nid_num));
        if (!service) {
                rc = -ENOMEM;
                goto err;
index 67daed7..6fdee82 100755 (executable)
@@ -3059,6 +3059,18 @@ test_250() {
 }
 run_test 250 "test that linux routes are added"
 
+test_251() {
+       [[ ${NETTYPE} =~ kfi* ]] ||
+               skip "Need kfi NETTYPE"
+
+       reinit_dlc || return $?
+       add_net "kfi" "${INTERFACES[0]}" || return $?
+       add_net "kfi1" "${INTERFACES[0]}" || return $?
+       add_net "kfi10" "${INTERFACES[0]}" || return $?
+       return 0
+}
+run_test 251 "Define multiple kfi networks on single interface"
+
 test_300() {
        # LU-13274
        local header
index 2ff4639..2e72bf5 100755 (executable)
@@ -7094,6 +7094,12 @@ lnet_if_list() {
        [[ -z ${nids[@]} ]] &&
                return 0
 
+       if [[ ${NETTYPE} =~ kfi* ]]; then
+               $LNETCTL net show 2>/dev/null | awk '/ cxi[0-9]+$/{print $NF}' |
+                       sort -u | xargs echo
+               return 0
+       fi
+
        declare -a INTERFACES
 
        for ((i = 0; i < ${#nids[@]}; i++)); do