1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 3 4 lib_dir=$(dirname $0)/../../../net/forwarding 5 6 ALL_TESTS="fw_flash_test params_test regions_test reload_test \ 7 netns_reload_test resource_test dev_info_test \ 8 empty_reporter_test dummy_reporter_test rate_test" 9 NUM_NETIFS=0 10 source $lib_dir/lib.sh 11 12 BUS_ADDR=10 13 PORT_COUNT=4 14 VF_COUNT=4 15 DEV_NAME=netdevsim$BUS_ADDR 16 SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/ 17 DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/ 18 DL_HANDLE=netdevsim/$DEV_NAME 19 20 wait_for_devlink() 21 { 22 "$@" | grep -q $DL_HANDLE 23 } 24 25 devlink_wait() 26 { 27 local timeout=$1 28 29 busywait "$timeout" wait_for_devlink devlink dev 30 } 31 32 fw_flash_test() 33 { 34 DUMMYFILE=$(find /lib/firmware -type f -printf '%P\n' | head -1) 35 RET=0 36 37 if [ -z "$DUMMYFILE" ] 38 then 39 echo "SKIP: unable to find suitable dummy firmware file" 40 return 41 fi 42 43 devlink dev flash $DL_HANDLE file $DUMMYFILE 44 check_err $? "Failed to flash with status updates on" 45 46 devlink dev flash $DL_HANDLE file $DUMMYFILE component fw.mgmt 47 check_err $? "Failed to flash with component attribute" 48 49 devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite settings 50 check_fail $? "Flash with overwrite settings should be rejected" 51 52 echo "1"> $DEBUGFS_DIR/fw_update_overwrite_mask 53 check_err $? "Failed to change allowed overwrite mask" 54 55 devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite settings 56 check_err $? "Failed to flash with settings overwrite enabled" 57 58 devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite identifiers 59 check_fail $? "Flash with overwrite settings should be identifiers" 60 61 echo "3"> $DEBUGFS_DIR/fw_update_overwrite_mask 62 check_err $? "Failed to change allowed overwrite mask" 63 64 devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite identifiers overwrite settings 65 check_err $? "Failed to flash with settings and identifiers overwrite enabled" 66 67 echo "n"> $DEBUGFS_DIR/fw_update_status 68 check_err $? "Failed to disable status updates" 69 70 devlink dev flash $DL_HANDLE file $DUMMYFILE 71 check_err $? "Failed to flash with status updates off" 72 73 log_test "fw flash test" 74 } 75 76 param_get() 77 { 78 local name=$1 79 80 cmd_jq "devlink dev param show $DL_HANDLE name $name -j" \ 81 '.[][][].values[] | select(.cmode == "driverinit").value' 82 } 83 84 param_set() 85 { 86 local name=$1 87 local value=$2 88 89 devlink dev param set $DL_HANDLE name $name cmode driverinit value $value 90 } 91 92 check_value() 93 { 94 local name=$1 95 local phase_name=$2 96 local expected_param_value=$3 97 local expected_debugfs_value=$4 98 local value 99 100 value=$(param_get $name) 101 check_err $? "Failed to get $name param value" 102 [ "$value" == "$expected_param_value" ] 103 check_err $? "Unexpected $phase_name $name param value" 104 value=$(<$DEBUGFS_DIR/$name) 105 check_err $? "Failed to get $name debugfs value" 106 [ "$value" == "$expected_debugfs_value" ] 107 check_err $? "Unexpected $phase_name $name debugfs value" 108 } 109 110 params_test() 111 { 112 RET=0 113 114 local max_macs 115 local test1 116 117 check_value max_macs initial 32 32 118 check_value test1 initial true Y 119 120 param_set max_macs 16 121 check_err $? "Failed to set max_macs param value" 122 param_set test1 false 123 check_err $? "Failed to set test1 param value" 124 125 check_value max_macs post-set 16 32 126 check_value test1 post-set false Y 127 128 devlink dev reload $DL_HANDLE 129 130 check_value max_macs post-reload 16 16 131 check_value test1 post-reload false N 132 133 log_test "params test" 134 } 135 136 check_region_size() 137 { 138 local name=$1 139 local size 140 141 size=$(devlink region show $DL_HANDLE/$name -j | jq -e -r '.[][].size') 142 check_err $? "Failed to get $name region size" 143 [ $size -eq 32768 ] 144 check_err $? "Invalid $name region size" 145 } 146 147 check_region_snapshot_count() 148 { 149 local name=$1 150 local phase_name=$2 151 local expected_count=$3 152 local count 153 154 count=$(devlink region show $DL_HANDLE/$name -j | jq -e -r '.[][].snapshot | length') 155 [ $count -eq $expected_count ] 156 check_err $? "Unexpected $phase_name snapshot count" 157 } 158 159 regions_test() 160 { 161 RET=0 162 163 local count 164 165 check_region_size dummy 166 check_region_snapshot_count dummy initial 0 167 168 echo ""> $DEBUGFS_DIR/take_snapshot 169 check_err $? "Failed to take first dummy region snapshot" 170 check_region_snapshot_count dummy post-first-snapshot 1 171 172 echo ""> $DEBUGFS_DIR/take_snapshot 173 check_err $? "Failed to take second dummy region snapshot" 174 check_region_snapshot_count dummy post-second-snapshot 2 175 176 echo ""> $DEBUGFS_DIR/take_snapshot 177 check_err $? "Failed to take third dummy region snapshot" 178 check_region_snapshot_count dummy post-third-snapshot 3 179 180 devlink region del $DL_HANDLE/dummy snapshot 1 181 check_err $? "Failed to delete first dummy region snapshot" 182 183 check_region_snapshot_count dummy post-first-delete 2 184 185 devlink region new $DL_HANDLE/dummy snapshot 25 186 check_err $? "Failed to create a new snapshot with id 25" 187 188 check_region_snapshot_count dummy post-first-request 3 189 190 devlink region dump $DL_HANDLE/dummy snapshot 25 >> /dev/null 191 check_err $? "Failed to dump snapshot with id 25" 192 193 devlink region read $DL_HANDLE/dummy snapshot 25 addr 0 len 1 >> /dev/null 194 check_err $? "Failed to read snapshot with id 25 (1 byte)" 195 196 devlink region read $DL_HANDLE/dummy snapshot 25 addr 128 len 128 >> /dev/null 197 check_err $? "Failed to read snapshot with id 25 (128 bytes)" 198 199 devlink region read $DL_HANDLE/dummy snapshot 25 addr 128 len $((1<<32)) >> /dev/null 200 check_err $? "Failed to read snapshot with id 25 (oversized)" 201 202 devlink region read $DL_HANDLE/dummy snapshot 25 addr $((1<<32)) len 128 >> /dev/null 2>&1 203 check_fail $? "Bad read of snapshot with id 25 did not fail" 204 205 devlink region del $DL_HANDLE/dummy snapshot 25 206 check_err $? "Failed to delete snapshot with id 25" 207 208 check_region_snapshot_count dummy post-second-delete 2 209 210 sid=$(devlink -j region new $DL_HANDLE/dummy | jq '.[][][][]') 211 check_err $? "Failed to create a new snapshot with id allocated by the kernel" 212 213 check_region_snapshot_count dummy post-first-request 3 214 215 devlink region dump $DL_HANDLE/dummy snapshot $sid >> /dev/null 216 check_err $? "Failed to dump a snapshot with id allocated by the kernel" 217 218 devlink region del $DL_HANDLE/dummy snapshot $sid 219 check_err $? "Failed to delete snapshot with id allocated by the kernel" 220 221 check_region_snapshot_count dummy post-first-request 2 222 223 log_test "regions test" 224 } 225 226 reload_test() 227 { 228 RET=0 229 230 devlink dev reload $DL_HANDLE 231 check_err $? "Failed to reload" 232 233 echo "y"> $DEBUGFS_DIR/fail_reload 234 check_err $? "Failed to setup devlink reload to fail" 235 236 devlink dev reload $DL_HANDLE 237 check_fail $? "Unexpected success of devlink reload" 238 239 echo "n"> $DEBUGFS_DIR/fail_reload 240 check_err $? "Failed to setup devlink reload not to fail" 241 242 devlink dev reload $DL_HANDLE 243 check_err $? "Failed to reload after set not to fail" 244 245 echo "y"> $DEBUGFS_DIR/dont_allow_reload 246 check_err $? "Failed to forbid devlink reload" 247 248 devlink dev reload $DL_HANDLE 249 check_fail $? "Unexpected success of devlink reload" 250 251 echo "n"> $DEBUGFS_DIR/dont_allow_reload 252 check_err $? "Failed to re-enable devlink reload" 253 254 devlink dev reload $DL_HANDLE 255 check_err $? "Failed to reload after re-enable" 256 257 log_test "reload test" 258 } 259 260 netns_reload_test() 261 { 262 RET=0 263 264 ip netns add testns1 265 check_err $? "Failed add netns \"testns1\"" 266 ip netns add testns2 267 check_err $? "Failed add netns \"testns2\"" 268 269 devlink dev reload $DL_HANDLE netns testns1 270 check_err $? "Failed to reload into netns \"testns1\"" 271 272 devlink -N testns1 dev reload $DL_HANDLE netns testns2 273 check_err $? "Failed to reload from netns \"testns1\" into netns \"testns2\"" 274 275 ip netns del testns2 276 ip netns del testns1 277 278 # Wait until netns async cleanup is done. 279 devlink_wait 2000 280 281 log_test "netns reload test" 282 } 283 284 DUMMYDEV="dummytest" 285 286 res_val_get() 287 { 288 local netns=$1 289 local parentname=$2 290 local name=$3 291 local type=$4 292 293 cmd_jq "devlink -N $netns resource show $DL_HANDLE -j" \ 294 ".[][][] | select(.name == \"$parentname\").resources[] \ 295 | select(.name == \"$name\").$type" 296 } 297 298 resource_test() 299 { 300 RET=0 301 302 ip netns add testns1 303 check_err $? "Failed add netns \"testns1\"" 304 ip netns add testns2 305 check_err $? "Failed add netns \"testns2\"" 306 307 devlink dev reload $DL_HANDLE netns testns1 308 check_err $? "Failed to reload into netns \"testns1\"" 309 310 # Create dummy dev to add the address and routes on. 311 312 ip -n testns1 link add name $DUMMYDEV type dummy 313 check_err $? "Failed create dummy device" 314 ip -n testns1 link set $DUMMYDEV up 315 check_err $? "Failed bring up dummy device" 316 ip -n testns1 a a 192.0.1.1/24 dev $DUMMYDEV 317 check_err $? "Failed add an IP address to dummy device" 318 319 local occ=$(res_val_get testns1 IPv4 fib occ) 320 local limit=$((occ+1)) 321 322 # Set fib size limit to handle one another route only. 323 324 devlink -N testns1 resource set $DL_HANDLE path IPv4/fib size $limit 325 check_err $? "Failed to set IPv4/fib resource size" 326 local size_new=$(res_val_get testns1 IPv4 fib size_new) 327 [ "$size_new" -eq "$limit" ] 328 check_err $? "Unexpected \"size_new\" value (got $size_new, expected $limit)" 329 330 devlink -N testns1 dev reload $DL_HANDLE 331 check_err $? "Failed to reload" 332 local size=$(res_val_get testns1 IPv4 fib size) 333 [ "$size" -eq "$limit" ] 334 check_err $? "Unexpected \"size\" value (got $size, expected $limit)" 335 336 # Insert 2 routes, the first is going to be inserted, 337 # the second is expected to fail to be inserted. 338 339 ip -n testns1 r a 192.0.2.0/24 via 192.0.1.2 340 check_err $? "Failed to add route" 341 342 ip -n testns1 r a 192.0.3.0/24 via 192.0.1.2 343 check_fail $? "Unexpected successful route add over limit" 344 345 # Now create another dummy in second network namespace and 346 # insert two routes. That is over the limit of the netdevsim 347 # instance in the first namespace. Move the netdevsim instance 348 # into the second namespace and expect it to fail. 349 350 ip -n testns2 link add name $DUMMYDEV type dummy 351 check_err $? "Failed create dummy device" 352 ip -n testns2 link set $DUMMYDEV up 353 check_err $? "Failed bring up dummy device" 354 ip -n testns2 a a 192.0.1.1/24 dev $DUMMYDEV 355 check_err $? "Failed add an IP address to dummy device" 356 ip -n testns2 r a 192.0.2.0/24 via 192.0.1.2 357 check_err $? "Failed to add route" 358 ip -n testns2 r a 192.0.3.0/24 via 192.0.1.2 359 check_err $? "Failed to add route" 360 361 devlink -N testns1 dev reload $DL_HANDLE netns testns2 362 check_fail $? "Unexpected successful reload from netns \"testns1\" into netns \"testns2\"" 363 364 devlink -N testns2 resource set $DL_HANDLE path IPv4/fib size ' -1' 365 check_err $? "Failed to reset IPv4/fib resource size" 366 367 devlink -N testns2 dev reload $DL_HANDLE netns 1 368 check_err $? "Failed to reload devlink back" 369 370 ip netns del testns2 371 ip netns del testns1 372 373 # Wait until netns async cleanup is done. 374 devlink_wait 2000 375 376 log_test "resource test" 377 } 378 379 info_get() 380 { 381 local name=$1 382 383 cmd_jq "devlink dev info $DL_HANDLE -j" ".[][][\"$name\"]" "-e" 384 } 385 386 dev_info_test() 387 { 388 RET=0 389 390 driver=$(info_get "driver") 391 check_err $? "Failed to get driver name" 392 [ "$driver" == "netdevsim" ] 393 check_err $? "Unexpected driver name $driver" 394 395 log_test "dev_info test" 396 } 397 398 empty_reporter_test() 399 { 400 RET=0 401 402 devlink health show $DL_HANDLE reporter empty >/dev/null 403 check_err $? "Failed show empty reporter" 404 405 devlink health dump show $DL_HANDLE reporter empty >/dev/null 406 check_err $? "Failed show dump of empty reporter" 407 408 devlink health diagnose $DL_HANDLE reporter empty >/dev/null 409 check_err $? "Failed diagnose empty reporter" 410 411 devlink health recover $DL_HANDLE reporter empty 412 check_err $? "Failed recover empty reporter" 413 414 log_test "empty reporter test" 415 } 416 417 check_reporter_info() 418 { 419 local name=$1 420 local expected_state=$2 421 local expected_error=$3 422 local expected_recover=$4 423 local expected_grace_period=$5 424 local expected_auto_recover=$6 425 426 local show=$(devlink health show $DL_HANDLE reporter $name -j | jq -e -r ".[][][]") 427 check_err $? "Failed show $name reporter" 428 429 local state=$(echo $show | jq -r ".state") 430 [ "$state" == "$expected_state" ] 431 check_err $? "Unexpected \"state\" value (got $state, expected $expected_state)" 432 433 local error=$(echo $show | jq -r ".error") 434 [ "$error" == "$expected_error" ] 435 check_err $? "Unexpected \"error\" value (got $error, expected $expected_error)" 436 437 local recover=`echo $show | jq -r ".recover"` 438 [ "$recover" == "$expected_recover" ] 439 check_err $? "Unexpected \"recover\" value (got $recover, expected $expected_recover)" 440 441 local grace_period=$(echo $show | jq -r ".grace_period") 442 check_err $? "Failed get $name reporter grace_period" 443 [ "$grace_period" == "$expected_grace_period" ] 444 check_err $? "Unexpected \"grace_period\" value (got $grace_period, expected $expected_grace_period)" 445 446 local auto_recover=$(echo $show | jq -r ".auto_recover") 447 [ "$auto_recover" == "$expected_auto_recover" ] 448 check_err $? "Unexpected \"auto_recover\" value (got $auto_recover, expected $expected_auto_recover)" 449 } 450 451 dummy_reporter_test() 452 { 453 RET=0 454 455 check_reporter_info dummy healthy 0 0 0 true 456 457 devlink health set $DL_HANDLE reporter dummy auto_recover false 458 check_err $? "Failed to dummy reporter auto_recover option" 459 460 check_reporter_info dummy healthy 0 0 0 false 461 462 local BREAK_MSG="foo bar" 463 echo "$BREAK_MSG"> $DEBUGFS_DIR/health/break_health 464 check_err $? "Failed to break dummy reporter" 465 466 check_reporter_info dummy error 1 0 0 false 467 468 local dump=$(devlink health dump show $DL_HANDLE reporter dummy -j) 469 check_err $? "Failed show dump of dummy reporter" 470 471 local dump_break_msg=$(echo $dump | jq -r ".break_message") 472 [ "$dump_break_msg" == "$BREAK_MSG" ] 473 check_err $? "Unexpected dump break message value (got $dump_break_msg, expected $BREAK_MSG)" 474 475 devlink health dump clear $DL_HANDLE reporter dummy 476 check_err $? "Failed clear dump of dummy reporter" 477 478 devlink health recover $DL_HANDLE reporter dummy 479 check_err $? "Failed recover dummy reporter" 480 481 check_reporter_info dummy healthy 1 1 0 false 482 483 devlink health set $DL_HANDLE reporter dummy auto_recover true 484 check_err $? "Failed to dummy reporter auto_recover option" 485 486 check_reporter_info dummy healthy 1 1 0 true 487 488 echo "$BREAK_MSG"> $DEBUGFS_DIR/health/break_health 489 check_err $? "Failed to break dummy reporter" 490 491 check_reporter_info dummy healthy 2 2 0 true 492 493 local diagnose=$(devlink health diagnose $DL_HANDLE reporter dummy -j -p) 494 check_err $? "Failed show diagnose of dummy reporter" 495 496 local rcvrd_break_msg=$(echo $diagnose | jq -r ".recovered_break_message") 497 [ "$rcvrd_break_msg" == "$BREAK_MSG" ] 498 check_err $? "Unexpected recovered break message value (got $rcvrd_break_msg, expected $BREAK_MSG)" 499 500 devlink health set $DL_HANDLE reporter dummy grace_period 10 501 check_err $? "Failed to dummy reporter grace_period option" 502 503 check_reporter_info dummy healthy 2 2 10 true 504 505 echo "Y"> $DEBUGFS_DIR/health/fail_recover 506 check_err $? "Failed set dummy reporter recovery to fail" 507 508 echo "$BREAK_MSG"> $DEBUGFS_DIR/health/break_health 509 check_fail $? "Unexpected success of dummy reporter break" 510 511 check_reporter_info dummy error 3 2 10 true 512 513 devlink health recover $DL_HANDLE reporter dummy 514 check_fail $? "Unexpected success of dummy reporter recover" 515 516 echo "N"> $DEBUGFS_DIR/health/fail_recover 517 check_err $? "Failed set dummy reporter recovery to be successful" 518 519 devlink health recover $DL_HANDLE reporter dummy 520 check_err $? "Failed recover dummy reporter" 521 522 check_reporter_info dummy healthy 3 3 10 true 523 524 echo 8192 > $DEBUGFS_DIR/health/binary_len 525 check_err $? "Failed set dummy reporter binary len to 8192" 526 527 local dump=$(devlink health dump show $DL_HANDLE reporter dummy -j) 528 check_err $? "Failed show dump of dummy reporter" 529 530 devlink health dump clear $DL_HANDLE reporter dummy 531 check_err $? "Failed clear dump of dummy reporter" 532 533 log_test "dummy reporter test" 534 } 535 536 rate_leafs_get() 537 { 538 local handle=$1 539 540 cmd_jq "devlink port function rate show -j" \ 541 '.[] | to_entries | .[] | select(.value.type == "leaf") | .key | select(contains("'$handle'"))' 542 } 543 544 rate_nodes_get() 545 { 546 local handle=$1 547 548 cmd_jq "devlink port function rate show -j" \ 549 '.[] | to_entries | .[] | select(.value.type == "node") | .key | select(contains("'$handle'"))' 550 } 551 552 rate_attr_set() 553 { 554 local handle=$1 555 local name=$2 556 local value=$3 557 local units=$4 558 559 devlink port function rate set $handle $name $value$units 560 } 561 562 rate_attr_get() 563 { 564 local handle=$1 565 local name=$2 566 567 cmd_jq "devlink port function rate show $handle -j" '.[][].'$name 568 } 569 570 rate_attr_tx_rate_check() 571 { 572 local handle=$1 573 local name=$2 574 local rate=$3 575 local debug_file=$4 576 577 rate_attr_set $handle $name $rate mbit 578 check_err $? "Failed to set $name value" 579 580 local debug_value=$(cat $debug_file) 581 check_err $? "Failed to read $name value from debugfs" 582 [ "$debug_value" == "$rate" ] 583 check_err $? "Unexpected $name debug value $debug_value != $rate" 584 585 local api_value=$(( $(rate_attr_get $handle $name) * 8 / 1000000 )) 586 check_err $? "Failed to get $name attr value" 587 [ "$api_value" == "$rate" ] 588 check_err $? "Unexpected $name attr value $api_value != $rate" 589 } 590 591 rate_attr_parent_check() 592 { 593 local handle=$1 594 local parent=$2 595 local debug_file=$3 596 597 rate_attr_set $handle parent $parent 598 check_err $? "Failed to set parent" 599 600 debug_value=$(cat $debug_file) 601 check_err $? "Failed to get parent debugfs value" 602 [ "$debug_value" == "$parent" ] 603 check_err $? "Unexpected parent debug value $debug_value != $parent" 604 605 api_value=$(rate_attr_get $r_obj parent) 606 check_err $? "Failed to get parent attr value" 607 [ "$api_value" == "$parent" ] 608 check_err $? "Unexpected parent attr value $api_value != $parent" 609 } 610 611 rate_node_add() 612 { 613 local handle=$1 614 615 devlink port function rate add $handle 616 } 617 618 rate_node_del() 619 { 620 local handle=$1 621 622 devlink port function rate del $handle 623 } 624 625 rate_test() 626 { 627 RET=0 628 629 echo $VF_COUNT > /sys/bus/netdevsim/devices/$DEV_NAME/sriov_numvfs 630 devlink dev eswitch set $DL_HANDLE mode switchdev 631 local leafs=`rate_leafs_get $DL_HANDLE` 632 local num_leafs=`echo $leafs | wc -w` 633 [ "$num_leafs" == "$VF_COUNT" ] 634 check_err $? "Expected $VF_COUNT rate leafs but got $num_leafs" 635 636 rate=10 637 for r_obj in $leafs 638 do 639 rate_attr_tx_rate_check $r_obj tx_share $rate \ 640 $DEBUGFS_DIR/ports/${r_obj##*/}/tx_share 641 rate=$(($rate+10)) 642 done 643 644 rate=100 645 for r_obj in $leafs 646 do 647 rate_attr_tx_rate_check $r_obj tx_max $rate \ 648 $DEBUGFS_DIR/ports/${r_obj##*/}/tx_max 649 rate=$(($rate+100)) 650 done 651 652 local node1_name='group1' 653 local node1="$DL_HANDLE/$node1_name" 654 rate_node_add "$node1" 655 check_err $? "Failed to add node $node1" 656 657 local num_nodes=`rate_nodes_get $DL_HANDLE | wc -w` 658 [ $num_nodes == 1 ] 659 check_err $? "Expected 1 rate node in output but got $num_nodes" 660 661 local node_tx_share=10 662 rate_attr_tx_rate_check $node1 tx_share $node_tx_share \ 663 $DEBUGFS_DIR/rate_nodes/${node1##*/}/tx_share 664 665 local node_tx_max=100 666 rate_attr_tx_rate_check $node1 tx_max $node_tx_max \ 667 $DEBUGFS_DIR/rate_nodes/${node1##*/}/tx_max 668 669 rate_node_del "$node1" 670 check_err $? "Failed to delete node $node1" 671 local num_nodes=`rate_nodes_get $DL_HANDLE | wc -w` 672 [ $num_nodes == 0 ] 673 check_err $? "Expected 0 rate node but got $num_nodes" 674 675 local node1_name='group1' 676 local node1="$DL_HANDLE/$node1_name" 677 rate_node_add "$node1" 678 check_err $? "Failed to add node $node1" 679 680 rate_attr_parent_check $r_obj $node1_name \ 681 $DEBUGFS_DIR/ports/${r_obj##*/}/rate_parent 682 683 local node2_name='group2' 684 local node2="$DL_HANDLE/$node2_name" 685 rate_node_add "$node2" 686 check_err $? "Failed to add node $node2" 687 688 rate_attr_parent_check $node2 $node1_name \ 689 $DEBUGFS_DIR/rate_nodes/$node2_name/rate_parent 690 rate_node_del "$node2" 691 check_err $? "Failed to delete node $node2" 692 rate_attr_set "$r_obj" noparent 693 check_err $? "Failed to unset $r_obj parent node" 694 rate_node_del "$node1" 695 check_err $? "Failed to delete node $node1" 696 697 log_test "rate test" 698 } 699 700 setup_prepare() 701 { 702 modprobe netdevsim 703 echo "$BUS_ADDR $PORT_COUNT" > /sys/bus/netdevsim/new_device 704 while [ ! -d $SYSFS_NET_DIR ] ; do :; done 705 } 706 707 cleanup() 708 { 709 pre_cleanup 710 echo "$BUS_ADDR" > /sys/bus/netdevsim/del_device 711 modprobe -r netdevsim 712 } 713 714 trap cleanup EXIT 715 716 setup_prepare 717 718 tests_run 719 720 exit $EXIT_STATUS
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.