<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<style type="text/css"></style><style id="owaParaStyle" type="text/css"></style>
</head>
<body ocsi="0">
<div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 13px;">
<div style=""><font face="monospace" size="2"><span style="font-size: 10pt;"></span></font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;"><br>
</span></font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;">We have Ofed1.3.1 installed, one of the sub packages is
</span></font><font style="font-family: Arial;" face="monospace"><span style="font-size: 120%;">libibverbs version 1.1.1.
</span></font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;"></span></font><font style="font-family: Arial;" face="monospace" size="2"><span style="font-size: 10pt;">We have a small program that lists the number of IB cards available
in the system through ibv_get_device_list()</span></font><span style="font-family: Arial;">. See below for the sample code.
<br>
<font size="2"><span style="font-family: Arial;"><br>
</span></font>The system has two IB cards, the value returned by </span><font style="font-family: Arial;" face="monospace" size="2"><span style="font-size: 10pt;">ibv_get_device_list() in 'num_devices' is two, as expected.
<br>
</span></font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;"><br>
</span></font><font style="font-family: Arial;" face="monospace" size="2"><span style="font-size: 10pt;">However, when we disable one of the cards using the
</span></font><span style="font-family: Arial;">modprobe command, the program continues to return two cards present (monitoring is continuous in a while loop).
<br>
</span><font style="font-family: Arial;" size="2">Killing and restarting the sample test process</font><span style="font-family: Arial;"> results in reporting correct number of IB cards available (returns one after it is restarted). One of the prior versions
was known to report the correct number of IB cards without requiring to restart the program.
</span><br style="font-family: Arial;">
<font style="font-family: Arial;" size="2"><br>
We would like to determine the number of cards present without having to go through a restart.
</font><font style="font-family: Arial;" size="2">Any inputs on this behavior is appreciated.<br>
<span style="font-family: Arial;"><br>
</span></font><font style="font-family: Arial;" size="2">modprobe command - "sudo modprobe -r ib_mthca"</font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;"><br>
<br>
</span></font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;">Test program:<br>
</span></font><font style="font-family: Arial;" face="monospace" size="2"><span style="font-size: 10pt;">=================================================<br>
#include <stdio.h><br>
#include <infiniband/verbs.h><br>
<br>
int main(int argc, char **argv)<br>
{<br>
int ret, num_devices;<br>
struct ibv_device **dev_list;<br>
<br>
while(1) {<br>
<br>
dev_list = ibv_get_device_list(&num_devices);<br>
<br>
if (num_devices != 0) {<br>
printf("IB ADAPTER AVAILABLE:%d\n", num_devices);<br>
}<br>
else {<br>
printf("IB ADAPTER UNAVAILABLE\n");<br>
}<br>
sleep(2);<br>
ibv_free_device_list(dev_list);<br>
}<br>
<br>
return(0);<br>
}<br>
=================================================<br>
</span></font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;"><br>
</span></font><font style="font-family: Arial;" size="2"><span style="font-size: 10pt;">Thanks,<br>
</span></font><font size="2"><span style="font-size: 10pt;"><span style="font-family: Arial;">Mani.</span><span style="font-family: monospace;"><span style="font-family: monospace;"><br>
</span></span></span></font><font size="2"><span style="font-size: 10pt;"></span></font></div>
</div>
</body>
</html>