Wednesday, July 27, 2011

Disable MSI on a bnx2 driver

Today I had a customer telling me that his network on one machine is slow sometimes. I took a look at it and and saw some Broadcom devices (I don't remember the model) and the bnx2 driver loaded. Also both devices were attached to a bonding device. First step was to figure out the active interface:

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)


Bonding Mode: load balancing (round-robin)
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 0
Down Delay (ms): 0


Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permenent HW addr: XX:XX:XX:XX:XX:XX


Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permenent HW addr: XX:XX:XX:XX:XX:XX


The line "Currently Active Slave: eth0" shows clearly eth0. Checking with ethtool the active interface gave me the following:

# ethtool -S eth0 | errors
     ...
     rx_crc_errors: 1423
     ...

Doing some research in the internet gave me the hint to disable MSI on the bnx2 driver. So, next steps will be bringing down the interfaces and removing the network drivers:

# ifconfig eth0 down
# ifconfig eth1 down
# ifconfig bond0 down
# rmmod bonding
# rmmod bnx2


Load the bnx2 driver again with disabled MSI:

# modprobe bnx2 disable_msi=1

Check /var/log/messages for "MSI" messages, it should not show up after loading the bnx2 driver again:

# grep MSI /var/log/messages

Load the bonding driver again and set the bond0 interface up:

# modprobe bonding
# ifconfig bond0 up


Now attach the slave interfaces again:

# ifenslave bond0 eth0
# ifenslave bond0 eth1


Finally configure the bond0 device again:

# ifconfig bond0 192.168.1.73 netmask 255.255.255.0

To make the changes permanent (e.g. after reboot) add the following line to /etc/modprobe.conf:

# echo "option bnx2 disable_msi=1" >> /etc/modprobe.conf

Hopefully your network runs better now - mine did not...

Additional information:
http://h50146.www5.hp.com/products/software/oe/linux/mainstream/bin/support/doc/option/nic/bnx2/v171d1/bnx2.txt
http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding Print Friendly and PDF

Monday, July 25, 2011

Obtaining NIC/LAN information in HP-UX

First find out which devices are available, by which dirver it is used, hardware path etc:

# ioscan -fnClan
Class     I  H/W Path       Driver   S/W State   H/W Type     Description
==========================================================================
lan       0  0/4/2/0        iether   CLAIMED     INTERFACE    HP AB352-60003 PCI/PCI-X 1000Base-T Dual-port Core
lan       1  0/4/2/1        iether   CLAIMED     INTERFACE    HP AB352-60003 PCI/PCI-X 1000Base-T Dual-port Core
lan       2  0/6/0/0/0/0/0/0/0/0  iether   CLAIMED     INTERFACE    HP AD337-60001 PCIe 1000Base-T Dual-port Adapter
lan       3  0/6/0/0/0/0/0/0/0/1  iether   CLAIMED     INTERFACE    HP AD337-60001 PCIe 1000Base-T Dual-port Adapter


For the next step the Class and Interface columns are important. The first line shows the class lan and interface 0, so our device will be lan0, the next device lan1 and so on:

# ifconfig lan0
lan0: flags=1843<UP,BROADCAST,RUNNING,MULTICAST,CKO>
        inet 10.0.0.1 netmask ffffff00 broadcast 192.168.1.255
# ifconfig lan1
lan1: flags=1843<UP,BROADCAST,RUNNING,MULTICAST,CKO>
        inet 10.0.1.1 netmask ffffff00 broadcast 192.168.1.255


But sometime this does not work. For every interface you try to manage with ifconfig you get the following:

# ifconfig lan0
ifconfig: no such interface

Even a request for all interfaces fails:

# ifconfig -a
ifconfig: no such interface

In this case take a look at /etc/rc.config.d/netconf and grep for INTERFACE_NAME:

# grep "INTERFACE_NAME" /etc/rc.config.d/netconf
# INTERFACE_NAME:     Network interface name (see lanscan(1m))
INTERFACE_NAME[0]=lan799
INTERFACE_NAME[1]=lan799:1
INTERFACE_NAME[2]=lan799:2

The above file netconf holds all network configuration to use while booting. Now you can take a look et e.g. lan799:

# ifconfig lan799
lan799: flags=1843<UP,BROADCAST,RUNNING,MULTICAST,CKO>
        inet 172.16.3.26 netmask ffff0000 broadcast 172.16.255.255

Another nice solutions to get all network interface is netstat:

# netstat -i
Name     Mtu  Network   Address   Ipkts Ierrs Opkts Oerrs Coll
lan999:2 1500 10.20.1.2 db01      2193  0     1695  0     0
lan999:1 1500 10.20.1.1 fs01      1540  0     138   0     0
lo0      4136 loopback  localhost 1281  0     1281  0     0
lan999   1500 10.20.1.0 dc01      2432  0     4232  0     0
Print Friendly and PDF

Configuring NTP in HP-UX

Assuming 192.168.1.1 is your local NTP server, then you need to edit /etc/rc.config.d/netdaemons first. Add your NTP server to NTPDATE_SERVER and change the value for XNTPD from 0 (zero) to 1 (one):

# vi /etc/rc.config.d/netdaemons
...
export NTPDATE_SERVER="192.168.1.1"
export XNTPD=1
export XNTPD_ARGS=
...


After that add the server to /etc/ntp.conf (in case that the file is existing already, make a backup):

# mv /etc/ntp.conf /etc/ntp.conf.orig
# vi /etc/ntp.conf
server 192.168.1.1
peer 192.168.1.1
driftfile /etc/ntp.drift


The server line defines your server and the peer line defines a substitue for it. The driftfile stores variance between the local clock and the NTP server. Finally, start the NTP daemon:

/sbin/init.d/xntpd start
25 Jul 13:36:31 ntpdate[21017]: step time server 192.168.1.1 offset -0.016372 sec


Check if it is running:

# ps -ef | grep ntp
    root 21019     1  0 13:36:31 ?         0:00 /usr/sbin/xntpd

# ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================
 
192.168.1.1     0.0.0.0         16 -    -   64    0     0.00    0.000 16000.0

That's it again, more information can be found here:
http://radek.com/hpux/kommandos.htm
http://docsrv.sco.com/NET_tcpip/ntpC.driftfile.html

Update 06/26/2012: added ntpq command and output Print Friendly and PDF