<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4495550914530992190</id><updated>2024-09-08T03:54:29.929-07:00</updated><category term="windows password"/><title type='text'>You wish you knew it before</title><subtitle type='html'>If it takes more than hour to find a solution online then it is worth sharing it!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-2852302545460321599</id><published>2013-06-14T12:01:00.000-07:00</published><updated>2013-06-14T12:01:01.781-07:00</updated><title type='text'>POSIX LINUX P_Thread error pthread_barrier_t undeclared undefined </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
When using &lt;b&gt;pthread_barrier_t&lt;/b&gt; or other p_thread functionalities, p_thread_*, make sure the proper macro for defining &lt;b&gt;_XOPEN_SOURCE&lt;/b&gt; is added on top of your source file before all the include files. This is needed for some of functionalities and might take a little while before you figure out why the identifier is undefined or undeclared at compile time. &lt;b&gt;This is in addition to having #include &lt;pthread .h=&quot;&quot;&gt;&lt;/pthread&gt;&lt;/b&gt;, etc. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;#define _XOPEN_SOURCE 600 // X/Open 6, incorporating POSIX 2004&lt;/b&gt;&lt;/span&gt;&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#include &lt;pthread .h=&quot;&quot;&gt;&lt;/pthread&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;...&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The other options: &lt;br /&gt;&lt;br /&gt;#define _XOPEN_SOURCE 500 // X/Open 5, incorporating POSIX 1995, OR&lt;br /&gt;#define _XOPEN_SOURCE 600 // X/Open 6, incorporating POSIX 2004, OR&lt;br /&gt;#define _XOPEN_SOURCE 700 // X/Open 7, incorporating POSIX 2008&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/2852302545460321599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2013/06/posix-linux-pthread-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/2852302545460321599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/2852302545460321599'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2013/06/posix-linux-pthread-error.html' title='POSIX LINUX P_Thread error pthread_barrier_t undeclared undefined '/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-7743206377119199806</id><published>2013-05-26T16:08:00.003-07:00</published><updated>2013-05-26T16:08:58.109-07:00</updated><title type='text'>An internal error occurred during: &quot;Compute launch button tooltip&quot;.org/eclipse/cdt/core/model/CoreModel  Ubuntu </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Building your first Android App on Ubuntu - Errors&lt;/span&gt;&lt;/code&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;code&gt;Running the first example of Android from &lt;/code&gt;&lt;a href=&quot;http://developer.android.com/training/basics/firstapp/running-app.html&quot;&gt;developer.android.com...&lt;/a&gt;&amp;nbsp;:&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Operating System: Ubuntu 12.04&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Error: &amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;    An internal error occurred during: &quot;Compute launch button tooltip&quot;.org/eclipse/cdt/core/model/CoreModel&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Solution:&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;    sudo apt-get --reinstall install tzdata-java&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/7743206377119199806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2013/05/an-internal-error-occurred-during.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/7743206377119199806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/7743206377119199806'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2013/05/an-internal-error-occurred-during.html' title='An internal error occurred during: &quot;Compute launch button tooltip&quot;.org/eclipse/cdt/core/model/CoreModel  Ubuntu '/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-8833930322393722249</id><published>2012-07-16T18:57:00.004-07:00</published><updated>2012-07-16T18:57:40.259-07:00</updated><title type='text'>Multi-line Matlab figure title with different font sizes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Q:&amp;nbsp;&lt;span style=&quot;background-color: white; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; text-align: -webkit-auto;&quot;&gt;How can I create a multi-line title for my plot in Matlab?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Here&#39;s how make a multiple-line Matlab figure title:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&amp;gt; line1_title = strcat( &#39;tex1_2&#39;, &#39;[23]&#39;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&amp;gt; line2_title = strcat( &#39;tex3_4&#39;, &#39;[45]&#39;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;title({[line1_title]; [line2_title]});&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if you want to change the font size for some part of the title string, simply mention it in the string in a latex style. for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&amp;gt; line1_title = strcat( &#39;tex1_2&#39;, &#39;[23]&#39;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&amp;gt; line2_title = strcat( &#39;\fontsize{16}&#39;, &#39;tex3_4&#39;, &#39;\fontsize{8}&#39;, &#39;[45]&#39;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&amp;gt; title({[line1_title]; [line2_title]});&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
possible symptom:&lt;br /&gt;
&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;&lt;span style=&quot;background-color: white; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;Error using set&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;Cell array of strings may only contain string and numeric matrices&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;Error in title (line 55)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set(h, &#39;String&#39;, string, pvpairs{:});&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;Error in title (line 23)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; h = title(gca,varargin{:});&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/8833930322393722249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/07/multi-line-matlab-figure-title-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/8833930322393722249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/8833930322393722249'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/07/multi-line-matlab-figure-title-with.html' title='Multi-line Matlab figure title with different font sizes'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-7381083506187000410</id><published>2012-07-08T07:52:00.000-07:00</published><updated>2012-08-07T07:03:48.372-07:00</updated><title type='text'>How to use .eps figures with pdflatex</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here&#39;s how to use eps files with pdflatex:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\usepackage{epstopdf}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\usepackage{epsfig}&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
.... later in your tex file include your graphics:&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\begin{figure}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\centering&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\includegraphics[width=5.5in]{./my_fig}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\caption{My figure}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\label{fig_my_figure}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;\end{figure}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Note:&lt;/span&gt; Do not use an extension for your my_file.eps file and just leave it as&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;{./my_fig} instead of&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;{./my_fig.eps} &lt;/b&gt;or you might see an error as: &lt;span style=&quot;color: red;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;LaTeX Error: Unknown graphics extension: .eps.&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
EXTRA: This is how it worked for me: First I compile the whole thing without the usepackage commands and the eps figures get converted to pdf. however, I get the error &quot;LaTeX Error: Unknown graphics extension: .eps.&quot;, then I uncomment the two usepackage commands and it works, as it has already converted the eps files to pdf itself.&lt;br /&gt;
&lt;br /&gt;
If I try to compile the project with the two commands in, then I get this error:&lt;br /&gt;
&lt;br /&gt;
pdfTeX error: pdflatex (file ./content/blah-eps-converted-to.pdf): cannot find image file&lt;br /&gt;
&amp;nbsp;==&amp;gt; Fatal error occurred, no output PDF file produced!&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Keywords: latex, pdflatex, eps, pdf&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/7381083506187000410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/07/how-to-use-eps-figures-with-pdflatex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/7381083506187000410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/7381083506187000410'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/07/how-to-use-eps-figures-with-pdflatex.html' title='How to use .eps figures with pdflatex'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-995376425228204291</id><published>2012-07-07T13:43:00.002-07:00</published><updated>2012-07-07T13:43:46.893-07:00</updated><title type='text'>Symbolic Link in Windows - mklink - &quot;You do not have sufficient privilege to perform this operation.&quot;</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here&#39;s how to create a symbolic link in &lt;b&gt;Windows &lt;/b&gt;for a file or directory:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;Start Menu &amp;gt; Programs &amp;gt; Accessories&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Right click on &quot;&lt;b&gt;Command Prompt&lt;/b&gt;&quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Select &quot;&lt;b&gt;Run as administrator&lt;/b&gt;.&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;This opens a new command prompt with administrator&#39;s&amp;nbsp;privilege.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Type &quot;&lt;b&gt;mklink /D C:\my_symbolic_link C:\my_target_directory&lt;/b&gt;&quot; for creating a symbolic link to a directory. Omit /D if you wish to create a link to a file.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;If you are not running as an administrator you might get this error: &quot;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;You do not have sufficient privilege to perform this operation.&lt;/span&gt;&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;More info:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
The &lt;b&gt;mklink&lt;/b&gt; [&lt;a href=&quot;http://en.wikipedia.org/wiki/NTFS_symbolic_link&quot; target=&quot;_blank&quot;&gt;Wikipedia&lt;/a&gt;]&amp;nbsp;command is used to create a symbolic link.&amp;nbsp;&lt;div&gt;
It has the following command line syntax:&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
mklink [[/D] | [/H] | [/J]] linkName target
&lt;br /&gt;&lt;br /&gt;/D – Creates a directory symbolic link. Default is a file symbolic link.&lt;br /&gt;/H – Creates a hard link instead of a symbolic link.&lt;br /&gt;/J – Creates a Directory Junction.&lt;br /&gt;linkName – Specifies the new symbolic link name.&lt;br /&gt;target – Specifies the path (relative or absolute) that the new link refers to.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/995376425228204291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/07/symbolic-link-in-windows-mklink-you-do.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/995376425228204291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/995376425228204291'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/07/symbolic-link-in-windows-mklink-you-do.html' title='Symbolic Link in Windows - mklink - &quot;You do not have sufficient privilege to perform this operation.&quot;'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-3474160831983658496</id><published>2012-05-09T10:24:00.000-07:00</published><updated>2012-05-09T10:24:07.736-07:00</updated><title type='text'>NetBeans 7.0.1 &quot;Show Javadoc&quot; does not work on Ubuntu 12.04 LTS - &quot;Javadoc not found.&quot;</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;NetBeans 7.0.1 &quot;Show Javadoc&quot; does not work on Ubuntu 12.04 LTS after a fresh install. - &quot;Javadoc not found.&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;More info:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; text-align: -webkit-auto;&quot;&gt;Ubuntu by default is not using &quot;sun-java6-jdk&quot; or&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;&quot;&gt;&quot;sun-java7-jdk&quot; or&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;instead it is using &quot;openjdk-6-jdk&quot; or&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;&quot;&gt;&quot;openjdk-7-jdk&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Solution:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;sudo apt-get install openjdk-7-doc&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;it will be isntalled under:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;/usr/share/doc/openjdk-7-doc&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Add the above directory in NetBeans and restart:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 18px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Tools --&amp;gt; Java Platforms --&amp;gt; Javadoc ( tab ) then press &quot; Add Zip/Folder, and point to the unzipped folder, restart NetBeans, and it will work fine hopefully (did for me).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;keywords:&amp;nbsp;Java Doc Documentation Javadoc NetBeans Ubuntu&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/3474160831983658496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/05/netbeans-701-show-javadoc-does-not-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/3474160831983658496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/3474160831983658496'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2012/05/netbeans-701-show-javadoc-does-not-work.html' title='NetBeans 7.0.1 &quot;Show Javadoc&quot; does not work on Ubuntu 12.04 LTS - &quot;Javadoc not found.&quot;'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-3948831804517979662</id><published>2010-12-30T02:10:00.000-08:00</published><updated>2010-12-30T02:10:27.377-08:00</updated><title type='text'>Matlab batch printing figures to file</title><content type='html'>Well... if you ever got this error in Matlab when printing a figure into a file, here&#39;s the solution:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;gt;&amp;gt; myfilename={&#39;myfile1&#39; &#39;myfile2&#39;}&lt;br /&gt;
myfilename = &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;myfile1&#39;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;myfile2&#39;&lt;br /&gt;
&amp;gt;&amp;gt; printfilename = strcat(&#39;/home/user/&#39;,myfilename(1))&lt;br /&gt;
printfilename = &lt;br /&gt;
&lt;span style=&quot;background-color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;/home/user/myfile1&#39;&lt;/span&gt;&lt;br /&gt;
&amp;gt;&amp;gt; figure&lt;br /&gt;
&amp;gt;&amp;gt; print(gcf,&#39;-depsc&#39;,printfilename)&lt;br /&gt;
??? Error using ==&amp;gt; print at 339&lt;br /&gt;
Handle input argument contains non-handle value(s).&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;gt;&amp;gt; printfilename = strcat(&#39;/home/user/&#39;,cell2mat(myfilename(1)))&lt;br /&gt;
printfilename =&lt;br /&gt;
&lt;span style=&quot;background-color: lime;&quot;&gt;/home/user/myfile1&lt;/span&gt;&lt;br /&gt;
&amp;gt;&amp;gt; print(gcf,&#39;-depsc&#39;,printfilename)&lt;br /&gt;
&amp;gt;&amp;gt; &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
Difference:&amp;nbsp;&amp;nbsp; &#39;text&#39; vs. text</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/3948831804517979662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/12/matlab-batch-printing-figures-to-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/3948831804517979662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/3948831804517979662'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/12/matlab-batch-printing-figures-to-file.html' title='Matlab batch printing figures to file'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-7447823965793318067</id><published>2010-12-04T19:00:00.000-08:00</published><updated>2010-12-04T19:00:16.830-08:00</updated><title type='text'>NPB NAS Parallel Benchmark Fortran Compiler issue</title><content type='html'>If you&#39;re facing a compiling problem like the one below, when compiling the Fortran codes in NPB 3.3 or NPB 2.4 (at least the ones that I tried), you can fix it very easily.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Problem:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: #cc0000; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px;&quot;&gt;&lt;span style=&quot;background-color: transparent; border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;randi8.f: In function `randlc &#39;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;randi8.f: 23:&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;data i246m1 / X&#39;00003FFFFFFFFFFF &#39;/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;^&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border-width: 0px; display: inline; font-size: 14px; margin: 0px; outline-width: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Integer at (^) too large&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Change the random number generator in the config file. It is mentioned in the installation manual:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#---------------------------------------------------------------------------&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# The variable RAND controls which random number generator&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# is used. It is described in detail in README.install.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Use &quot;randi8&quot; unless there is a reason to use another one.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Other allowed values are &quot;randi8_safe&quot;, &quot;randdp&quot; and &quot;randdpvec&quot;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#---------------------------------------------------------------------------&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;RAND&amp;nbsp;&amp;nbsp; = &lt;b style=&quot;background-color: lime;&quot;&gt;randi8_safe&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;More info:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Here&#39;s what README.install says:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #20124d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; The &quot;RAND&quot; variable in make.def&lt;br /&gt;
&amp;nbsp;&amp;nbsp; --------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Most of the NPBs use a random number generator. In two of the NPBs (FT&lt;br /&gt;
&amp;nbsp;&amp;nbsp; and EP) the computation of random numbers is included in the timed&lt;br /&gt;
&amp;nbsp;&amp;nbsp; part of the calculation, and it is important that the random number&lt;br /&gt;
&amp;nbsp;&amp;nbsp; generator be efficient.&amp;nbsp; The default random number generator package&lt;br /&gt;
&amp;nbsp;&amp;nbsp; provided is called &quot;randi8&quot; and should be used where possible. It has&lt;br /&gt;
&amp;nbsp;&amp;nbsp; the following requirements:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; randi8:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. Uses integer*8 arithmetic. Compiler must support integer*8&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. Uses the Fortran 90 IAND intrinsic. Compiler must support IAND.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. Assumes overflow bits are discarded by the hardware. In particular,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; that the lowest 46 bits of a*b are always correct, even if the&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result a*b is larger than 2^64.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Since randi8 may not work on all machines, we supply the following&lt;br /&gt;
&amp;nbsp;&amp;nbsp; alternatives:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; randi8_safe&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. Uses integer*8 arithmetic&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. Uses the Fortran 90 IBITS intrinsic.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. Does not make any assumptions about overflow. Should always&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; work correctly if compiler supports integer*8 and IBITS.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; randdp&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. Uses double precision arithmetic (to simulate integer*8 operations).&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Should work with any system with support for 64-bit floating&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point arithmetic.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; randdpvec&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. Similar to randdp but written to be easier to vectorize.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #20124d;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/7447823965793318067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/12/npb-nas-parallel-benchmark-fortran.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/7447823965793318067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/7447823965793318067'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/12/npb-nas-parallel-benchmark-fortran.html' title='NPB NAS Parallel Benchmark Fortran Compiler issue'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-2751285216170561332</id><published>2010-12-02T11:47:00.000-08:00</published><updated>2010-12-02T12:39:27.654-08:00</updated><title type='text'>OFED Infiniband on CentOS , overcoming &quot;redeclaration&quot; erros for a customized patched kernel</title><content type='html'>&lt;span style=&quot;font-size: 100%;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;I was trying to install OFED on a patched kernel. The OFED rpms were not working for me. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;For some reason, that I do not still know, if I had installed any source rpm kernel, patched or original, I could not install OFED. However, original kernel rpms would work just fine.  I guess, some script problem with backport on infiniband probably is the source. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;I was facing errors like: &lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;error: redefinition of some header files both in the backport and in the source code.&lt;/span&gt;
&lt;i&gt;&lt;i&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;error: previous declaration of etc etc etc.&quot;&lt;/span&gt;

&lt;/i&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 100%;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;After trying a lot of different options, finally this worked for me:&lt;/span&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: verdana;&quot;&gt;Install the modules, one by one yourself.&lt;/span&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;I am using CentOS, so I am assuming this should work for Fedora too (running as root):&lt;/span&gt;


&lt;span style=&quot;color: #000099; font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;#~~~~~~~~~~ INSTALLATION OF IB MODULES ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;cd /root&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel wget make.x86_64 &lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;gcc.x86_64 libtool.x86_64 automake byacc flex.x86_64 which.x86_64 file.x86_64 passwd &lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;compat-gcc-34-g77.x86_64 gcc-gfortran.x86_64 gcc-c++.x86_64&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;wget http://kernel.org/pub/software/scm/git/git-1.7.3.tar.gz&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;tar zxvf git-1.7.3.tar.gz&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;cd git-1.7.3&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;make prefix=/usr/local all&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;make prefix=/usr/local install&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;cd&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;git clone git://git.openfabrics.org/~shefty/libibcm.git&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;git clone git://git.kernel.org/pub/scm/libs/infiniband/libibverbs.git&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;wget http://www.openfabrics.org/downloads/mlx4/libmlx4-1.0.1.tar.gz&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;git clone git://git.openfabrics.org/~shefty/librdmacm.git&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;git clone git://git.openfabrics.org/~sashak/management.git &lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;#~~~~~~~~~~ Order of compiling modules is important ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;cd /root/management/libibumad&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./autogen.sh ; ./configure ; make ; make install&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;export LD_LIBRARY_PATH=/usr/local/lib&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;cd /root/management/libibmad&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./autogen.sh ; ./configure ; make ; make install&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;cd /root/management/opensm&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./autogen.sh ; ./configure ; make ; make install&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;cd /root/libibverbs&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;vim configure.in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ Add below to line 15 ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;AC_PROG_LIBTOOL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ END OF FILE ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;aclocal&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./autogen.sh ; ./configure ; make ; make install&lt;/span&gt;


&lt;span style=&quot;color: blue;&quot;&gt;cd /root&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;tar zxvf libmlx4-1.0.1.tar.gz&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;cd /root/libmlx4-1.0.1&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./configure ; make ; make install&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;cd /root/libibcm&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./autogen.sh ; ./configure ; make ; make install&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;cd /root/librdmacm/&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./autogen.sh ; ./configure ; make ; make install&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;cd /root/management/infiniband-diags&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;./autogen.sh ; ./configure ; make ; make install&lt;/span&gt;


&lt;span style=&quot;color: blue;&quot;&gt;cd&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;mkdir /etc/infiniband&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;vim /etc/infiniband/openib.conf&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ Add this to /etc/infiniband/openib.conf ~~~~~~~~~~#&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ BEGINNING OF FILE ~~~~~~~~~~#&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Start HCA driver upon boot&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ONBOOT=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load UCM module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UCM_LOAD=no&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load RDMA_CM module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RDMA_CM_LOAD=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load RDMA_UCM module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RDMA_UCM_LOAD=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Increase ib_mad thread priority&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RENICE_IB_MAD=no&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load MTHCA&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;MTHCA_LOAD=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load IPATH&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IPATH_LOAD=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load MLX4 modules&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;MLX4_LOAD=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load MLX4_EN module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;MLX4_EN_LOAD=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load CXGB3 modules&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;CXGB3_LOAD=yes&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load IPoIB&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IPOIB_LOAD=no&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Enable IPoIB Connected Mode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SET_IPOIB_CM=np&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load SDP module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SDP_LOAD=no&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load SRP module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SRP_LOAD=no&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load SRP Target module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SRPT_LOAD=no&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load RDS module&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RDS_LOAD=no&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Enable SRP High Availability daemon&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SRPHA_ENABLE=no&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SRP_DAEMON_ENABLE=no&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ END OF FILE ~~~~~~~~~~#&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;vim /etc/init.d/openibd&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ An openibd would be nice ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ Add below to /etc/init.d/openibd ~~~~~~~~~~#&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ BEGINNING OF FILE ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Bring up/down openib&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# chkconfig: 2345 05 95&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# description: Activates/Deactivates InfiniBand Driver to \&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#              start at boot time.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;### BEGIN INIT INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Provides:       openibd&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;### END INIT INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Copyright (c) 2006 Mellanox Technologies. All rights reserved.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# This Software is licensed under one of the following licenses:&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# 1) under the terms of the &quot;Common Public License 1.0&quot; a copy of which is&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#    available from the Open Source Initiative, see&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#    http://www.opensource.org/licenses/cpl.php.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# 2) under the terms of the &quot;The BSD License&quot; a copy of which is&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#    available from the Open Source Initiative, see&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#    http://www.opensource.org/licenses/bsd-license.php.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# 3) under the terms of the &quot;GNU General Public License (GPL) Version 2&quot; a&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#    copy of which is available from the Open Source Initiative, see&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#    http://www.opensource.org/licenses/gpl-license.php.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Licensee has the right to choose one of the above licenses.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Redistributions of source code must retain the above copyright&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# notice and one of the license notices.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Redistributions in binary form must reproduce both the above copyright&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# notice, one of the license notices in the documentation&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# and/or other materials provided with the distribution.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#  $Id: openibd 9139 2006-08-29 14:03:38Z vlad $&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# config: /etc/infiniband/openib.conf&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;CONFIG=&quot;/etc/infiniband/openib.conf&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -f $CONFIG ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo No InfiniBand configuration found&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;. $CONFIG&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;CWD=`pwd`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;cd /etc/infiniband&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;WD=`pwd`&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;PATH=$PATH:/sbin:/usr/bin&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -e /etc/profile.d/ofed.sh ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;. /etc/profile.d/ofed.sh&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Only use ONBOOT option if called by a runlevel directory.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Therefore determine the base, follow a runlevel link name ...&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;base=${0##*/}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;link=${base#*[SK][0-9][0-9]}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# ... and compare them&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $link == $base ] ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RUNMODE=manual&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ONBOOT=yes&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RUNMODE=auto&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ACTION=$1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;shift&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RESTART=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;max_ports_num_in_hca=0&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Check if OpenIB configured to start automatically&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${ONBOOT}&quot; != &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if ( grep -i &#39;SuSE Linux&#39; /etc/issue &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ); then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -n &quot;$INIT_VERSION&quot; ] ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# MODE=onboot&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if LANG=C egrep -L &quot;^ONBOOT=[&#39;\&quot;]?[Nn][Oo][&#39;\&quot;]?&quot; ${CONFIG} &amp;gt; /dev/null &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;#########################################################################&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Get a sane screen width&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ -z &quot;${COLUMNS:-}&quot; ] &amp;amp;&amp;amp; COLUMNS=80&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;[ -z &quot;${CONSOLETYPE:-}&quot; ] &amp;amp;&amp;amp; [ -x /sbin/consoletype ] &amp;amp;&amp;amp; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;CONSOLETYPE=&quot;`/sbin/consoletype`&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ -f /etc/sysconfig/i18n -a -z &quot;${NOLOCALE:-}&quot; ] ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;. /etc/sysconfig/i18n&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$CONSOLETYPE&quot; != &quot;pty&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;case &quot;${LANG:-}&quot; in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ja_JP*|ko_KR*|zh_CN*|zh_TW*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;export LC_MESSAGES=en_US&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;export LANG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;esac&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;export LANG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Read in our configuration&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -z &quot;${BOOTUP:-}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -f /etc/sysconfig/init ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;. /etc/sysconfig/init&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# This all seem confusing? Look in /etc/sysconfig/init,&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# or in /usr/doc/initscripts-*/sysconfig.txt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;BOOTUP=color&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RES_COL=60&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;MOVE_TO_COL=&quot;echo -en \\033[${RES_COL}G&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_SUCCESS=&quot;echo -en \\033[1;32m&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_FAILURE=&quot;echo -en \\033[1;31m&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_WARNING=&quot;echo -en \\033[1;33m&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_NORMAL=&quot;echo -en \\033[0;39m&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;LOGLEVEL=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$CONSOLETYPE&quot; = &quot;serial&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;BOOTUP=serial&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;MOVE_TO_COL=&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_SUCCESS=&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_FAILURE=&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_WARNING=&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SETCOLOR_NORMAL=&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;${BOOTUP:-}&quot; != &quot;verbose&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;INITLOG_ARGS=&quot;-q&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;INITLOG_ARGS=&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo_success() {&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $@&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $MOVE_TO_COL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;[  &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_SUCCESS&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $&quot;OK&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_NORMAL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;  ]&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -e &quot;\r&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo_done() {&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $@&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $MOVE_TO_COL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;[  &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_NORMAL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $&quot;done&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_NORMAL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;  ]&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -e &quot;\r&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo_failure() {&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $@&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $MOVE_TO_COL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;[&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_FAILURE&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $&quot;FAILED&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_NORMAL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;]&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -e &quot;\r&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo_warning() {&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $@&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $MOVE_TO_COL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;[&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_WARNING&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n $&quot;WARNING&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ &quot;$BOOTUP&quot; = &quot;color&quot; ] &amp;amp;&amp;amp; $SETCOLOR_NORMAL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;]&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -e &quot;\r&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;count_ib_ports()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local cnt=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local ports_in_hca=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sysdir=/sys/class/infiniband&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;hcas=$(/bin/ls -1 ${sysdir} 2&amp;gt; /dev/null)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for hca in $hcas&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ports_in_hca=$(/bin/ls -1 ${sysdir}/${hca}/ports 2&amp;gt; /dev/null | wc -l)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $ports_in_hca -gt $max_ports_num_in_hca ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;max_ports_num_in_hca=$ports_in_hca&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;cnt=$[ $cnt + $ports_in_hca ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;return $cnt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Setting Environment variables&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IS_FEDORA=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -f /etc/redhat-release ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;DISTRIB=&quot;RedHat&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;NETWORK_CONF_DIR=&quot;/etc/sysconfig/network-scripts&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Check for Fedora, CentOS or Red Hat Enterprise Linux AS release 4 distribution&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ( grep -wE &quot;Fedora|Nahant|CentOS&quot; /etc/redhat-release &amp;gt; /dev/null ); then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IS_FEDORA=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif [ -f /etc/rocks-release ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;DISTRIB=&quot;Rocks&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;NETWORK_CONF_DIR=&quot;/etc/sysconfig/network-scripts&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif [ -f /etc/SuSE-release ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;DISTRIB=&quot;SuSE&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;NETWORK_CONF_DIR=&quot;/etc/sysconfig/network&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif [ -f /etc/debian_version ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;DISTRIB=&quot;Debian&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;DISTRIB=`ls /etc/*-release | head -n 1 | xargs -iXXX basename XXX -release 2&amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/dev/null`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -d /etc/sysconfig/network-scripts ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;NETWORK_CONF_DIR=&quot;/etc/sysconfig/network-scripts&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif [ -d /etc/sysconfig/network ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;NETWORK_CONF_DIR=&quot;/etc/sysconfig/network&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure &quot;You system is not supported for IPoIB configuration&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Try to load driver manually using configuration files from $WD &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;directory&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Define kernel version prefix&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;KPREFIX=`uname -r | cut -c -3 | tr -d &#39;.&#39; | tr -d &#39;[:space:]&#39;`&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Setting OpenIB start parameters&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SDP_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES ib_sdp&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IPOIB_LOAD=&quot;yes&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;IPOIB=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IPOIB_MTU=${IPOIB_MTU:-65520}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${IPOIB_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IPOIB=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SRP_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES ib_srp&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SRPT_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES ib_srpt&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${QLGC_VNIC_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES qlgc_vnic&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SRP_TARGET_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES ib_srp_target&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${RDMA_CM_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES rdma_cm&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${UCM_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES ib_ucm&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${RDS_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES rds&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${ISER_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES ib_iser&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${RDMA_UCM_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;POST_LOAD_MODULES=&quot;$POST_LOAD_MODULES rdma_ucm&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;GEN1_UNLOAD_MODULES=&quot;ib_srp_target scsi_target ib_srp kdapltest_module ib_kdapl &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ib_sdp ib_useraccess ib_useraccess_cm ib_cm ib_dapl_srv ib_ip2pr ib_ipoib ib_tavor mod_thh mod_rhh &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ib_dm_client ib_sa_client ib_client_query ib_poll ib_mad ib_core ib_services&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;UNLOAD_MODULES=&quot;ib_mthca mlx4_ib ib_ipath ipath_core ib_ehca iw_cxgb3 cxgb3&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UNLOAD_MODULES=&quot;$UNLOAD_MODULES ib_ipoib ib_madeye ib_rds&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UNLOAD_MODULES=&quot;$UNLOAD_MODULES rds ib_ucm kdapl ib_srp_target scsi_target ib_srpt &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ib_srp ib_iser ib_sdp&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UNLOAD_MODULES=&quot;$UNLOAD_MODULES rdma_ucm rdma_cm ib_addr ib_cm ib_local_sa findex&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UNLOAD_MODULES=&quot;$UNLOAD_MODULES ib_sa ib_uverbs ib_umad ib_mad ib_core&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;STATUS_MODULES=&quot;rdma_ucm ib_rds rds ib_srpt ib_srp qlgc_vnic ib_sdp rdma_cm ib_addr &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ib_local_sa findex ib_ipoib ib_ehca ib_ipath ipath_core mlx4_core mlx4_ib mlx4_en ib_mthca ib_uverbs &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ib_umad ib_ucm ib_sa ib_cm ib_mad ib_core iw_cxgb3&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ipoib_ha_pidfile=/var/run/ipoib_ha.pid&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;srp_daemon_pidfile=/var/run/srp_daemon.pid&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;get_interfaces()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;count_ib_ports&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ports_num=$?&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;interfaces=&quot;&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for (( i=0 ; i &amp;lt; $ports_num ; i++ ))&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;interfaces=&quot;$interfaces ib${i}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;get_mlx4_en_interfaces()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;mlx4_en_interfaces=&quot;&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for ethpath in /sys/class/net/eth*&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if (grep 0x15b3 ${ethpath}/device/vendor &amp;gt; /dev/null 2&amp;gt;&amp;amp;1); then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;mlx4_en_interfaces=&quot;$mlx4_en_interfaces ${ethpath##*/}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# If module $1 is loaded return - 0 else - 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;is_module()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local RC&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/sbin/lsmod | grep -w &quot;$1&quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$?&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;return $RC&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Return module&#39;s refcnt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;is_ref()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local refcnt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;refcnt=`cat /sys/module/&quot;$1&quot;/refcnt 2&amp;gt; /dev/nill`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return $refcnt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;get_sw_fw_info()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;INFO=/etc/infiniband/info&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;OFEDHOME=&quot;/usr/local&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -x ${INFO} ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;OFEDHOME=$(${INFO} | grep -w prefix | cut -d &#39;=&#39; -f 2)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;MREAD=$(which mstmread 2&amp;gt; /dev/null)&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Get OFED Build id&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -r ${OFEDHOME}/BUILD_ID ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo  &quot;Software&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo  &quot;-------------------------------------&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;printf &quot;Build ID:\n&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;cat ${OFEDHOME}/BUILD_ID&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo  &quot;-------------------------------------&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Get FW version&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -x ${MREAD} ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;vendor=&quot;15b3&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;slots=$(lspci -n -d &quot;${vendor}:&quot; 2&amp;gt; /dev/null | grep -v &quot;5a46&quot; | cut -d &#39; &#39; -f &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;1)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for mst_device in $slots&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;major=$($MREAD ${mst_device} 0x82478 2&amp;gt; /dev/null | cut -d &#39;:&#39; -f 2)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;subminor__minor=$($MREAD ${mst_device} 0x8247c 2&amp;gt; /dev/null | cut -d &#39;:&#39; -f &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;2)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ftime=$($MREAD ${mst_device} 0x82480 2&amp;gt; /dev/null | cut -d &#39;:&#39; -f 2)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fdate=$($MREAD ${mst_device} 0x82484 2&amp;gt; /dev/null | cut -d &#39;:&#39; -f 2)&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;major=$(echo -n $major | cut -d x -f 2 | cut -b 4)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;subminor__minor1=$(echo -n $subminor__minor | cut -d x -f 2 | cut -b 3,4)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;subminor__minor2=$(echo -n $subminor__minor | cut -d x -f 2 | cut -b &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;5,6,7,8)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Device ${mst_device} Info:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Firmware:&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;printf &quot;\tVersion:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;printf &quot;\t$major.$subminor__minor1.$subminor__minor2\n&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;day=$(echo -n $fdate | cut -d x -f 2 | cut -b 7,8)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;month=$(echo -n $fdate | cut -d x -f 2 | cut -b 5,6)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;year=$(echo -n $fdate | cut -d x -f 2 | cut -b 1,2,3,4)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;hour=$(echo -n $ftime | cut -d x -f 2 | cut -b 5,6)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;min=$(echo -n $ftime | cut -d x -f 2 | cut -b 3,4)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sec=$(echo -n $ftime | cut -d x -f 2 | cut -b 1,2)&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;printf &quot;\tDate:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;printf &quot;\t$day/$month/$year $hour:$min:$sec\n&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Create debug info&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;get_debug_info()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;trap &#39;&#39; 2 9 15&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;DEBUG_INFO=/tmp/ib_debug_info.log&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/rm -f $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;touch $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Hostname: `hostname -s`&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;test -e /etc/issue &amp;amp;&amp;amp; echo &quot;OS: `cat /etc/issue`&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Current kernel: `uname -r`&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Architecture: `uname -m`&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;GCC version: `gcc --version`&quot;  &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;CPU: `cat /proc/cpuinfo | /bin/grep -E \&quot;model name|arch\&quot; | head -1`&quot; &amp;gt;&amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;$DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;`cat /proc/meminfo | /bin/grep \&quot;MemTotal\&quot;`&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Chipset: `/sbin/lspci 2&amp;gt; /dev/null | head -1 | cut -d &#39;:&#39; -f 2-`&quot; &amp;gt;&amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;$DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;get_sw_fw_info &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;############# LSPCI ##############&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/lspci 2&amp;gt; /dev/null &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;############# LSPCI -N ##############&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/lspci -n 2&amp;gt; /dev/null &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;############# LSMOD ##############&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/lsmod &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;############# DMESG ##############&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/dmesg &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;############# Messages ##############&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;tail -50 /var/log/messages &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;############# Running Processes ##############&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/ps -ef &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;##############################################&quot; &amp;gt;&amp;gt; $DEBUG_INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Please open an issue in the https://bugs.openfabrics.org and attach &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;$DEBUG_INFO&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;errata_58()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Check AMD chipset issue Errata #58&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if test -x /sbin/lspci &amp;amp;&amp;amp; test -x /sbin/setpci; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ( /sbin/lspci -nd 1022:1100 2&amp;gt; /dev/null | grep &quot;1100&quot; &amp;gt; /dev/null ) &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;( /sbin/lspci -nd 1022:7450 2&amp;gt; /dev/null | grep &quot;7450&quot; &amp;gt; /dev/null ) &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;( /sbin/lspci -nd 15b3:5a46 2&amp;gt; /dev/null | grep &quot;5a46&quot; &amp;gt; /dev/null ); then&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if ! ( grep FIX_AMD_8131_ERR58 $CONFIG &amp;gt; /dev/null ); then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $CONFIG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;# Set FIX_AMD_8131_ERR58=YES to apply AMD-8131 Errata #58 &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;workaround&quot; &amp;gt;&amp;gt; $CONFIG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;FIX_AMD_8131_ERR58=\&quot;YES\&quot;&quot; &amp;gt;&amp;gt; $CONFIG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Set default value for FIX_AMD_8131_ERR58&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -z &quot;$FIX_AMD_8131_ERR58&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;FIX_AMD_8131_ERR58=&quot;YES&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;CURVAL=`/sbin/setpci -d 1022:1100 69`&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;for val in $CURVAL&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;${val}&quot; != &quot;c0&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$FIX_AMD_8131_ERR58&quot; == &quot;YES&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/setpci -d 1022:1100 69=c0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $? -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# echo &quot;AMD-8131 Errata #58 workaround applied&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;break&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Failed to apply AMD-8131 Errata #58 workaround&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Invalid configuration found for PCI-X chipset AMD-8131 &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;(Errata #58)&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$RUNMODE&quot; == &quot;manual&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;read -p &quot;Do you wish to continue anyway? [y/N]:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [[ &quot;$REPLY&quot; != &quot;y&quot; &amp;amp;&amp;amp; &quot;$REPLY&quot; != &quot;yes&quot; ]]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;break&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;errata_56()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Check AMD chipset issue Errata #56&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if test -x /sbin/lspci &amp;amp;&amp;amp; test -x /sbin/setpci; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ( /sbin/lspci -nd 1022:1100 2&amp;gt; /dev/null | grep &quot;1100&quot; &amp;gt; /dev/null ) &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;( /sbin/lspci -nd 1022:7450 2&amp;gt; /dev/null | grep &quot;7450&quot; &amp;gt; /dev/null ) &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;( /sbin/lspci -nd 15b3:5a46 2&amp;gt; /dev/null | grep &quot;5a46&quot; &amp;gt; /dev/null ); then&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if ! ( grep FIX_AMD_8131_ERR56 $CONFIG &amp;gt; /dev/null ); then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &amp;gt;&amp;gt; $CONFIG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;# Set FIX_AMD_8131_ERR56=YES to apply AMD-8131 Errata #56 &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;workaround&quot; &amp;gt;&amp;gt; $CONFIG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;FIX_AMD_8131_ERR56=\&quot;YES\&quot;&quot; &amp;gt;&amp;gt; $CONFIG&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Set default value for FIX_AMD_8131_ERR56&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -z &quot;$FIX_AMD_8131_ERR56&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;FIX_AMD_8131_ERR56=&quot;YES&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;bus=&quot;&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Look for devices AMD-8131&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for amd_dev in `/sbin/setpci -v -f -d 1022:7450 19 | cut -d&#39;:&#39; -f1,2`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;bus=`/sbin/setpci -s $amd_dev 19`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;rev=`/sbin/setpci -s $amd_dev 8`&lt;/span&gt;


&lt;span style=&quot;color: orange;&quot;&gt;# Look for Tavor attach to secondary bus of this devices&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for device in `/sbin/setpci -f -s $bus: -d 15b3:5a46 19`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $rev -lt 13 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$FIX_AMD_8131_ERR56&quot; == &quot;YES&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/setpci -d 15b3:5a44 72=14&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $? -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# echo &quot;AMD-8131 Errata #56 &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;workaround applied&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;break&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Failed to apply AMD-8131 &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;Errata #56 workaround&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Invalid configuration found for PCI-X &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;chipset AMD-8131 (Errata #56)&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$RUNMODE&quot; == &quot;manual&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;read -p &quot;Do you wish to continue &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;anyway? [y/N]:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [[ &quot;$REPLY&quot; != &quot;y&quot; &amp;amp;&amp;amp; &quot;$REPLY&quot; != &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;&quot;yes&quot; ]]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;    exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;break&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;continue&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# If more than one device is on the bus the issue a&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# warning&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;num=`/sbin/setpci -f -s $bus: 0 | wc -l |  sed &#39;s/\ *//g&#39;`&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ $num -gt 1 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Warning: your current PCI-X configuration &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;might be incorrect.&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;see AMD-8131 Errata 56 for more details.&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;need_location_code_fix()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local sub ARCH KVERSION&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ARCH=$(uname -m)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;KVERSION=$(uname -r)&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$ARCH&quot; != &quot;ppc64&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;case $KVERSION in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;2.6.9-*.EL*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sub=$(echo $KVERSION | cut -d&quot;-&quot; -f2 | cut -d&quot;.&quot; -f1)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $sub -lt 62 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 2;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;2.6.16.*-*-*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sub=$(echo $KVERSION | cut -d&quot;.&quot; -f4 | cut -d&quot;-&quot; -f1)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $sub -lt 53 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;2.6.18-*.el5*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sub=$(echo $KVERSION | cut -d&quot;-&quot; -f2 | cut -d&quot;.&quot; -f1)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $sub -lt 54 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;2.6.*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sub=$(echo $KVERSION | cut -d&quot;.&quot; -f3 | cut -d&quot;-&quot; -f1 | tr -d &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;[:alpha:][:punct:])&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $sub -lt 24 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;esac&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;return 1;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;fix_location_codes()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# ppc64 only:&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Fix duplicate location codes on kernels where ibmebus can&#39;t handle them&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;need_location_code_fix&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ret=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if  [ $ret = 1 ]; then return 0; fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ! [ -d /proc/device-tree -a -f /proc/ppc64/ofdt ]; then return 0; fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;local i=1 phandle lcode len&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# output all duplicate location codes and their devices&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for attr in $(find /proc/device-tree -name &quot;ibm,loc-code&quot; | grep &quot;lh.a&quot;); do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -e $(dirname $attr)&quot;\t&quot;$(cat $attr)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done | sort -k2 | uniq -f1 --all-repeated=separate | cut -f1 | while read &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;dev; do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -n &quot;$dev&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# append an instance counter to the location code&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;phandle=$(hexdump -e &#39;8 &quot;%u&quot;&#39; $dev/ibm,phandle)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;lcode=$(cat $dev/ibm,loc-code)-I$i&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;len=$(echo -n &quot;$lcode&quot; | wc -c)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;node=${dev#/proc/device-tree}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# kernel-2.6.9 don&#39;t provide &quot;update_property&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -z &quot;$(echo -n &quot;$node&quot; | grep &quot;lhca&quot;)&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $ret = 2 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;add_node $node&quot; &amp;gt; /tmp/addnode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;cd $dev&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for a in *; do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SIZE=$(stat -c%s $a)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$a&quot; = &quot;ibm,loc-code&quot; ] ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; echo -n &quot; $a $len $lcode&quot; &amp;gt;&amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/tmp/addnode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif [ &quot;$a&quot; = &quot;interrupts&quot; ] ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; echo -n &quot; $a 0 &quot; &amp;gt;&amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/tmp/addnode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; echo -n &quot; $a $SIZE &quot; &amp;gt;&amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/tmp/addnode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; cat $a &amp;gt;&amp;gt; /tmp/addnode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;remove_node $node&quot; &amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/proc/ppc64/ofdt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;cat /tmp/addnode &amp;gt; /proc/ppc64/ofdt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;rm -rf /tmp/addnode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;update_property $phandle &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ibm,loc-code $len $lcode&quot; &amp;gt; /proc/ppc64/ofdt&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;i=$(($i + 1))&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# empty line means new group -- reset i&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;i=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;rotate_log()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local log=$1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -s ${log} ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;cat ${log} &amp;gt;&amp;gt; ${log}.$(date +%Y-%m-%d)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/rm -f ${log}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;touch ${log}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Check whether IPoIB interface configured to be started upon boot.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;is_onboot()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local i=$1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;shift&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;case $DISTRIB in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RedHat|Rocks)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if LANG=C egrep -L &quot;^ONBOOT=[&#39;\&quot;]?[Nn][Oo][&#39;\&quot;]?&quot; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${NETWORK_CONF_DIR}/ifcfg-$i &amp;gt; /dev/null ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SuSE)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ! LANG=C egrep -L &quot;^STARTMODE=[&#39;\&quot;]?onboot[&#39;\&quot;]?&quot; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${NETWORK_CONF_DIR}/ifcfg-$i &amp;gt; /dev/null ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;Debian)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ! ( LANG=C grep auto /etc/network/interfaces | grep -w $i &amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/dev/null 2&amp;gt;&amp;amp;1) ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if LANG=C egrep -L &quot;^ONBOOT=[&#39;\&quot;]?[Nn][Oo][&#39;\&quot;]?&quot; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${NETWORK_CONF_DIR}/ifcfg-$i &amp;gt; /dev/null ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;esac&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;return 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;set_ipoib_cm()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local i=$1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;shift&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -e /sys/class/net/${i}/mode ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Failed to configure IPoIB connected mode for ${i}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo connected &amp;gt; /sys/class/net/${i}/mode&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/ifconfig ${i} mtu ${IPOIB_MTU}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;bring_up()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local i=$1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;shift&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;case $DISTRIB in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RedHat|Rocks)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $IS_FEDORA -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; /sbin/ifup ${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; . ${NETWORK_CONF_DIR}/ifcfg-${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -z ${IPADDR} ] &amp;amp;&amp;amp; [ ! -z ${NETMASK} ] &amp;amp;&amp;amp; [ ! -z ${BROADCAST} &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/ifconfig ${i} ${IPADDR} netmask ${NETMASK} broadcast &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${BROADCAST} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; /sbin/ifup ${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;SuSE)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$KPREFIX&quot; == &quot;26&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ifconfig ${i} up &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; # Workaround for ifup issue: two devices with the same &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;IP address&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;. ${NETWORK_CONF_DIR}/ifcfg-${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -z ${IPADDR} ] &amp;amp;&amp;amp; [ ! -z ${NETMASK} ] &amp;amp;&amp;amp; [ ! -z ${BROADCAST} &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/ifconfig ${i} ${IPADDR} netmask ${NETMASK} broadcast &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${BROADCAST} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; /sbin/ifup ${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# /sbin/ifup ${i} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/ifup ${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;esac&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SET_IPOIB_CM}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;set_ipoib_cm ${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;return $?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;start()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local RC=0&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Stop Gen1 modules if they are UP after uninstall&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if is_module ib_tavor; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Found Infiniband Gen1 modules.&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Trying to unload them first...&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;stop_gen1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;errata_58&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load Mellanox HCA driver&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${MTHCA_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe ib_mthca &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;my_rc=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $my_rc -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading Mellanox HCA driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $my_rc ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${MLX4_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe mlx4_core &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;my_rc=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $my_rc -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading Mellanox MLX4 HCA driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Set port configuration&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -f /etc/infiniband/connectx.conf ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;. /etc/infiniband/connectx.conf &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe mlx4_ib &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;my_rc=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $my_rc -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading Mellanox MLX4_IB HCA driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $my_rc ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${MLX4_EN_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ! is_module mlx4_core; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe mlx4_core &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe mlx4_en &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;my_rc=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $my_rc -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading Mellanox MLX4_EN HCA driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $my_rc ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load QLogic InfiniPath driver&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${IPATH_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe ib_ipath &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;my_rc=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $my_rc -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading QLogic InfiniPath driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Don&#39;t exit on error&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Workarround for Bug 252.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# RC=$[ $RC + $my_rc ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load eHCA driver&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${EHCA_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fix_location_codes&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe ib_ehca &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;my_rc=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $my_rc -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading eHCA driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $my_rc ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load iw_cxgb3 driver&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${CXGB3_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fix_location_codes&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe iw_cxgb3 &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;my_rc=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $my_rc -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading cxgb3 driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $my_rc ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;cat &amp;lt;&amp;lt;&amp;gt;&amp;gt; /tmp/ib_set_node_desc.sh&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Bring up/down openib&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# chkconfig: 2345 05 95&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# description: Activates/Deactivates InfiniBand Driver to \&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#              start at boot time.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;### BEGIN INIT INFO&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Provides:       openibd&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;### END INIT INFO&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Wait while node&#39;s hostname is set&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sleep 10&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Add node description to sysfs&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;IBSYSDIR=&quot;/sys/class/infiniband&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -d \${IBSYSDIR} ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;declare -i hca_id=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for hca in \${IBSYSDIR}/*&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -e \${hca}/node_desc ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;logger -i &quot;Set node_desc for \$(basename \$hca): \$(hostname -s) &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;HCA-\${hca_id}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo -n &quot;\$(hostname -s) HCA-\${hca_id}&quot; &amp;gt;&amp;gt; \${hca}/node_desc&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;let hca_id++&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/rm -f \$0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;EOF&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;chmod 755 /tmp/ib_set_node_desc.sh&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/tmp/ib_set_node_desc.sh &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe ib_umad &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $? ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe ib_uverbs &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $? ]&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ $IPOIB -eq 1 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe ib_ipoib &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$[ $RC + $? ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ $RC -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_success $&quot;Loading HCA driver and Access Layer: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Loading HCA driver and Access Layer: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;get_debug_info&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Enable IPoIB Interface if configured&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $IPOIB -eq 1 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;get_interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo Setting up InfiniBand network interfaces:&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for i in $interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [[ ! -e ${WD}/ifcfg-${i} &amp;amp;&amp;amp; ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;]]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;No configuration found for ${i}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SET_IPOIB_CM}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;set_ipoib_cm ${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;REMOVE_NETWORK_CONF=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ln -snf ${WD}/ifcfg-${i} &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${NETWORK_CONF_DIR}/ifcfg-${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;REMOVE_NETWORK_CONF=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$RUNMODE&quot; != &quot;manual&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ! is_onboot $i; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;continue&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;bring_up $i&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$?&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;unset IPADDR NETMASK BROADCAST&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ $REMOVE_NETWORK_CONF -eq 1 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; rm -f ${NETWORK_CONF_DIR}/ifcfg-${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ $RC -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_success $&quot;Bringing up interface $i:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Bringing up interface $i:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Bring up child interfaces if configured&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for child_conf in $(/bin/ls -1 ${NETWORK_CONF_DIR}/ifcfg-${i}.???? &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;2&amp;gt; /dev/null)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ch_i=${child_conf##*-}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Skip saved interfaces rpmsave and rpmnew&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if (echo $ch_i | grep rpm &amp;gt; /dev/null 2&amp;gt;&amp;amp;1); then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;continue&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$RUNMODE&quot; != &quot;manual&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ! is_onboot $ch_i; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;continue&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -f /sys/class/net/${i}/create_child ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;continue&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;pkey=0x${ch_i##*.}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -e /sys/class/net/${i}.${ch_i##*.} ] ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $pkey &amp;gt; /sys/class/net/${i}/create_child&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;bring_up $ch_i&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$?&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;unset IPADDR NETMASK BROADCAST&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $RC -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_success $&quot;Bringing up interface $ch_i:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Bringing up interface $ch_i:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_done &quot;Setting up service network   .   .   .&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Load configured modules&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$POST_LOAD_MODULES&quot; != &quot;&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for mod in  $POST_LOAD_MODULES&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;case $mod in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ib_iser)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Voltaire requirement&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe --force-modversion $mod &amp;gt; /dev/null &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ib_srp)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe $mod &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SRPHA_ENABLE}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  if [ ! -x /sbin/multipath ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;/sbin/multipath is required to enable &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;SRP HA.&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Create 91-srp.rules file&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;mkdir -p /etc/udev/rules.d&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$DISTRIB&quot; == &quot;SuSE&quot;  ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;   cat &amp;gt; /etc/udev/rules.d/91-srp.rules &amp;lt;&amp;lt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;EOF&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ACTION==&quot;add&quot;, KERNEL==&quot;sd*[!0-9]&quot;, RUN+=&quot;/sbin/multipath %M:%m&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;EOF&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe dm_multipath &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;srp_daemon.sh &amp;amp;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;srp_daemon_pid=$!&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo ${srp_daemon_pid} &amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${srp_daemon_pidfile}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif [ &quot;X${SRP_DAEMON_ENABLE}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;srp_daemon.sh &amp;amp;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;srp_daemon_pid=$!&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo ${srp_daemon_pid} &amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${srp_daemon_pidfile}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe $mod &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;esac&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ $RC -ne 0 ] &amp;amp;&amp;amp; echo_failure &quot;Loading $mod&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;errata_56&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Create devices using udev&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -x /sbin/udevstart ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UDEVSTART=/sbin/udevstart&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif [ -x /sbin/start_udev ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UDEVSTART=/sbin/start_udev&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;UDEVSTART=&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -z &quot;${UDEVSTART}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;devstart_cnt=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;devstart_maxcnt=10&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;while [ ! -d /dev/infiniband/ ] &amp;amp;&amp;amp; [ $devstart_cnt -lt $devstart_maxcnt ]; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sleep 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;let devstart_cnt++&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -d /dev/infiniband/ ] &amp;amp;&amp;amp; [ $devstart_cnt -eq $devstart_maxcnt ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;${UDEVSTART} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -d /dev/infiniband/ ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_warning $&quot;udevstart: No devices created under /dev/infiniband&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Create qlgc_vnic interfaces. This needs to be done after udevstart&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${QLGC_VNIC_LOAD}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -x /etc/init.d/qlgc_vnic ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/etc/init.d/qlgc_vnic start&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ X${RENICE_IB_MAD} == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Set max_ports_num_in_hca variable&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;count_ib_ports&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ports_num=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;list_of_ibmads=&quot;&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for (( i=1 ; $i &amp;lt;= ${max_ports_num_in_hca} ; i++ ))&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;list_of_ibmads=&quot;${list_of_ibmads} ib_mad${i}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ib_mad_pids=($(pidof ${list_of_ibmads} 2&amp;gt; /dev/null))&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;num_of_root_ibmad_procs=$(/bin/ps h -o user -p ${ib_mad_pids[*]} | grep -w &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;root | wc -l)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;get_pid_retries=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;while [ ${num_of_root_ibmad_procs} -lt $ports_num ]&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Wait maximum for 5 sec to get ib_mad process pid&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $get_pid_retries -gt 10 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo Failed to get $ports_num ib_mad PIDs to renice. Got &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;${num_of_root_ibmad_procs}.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;break&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;usleep 500000&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ib_mad_pids=($(pidof ${list_of_ibmads} 2&amp;gt; /dev/null))&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;num_of_root_ibmad_procs=$(/bin/ps h -o user -p ${ib_mad_pids[*]} | grep &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;-w root | wc -l)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;let get_pid_retries++&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for ib_mad_pid in ${ib_mad_pids[*]}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$(/bin/ps -p ${ib_mad_pid} h -o user 2&amp;gt; /dev/null)&quot; == &quot;root&quot; ]; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;renice -19 ${ib_mad_pid} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;return $RC&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;rm_mod()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local mod=$1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;shift&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;unload_log=`/sbin/rmmod $mod 2&amp;gt;&amp;amp;1`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $? -ne 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Unloading $mod&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -z &quot;${unload_log}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $unload_log&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# get_debug_info&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ ! -z $2 ] &amp;amp;&amp;amp; echo $2&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;unload()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Unload module $1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local mod=$1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local unload_log&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if is_module $mod; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;case $mod in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ib_ipath)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# infinipath depends on modprobe.conf remove rule&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe -v -r $mod &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sleep 2&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ib_mthca | mlx4_ib | ib_ehca | iw_cxgb3)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;rm_mod $mod&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sleep 2&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# is_module ib_ipoib &amp;amp;&amp;amp; /sbin/modprobe -r ib_ipoib &amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/sbin/modprobe -r $mod &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $? -ne 0 ] || is_module $mod; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Try rmmod if modprobe failed: case that previous &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;installation included more IB modules.&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;rm_mod $mod&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;esac&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;stop_gen1()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if is_module ib_ipoib; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Unload IPoIB interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;get_interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for i in $interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [[ ! -e ${WD}/ifcfg-${i} &amp;amp;&amp;amp; ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;]]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# echo &quot;No configuration found for ${i}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;continue&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;REMOVE_NETWORK_CONF=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ln -snf ${WD}/ifcfg-${i} ${NETWORK_CONF_DIR}/ifcfg-${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;REMOVE_NETWORK_CONF=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ifdown ${i} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$(($RC+$?))&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ $RC -eq 0 ] &amp;amp;&amp;amp; echo_success $&quot;Shutting down interface $i: &quot; || &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;Shutting down interface $i: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $REMOVE_NETWORK_CONF -eq 1 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;rm -f ${NETWORK_CONF_DIR}/ifcfg-${i}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;[ $RC -ne 0 ] &amp;amp;&amp;amp; echo &quot;Please reboot the host.&quot; &amp;amp;&amp;amp;  exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sleep 2&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;


&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;${GEN1_UNLOAD_MODULES}&quot; != &quot;&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for mod in  ${GEN1_UNLOAD_MODULES}&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;unload $mod &quot;Please reboot the host.&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;stop()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Check if applications which use infiniband are running&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local apps=&quot;opensm osmtest ibbs ibns&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local pid&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;for app in $apps&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ( ps -ef | grep $app | grep -v grep &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 ); then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Please stop $app and all applications running over InfiniBand&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Then run \&quot;$0 $ACTION\&quot;&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Check if open-iscsi is running and if there are open iSER sessions&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $(pidof iscsid | wc -w) -gt 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;iser_session_cnt=$(iscsiadm -m session 2&amp;gt;&amp;amp;1 | grep -c &quot;^iser&quot;)&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ $iser_session_cnt -gt 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# If it&#39;s RH4, open-iscsi must be stopped before openibd&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [[ -f /etc/redhat-release &amp;amp;&amp;amp; $(grep -c &quot;Red Hat &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;Enterprise Linux AS release 4&quot; /etc/redhat-release) -eq 1 ]]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; echo &quot;Please stop open-iscsi: /etc/init.d/iscsi stop&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; echo &quot;Please logout from all open-iscsi over iSER &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;sessions&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Then run \&quot;$0 $ACTION\&quot;&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Stop Gen1 modules if they are UP after uninstall&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if is_module ib_tavor; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;stop_gen1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $RESTART -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if ! is_module ib_core &amp;amp;&amp;amp; ! is_module mlx4_en; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $RESTART -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_failure $&quot;HCA driver is not loaded or loaded with errors&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Stop IPoIB HA daemon if running&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -f $ipoib_ha_pidfile ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local line p&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;read line &amp;lt; $ipoib_ha_pidfile&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for p in $line ; do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ -z &quot;${p//[0-9]/}&quot; -a -d &quot;/proc/$p&quot; ] &amp;amp;&amp;amp; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;ipoib_ha_pids=&quot;$ipoib_ha_pids $p&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/rm -f $ipoib_ha_pidfile&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ -n &quot;${ipoib_ha_pids:-}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;kill -9 ${ipoib_ha_pids} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;mcastpid=$(pidof -x mcasthandle)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -n &quot;${mcastpid:-}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;kill -9 ${mcastpid} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Down all bond interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if ( which ib-bond &amp;amp;&amp;gt;/dev/null ) ; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;ib-bond --stop-all&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Stop SRP HA daemon if running&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -f $srp_daemon_pidfile ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local line p&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;read line &amp;lt; $srp_daemon_pidfile&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for p in $line ; do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ -z &quot;${p//[0-9]/}&quot; -a -d &quot;/proc/$p&quot; ] &amp;amp;&amp;amp; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;srp_daemon_pids=&quot;$srp_daemon_pids $p&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/rm -f $srp_daemon_pidfile&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ -n &quot;${srp_daemon_pids:-}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;kill -15 ${srp_daemon_pids} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;X${SRPHA_ENABLE}&quot; == &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/rm -f /etc/udev/rules.d/91-srp.rules &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;mpath_pids=$(pidof -x multipath)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -n &quot;${mpath_pids:-}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;kill -9 ${mpath_pids} &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if is_module ib_srp; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for f in `/bin/ls /sys/class/scsi_host`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; if [ -f /sys/class/scsi_host/$f/local_ib_port ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  for i in `/bin/ls -d &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/sys/class/scsi_host/$f/device/target*/*/block* | awk -F: &#39;{print $NF}&#39;`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;mdev=`/sbin/scsi_id -g -s /block/$i 2&amp;gt; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;/dev/null`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -n &quot;${mdev}&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;   /sbin/multipath -f $mdev &amp;gt; /dev/null &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ -d /sys/class/infiniband_qlgc_vnic/ ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ -x /etc/init.d/qlgc_vnic ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/etc/init.d/qlgc_vnic stop 2&amp;gt;&amp;amp;1 1&amp;gt;/dev/null&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Unload modules&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ &quot;$UNLOAD_MODULES&quot; != &quot;&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;for mod in  $UNLOAD_MODULES&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;unload $mod&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;local done=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Unload mlx4_core&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if is_module mlx4_core; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;is_ref mlx4_core&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $? -eq 0 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;unload mlx4_core&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;elif is_module mlx4_en; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# Unload mlx4_en if one or more of the following cases takes place:&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# - No MLX4 eth devices present&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;# - mlx4_en module was not loaded by the openibd script&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if (grep 0x15b3 /sys/class/net/eth*/device/vendor &amp;gt; /dev/null 2&amp;gt;&amp;amp;1) &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;&amp;amp;&amp;amp; [ &quot;X$MLX4_EN_LOAD&quot; != &quot;Xyes&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;MLX4_EN module is loaded and in use.&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;To unload MLX4_EN run: &#39;modprobe -r mlx4_en mlx4_core&#39;&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;unload mlx4_en&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;unload mlx4_core&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if [ $done -eq 1 ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;/bin/rm -rf /dev/infiniband&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo_success $&quot;Unloading HCA driver: &quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;sleep 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;status()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;local RC=0&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt; if is_module ib_mthca || is_module mlx4_core || is_module ib_ipath || &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;is_module ib_ehca || is_module iw_cxgb3; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  echo &quot;  HCA driver loaded&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  echo $&quot;HCA driver is not loaded&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if is_module ib_ipoib; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; get_interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; if [ -n &quot;$interfaces&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $&quot;Configured IPoIB devices:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $&quot;Currently active IPoIB devices:&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;for i in $interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [[ ! -e ${WD}/ifcfg-${i} &amp;amp;&amp;amp; ! -e ${NETWORK_CONF_DIR}/ifcfg-${i} &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;]]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;continue&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo `/sbin/ip -o link show $i | awk -F &quot;: &quot; &#39;/UP&amp;gt;/ { print $2 }&#39;`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RC=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;if is_module mlx4_en; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; get_mlx4_en_interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; if [ -n &quot;$mlx4_en_interfaces&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $&quot;Configured MLX4_EN devices:&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $mlx4_en_interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo $&quot;Currently active MLX4_EN devices:&quot;&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;for i in $mlx4_en_interfaces&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo `/sbin/ip -o link show $i | awk -F &quot;: &quot; &#39;/UP&amp;gt;/ { print $2 }&#39;`&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt; fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;local cnt=0&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;for mod in  $STATUS_MODULES&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if is_module $mod; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;[ $cnt -eq 0 ] &amp;amp;&amp;amp; echo &quot;The following OFED modules are loaded:&quot; &amp;amp;&amp;amp; &lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;let cnt++&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;  $mod&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;done&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;return $RC&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;


&lt;span style=&quot;color: orange;&quot;&gt;RC=0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;start_time=$(date +%s | tr -d &#39;[:space:]&#39;)&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;trap_handler()&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;let run_time=$(date +%s | tr -d &#39;[:space:]&#39;)-${start_time}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;# Ask to wait for 5 seconds if trying to stop openibd&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;if [ $run_time -gt 5 ] &amp;amp;&amp;amp; [ &quot;$ACTION&quot; == &quot;stop&quot; ]; then&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;printf &quot;\nProbably some application are still using InfiniBand modules...\n&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;printf &quot;\nPlease wait ...\n&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;return 0&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;trap &#39;trap_handler&#39; 2 9 15&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;case $ACTION in&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;start)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;start&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;stop)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;stop&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;restart)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;RESTART=1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;stop&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;start&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;status)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;status&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;*)&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo &quot;Usage: `basename $0` {start|stop|restart|status}&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;echo&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit 1&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;;;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;esac&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;RC=$?&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;exit $RC&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ END OF FILE ~~~~~~~~~~#&lt;/span&gt;


&lt;span style=&quot;color: blue;&quot;&gt;vim /etc/sysconfig/i18n&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ BEGINNING OF FILE ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  LANG=&quot;en_US.UTF-8&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  SYSFONT=&quot;latarcyrheb-sun16&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ END OF FILE ~~~~~~~~~~#&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;vim /etc/udev/rules.d/90-ib.rules&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ BEGINNING OF FILE ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  KERNEL==&quot;umad*&quot;, NAME=&quot;infiniband/%k&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  KERNEL==&quot;issm*&quot;, NAME=&quot;infiniband/%k&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  KERNEL==&quot;ucm*&quot;, NAME=&quot;infiniband/%k&quot;, MODE=&quot;0666&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  KERNEL==&quot;uverbs*&quot;, NAME=&quot;infiniband/%k&quot;, MODE=&quot;0666&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  KERNEL==&quot;ucma&quot;, NAME=&quot;infiniband/%k&quot;, MODE=&quot;0666&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;  KERNEL==&quot;rdma_cm&quot;, NAME=&quot;infiniband/%k&quot;, MODE=&quot;0666&quot;&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ END OF FILE ~~~~~~~~~~#&lt;/span&gt;

&lt;span style=&quot;color: blue;&quot;&gt;chmod 755 /etc/init.d/openibd&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;rmmod iw_nes&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;/etc/init.d/openibd restart&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ibstat&lt;/span&gt;

&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~ END OF INSTALLATION OF IB MODULES  ~~~~~~~~~~#&lt;/span&gt;
&lt;span style=&quot;color: orange;&quot;&gt;#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#&lt;/span&gt;



&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/2751285216170561332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/12/ofed-infiniband-on-centos-overcoming.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/2751285216170561332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/2751285216170561332'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/12/ofed-infiniband-on-centos-overcoming.html' title='OFED Infiniband on CentOS , overcoming &quot;redeclaration&quot; erros for a customized patched kernel'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-3284237147447161889</id><published>2010-10-27T13:53:00.000-07:00</published><updated>2010-10-27T14:19:26.766-07:00</updated><title type='text'>ubuntu - kernel - Broadcom bnx2 firmware problem 2.6.32</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;&gt;I upgraded my linux kernel from 2.6.28 to 2.6.32 (ubuntu) and suddenly the bnx2 firmware/driver broke. This left me with no network card driver and therefore no internet access. &lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Error: bnx2: can&#39;t load firmware file &quot;bnx2/bnx2-mips-06-5.0.0.j3.fw&quot;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;temporary solution: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Download the Broadcom NetXtreme II 1 Gigabit Drivers for Linux from their &lt;a href=&quot;http://www.broadcom.com/support/ethernet_nic/netxtremeii.php&quot;&gt;website&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;(linux-5.2.55 in my case). &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;mkdir mybnx&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;cd mybnx&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;unzip linux-5.2.55.zip&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;cd Server/Linux/Driver/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;tar zxvf netxtreme2-5.2.55.tar.gz&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;cd netxtreme2-5.2.55&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;make&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;cd bnx2/src&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;There should be a bnx2.ko ready in here by now.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Test if it solves the problem: &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;First, remove the current modules: &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;rmmod bnx2 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;rmmod bnx2x &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;rmmod cnic&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Then, insert the new compiled module, and in a few seconds it should be working:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;(make sure, you&#39;re in the ~/mybnx/Server/Linux/Driver/netxtreme2-5.2.55/bnx2/src/ directory)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;insmod bnx2.ko&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if it worked (e.g. check if you have internet connection through &quot;ifconfig&quot;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;update the initrd file and update the kernel module: &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;cp ~/mybnx/Server/Linux/Driver/netxtreme2-5.2.55/bnx2/src/bnx2.ko /lib/modules/2.6.32-WHATEVER-YOU-VERSION-IS/kernel/drivers/net/bnx2.ko&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;cd /boot&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;update-initramfs -c -k &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; &gt;2.6.32-WHATEVER-YOU-VERSION-IS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;; font-size: small; color: rgb(0, 0, 153); &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;simply, reboot. It should be working by now.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/3284237147447161889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/10/ubuntu-kernel-broadcom-bnx2-firmware.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/3284237147447161889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/3284237147447161889'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/10/ubuntu-kernel-broadcom-bnx2-firmware.html' title='ubuntu - kernel - Broadcom bnx2 firmware problem 2.6.32'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-5103643880664523509</id><published>2010-08-13T18:13:00.000-07:00</published><updated>2010-08-13T18:28:16.389-07:00</updated><title type='text'>Converting string to double in C</title><content type='html'>It may take someone like me a little while to notice that &quot;sscanf&quot; has a slightly different format for double variables than printf. Here&#39;s a code that can convert a string to a double (notice the difference in %f and %lf between printf and sscanf formatting):&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;     char mystring[40] = &quot;+2.5E-01&quot; ;&lt;br /&gt;        double mydouble ;&lt;br /&gt;        sscanf(mystring, &quot;%lf&quot;, &amp;amp;mydouble) ;&lt;br /&gt;     printf(&quot;mystring=%s \t \t mydouble=%f\n&quot;, mystring, mydouble);&lt;br /&gt;     return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/5103643880664523509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/08/convert-string-to-double.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/5103643880664523509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/5103643880664523509'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/08/convert-string-to-double.html' title='Converting string to double in C'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-881172256737295153</id><published>2010-08-09T09:22:00.001-07:00</published><updated>2010-08-09T09:32:54.591-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="windows password"/><title type='text'>Forgot your Windows password?</title><content type='html'>If you still have access to an admin account login you can change a user&#39;s password through this:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Go to &quot;Run&quot;, then run &quot;cmd&quot; to open a command prompt window.&lt;/li&gt;&lt;li&gt;Type the username and the desired password in the following command: &lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#3333FF;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;net user YourUsername YourNewPassword&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;font-family:&#39;courier new&#39;;color:#3333FF;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:georgia;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; white-space: normal; font-family:Georgia, serif;&quot;&gt;This runs very smoothly when you still have access to your admin account via your fingerprint login (if available). I have tried it on a Lenovo X61s and it worked perfectly on Windows Vista.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/881172256737295153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/08/forgot-your-windows-password.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/881172256737295153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/881172256737295153'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/08/forgot-your-windows-password.html' title='Forgot your Windows password?'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4495550914530992190.post-818900741298588072</id><published>2010-05-16T17:05:00.000-07:00</published><updated>2010-05-16T19:59:56.956-07:00</updated><title type='text'>Converting excel charts to EPS for Latex</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;   style=&quot;  ;font-family:&#39;Times New Roman&#39;;font-size:medium;&quot;&gt;&lt;div style=&quot;margin-top: 6px; margin-right: 6px; margin-bottom: 6px; margin-left: 6px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Verdana; font-size: 10pt; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); min-height: 1100px; counter-reset: __goog_page__ 0; line-height: normal; &quot;&gt;LaTex related tips and tricks&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;b&gt;Converting excel charts to eps:&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;The A&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:verdana, arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#333333;&quot;&gt;dobe generic postscript printer (free driver) cannot be installed on Windows Vista, etc. (unlike XP, etc). Here&#39;s a summary of my solutions. I hope it saves you hours of fixing this problem. A lot of times the font quality gets messed up, but it seems that Method-1 works pretty well.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Method 1 [best]:&lt;/li&gt;&lt;/ul&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Save you chart in excel as PDF&lt;br /&gt;&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Use GSview, convert to PS with 600dpi&lt;br /&gt;&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Use GSview convert the previous output (*.ps) to EPS , but set the boundaries&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;Method 2:&lt;/li&gt;&lt;/ul&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;save the chart as PDF in excel.&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;then use pdftops tool: c:\Users\TEST&gt;&quot;c:\Program Files\MiKTeX 2.8\miktex\bin\pdf2ps.exe&quot; input.pdf output.eps&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;Method 3:&lt;/li&gt;&lt;/ul&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;save the chart as PDF in excel&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;use a free website to convert the PDF to EPS, such as: &lt;a href=&quot;http://pdf.my-addr.com/free-online-pdf-to-eps-convert.php&quot; style=&quot;color: rgb(85, 26, 139); &quot;&gt;http://pdf.my-addr.com/free-online-pdf-to-eps-convert.php&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;Method 4:&lt;/li&gt;&lt;/ul&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Install a generic commercial printer provided by Microsoft: &lt;a href=&quot;http://office.microsoft.com/en-us/publisher/hp062079971033.aspx&quot; style=&quot;color: rgb(85, 26, 139); &quot;&gt;http://office.microsoft.com/en-us/publisher/hp062079971033.aspx&lt;/a&gt;&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Change the options of the printer to output as EPS&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Simply print to an EPS file whatever you wish&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;If the boundaries are not right, try to fix it with GSview:&lt;/li&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Open the eps file&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Choose &quot;PS to EPS&quot;, but uncheck the option for automatically calculate bounding box &lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Correct the bounding box&lt;/li&gt;&lt;li style=&quot;margin-top: 0px; margin-bottom: 0px; &quot;&gt;Save your output &lt;/li&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://you-wish-you-knew-it-before.blogspot.com/feeds/818900741298588072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/05/converting-excel-charts-to-eps-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/818900741298588072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4495550914530992190/posts/default/818900741298588072'/><link rel='alternate' type='text/html' href='http://you-wish-you-knew-it-before.blogspot.com/2010/05/converting-excel-charts-to-eps-for.html' title='Converting excel charts to EPS for Latex'/><author><name>RZ</name><uri>http://www.blogger.com/profile/10990199860367798384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>