Skip to content

seek-hope/p4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tofino prototype

The data plane codes in P4 are at ./switch/, and the controller codes in C are at ./ctrl.

Compile and Run

Compile the code

make
./contrl

Possible Questions on Stage Two

Enable the port to CPU

bfshell

After running ./contrl, create another new shell and type the instructions below to enable port to CPU on P4's side:

sudo su
source ~/bf-sde-9.13.0/set_sde.bash
bfshell
ucli
pm
port-del 21/0
port-add 21/0 10G NONE
port-enb 21/0

# bf-sde.pm> show
# this instruction can see the corresponding number of the port (example: 9/0 → 132)
# also can see how many frames are sent (TX) or received (RX) on desired port

# Ctrl+\ to exit bfshell
P4 Ubuntu

Use ifconfig -a to see all interfaces

First four interfaces are corresponded to 21/0 ~ 21/3

Use ifconfig <interface_name> up to get interface up

Subnet Configuration

Set the subnets of two p4 ports (selected from 9/0 ~ 9/3) to 192.168.1.2/24 and 192.168.2.2/24

Don't forget to set default gateway like below:

sudo ip route add default via <gateway>(example: 192.168.1.1) dev eth0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages