.. | .. |
---|
1 | 1 | #!/bin/bash |
---|
| 2 | +# SPDX-License-Identifier: GPL-2.0-or-later |
---|
2 | 3 | # Copyright (c) 2016 Microsemi. All Rights Reserved. |
---|
3 | | -# |
---|
4 | | -# This program is free software; you can redistribute it and/or |
---|
5 | | -# modify it under the terms of the GNU General Public License as |
---|
6 | | -# published by the Free Software Foundation; either version 2 of |
---|
7 | | -# the License, or (at your option) any later version. |
---|
8 | | -# |
---|
9 | | -# This program is distributed in the hope that it would be useful, |
---|
10 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | -# GNU General Public License for more details. |
---|
13 | 4 | # |
---|
14 | 5 | # Author: Logan Gunthorpe <logang@deltatee.com> |
---|
15 | 6 | |
---|
.. | .. |
---|
87 | 78 | |
---|
88 | 79 | function _modprobe() |
---|
89 | 80 | { |
---|
90 | | - modprobe "$@" |
---|
| 81 | + modprobe "$@" || return 1 |
---|
91 | 82 | |
---|
92 | 83 | if [[ "$REMOTE_HOST" != "" ]]; then |
---|
93 | | - ssh "$REMOTE_HOST" modprobe "$@" |
---|
| 84 | + ssh "$REMOTE_HOST" modprobe "$@" || return 1 |
---|
94 | 85 | fi |
---|
95 | 86 | } |
---|
96 | 87 | |
---|
.. | .. |
---|
451 | 442 | echo " Passed" |
---|
452 | 443 | } |
---|
453 | 444 | |
---|
| 445 | +function msi_test() |
---|
| 446 | +{ |
---|
| 447 | + LOC=$1 |
---|
| 448 | + REM=$2 |
---|
| 449 | + |
---|
| 450 | + write_file 1 $LOC/ready |
---|
| 451 | + |
---|
| 452 | + echo "Running MSI interrupt tests on: $(subdirname $LOC) / $(subdirname $REM)" |
---|
| 453 | + |
---|
| 454 | + CNT=$(read_file "$LOC/count") |
---|
| 455 | + for ((i = 0; i < $CNT; i++)); do |
---|
| 456 | + START=$(read_file $REM/../irq${i}_occurrences) |
---|
| 457 | + write_file $i $LOC/trigger |
---|
| 458 | + END=$(read_file $REM/../irq${i}_occurrences) |
---|
| 459 | + |
---|
| 460 | + if [[ $(($END - $START)) != 1 ]]; then |
---|
| 461 | + echo "MSI did not trigger the interrupt on the remote side!" >&2 |
---|
| 462 | + exit 1 |
---|
| 463 | + fi |
---|
| 464 | + done |
---|
| 465 | + |
---|
| 466 | + echo " Passed" |
---|
| 467 | +} |
---|
| 468 | + |
---|
454 | 469 | function perf_test() |
---|
455 | 470 | { |
---|
456 | 471 | USE_DMA=$1 |
---|
.. | .. |
---|
529 | 544 | _modprobe -r ntb_pingpong |
---|
530 | 545 | } |
---|
531 | 546 | |
---|
| 547 | +function ntb_msi_tests() |
---|
| 548 | +{ |
---|
| 549 | + LOCAL_MSI="$DEBUGFS/ntb_msi_test/$LOCAL_DEV" |
---|
| 550 | + REMOTE_MSI="$REMOTE_HOST:$DEBUGFS/ntb_msi_test/$REMOTE_DEV" |
---|
| 551 | + |
---|
| 552 | + echo "Starting ntb_msi_test tests..." |
---|
| 553 | + |
---|
| 554 | + if ! _modprobe ntb_msi_test 2> /dev/null; then |
---|
| 555 | + echo " Not doing MSI tests seeing the module is not available." |
---|
| 556 | + return |
---|
| 557 | + fi |
---|
| 558 | + |
---|
| 559 | + port_test $LOCAL_MSI $REMOTE_MSI |
---|
| 560 | + |
---|
| 561 | + LOCAL_PEER="$LOCAL_MSI/peer$LOCAL_PIDX" |
---|
| 562 | + REMOTE_PEER="$REMOTE_MSI/peer$REMOTE_PIDX" |
---|
| 563 | + |
---|
| 564 | + msi_test $LOCAL_PEER $REMOTE_PEER |
---|
| 565 | + msi_test $REMOTE_PEER $LOCAL_PEER |
---|
| 566 | + |
---|
| 567 | + _modprobe -r ntb_msi_test |
---|
| 568 | +} |
---|
| 569 | + |
---|
532 | 570 | function ntb_perf_tests() |
---|
533 | 571 | { |
---|
534 | 572 | LOCAL_PERF="$DEBUGFS/ntb_perf/$LOCAL_DEV" |
---|
.. | .. |
---|
550 | 588 | _modprobe -r ntb_perf 2> /dev/null |
---|
551 | 589 | _modprobe -r ntb_pingpong 2> /dev/null |
---|
552 | 590 | _modprobe -r ntb_transport 2> /dev/null |
---|
| 591 | + _modprobe -r ntb_msi_test 2> /dev/null |
---|
553 | 592 | set -e |
---|
554 | 593 | } |
---|
555 | 594 | |
---|
.. | .. |
---|
586 | 625 | echo |
---|
587 | 626 | ntb_pingpong_tests |
---|
588 | 627 | echo |
---|
| 628 | +ntb_msi_tests |
---|
| 629 | +echo |
---|
589 | 630 | ntb_perf_tests |
---|
590 | 631 | echo |
---|