From 5fea36c952373c9a235be7bf57eb2e516fcb36b2 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Tue, 28 Jun 2022 19:24:32 -0500 Subject: [PATCH] LU-15983 lnet: Define KFILND network type Define the KFILND network type. This reserves the network type number for future implementation and allows creation of kfi peers and adding routes to kfi peers. Test-Parameters: trivial testlist=sanity-lnet HPE-bug-id: LUS-11060 Signed-off-by: Chris Horn Change-Id: I9111645f1290c8af4937d1b2689a068df81922a4 Reviewed-on: https://review.whamcloud.com/47830 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Cyril Bordage Reviewed-by: Frank Sehr Reviewed-by: Oleg Drokin --- libcfs/libcfs/util/nidstrings.c | 12 ++++++++++++ lnet/include/uapi/linux/lnet/nidstr.h | 1 + lnet/lnet/nidstrings.c | 10 ++++++++++ lustre/tests/sanity-lnet.sh | 28 ++++++++++++++++++++++------ 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/libcfs/libcfs/util/nidstrings.c b/libcfs/libcfs/util/nidstrings.c index bf3bc05..780a8ab 100644 --- a/libcfs/libcfs/util/nidstrings.c +++ b/libcfs/libcfs/util/nidstrings.c @@ -562,6 +562,18 @@ static struct netstrfns libcfs_netstrfns[] = { .nf_match_addr = libcfs_num_match, .nf_min_max = cfs_num_min_max, .nf_expand_addrrange = libcfs_num_addr_range_expand + }, + { + .nf_type = KFILND, + .nf_name = "kfi", + .nf_modname = "kkfilnd", + .nf_addr2str = libcfs_decnum_addr2str, + .nf_str2addr = libcfs_num_str2addr, + .nf_parse_addrlist = libcfs_num_parse, + .nf_print_addrlist = libcfs_num_addr_range_print, + .nf_match_addr = libcfs_num_match, + .nf_min_max = cfs_num_min_max, + .nf_expand_addrrange = libcfs_num_addr_range_expand } }; diff --git a/lnet/include/uapi/linux/lnet/nidstr.h b/lnet/include/uapi/linux/lnet/nidstr.h index ea92a17..9e4b156 100644 --- a/lnet/include/uapi/linux/lnet/nidstr.h +++ b/lnet/include/uapi/linux/lnet/nidstr.h @@ -52,6 +52,7 @@ enum { GNILND = 13, GNIIPLND = 14, PTL4LND = 15, + KFILND = 16, NUM_LNDS }; diff --git a/lnet/lnet/nidstrings.c b/lnet/lnet/nidstrings.c index 2af9d8a..20901ed 100644 --- a/lnet/lnet/nidstrings.c +++ b/lnet/lnet/nidstrings.c @@ -764,6 +764,16 @@ static struct netstrfns libcfs_netstrfns[] = { .nf_print_addrlist = libcfs_num_addr_range_print, .nf_match_addr = libcfs_num_match }, + { + .nf_type = KFILND, + .nf_name = "kfi", + .nf_modname = "kkfilnd", + .nf_addr2str = libcfs_decnum_addr2str, + .nf_str2addr = libcfs_num_str2addr, + .nf_parse_addrlist = libcfs_num_parse, + .nf_print_addrlist = libcfs_num_addr_range_print, + .nf_match_addr = libcfs_num_match + }, }; static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns); diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index e7568d5..bc67e12 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -161,7 +161,7 @@ validate_nid() { local num_re='[0-9]\+' local ip_re="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" - if [[ $net =~ gni[0-9]* ]]; then + if [[ $net =~ gni[0-9]* ]] || [[ $net =~ kfi[0-9]* ]]; then [[ $addr =~ ${num_re} ]] && return 0 else [[ $addr =~ ${ip_re} ]] && return 0 @@ -358,10 +358,17 @@ peer: - nid: 6.6.3.6@o2ib - nid: 6@gni - nid: 10@gni + - nid: 6@kfi + - nid: 10@kfi EOF append_global_yaml - compare_peer_add "6.6.6.6@tcp" \ - "6.6.[6-7].[0-4/2]@tcp,6.6.[1-4/2].[0-6/3]@o2ib,[6-12/4]@gni" + + local nid_expr="6.6.[6-7].[0-4/2]@tcp" + nid_expr+=",6.6.[1-4/2].[0-6/3]@o2ib" + nid_expr+=",[6-12/4]@gni" + nid_expr+=",[6-12/4]@kfi" + + compare_peer_add "6.6.6.6@tcp" "${nid_expr}" } run_test 6 "Add peer with multiple nidranges" @@ -414,9 +421,18 @@ test_7() { error "Peer add failed $?" compare_peer_del "7@gni" - echo "Delete peer that has tcp, o2ib and gni nids" + echo "Delete peer with single nid (kfi)" + do_lnetctl peer add --prim_nid 7@kfi || error "Peer add failed $?" + compare_peer_del "7@kfi" + + echo "Delete peer that has multiple nids (kfi)" + do_lnetctl peer add --prim_nid 7@kfi --nid [8-12]@kfi || + error "Peer add failed $?" + compare_peer_del "7@kfi" + + echo "Delete peer that has tcp, o2ib, gni and kfi nids" do_lnetctl peer add --prim_nid 7@gni \ - --nid [8-12]@gni,7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib || + --nid [8-12]@gni,7.7.7.[1-4]@tcp,7.7.7.[5-9]@o2ib,[1-5]@kfi || error "Peer add failed $?" compare_peer_del "7@gni" } @@ -548,7 +564,7 @@ create_nid() { local num="$1" local net="$2" - if [[ $net =~ gni* ]]; then + if [[ $net =~ gni* ]] || [[ $net =~ kfi* ]]; then echo "${num}@${net}" else echo "${num}.${num}.${num}.${num}@${net}" -- 1.8.3.1