File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ if [ $# -lt 2 ]; then
1717 echo " create_dcf_vf Create DCF VFs and bind to VFIO"
1818 echo " disable_vf Disable VF"
1919 echo " list all List all NIC devices and the brief"
20+ echo " list <bb:dd:ff.x> List VFs of the specified PF"
2021 exit 0
2122fi
2223
@@ -112,6 +113,23 @@ create_kvf() {
112113 done
113114}
114115
116+ list_vf () {
117+ pci_device_path=" /sys/bus/pci/devices/$1 /"
118+ if [ ! -d " $pci_device_path " ]; then
119+ echo " PCI device $1 does not exist."
120+ exit 1
121+ fi
122+ vf_names=$( find " $pci_device_path " -name " virtfn*" -exec basename {} \; | sort)
123+ if [ -z " $vf_names " ]; then
124+ echo " No VFs found for $1 "
125+ return
126+ fi
127+ for vf in $vf_names ; do
128+ vfport=$( basename " $( readlink " $pci_device_path /$vf " ) " )
129+ printf " %s\n" " $vfport "
130+ done
131+ }
132+
115133list () {
116134 printf " %-4s\t%-12s\t%-12s\t%-4s\t%-6s\t%-10s\n" " ID" " PCI BDF" " Driver" " NUMA" " IOMMU" " IF Name"
117135
@@ -149,8 +167,13 @@ if [ -z "$cmd" ]; then
149167fi
150168
151169if [ " $cmd " == " list" ]; then
152- list
153- exit 0
170+ if [ " $2 " == " all" ]; then
171+ list
172+ exit 0
173+ else
174+ list_vf " $2 "
175+ exit 0
176+ fi
154177fi
155178
156179bdf=$2
You can’t perform that action at this time.
0 commit comments