Data-Plane Time synchronization Protocol (https://www.comp.nus.edu.sg/~pravein/papers/DPTP_SOSR19.pdf) This source code synchronizes two Barefoot Tofino switches to support a global timing (64-bit) in the data-plane.
p4_14 : v_14/ (Tested on SDE 8.x.x)
p4_16 : v_16/ (Tested on SDE 9.x.x)
The Topology used in as below :
A single tofino switch named "tofino1" is virtualized into two switches Master(M) and Switch1. To do this virtualization, you will need to add a loopback link between port3 (160-163) and port5 (176-179). Once done, it will be configured as 10G ports, and we will be using only one link (160-176) as the connection between Switch1 and Master. Additionally, you will need atleast one host connected to port 1(128-131) to send DPTP requests.
- Navigate to the SDE PATH :
cd ~/bf-sde-8.x.x
export DPTP_PATH=<PATH TO DPTP FOLDER>
- Set the env variables :
. ./set_sde.bash
- Build the p4 program using the command :
./p4_build.sh $DPTP_PATH/v_14/dptp_topo.p4
- Load the p4 program, and run the control plane API code using :
"cd $DPTP_PATH/v_14/CP"
"./run.sh"
- This should automatically start the synchronization between Switch1 and master through packets from control-plane.
- Navigate to the SDE PATH :
cd ~/bf-sde-9.x.x
export DPTP_PATH=<PATH TO DPTP FOLDER>
- Set the env variables :
. ./set_sde.bash
-
DPTP program in p4_16 has multiple profiles :
a) DPTP with logical switches to get measurements and to do a sanity check.
./p4_build.sh -DLOGICAL_SWITCHES $DPTP_PATH/v_16/p4_src/dptp.p4
b) DPTP without logical switches. This is basically the program that can be included in any p4 programs
./p4_build.sh $DPTP_PATH/v_16/p4_src/dptp.p4
-
Load the p4 program, and run the control plane API code using :
"cd $DPTP_PATH/v_16/CP"
"./run.sh"
- This should automatically start the synchronization between Switch1 and master through packets from control-plane.
Moongen script sends synchronization requests packets between switches Pull from https://github.com/praveingk/moongen/, Make sure the submodule libmoon is also pulled. Follow the readme instructions in moongen to build it.
- Enable the NIC to work with DPDK:
sudo ./libmoon/deps/dpdk/usertools/dpdk-devbind.py --b igb_uio <NIC Port>
- To start DPTP in the network between switch 1 and master:
sudo ./build/MoonGen examples/dptp_topo.lua <DPDK PORT id1> <DPDK Port id2>
Note that "DPDK Port id2" is redundant and is used only for switch-to-host DPTP accuracy measurement.
- To create cross-traffic in the link being used for synchronization towards the SW1 (i.e. 160 --> 176), we simply craft a packet to destination address of SW1 (0x100000000001) and send it from any host link.
sudo ./build/MoonGen examples/dptp_topo.lua -d 1 <DPDK PORT id1> <DPDK Port id2>
Note that "DPDK Port id2" is redundant and is used only for switch-to-host DPTP accuracy measurement.
- To create oversubscribed traffic, run the above example from two 10G host-links.