From: Steve Wise Date: Wed, 27 Jun 2012 19:48:05 +0000 (-0500) Subject: ibdev2netdev: Support RNIC. X-Git-Tag: vofed-3.5-x~66 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=d2ee5f3f0b5904bc781bca77298e0b35bbb5af2e;p=~emulex%2Ffor-vlad%2Fold%2Fcompat-rdma.git ibdev2netdev: Support RNIC. The oldstyle=y logic in ibdev2netdev to match netdevs to ibdevs didn't work for RNIC devices since their mac address is left justified in the gid. This patch uses the type attribute to do the right thing for RNIC devices. Note: the oldstyle=n logic works. Signed-off-by: Steve Wise --- diff --git a/ofed_scripts/ibdev2netdev b/ofed_scripts/ibdev2netdev index 7cffa7e..515e170 100755 --- a/ofed_scripts/ibdev2netdev +++ b/ofed_scripts/ibdev2netdev @@ -112,16 +112,21 @@ function find_mac() { ibdevs=$(ls /sys/class/infiniband/) for ibdev in $ibdevs; do + type=$(cat /sys/class/infiniband/$ibdev/node_type|cut -d ' ' -f 2) ports=$(ls /sys/class/infiniband/$ibdev/ports/) for port in $ports; do gids=$(ls /sys/class/infiniband/$ibdev/ports/$port/gids) for gid in $gids; do - first=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21-22) - first=$(( first ^ 2 )) - first=$(printf "%02x" $first) - second=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 's/://g' | cut -b 3-6) - third=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 's/://g' | cut -b 11-) - pmac=$first$second$third + if [[ "$type" = "RNIC" ]]; then + pmac=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 1-14|sed -e 's/://g') + else + first=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21-22) + first=$(( first ^ 2 )) + first=$(printf "%02x" $first) + second=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 's/://g' | cut -b 3-6) + third=$(cat /sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 's/://g' | cut -b 11-) + pmac=$first$second$third + fi if [ x$pmac == x$1 ]; then print_line $ibdev $port $2 fi