From: Chris Horn Date: Thu, 6 Jun 2024 19:35:29 +0000 (-0600) Subject: LU-17894 lnet: Initialize common lnd params X-Git-Tag: 2.15.64~48 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=492a0027b2ecf26e924912a4de8bc792775a8063;p=fs%2Flustre-release.git LU-17894 lnet: Initialize common lnd params This ensures the correct default values are used when the user does not specify a value for them. Test-Parameters: trivial testlist=sanity-lnet Fixes: 7e01787863 ("LU-12452 lnet: allow to set IP ToS value per-NI") Signed-off-by: Chris Horn Change-Id: I201e9acbc3be8e27cd8957b722c8cea9a64de6c1 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55341 Reviewed-by: Etienne AUJAMES Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lnet/utils/lnetctl.c b/lnet/utils/lnetctl.c index a27dca3..152a694 100644 --- a/lnet/utils/lnetctl.c +++ b/lnet/utils/lnetctl.c @@ -2539,13 +2539,12 @@ static int jt_add_ni(int argc, char **argv) found = true; } - if (pto >= 0 || pc > 0 || pbc > 0 || cre > 0 || cpp > -1) { - tunables.lt_cmn.lct_peer_timeout = pto; - tunables.lt_cmn.lct_peer_tx_credits = pc; - tunables.lt_cmn.lct_peer_rtr_credits = pbc; - tunables.lt_cmn.lct_max_tx_credits = cre; + tunables.lt_cmn.lct_peer_timeout = pto; + tunables.lt_cmn.lct_peer_tx_credits = pc; + tunables.lt_cmn.lct_peer_rtr_credits = pbc; + tunables.lt_cmn.lct_max_tx_credits = cre; + if (pto >= 0 || pc > 0 || pbc > 0 || cre > 0) found = true; - } if (found && LNET_NETTYP(nw_descr.nw_id) == O2IBLND) tunables.lt_tun.lnd_tun_u.lnd_o2ib.lnd_map_on_demand = UINT_MAX; diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index fdb9a45..9d91754 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -3471,47 +3471,63 @@ test_231() { reinit_dlc || return $? local net=${NETTYPE}231 + local opts="--net $net --if ${INTERFACES[0]}" - do_lnetctl net add --net $net --if ${INTERFACES[0]} || - error "Failed to add net" + do_lnetctl net add $opts || error "Failed to add net" + + local lnd=$(basename $LNETLND) + local param_path="/sys/module/$lnd/parameters" + + [[ -d $param_path ]] || + error "Cannot find kernel params for $lnd at $param_path" + + local lnd_pto=$(cat $param_path/peer_timeout) + + # A value of -1 means we use the default peer timeout + #lnet/include/lnet/lib-lnet.h:#define DEFAULT_PEER_TIMEOUT 180 + ((lnd_pto != -1)) || lnd_pto=180 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml - sed -i 's/peer_timeout: .*$/peer_timeout: 0/' \ - $TMP/sanity-lnet-$testnum-expected.yaml - reinit_dlc || return $? + local pto=$(awk '/^\s+peer_timeout:/{print $NF}' \ + $TMP/sanity-lnet-$testnum-expected.yaml) - do_lnetctl import $TMP/sanity-lnet-$testnum-expected.yaml || - error "Failed to import configuration" + ((pto == lnd_pto)) || + error "Expect peer_timeout $lnd_pto but found $pto" $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml + compare_yaml_files || + error "Unexpected config after net add without options" - compare_yaml_files || error "Wrong config after import" + for pto in -1 0 60 180; do + reinit_dlc || return $? - do_lnetctl net del --net $net --if ${INTERFACES[0]} || - error "Failed to delete net $net" + sed -i 's/peer_timeout: .*/peer_timeout: '$pto'/' \ + $TMP/sanity-lnet-$testnum-expected.yaml - do_lnetctl net add --net $net --if ${INTERFACES[0]} --peer-timeout=0 || - error "Failed to add net with peer-timeout=0" + do_lnetctl import $TMP/sanity-lnet-$testnum-expected.yaml || + error "Failed to import configuration" - $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml + $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml - compare_yaml_files || error "Wrong config after lnetctl net add" + # Swap lnd_to for -1 in the expected output + ((pto != -1)) || + sed -i 's/peer_timeout: '$pto'/peer_timeout: '$lnd_pto'/' \ + $TMP/sanity-lnet-$testnum-expected.yaml - reinit_dlc || return $? + compare_yaml_files || error "Wrong config after import" - # lnet/include/lnet/lib-lnet.h defines DEFAULT_PEER_TIMEOUT 180 - sed -i 's/peer_timeout: .*$/peer_timeout: 180/' \ - $TMP/sanity-lnet-$testnum-expected.yaml + do_lnetctl net del $opts || error "Failed to delete net $net" - sed -i '/^.*peer_timeout:.*$/d' $TMP/sanity-lnet-$testnum-actual.yaml + do_lnetctl net add $opts --peer-timeout=$pto || + error "Failed to add net with peer-timeout=$pto" - do_lnetctl import $TMP/sanity-lnet-$testnum-actual.yaml || - error "Failed to import config without peer_timeout" + $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml - $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml + compare_yaml_files || error "Wrong config after lnetctl net add" + done - compare_yaml_files + return 0 } run_test 231 "Check DLC handling of peer_timeout parameter"