configure switchdev mode to run hardware offload test

1. set 2 VFs
echo 2 > /sys/class/net/eth2/device/sriov_numvfs
ip link show

...
17: eth2: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 98:03:9b:9f:d2:0e brd ff:ff:ff:ff:ff:ff
vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable, trust off, query_rss off
vf 1 MAC 00:00:00:00:00:00, spoof checking off, link-state disable, trust off, query_rss off
...
"

2. unbind the VFs
lspci | grep -i mellanox

...
00:08.2 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function]
00:08.3 Ethernet controller: Mellanox Technologies MT28908 Family [ConnectX-6 Virtual Function]
...

echo 0000:00:08.2 > /sys/bus/pci/drivers/mlx5_core/unbind
echo 0000:00:08.3 > /sys/bus/pci/drivers/mlx5_core/unbind

3. set switchdev mode
devlink dev eswitch set pci/0000:00:08.0 mode switchdev

4. set mac address for VFs
ip link set eth2 vf 0 mac e4:11:22:33:44:50
ip link set eth2 vf 1 mac e4:11:22:33:44:51

5. bind the VFs
echo 0000:00:08.2 > /sys/bus/pci/drivers/mlx5_core/bind
echo 0000:00:08.3 > /sys/bus/pci/drivers/mlx5_core/bind

6. 
    for the NIC under test need to define a custom configurations file (at
    asap_dev_reg project root directory), which includes relevant NIC network
    interfaces data (PF0, PF1, VF0,VF1,REP0,REP1):

    1.  Nic type should be dual port NIC ConnectX-5/ConnectX-4Lx in Ethernet mode where:

        1.   is the network interface of the NIC’s first physical function

        2.   is the network interface of the NIC’s second physical function
            (the second port)

        3.   is the network interface of the first virtual function created
            on PF0

        4.   is the network interface of the second virtual function created
            on PF0

        5.   is the network interface of the first representor created when
            switched to switchdev mode on PF0

        6.   is the network interface of the second representor created when
            switched to switchdev mode on PF0

    2.  example configuration file needed (some example config files can be found
        at project root directory named “config_*.sh“):
        NIC=
        NIC2=
        VF=
        VF1=$VF
        VF2=
        REP=
        REP2=

cat config_reproduce.sh

NIC=eth2
NIC2=eth3
VF=eth4
VF1=$VF
VF2=eth5
REP=eth2_pf64vf0
REP2=eth2_pf64vf1
"

7. export CONFIG=config_reproduce.sh

8. 
ovs-vsctl set Open_vSwitch . other_config:hw-offload=true
systemctl restart openvswitch

9. ./test-eswitch-netdev-tx.sh
 

你可能感兴趣的:(Linux,kernel)