#!/bin/sh # ----------------------------------------------------- # Mellanox NIC runtime performance tuning. # # Iterates over all detected Mellanox network devices # and applies selected optimizations. # # Run this at system startup. # ----------------------------------------------------- # Disable pause frames. flow_ctl=off # Set PCI max read request parameter to 1K. max_read_req=3 # Fix RX performance on mixed traffic flows mixed_flow_fix=true devs=$(ls -d /sys/class/net/*/device/infiniband_verbs/uverbs* | cut -d / -f 5) if [ $mixed_flow_fix = true ] ; then /usr/bin/mst start fi for dev in $devs; do pci_addr=$(grep PCI_SLOT_NAME /sys/class/net/$dev/device/uevent | tail -c +15) echo Device: $dev $pci_addr /sbin/ethtool -A $dev rx $flow_ctl tx $flow_ctl pci68w_val=$(/usr/bin/setpci -s $pci_addr 68.w | tail -c +2) /usr/bin/setpci -s $pci_addr 68.w=$max_read_req$pci68w_val if [ $mixed_flow_fix = true ] ; then /usr/bin/mcra $pci_addr 0x815e0.0 0 /usr/bin/mcra $pci_addr 0x81640.0 0 fi done