Skip to content

Instantly share code, notes, and snippets.

@williamtu
Last active December 29, 2023 07:01
Show Gist options
  • Save williamtu/72bd27dcec223fc26ed6e87edb02d07d to your computer and use it in GitHub Desktop.
Save williamtu/72bd27dcec223fc26ed6e87edb02d07d to your computer and use it in GitHub Desktop.
OVS AFXDP script
rm -f /usr/local/etc/openvswitch/conf.db
ovsdb-tool create /usr/local/etc/openvswitch/conf.db /root/ovs/vswitchd/vswitch.ovsschema
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--pidfile --detach
if [ "$1" == "gdb" ]; then
gdb -ex=r --args ovs-vswitchd --no-chdir --pidfile --log-file=/root/ovs/ovs-vswitchd.log -vvconn -vofproto_dpif -vunixctl --disable-system
elif [ "$1" == "callgrind" ]; then
valgrind --tool=callgrind ovs-vswitchd --no-chdir --pidfile --log-file=/root/ovs/ovs-vswitchd.log -vvconn -vofproto_dpif -vunixctl --disable-system --detach
else
taskset 0x3 ovs-vswitchd --no-chdir --pidfile --log-file=/root/ovs/ovs-vswitchd.log -vvconn -vofproto_dpif -vunixctl --disable-system --detach
fi
ovs-vsctl -- add-br br0 -- set Bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15 fail-mode=secure datapath_type=netdev
#ovs-vsctl add-port br0 enp2s0 -- set interface enp2s0 type="afxdp" other_config:pmd-rxq-affinity="0:1,1:3"
ovs-vsctl add-port br0 enp2s0 -- set interface enp2s0 type="afxdp"
ovs-ofctl del-flows br0
ovs-ofctl -O OpenFlow13 add-flow br0 "in_port=enp2s0, \
actions=meter:8,set_field:14->in_port,set_field:a0:36:9f:33:b1:40->dl_src,enp2s0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment