Use PCI_SLOT_NAME cut instead of ls -ld cut more precisely

If the vf port file like /sys/class/net/ens4f0/device/virtfn0 date is
'Jan 5', ls -ld result will be 'Jan  5', there are two space between
Jan and 5, if use the old "cut -f 11 -d ''", it will not get the vf pci
id, should be cut 12. So here we use the context in
/sys/class/net/p2p1/device/virtfn*/uevent, do with it will be more
precise.

Change-Id: If7145744bc66514e33f08071a07238ab8c7c7786
This commit is contained in:
lijiaping 2021-01-07 18:10:46 +08:00
parent 98b3af136a
commit 6e6212c4f1

View File

@ -167,7 +167,7 @@ Configure Open vSwitch hardware offloading
.. code-block:: console
# for vf in `ls -ld /sys/class/net/ens4f0/device/virt* | cut -f 11 -d ' ' | cut -b 4-`
# for vf in `grep PCI_SLOT_NAME /sys/class/net/ens4f0/device/virtfn*/uevent | cut -d'=' -f2`
do
echo $vf > /sys/bus/pci/drivers/mlx5_core/unbind
done
@ -189,7 +189,7 @@ Configure Open vSwitch hardware offloading
.. code-block:: console
# for vf in `ls -ld /sys/class/net/ens4f0/device/virt* | cut -f 11 -d ' ' | cut -b 4-`
# for vf in `grep PCI_SLOT_NAME /sys/class/net/ens4f0/device/virtfn*/uevent | cut -d'=' -f2`
do
echo $vf > /sys/bus/pci/drivers/mlx5_core/bind
done