5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
29 USAGE
="Usage: ibd_upgrade [-v]"
30 DRVCONF
=/kernel
/drv
/ibp.conf.old
33 # split device path into path components
35 split_path_components
()
44 hca_path
="/dev/`dirname $device_path`"
45 bname
=`basename $device_path`
64 if [ $verbose -eq 1 ]; then
75 # Get the instance number of ibd
76 # Device name format would be ibd#,
82 if [ "$1" != "ib" ]; then
92 if [ ${inst} -lt $# ]; then
93 (( inst
= $inst + 1 ))
94 eval "linkmode=\$${inst}"
99 if [ "$linkmode" = "0" ]; then
100 do_cmd
"dladm set-linkprop -p linkmode=ud ${device}"
109 \?) echo "$USAGE" 1>&2
115 if [ -f ${DRVCONF} ]; then
116 enable_rc
=`egrep "^[ ]*enable_rc[ ]*=" ${DRVCONF} | sed -e "s/[ ]*//g" -e "s/enable_rc=//" -e "s/;$//" 2>/dev/null`
120 # Loop through all ibd devices based on the old model (i.e., one ibd instance
121 # per partition; consequently device names have non zero pkey)
122 # and create data links with the same names as in the old model under the
125 ls -l /dev
/ibd
* 2> /dev
/null \
126 |
while read x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 device_path
128 split_path_components
130 if [ "$node_name" != "ibport" -o "$service" != "ipib" \
131 -o "$pkey" = "0x0" -o "$pkey" = "0x" ]; then
135 # verify that the hca path exists
136 cd $hca_path 2> /dev
/null
137 if [ $?
-ne 0 ]; then
141 fn
=`echo ibport@${port},0,ipib:ibp*[0-9]`
142 if [ -c "$fn" ]; then
147 do_cmd
"dladm delete-phys $partition_name" 2>/dev
/null
148 if [ $?
-ne 0 ]; then
149 do_cmd
"ibd_delete_link $partition_name"
151 do_cmd
"dladm create-part -f -l $2 -P $pkey $partition_name"
153 if [ "$enable_rc" != "" ]; then
154 process_rc_mode
$partition_name