#!/bin/bash # # Initialize SRIOV virtual devices # # This is usually run automatically by systemd after a hardware activation # event in udev has triggered a start of the rdma.service unit port=1 function __get_parent_pci_dev() { pushd /sys/bus/pci/devices/$pci_dev >/dev/null 2>&1 ppci_dev=`ls -l physfn | cut -f 2 -d '/'` popd >/dev/null 2>&1 } function __get_parent_ib_dev() { ib_dev=`ls -l | awk '/'$ppci_dev'/ { print $9 }'` } function __get_parent_net_dev() { for netdev in /sys/bus/pci/devices/$ppci_dev/net/* ; do if [ "$port" -eq `cat $netdev/dev_port` ]; then netdev=`basename $netdev` break fi done } function __get_vf_num() { pushd /sys/bus/pci/devices/$ppci_dev >/dev/null 2>&1 vf=`ls -l virtfn* | awk '/'$pci_dev'/ { print $9 }' | sed -e 's/virtfn//'` popd >/dev/null 2>&1 } function __en_sriov_set_vf() { pci_dev=$1 shift [ "$1" = "port" ] && port=$2 && shift 2 # We find our parent device by the netdev registered port number, # however, the netdev port numbers start at 0 while the port # numbers on the card start at 1, so we subtract 1 from our # configured port number to get the netdev number let port-- # Now we need to fill in the necessary information to pass to the ip # command __get_parent_pci_dev __get_parent_net_dev __get_vf_num # The rest is easy. Either the user passed valid arguments as options # or they didn't ip link set dev $netdev vf $vf $* } function __ib_sriov_set_vf() { pci_dev=$1 shift [ "$1" = "port" ] && port=$2 && shift 2 guid="" __get_parent_pci_dev __get_parent_ib_dev [ -f $ib_dev/iov/$pci_dev/ports/$port/gid_idx/0 ] || return while [ -n "$1" ]; do case $1 in guid) guid=$2 shift 2 ;; pkey) shift 1 break ;; *) echo "Unknown option in $src" shift ;; esac done if [ -n "$guid" ]; then guid_idx=`cat "$ib_dev/iov/$pci_dev/ports/$port/gid_idx/0"` echo "$guid" > "$ib_dev/iov/ports/$port/admin_guids/$guid_idx" fi i=0 while [ -n "$1" ]; do for pkey in $ib_dev/iov/ports/$port/pkeys/*; do if [ `cat $pkey` = "$1" ]; then echo `basename $pkey` > $ib_dev/iov/$pci_dev/ports/$port/pkey_idx/$i let i++ break fi done shift done } [ -d /sys/class/infiniband ] || return pushd /sys/class/infiniband >/dev/null 2>&1 if [ -z "$*" ]; then src=/etc/rdma/sriov-vfs [ -f "$src" ] || return grep -v "^#" $src | while read -a args; do # When we use read -a to read into an array, the index starts at # 0, unlike below where the arg count starts at 1 port=1 next_arg=1 [ "${args[$next_arg]}" = "port" ] && next_arg=3 case ${args[$next_arg]} in guid|pkey) __ib_sriov_set_vf ${args[*]} ;; mac|vlan|rate|spoofchk|enable) __en_sriov_set_vf ${args[*]} ;; *) ;; esac done else [ "$2" = "port" ] && next_arg=$4 || next_arg=$2 case $next_arg in guid|pkey) __ib_sriov_set_vf $* ;; mac|vlan|rate|spoofchk|enable) __en_sriov_set_vf $* ;; *) ;; esac fi popd >/dev/null 2>&1
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
awk | Folder | 0755 |
|
|
coreutils | Folder | 0755 |
|
|
dbus-1 | Folder | 0755 |
|
|
dovecot | Folder | 0755 |
|
|
gcc | Folder | 0755 |
|
|
getconf | Folder | 0755 |
|
|
git-core | Folder | 0755 |
|
|
grubby | Folder | 0755 |
|
|
imunify-notifier | Folder | 0755 |
|
|
initscripts | Folder | 0755 |
|
|
kcare | Folder | 0755 |
|
|
linux-boot-probes | Folder | 0755 |
|
|
man-db | Folder | 0755 |
|
|
microcode_ctl | Folder | 0755 |
|
|
openldap | Folder | 0755 |
|
|
openssh | Folder | 0755 |
|
|
os-probes | Folder | 0755 |
|
|
p11-kit | Folder | 0755 |
|
|
plymouth | Folder | 0755 |
|
|
selinux | Folder | 0755 |
|
|
smartmontools | Folder | 0755 |
|
|
sudo | Folder | 0755 |
|
|
tuned | Folder | 0755 |
|
|
utempter | Folder | 0755 |
|
|
chrony-helper | File | 6.37 KB | 0755 |
|
ebtables | File | 1.66 KB | 0755 |
|
exim.daemon | File | 758 B | 0755 |
|
gam_server | File | 90.73 KB | 0755 |
|
generate-rndc-key.sh | File | 546 B | 0755 |
|
glib-pacrunner | File | 15.73 KB | 0755 |
|
gnupg-pcsc-wrapper | File | 19.3 KB | 0755 |
|
gpg-check-pattern | File | 102.95 KB | 0755 |
|
gpg-preset-passphrase | File | 86.39 KB | 0755 |
|
gpg-protect-tool | File | 185.57 KB | 0755 |
|
gpg2keys_curl | File | 44.81 KB | 0755 |
|
gpg2keys_finger | File | 61.34 KB | 0755 |
|
gpg2keys_hkp | File | 53 KB | 0755 |
|
gpg2keys_ldap | File | 61.02 KB | 0755 |
|
grepconf.sh | File | 253 B | 0755 |
|
mlx4-setup.sh | File | 2.48 KB | 0755 |
|
newns | File | 7.03 KB | 0755 |
|
nm-dhcp-helper | File | 15.12 KB | 0755 |
|
nm-dispatcher | File | 47.7 KB | 0755 |
|
nm-iface-helper | File | 839.36 KB | 0755 |
|
nm-ifdown | File | 155 B | 0755 |
|
nm-ifup | File | 153 B | 0755 |
|
platform-python | File | 6.98 KB | 0755 |
|
rdma-init-kernel | File | 5.59 KB | 0755 |
|
rdma-set-sriov-vf | File | 3.05 KB | 0755 |
|
report-command-error | File | 7.29 MB | 0755 |
|
run-with-intensity | File | 9.14 MB | 0755 |
|
tcawmgr.cgi | File | 19.56 KB | 0755 |
|
truescale-serdes.cmds | File | 8.5 KB | 0755 |
|
urlgrabber-ext-down | File | 2.54 KB | 0755 |
|
virt-what-cpuid-helper | File | 7.02 KB | 0755 |
|