[openib-general] Forcing IB link state down

Eitan Zahavi eitan at mellanox.co.il
Sat Sep 24 22:52:53 PDT 2005


Hi Viswa,

A Tcl API for sending and receiving MADs is available under
https://openib.org/svn/gen2/utils/src/linux-user/ibis
(IBIS == IB Inband Services)

If you follow on the autogen.sh && configure && make && make install
you should get /usr/local/bin/ibis executable.

Then the following script would do the trick.
NOTE: when you force a port down you need to remember that if that
port is used for returning the response to the Set command - no response
will be possible and the following script will say:
"You probably turned off the port you came in through as you got no response!"

Hope this will meet your requirements.

Eitan


#!/bin/sh
# This file invokes the IBIS \
    export TCLLIBPATH="/usr/local/lib"; \
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; \
    exec /usr/local/bin/ibis "$0" "$@"

proc usage {} {
    global argv0
    puts "Usage: $argv0 <lid> <port> <UP|DOWN>"
    exit 1
}

# parse command line
if {[llength $argv] != 3} {
    usage
}

set lid [lindex $argv 0]
set port [lindex $argv 1]
set state [lindex $argv 2]

if {[lsearch {UP DOWN} $state] < 0} {
    usage
}

# init the IBIS
ibis_init
# attach to teh default port (as selected by UMAD) IBIS will abort if fail
ibis_set_port [lindex [lindex [ibis_get_local_ports_info] 0] 0]

# Query the PortInfo to get all its parameters and verify it is there...
set r [smPortInfoMad getByLid $lid $port]
if {$r != 0} {
    puts "Could not query the target port. Got code:$r"
    exit 1
}

# Do we set the physical port state polling or disabled?
if {$state == "UP"} {
    smPortInfoMad configure -state_info2 0x22 -state_info1 0x0
} else {
    smPortInfoMad configure -state_info2 0x32 -state_info1 0x0
}

# send and see we got
set r [smPortInfoMad setByLid $lid $port]
if {$r == 6} {
    puts "You probably turned off the port you came in through as you got no response!"
    exit 0
}
if {$r != 0} {
    puts "set failed with code $r"
    exit 1
}
exit 0



Hal Rosenstock wrote:
> On Fri, 2005-09-23 at 14:23, Viswanath Krishnamurthy wrote:
> 
>>I was looking if mthca driver has any API/ioctl to disable/enable the
>>link..
> 
> 
> I don't know, Roland ? I think this would be done via SM MADs.
> 
> -- Hal
> 
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit
> http://openib.org/mailman/listinfo/openib-general
> 




More information about the general mailing list