Configure local mirror with ASAP^2
0.
#udev rules
SUBSYSTEM=="net", ACTION=="add", ATTR{phys_switch_id}!="", ATTR{phys_port_name}!="", \
IMPORT{program}="/etc/infiniband/vf-net-link-name.sh $attr{phys_switch_id} $attr{phys_port_name}" \
NAME="$env{NAME}", RUN+="/sbin/mlnx_net_rules $env{NAME}"
SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/mlnx_net_rules $env{NAME}"
SUBSYSTEM=="net", ACTION=="add", ATTR{phys_switch_id}=="e8a8470003da341c", \
ATTR{phys_port_name}!="", NAME="eth2_$attr{phys_port_name}"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}="1c:34:da:47:a8:e8", NAME="eth2"
1.
#enable sriov
echo 2 > /sys/class/net/eth3/device/sriov_numvfs
lspci | grep -i mellanox
2.
#unbind VFs
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.
#enable switchdev
devlink dev eswitch set pci/0000:00:08.0 mode switchdev
4.
#set VFs mac address
ip link set dev eth3 vf 0 mac e4:11:22:33:44:50
ip link set dev eth3 vf 1 mac e4:11:22:33:44:51
5.
#To change the encapsulation value make sure all VFs are unbound and no rules are set
echo basic > /sys/class/net/eth4/compat/devlink/encap
6.
#bind 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
7.
#configure openvswitch
systemctl start openvswitch
ovs-vsctl add-br ovs-sriov
ovs-vsctl set Open_vSwitch . other_config:hw-offload=true
ovs-vsctl set Open_vSwitch . other_config:max-idle=300000
systemctl restart openvswitch
8.
#add representor to OVS
ovs-vsctl add-port ovs-sriov eth3
ovs-vsctl add-port ovs-sriov eth5
ovs-vsctl add-port ovs-sriov eth6
ip link set eth3 up
ip link set eth5 up
ip link set eth6 up
9.
#configure netnamespace
ip netns add net0
ip link set dev eth7 netns net0
ip netns exec net0 ip l
ip netns exec net0 ip addr add 1.1.1.7/24 dev eth6
ip netns exec net0 ip a
ip netns exec net0 ip link set eth7 up
10.
#show ovs flows
ovs-dpctl show
ovs-dpctl dump-flows
ovs-appctl dpctl/dump-flows
ovs-vsctl list Mirror
ovs-dpctl dump-conntrack
11.
#eth5/6 are the representor interfaces
ovs-vsctl -- set Bridge ovs-sriov mirrors=@m \
-- --id=@eth5 get Port eth5 \
-- --id=@eth6 get Port eth6 \
-- --id=@m create Mirror name=mirror_test select-dst-port=@eth5 select-src-port=@eth5 output-port=@eth6
ovs-vsctl list Mirror