-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show_gids: Fix slow run on hosts with many interfaces #58
base: mlnx_ofed
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,15 +74,46 @@ function print_gids() | |
|
||
echo -e "DEV\tPORT\tINDEX\tGID\t\t\t\t\tIPv4 \t\tVER\tDEV" | ||
echo -e "---\t----\t-----\t---\t\t\t\t\t------------ \t---\t---" | ||
DEVS=$1 | ||
#Break after predefined number of 0 GIDS found | ||
#Assuming that the rest will be zero as well | ||
#Needed on hosst with large number of NICs, to avoid script slow run | ||
MAX_NUM_OF_ZERO_GIDS=2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we need this, istead of break on first zero gid? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per my experience with holes in git table, we have seen such issue recently. During ib_write_bw run if link is toggled, a hole will be created. Reasonable assumption is if there is a hole, most of the times it will be small, not in higher indexes. Thus the idea of scanning several more GIDs after the hole, it will not increase total time by much, but will account for most of the cases with holes. |
||
IS_SLIM=0 | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
--dev=*) | ||
DEVS="${1#*=}" | ||
;; | ||
--slim) | ||
IS_SLIM=1 | ||
;; | ||
*) | ||
echo "show_gids will print gids table for all RDMA devices" | ||
echo "-d|--dev=<rdma device> Can choose specifci mlx devices" | ||
echo "-s|--slim will break gid table scan after predefine max num-2 of zero GIDs" | ||
exit 1 | ||
esac | ||
shift | ||
done | ||
|
||
if [ -z "$DEVS" ] ; then | ||
DEVS=$(ls /sys/class/infiniband/) | ||
fi | ||
|
||
for d in $DEVS ; do | ||
for p in $(ls /sys/class/infiniband/$d/ports/) ; do | ||
for g in $(ls /sys/class/infiniband/$d/ports/$p/gids/) ; do | ||
declare -i ZERO_GIDS_CNT | ||
ZERO_GIDS_CNT=0 | ||
for g in $(ls -v /sys/class/infiniband/$d/ports/$p/gids/) ; do | ||
gid=$(cat /sys/class/infiniband/$d/ports/$p/gids/$g); | ||
if [ $gid = 0000:0000:0000:0000:0000:0000:0000:0000 ] ; then | ||
if [ $IS_SLIM = 1 ] ; then | ||
ZERO_GIDS_CNT+=1 | ||
if [ $ZERO_GIDS_CNT = $MAX_NUM_OF_ZERO_GIDS ] ; then | ||
break | ||
fi | ||
fi | ||
continue | ||
fi | ||
if [ $gid = fe80:0000:0000:0000:0000:0000:0000:0000 ] ; then | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space between "#" and comment:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do