From 83ea3c452e17f62603acbb57b0fd729211d1e8c2 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Mon, 26 Sep 2022 12:59:38 -0600 Subject: [PATCH] LU-16197 kfilnd: Convert NID num to host order 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 Signed-off-by: Ian Ziemba Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48700 Reviewed-by: Ron Gredvig Reviewed-by: Olaf Faaland Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lnet/klnds/kfilnd/kfilnd_dom.c | 2 +- lustre/tests/sanity-lnet.sh | 12 ++++++++++++ lustre/tests/test-framework.sh | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lnet/klnds/kfilnd/kfilnd_dom.c b/lnet/klnds/kfilnd/kfilnd_dom.c index 74cdc7f..a5149aa 100644 --- a/lnet/klnds/kfilnd/kfilnd_dom.c +++ b/lnet/klnds/kfilnd/kfilnd_dom.c @@ -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; diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index 67daed7..6fdee82 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 2ff4639..2e72bf5 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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 -- 1.8.3.1