1. Primary source for OFED. Somewhat convoluted, thus a bit of work to get them compiled on your platform. Compilation for MPI, MVAPICH, etc would be needed for HPC env. They include ULP (upper layer protocol) such as IPoIB.
  2. RHEL ofed - RHEL backport fixes, and keep a more usable OFED stack than the community version. use this before using community version to avoid headache (eg luster compatibility).
  3. - compile binaries for major distro, used to be about 3 months lag behind source, but probably best route for supported cards.
    If updateing OS, need to get new version of driver, and recompile for the OS. may take some 15 min to compile and install. May also disable opensmd systemd , just need to re-enable it
  4. It seems that the current trend is to use the ofed drivers. some compilation needed. Compilation for MPI, MVAPICH, etc would be needed for HPC env. They include ULP (upper layer protocol) such as IPoIB.

InfiniBand 101

CA - Control Adaptor
HCA - Host CA (like how FibreChannel has HBA)
LID - Local ID, uniq id of IB end points.
port - a port on the HCA, like NIC ports in ethernet quad card.
GUID - Global Uniq ID
sminfo give the GUID of the subnet manager, can be used to determine if two nodes are on same fabric or in two separate islands.

Symbol Error - Think of this as packet error in the ethernet world. it is the rate of error accumulation that should be of concern.

XmtDiscards - counter indicative of congestion (concern when rate of increase is rapid)

Verbs - IB allow code to be run on the network. Think optimizing calls for calculating sum of counters distributed among many IB hosts. Verbs allow command to be executed on feature-rich IB swtich.

opensm 	# open fabric subnet manager.  run on one of the host.  
	# additional standy manager on other hosts can be setup.  
	# the daemon process will only bind to ONE IB port.  
	# HA fabrics should be joined into a single one.
  	# Fix opensm.conf to bind to desired guid (port).   
	# not specifiying one will get prompt to choose if multiple port is avail.
	# If have two-port card and need TWO subnet manager, then need to 
	# update /etc/init.d/opensm and start TWO instance of opensmd
	# use -g GUID to specify which port each instance use.  this would overwrite config in /etc/opensm/opensm.conf. eg 
 	# /usr/sbin/opensm --daemon 
 	# /usr/sbin/opensm --daemon -g 0x506b4b03007c00c2

OFED has ib driver and opensm
Mellanox compiled their own version and provide support for it, MLNX_OFED, aka MOFED.  has driver and opensm.  No more support for ConnectX-2 cards in 2018.
SL7 version of OFED is said to have less trouble with LUSTER than general public OFED.

opensm --create-config /tmp/opensm.conf 
cp -i /tmp/opensm.conf /etc/opensm/
vi /etc/opensm/opensm.conf # set GUID for the port where openSM should bind to

Troubleshooting commands
  - all ports should be active.  It would be active if there is running fabric manager to register them when the port comes alive.
  - If port is connected, but no running Subnet Manager, port status would be Initiating
  - If port status is Down, then there is problem with physical link (even when no SM is running)  Reseating after SM is running may help.
  - node guid
  - port guid

ibv_devinfo - similar info to ibstat


ompi_info --all

iblinkinfo --node-name-map fabrics.node-name-map
	# iblinkinfo provides link info for whole fabric, very quick 
	# node-name-map converts GUID to human name
	# 0xe41d2d03004f1b40 "ib000.cf0 (Mellanox SX6025, S54-21)"

ibnetdiscover --node-name-map fabrics.node-name-map > ibnet.topo
	# generate a topology file 
	# switch LID would be listed above all the port, see comment field 

cat fabrics.conf | grep -v ^$ | tr '[]' '#' | awk -F\= '{print $1 " \"" $2 "\""}' > fabrics.node-name-map

/etc/init.d/openibd status
/etc/init.d/opensmd status


        # ib adaptive control manager
        # not really needed by OFED, but included by yong

tool to update IB (HCA?) firmware:
flint ?
mfp ?

# select output of ibnetdiscover

Switch  24 "S-0002c90200410d02"   # "MT47396 Infiniscale-III Mellanox Technologies" base port 0 lid 2 lmc 0
#                                                                               ib switch LID      ^^^

[16]    "H-00188b9097fe8e41"[1](188b9097fe8e42)     # "rac1001 HCA-1" lid 4 4xDDR
[15]    "H-00188b9097fe906d"[1](188b9097fe906e)     # "rac1002 HCA-1" lid 9 4xDDR
^^^^ ib port where host is connected            comment area and host's LID ^^^
ibclearerrors		# reboot will induce errors, this is normal.

hca_self_test.ofed  	# sanity check. ofed-scripts rpm.  /usr/bin
pdsh -g etna0 TERM=vt52 /usr/bin/hca_self_test.ofed | grep -i fail
# the script use tput and eed to force TERM when used with pdsh

perfquery		# simple to read ib counters.  pay special attention to:
			# SymbolErrorCounter
			# LinkErrorRecover
			# infiniband-diags by Mellanox, install to /sbin

ibqueryerrors -c -s XmWait

ibcheckerrors -b	# very noisy, from infiniband-diags rpm by Mellanox, /sbin

ibdiagnet		# scan fabric, takes a long time

wwibcheck by Yong Qin:
ibcheck -f fabrics.conf -C etna -E  -dd -a -b -O 20 > now.out
ibcheck -f fabrics.conf -C etna -E  -dd -a -b -O 20 > 2hrsLater.out
but can't simple diff to see errors, need to awk out the RcvPkgs columns...

per-node errors listed in bottom section.
This is the header of avail counters:

   NodeDesc Port               Guid ExcBufOverrunErrors LinkDowned LinkIntegrityErrors LinkRecovers RcvConstraintErrors    RcvData RcvErrors    RcvPkts RcvRemotePhysErrors RcvSwRelayErrors SymbolErrors VL15Dropped XmtConstraintErrors    XmtData XmtDiscards    XmtPkts

IB port on switch side

ibportstate - manage specific port on the IB switch, eg turn it on/off, etc.

ibportstate [swlid] [swPortNum] [command]	
ibportstate  2        11         disable	# turn off IB switch port a specific host is connected to
ibportstate  6        11         disable
     # can also use enable, status.  Other form allow for changing speed, etc.

ibcheck needs root to run many cmd (ibcheck use fabrics.conf for GUID to hostname resolution, etna below is name of a cluster)
ibcheck -f ../fabrics.conf -C etna -E  -dd -a -b -O 20 > ibcheck-E-b-dd-a.etna.out.1226

ibcheck -h		# help (also pydoc ./ibcheck)

ibcheck -E      # errors and perf counter (top-like UI, h for help)

ibcheck -d -f fabrics.conf -C lrc-fabric
	-f      # specify a fabric definition file, so name displayed is looked up from fabrics.conf
	-d      # detail level 1, just a list of devices
	-dd     # detail level 2, switch and what is connected to each ports [most adequate output]
		# -dd   scan all ports with a link attached to it, ie list switch and what is connected to it.
	-ddd    # detail level 3, add vendor id, device id, guid etc to each switch or Ca.  empty ports explicity listed as such
		# -ddd  scan all ports - empty port will be explicity listed as such
	-C      # filter by Cluster - ie display only for entries matching specified cluster
	-i      # change scan interval, in seconds.
	-b      # batch mode, avoid the top-like interface for -E
	-O      # timeout, default to 3 sec, may need it to be longer

ibcheck -f fabrics.conf -dd -C cf0 -E -i3
		# monitor Error counter for specific cluster
		# top-like interface.  use space to toggle between error-only list vs all-node list
		# -f fabrics.conf is file maintained manually.  Use Node GUID : name key-value pair
		# note that nodes are defined in their cluster (eg [lr4]) and super cluster (ie [lrc-fabric])

ibcheck -l 32,33 -ddd 					# -l filter for specific LID (comma list)
ibcheck -f fabrics.conf -g 0x7cfe900300b515e0 -ddd 	# -g GUID, can be comma list
ibcheck -f fabrics.conf -t ibnetdiscover.out	 	# -t scan for changes against a saved ibnetdiscovery file
ibcheck -f fabrics.conf -dd -M 				# -M also display how many subnet manager(s) are running and where.

ibcheck -E -b         -O 10 -ddd

  1. Yong Qin's IB Diag & Troubleshooting
  2. ulowa basic ib troubleshooting
  3. - my cache of assorted IB docs.


Run IP network over Infiniband (instead of Ethernet).

# bring up interface after driver install, w/o reboot 
rmmod    ib_ipoib
modprobe ib_ipoib

/etc/sysconfig/network-scripts/ifcfg-ib0 ::
no  = use datagram (default?)
yes = like tcp?
  • RH IPoIB cli
  • RH IPoIB

    IBoIP with Bonding Config

    OFED 1.4 instructions for configuring bonding for IPoIB interfaces is to create static config in /etc/sysconfig/network-scripts for the file ifcfg-bond0, ifcfg-ib0, ifcfg-ib1, as below:
    IB-bond for system WITHOUT ethernet bond
    $ cat /etc/sysconfig/network-scripts/ifcfg-bond0
    $ cat /etc/sysconfig/network-scripts/ifcfg-ib0  
    $ cat /etc/sysconfig/network-scripts/ifcfg-ib1
    # relevant entries in  /etc/modprobe.conf ::
    ## added for Oracle 10/11 (per Cambridge WI)
    ## make sure that the hangcheck-timer kernel module is set to load when the system boots
    options hangcheck-timer hangcheck_tick=1 hangcheck_margin=10 hangcheck_reboot=1
    alias ib0 ib_ipoib
    alias ib1 ib_ipoib
    alias net-pf-27 ib_sdp
    ##  For IB bonding
    alias bond0 bonding
    options bond0 miimon=100 mode=1 max_bonds=1
    As of OFED 1.4.0 (circa 2009.09), the above bonding config would work, bond0 would be created correctly and disabling the ib port for say ib0 would cause thigns to fail over.

    However, fail over won't actually work if the machine also has ethernet bonding configured. The config would successfully create a bond for ib0 and ib1. But the IP would be bond to a specific interface and when the IB port is disabled from the switch, ping and rds-ping would stop working. Maybe it has to do with some bugs in the ifcfg-* scripts in RHEL 5.3 that associate the HW "mac address" of the ibX interfaces incorrectly to the bonding interface. OFED 1.4.x doesn't support the bonding config in /etc/inifiniband/openib.conf anymore. Manually creating the ib-bond after system boot would work, and fail over actually works correctly. Here is the required config:
    IB-bond for system with ethernet bond
    $ cat /etc/sysconfig/network-scripts/ifcfg-ib0
    $ cat /etc/sysconfig/network-scripts/ifcfg-ib1
    # relevant entries in  /etc/modprobe.conf ::
    options bond0 mode=balance-rr miimon=100    max_bonds=2
    # ethernet bonds are configured as in stock RHEL 5.3 config.
    # init script to start ib-bond at boot time:
    # run "manual" ib-bond config
    # could not do this in /etc/sysconfig/network-scripts as bond1, ib0, ib1 scripts
    # as somehow presence of eth bond would make ib-bond fail over not to work.
    # maybe a bug in how the network-scripts are parsed...
    ##  nn = startLevel  Sxx Kxx
    ##  eg start at rc3 and rc5,   start as S56, kill is omitted so no Kxx script
    ##  maybe as S28 if need to be before oracleasm
    # chkconfig: 35 28 -
    # description: ib-bond config
    # source function library
    . /etc/rc.d/init.d/functions
    start() {
            ifconfig ib0 up
            ifconfig ib1 up
            ib-bond --bond-name bond1 --bond-ip --slaves ib0,ib1 --miimon 100
    stop() {
            ib-bond --bond-name bond1 --stop
    status() {
            ib-bond --status-all
    case "$1" in
                    echo -n $"Starting $prog: "
                    [ "$RETVAL" = 0 ] && logger "ib-bond-config start ok" || logger local7.err "ib-bond-config start failed"
                    echo -n $"Stopping $prog: "
                    #echo 'not implemented yet'
                    [ "$RETVAL" = 0 ] && logger "ib-bond-config stop ok" || logger local7.err "ib-bond-config stop failed"
                    echo $"Usage: $0 {start|stop|status}"
    exit $RETVAL
    ## setup aid:
    ##  sudo cp -p /nfshome/sa/config_backup/lx/conf.test-4000/ib-bond-config /etc/init.d/
    ##  sudo ln -s /etc/init.d/ib-bond-config /etc/rc.d/rc3.d/S56ib-bond-config
    ##  sudo ln -s /etc/init.d/ib-bond-config /etc/rc.d/rc5.d/S56ib-bond-config
    There is one final catch. eth fail over work for one NIC at a time. If both eth0 and eth1 is ifdown'd, the minute eth0 is ifup, the machine reset. Not sure why, no log message, so may not even be a kernel panic... But if both eth interfaces are down, machine is probably screwed anyway...

    RDS and InfiniBand

    RDS stands for Reliable Datagram Socket. It was modeled/designed like a UDP replacement, but adds reliability and in-sequence delivery characteristics traditionally only available from TCP. It was to be lightweight, rely on the InfiniBand hardware to do the path mapping and "virtual channel" config.

    The RDS developer mailing list has a doc that indicates RDS would not depend on IP when run on InfiniBand, so then IBoIP may not actually need to be configured (eg, how MPICH work with infiniband without any IP support). On the flip side, there are also discussion of implementing RDS over TCP! (eg: take 2) At any rate, rds-ping needs an IP address. rds-info is centered around the premise of IP address. Oracle doesn't work unless IP are assigned for IB interface.

    So, for HA (at least for Oracle), it seems that IBoIP fail over from the IB-bonding need to be configured. Oracle cluster/RAC does not have ability to use multiple ib0, ib1 interfaces as its private network, so some sort of automatic HCA fail over would be needed.

    RDMA and InfiniBand

    RDMA = Remote DMA , ie Remote Direct Memory Access.
    It would allow data transfer between two hosts with IB HCA to copy data from one host directly into the other, bypassing the many copy needed of traditional NIC. Combined with low latency of IB, it would give very high transfer speed.
    However, RDMA is not implemented by RDS as of OFED 1.4. (it is for TCP? but that would be at the IPoIB layer? Or maybe for things that use IB directly like MPICH... don't know....).


    /usr/bin/mst start
    mst status
    mlxvpd    -d /dev/mst/mt4119_pciconf0 	# show nic model part number, serial
    mlxuptime -d /dev/mst/mt4119_pciconf0	# show dev cpu freq and uptime
    ibv_devinfo	# find firmware version
    /sbin/lspci -d 15b3:		# list only mellanox devices, get device id for use with mstflint
    mstflint -hh # detail help on burning firmware on mellanox device
    sudo /usr/bin/mstflint --device af:00.0 query 
    sudo /usr/bin/mstflint -d       af:00.0 q     full  # full query, but still no OPN info
    ## burn .bin firmware (not .zip).  -ir burn does some image reactivation prior burning, which was what the example shows.
    sudo /usr/bin/mstflint --device af:00.0 --image fw-ConnectX5-rel-16_27_2008-MCX555A-ECA_Ax-UEFI-14.20.22-FlexBoot-3.5.901.bin -ir burn 
    ## but that --ir thing wasn't accepted, so skiped, and end up doing:
    sudo /usr/bin/mstflint --device af:00.0 --image fw-ConnectX5-rel-16_28_2006-MCX555A-ECA_Ax_Bx-UEFI-14.21.17-FlexBoot-3.6.102.bin  burn 
    # can't verify again after firmware upgrade, unless do a reload of the module first.  easier to just reboot.
    sudo /usr/bin/mstflint --device af:00.0 verify
    # to check for cable problem, connectivity with switch:
    lspci | grep Mellano # to get pci device number
    mlxlink -d af:00.0 -m -e -c --show_fec
    mlxlink -d af:00.0 --speeds 10G,25G,50G,100G
    mlxlink -d af:00.0 -a TG # Toggle link up and down (to reset speed)
    # find cable type via Part Number:
    mlxlink -d af:00.0 -m  | grep Part
    	Vendor Part Number  : MCP1600-C002	# EDR QSFP28 DAC ## n0002sav3 no FDR, only SDR (CX-5 HBA, FDR switch)
    	Vendor Part Number  : MCP1600-E002E30	# EDR QSFP+  DAC ## n0004sav3 works as FDR (CX5 HBA, FDR switch)
    	Vendor Part Number  : MC2207130-002	# FDR QSFP+  DAC VPI 56 Gbps IB/40 Gbps Eth ## n0150sav3 
    the C0002 version is an ethernet cable, in IB it will negotiate to 10Gb in FDR config, and not work at all for EDR config.  
    the E002E30 version is IB and can negotiate down to 56Gb and run at FDR rate!
    part matter!!
    ref:     - Cxxx = Ethernet - E0xxEyy = IB - FDR VPI
  • mstflint doc from mellanox.

    IB to Ethenert

    mlxconfigfrom mellanox doc.
    Check if Mellanox ConnectX-n card is in IB or Eth/VPI mode
    mst start
    mlxconfig query | grep LINK_TY
    # 1 = IB
    # 2 = Eth/VPI

    change IB card to Eth mode
    mlxconfig --dev /dev/mst/mt4119_pciconf0 set LINK_TYPE_P1=2                  # single port NIC
    mlxconfig --dev /dev/mst/mt4119_pciconf0 set LINK_TYPE_P1=2 LINK_TYPE_P2=2   # dual   port NIC
    for Mellanox ConnectX-4 
    may need to run 
    mst start
    mst status
    to create /dev/mst device 
    allegedly once in eth mode, no need for any of these things.
    mst in turn req OFED driver installed.
    (have not found way to run these out of docker container, even when Mellanox seems to have something for this, maybe for some product they have which i have not found doc about yet).
    also need a Mellanox MAM1Q00A-QSA for each port you want to be on ethernet as well as SR optics.  
    Note that the LINK_TYPE_P1 and LINK_TYPE_P2 equal 1 (InfiniBand) by default.
     mlxconfig -d /dev/mst/mt4119_pciconf0 query
     (or simply mlxdonfig query)
     --dev name depends on what "mst status" reports
    eg2 (connectX-3 MT27500):
    mlxconfig --dev /dev/mst/mt4099_pciconf0 query | grep LINK_TY
             LINK_TYPE_P1                        VPI(3)          
    		 LINK_TYPE_P2                        VPI(3)          
    eg3 (ConnectX-5 MT27800):
             LINK_TYPE_P1                        IB(1)           
    before eth mode on CX-5 card, ifconfig reports:
    	2: enp1s0f0:   [NO-CARRIER,BROADCAST,MULTICAST,UP] mtu 1500 qdisc mq state DOWN group default qlen 1000
    	3: enp1s0f1:   [NO-CARRIER,BROADCAST,MULTICAST,UP] mtu 1500 qdisc mq state DOWN group default qlen 1000
    	4: enp134s0f0: [BROADCAST,MULTICAST,UP,LOWER_UP] mtu 1500 qdisc mq state UP group default qlen 1000
    	5: enp134s0f1: [NO-CARRIER,BROADCAST,MULTICAST,UP] mtu 1500 qdisc mq state DOWN group default qlen 1000
    	6: docker0:    [NO-CARRIER,BROADCAST,MULTICAST,UP] mtu 1500 qdisc noqueue state DOWN group default 
    	25: ib0:       [NO-CARRIER,BROADCAST,MULTICAST,UP] mtu 4092 qdisc mq state DOWN group default qlen 256
    ibdev2netdev  # from mlnx-ofa_kernel-4.7-OFED.
    	mlx5_0 port 1 ... ib0 (Down)
    Change to Ethernet mode for dual port card:
    eg# mlxconfig -d /dev/mst/mt4119_pciconf0 set LINK_TYPE_P1=2 LINK_TYPE_P2=2
    mlxconfig --dev /dev/mst/mt4119_pciconf0 set LINK_TYPE_P1=2
    Device #1:
    Device type:    ConnectX5       
    Name:           N/A             
    Description:    N/A             
    Device:         /dev/mst/mt4119_pciconf0
    Configurations:                              Next Boot       New
             LINK_TYPE_P1                        IB(1)           ETH(2)          
    reboot needed for change to be effected.
    VPI mode automagically do Eth and IB, no need to change its mode?
    Some card can only do IB or only Eth, can't be changed?
    **no, likely need to still flip to eth so that os assign a ifconfig nic name to it. **
    # ip a | egrep UP\|inet
    2: enp1s0f0: [BROADCAST,MULTICAST,UP,LOWER_UP] mtu 1500 qdisc mq state UP group default qlen 1000
        inet brd scope global noprefixroute enp1s0f0
    3: enp1s0f1: [NO-CARRIER,BROADCAST,MULTICAST,UP] mtu 1500 qdisc mq state DOWN group default qlen 1000
    4: ib0: [BROADCAST,MULTICAST,UP,LOWER_UP] mtu 2044 qdisc mq state UP group default qlen 256
        inet brd scope global noprefixroute ib0
        inet6 fe80::e61a:4fc3:cba3:72c9/64 scope link noprefixroute 
    enp1s0f? are likely the onboard RJ45 ports.

    [Doc URL:]
    [Doc URL:]
    Last Updated: 2020-10-27
    (cc) Tin Ho. See main page for copyright info.

    psg101 sn50 tin6150