Whamcloud - gitweb
LU-15983 lnet: Define KFILND network type 30/47830/5
authorChris Horn <chris.horn@hpe.com>
Wed, 29 Jun 2022 00:24:32 +0000 (19:24 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 26 Jul 2022 04:54:14 +0000 (04:54 +0000)
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 <chris.horn@hpe.com>
Change-Id: I9111645f1290c8af4937d1b2689a068df81922a4
Reviewed-on: https://review.whamcloud.com/47830
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/util/nidstrings.c
lnet/include/uapi/linux/lnet/nidstr.h
lnet/lnet/nidstrings.c
lustre/tests/sanity-lnet.sh

index bf3bc05..780a8ab 100644 (file)
@@ -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
        }
 };
 
index ea92a17..9e4b156 100644 (file)
@@ -52,6 +52,7 @@ enum {
        GNILND          = 13,
        GNIIPLND        = 14,
        PTL4LND         = 15,
+       KFILND          = 16,
 
        NUM_LNDS
 };
index 2af9d8a..20901ed 100644 (file)
@@ -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);
index e7568d5..bc67e12 100755 (executable)
@@ -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}"