Skip to content

Commit

Permalink
ovs-dpdk supports adding bond for multi-NICs (#2064)
Browse files Browse the repository at this point in the history
In the IDC environment, multi-NIC link aggregation is used to achieve high availability

Co-authored-by: yuanliu <yuanliu@cmss.chinamobile.com>
  • Loading branch information
lynn901 and yuanliu committed Nov 23, 2022
1 parent aef4cd3 commit 419c385
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dist/images/ovs-dpdk-config
@@ -1,2 +1,4 @@
ENCAP_IP=192.168.190.2
DPDK_DEV=0000:00:0b.0
DPDK_DEV=(0000:00:0b.0 0000:00:0c.0)
BOND_TYPE=4 # ""=single_port, 0="balance-slb", 1="active-backup", 4="lacp"
VLAN_TAG=0 # 0=untag
31 changes: 29 additions & 2 deletions dist/images/start-ovs-dpdk-v2.sh
Expand Up @@ -73,8 +73,35 @@ ovs-vsctl --may-exist add-br ${DPDK_TUNNEL_IFACE} \
-- br-set-external-id ${DPDK_TUNNEL_IFACE} bridge-id ${DPDK_TUNNEL_IFACE} \
-- set bridge ${DPDK_TUNNEL_IFACE} fail-mode=standalone

ovs-vsctl --timeout 10 add-port ${DPDK_TUNNEL_IFACE} dpdk0 \
-- set Interface dpdk0 type=dpdk options:dpdk-devargs=${DPDK_DEV}
OPTS=""
IPS=""
for ((i=0;i< ${#DPDK_DEV[@]};i++));
do
echo ${DPDK_DEV[i]};
S=" -- set Interface p$i type=dpdk options:dpdk-devargs=${DPDK_DEV[i]}"
OPTS="$OPTS$S"
IPS=$IPS" p"$i
done

case ${BOND_TYPE} in
"")
ovs-vsctl --timeout 10 add-port ${DPDK_TUNNEL_IFACE} dpdk0 ${OPTS};;
"active-backup"|1)
ovs-vsctl --timeout 10 add-bond ${DPDK_TUNNEL_IFACE} dpdk0 ${IPS} ${OPTS}
ovs-vsctl set port dpdk0 bond_mode=active-backup;;
"balance-slb"|0)
ovs-vsctl --timeout 10 add-bond ${DPDK_TUNNEL_IFACE} dpdk0 ${IPS} ${OPTS}
ovs-vsctl set port dpdk0 bond_mode=balance-slb;;
"lacp"|4)
ovs-vsctl --timeout 10 add-bond ${DPDK_TUNNEL_IFACE} dpdk0 ${IPS} ${OPTS}
ovs-vsctl set port dpdk0 bond_mode=balance-tcp
ovs-vsctl set port dpdk0 lacp=active;;
*)
echo "wrong ovs dpdk bond_type config"
exit 1;;
esac

ovs-vsctl set port ${DPDK_TUNNEL_IFACE} tag=${VLAN_TAG}

ip addr add ${ENCAP_IP} dev ${DPDK_TUNNEL_IFACE}
fi
Expand Down

0 comments on commit 419c385

Please sign in to comment.