This repository contains the P4 implementation of Ribosome for Intel Tofino.
This implementation is tested with SDE 9.7.0.
The main file is ribosome.p4
. It contains the implementation of the entire pipeline.
The ingress_controls
directory contains all the controls that Ribosome uses in the Ingress
pipeline.
The egress_controls
directory contains all the controls that Ribosome uses in the Egress
pipeline.
The parsers
directory contains both the Ingress Parser/Deparser and Egress Parser/Deparser.
The include
directory contains parser and configuration files.
The file setup.py
contains a bfrt_python
script that configures ports, mirroring, and other several callbacks for the program.
Example command to build the code, it can vary depending on your SDE installation:
./p4_build.sh -DSPLIT=128 ribosome.p4 # Do not split packets with "length <= SPLIT"
You can specify the split threshold modifying the value of SPLIT
. This parameter sets the threshold under which Ribosome does not split the packets. The threshold is expressed in bytes.
You can add a custom split threshold by editing the parsers/ingress_parser.p4
file, in the check_ip_len
state.
Before running Ribosome code, you need to fill the access.txt
file with the commands to append 4 bytes (used as RDMA iCRC) at the end of packets.
In this repository, commands have been removed as they are under NDA.
Example commands to run Ribosome, they can vary depending on your SDE installation.
On a terminal, run switchd
:
$SDE/run_switchd.sh -p ribosome
On another terminal, launch the setup.py
script using bfshell
:
$SDE/run_bfshell.sh -i -b /absolute/path/to/setup.py
This implementation of Ribosome leverages on RDMA servers as external buffers for payloads.
The number of RDMA servers is set to 4. To add or remove servers, you have to:
-
Edit the
include/configuration.p4
file, specifying the number of desired servers, for example:#define NUMBER_OF_SERVERS 3
-
Edit the
NUMBER_OF_SERVERS
variable in thesetup.py
file, specifying the new number of desired servers:NUMBER_OF_SERVERS = 3
-
Recompile the P4 code.
This implementation of Ribosome leverages on 32 Queue-Pairs for each RDMA server connection.
To change the number of Queue-Pairs, you have to:
-
Edit the
include/configuration.p4
file, specifying the number of desired QPs, for example:#define MAX_QP_NUM 16
-
Edit the
MAX_QP_NUM
variable in thesetup.py
file, specifying the new number of desired QPs:MAX_QP_NUM = 16
-
Recompile the P4 code.
You can set the number of bytes to send to the NF. To do so, you have to:
-
Edit the
include/configuration.p4
file, specifying the length in bytes of the packet copy to send to the NF:#define PKT_MIN_LENGTH 71
-
Edit the
setup.py
file, changing thePKT_MIN_LENGTH
variable:################################# ##### MIRROR SESSIONS TABLE ##### ################################# # In this section, we setup the mirror sessions of Ribosome. # One session is used to truncate/send the headers to the NF. # Other NUMBER_OF_SERVERS are used to send QP Refresh Packets to the proper RDMA server. PKT_MIN_LENGTH = 71
-
Recompile the P4 code.
You can find ports configuration in the include/configuration.p4
file. Here you can set the port towards the NF and
the RDMA servers.
If you make changes, you need to update the ports value in the setup.py
file accordingly.
The outport ports specified in the files are used to send out the traffic after being processed. The current implementation sends out the packets randomly selecting one of the four output ports. To modify this behaviour you can:
- Modify the sending rules of packets not split: editing the
ingress_control/default_switch.p4
file. - Modify the sending rules of reconstructed packets: editing the
ingress_control/packet_reconstruct.p4
file.
SERVER_PORT_TO_IDX
dict in the setup.py
file, specifying which Server IDX should be used to send QP Restore packets towards that server. More information about the Server IDX can be found in the RDMA Server Agent repository.
You can add entries to the blacklist
table to disable payload splitting on specific traffic classes.
You can set up the blacklist
table from the setup.py
file:
###########################
##### BLACKLIST TABLE #####
###########################
# This function setups the entries in the blacklist table.
# You can add/edit/remove entries to disable payload splitting on specific traffic classes.
def setup_blacklist_table():
from ipaddress import ip_address
global p4, NF_PORT
blacklist_table = p4.Ingress.blacklist
blacklist_table.clear()
blacklist_table.add_with_drop(dst_addr=ip_address('224.0.0.0'), dst_addr_p_length=16)
blacklist_table.add_with_send(dst_addr=ip_address('10.0.0.1'), dst_addr_p_length=32, port=0)