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
17
17
echo " create_dcf_vf Create DCF VFs and bind to VFIO"
18
18
echo " disable_vf Disable VF"
19
19
echo " list all List all NIC devices and the brief"
20
+ echo " list <bb:dd:ff.x> List VFs of the specified PF"
20
21
exit 0
21
22
fi
22
23
@@ -112,6 +113,23 @@ create_kvf() {
112
113
done
113
114
}
114
115
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
+
115
133
list () {
116
134
printf " %-4s\t%-12s\t%-12s\t%-4s\t%-6s\t%-10s\n" " ID" " PCI BDF" " Driver" " NUMA" " IOMMU" " IF Name"
117
135
@@ -149,8 +167,13 @@ if [ -z "$cmd" ]; then
149
167
fi
150
168
151
169
if [ " $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
154
177
fi
155
178
156
179
bdf=$2
You can’t perform that action at this time.
0 commit comments