Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

P4 on Raspberry Pi for Networking Education

License

NotificationsYou must be signed in to change notification settings

p4lang/p4pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P4Pi Logo


P4Pi (pronounced papi or puppy) allows to design and deploy network data planeswritten in P4 using the Raspberry Pi platform.

Getting Started

Please refer to theP4Pi Wiki Pages.

The following instructions are for experts looking to build their own image. We recommend starting from the generated P4Pi images, as detailed in the wiki.

Common

To setup your Raspberry Pi for the first time, follow the instructions onthe Raspberry Pi Website, using the operating system noted below.

Start from the latest(at the time of writing)64 bit Raspberry Pi OS lite

Update packages

sudo apt-get update&& sudo apt-get full-upgrade -ysudo apt-get install -y git

To use pcap poll mode driver installlibpcap-dev before compiling dpdk

sudo apt-get install -y libpcap-dev

Performance tuning

Isolate CPU core(s)

Add kernel parameters for cpu isolation in/boot/cmdline.txt eg:

isolcpus=2

Tap Poll Mode Driver

Installbridge-utils

sudo apt-get install -y bridge-utils

Use--vdev net_tap0 inopts_dpdk.cfgStart basic_mirror to create dtap0 then bridge it to eth0/wlan0:

sudo brctl addbr br0sudo brctl addif br0<eth0/wlan0> dtap0sudo ifconfig br0 up

Pi as WiFi AP

Based on this

Install hostapd and dnsmasq

sudo apt-get install -y hostapd dnsmasqsudo systemctl unmask hostapd

Configure static ip for the pi

Append to/etc/dhcpcd.conf

interface wlan0    static ip_address=192.168.4.1/24    nohook wpa_supplicant

Configure dhcp

Replace/etc/dnsmasq.conf with

interface=wlan0dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h

Configure hostapd

Edit/etc/hostapd/hostapd.conf: (fiddle with channel if needed, unfortunately the auto channel scan is not supported by the hardware)

country_code=HUinterface=wlan0ssid=<NameOfNetwork>hw_mode=achannel=48ieee80211d=1ieee80211n=1ieee80211ac=1wmm_enabled=1macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0wpa=2wpa_passphrase=<Password>wpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMP

Start hostapd

sudo systemctl start hostapd# or enable and restart

On the pc add a manual arp entry for a non-existant destination in the same subnet and run iperf with that as a destination eg

sudo arp -s 192.168.4.10 00:50:ba:85:85:ca

Configuration settings

Environmental variables

export P4PI=/root/t4p4s/piexport GRPC=/root/t4p4s/grpcexport GRPCPP=/root/t4p4s/P4Runtime_GRPCPP

Creating veth pairs

By default the following command is executed on start-up byp4pi-setup.service.

sudo p4pi-setup

It creates two virtual Ethernet devices pairs and two bridge interfacesare used in T4P4S examples to process packets.

In order to add the wireless access point interface to a bridge used T4P4S,uncomment the following line in/etc/hostapd/hostapd.conf:

#bridge=br0

Results

With pcap PMD

Ethernet

baseline:

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec  13.1 GBytes   941 Mbits/sec    1             sender[  5]   0.00-120.00 sec  13.1 GBytes   941 Mbits/sec                  receiver

bmv2:

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec   639 MBytes  44.7 Mbits/sec  19456             sender[  5]   0.00-120.00 sec   639 MBytes  44.7 Mbits/sec                  receiver

dpdk (with hugepages and isolated cpu core)

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec  1.18 GBytes  84.6 Mbits/sec  2478             sender[  5]   0.00-120.01 sec  1.18 GBytes  84.5 Mbits/sec                  receiver

T4P4S:

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec   973 MBytes  68.0 Mbits/sec  2965             sender[  5]   0.00-120.02 sec   970 MBytes  67.8 Mbits/sec                  receiver

T4P4S with Tap PMD:

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec  2.57 GBytes   184 Mbits/sec  522             sender[  5]   0.00-120.04 sec  2.57 GBytes   184 Mbits/sec                  receiver

WiFi

Baseline:

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec   827 MBytes  57.8 Mbits/sec    0             sender[  5]   0.00-120.02 sec   824 MBytes  57.6 Mbits/sec                  receiver

T4P4s:

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec   396 MBytes  27.7 Mbits/sec  401             sender[  5]   0.00-120.06 sec   393 MBytes  27.5 Mbits/sec                  receiver

T4P4S with Tap PMD:

[ ID] Interval           Transfer     Bitrate         Retr[  5]   0.00-120.00 sec   415 MBytes  29.0 Mbits/sec    1             sender[  5]   0.00-120.09 sec   413 MBytes  28.8 Mbits/sec                  receiver

[8]ページ先頭

©2009-2025 Movatter.jp