Commit 5ee84460 authored by Jialin Li's avatar Jialin Li
Browse files

merge master

parents d8440794 dbbc89bd
#!/bin/bash
DUR=30
# K is DCTCP threshold in the unit of cells (208 bytes for BCMXXXXX)
K_START=0
K_END=32
K_INTERVAL=32
MTU=1500
set -x
for ((K=$K_START; K<=$K_END; K+=$K_INTERVAL))
do
ssh honey1.kaist.ac.kr -p 2222 ~/change_k.sh $K > /dev/null
EXP=$MTU-$K
sleep 1
ssh honey2.kaist.ac.kr -p 2222 sudo taskset 0x02 iperf -c 10.9.9.11 -i 1 -Z dctcp -w 400K -t $DUR > $EXP-1.txt &
ssh honey3.kaist.ac.kr -p 2222 sudo taskset 0x02 iperf -c 10.9.9.11 -i 1 -Z dctcp -w 400K -t $DUR > $EXP-2.txt
wait
cat $EXP-*.txt
sleep 3
done
...@@ -5,6 +5,8 @@ QEMU_CMD="$EHSIM_BASE/qemu/x86_64-softmmu/qemu-system-x86_64" ...@@ -5,6 +5,8 @@ QEMU_CMD="$EHSIM_BASE/qemu/x86_64-softmmu/qemu-system-x86_64"
QEMU_IMG="$EHSIM_BASE/qemu/qemu-img" QEMU_IMG="$EHSIM_BASE/qemu/qemu-img"
GEM5_BASE="$EHSIM_BASE/gem5" GEM5_BASE="$EHSIM_BASE/gem5"
NS3_BASE="$EHSIM_BASE/ns-3" NS3_BASE="$EHSIM_BASE/ns-3"
OUTDIR_BASE="$EHSIM_BASE/experiments/out"
WORKDIR_BASE="$OUTDIR_BASE"
if [ -f local-config.sh ] ; then if [ -f local-config.sh ] ; then
source local-config.sh source local-config.sh
...@@ -40,9 +42,10 @@ GEM5_KERNEL=$EHSIM_BASE/images/vmlinux ...@@ -40,9 +42,10 @@ GEM5_KERNEL=$EHSIM_BASE/images/vmlinux
# Args: # Args:
# - experiment name # - experiment name
init_out() { init_out() {
export OUTDIR=./out/$1/$2 export OUTDIR=$OUTDIR_BASE/$1/$2
rm -rf $OUTDIR export WORKDIR=$WORKDIR_BASE/$1/$2
mkdir -p $OUTDIR rm -rf $OUTDIR $WORKDIR
mkdir -p $OUTDIR $WORKDIR
date > $OUTDIR/starttime date > $OUTDIR/starttime
} }
...@@ -51,10 +54,11 @@ init_out() { ...@@ -51,10 +54,11 @@ init_out() {
# - Cosim instance # - Cosim instance
# - secondary hard drive # - secondary hard drive
# - [optional primary image name: default ubuntu1804-base] # - [optional primary image name: default ubuntu1804-base]
# - [optional: additinoal qemu arguments]
run_qemu() { run_qemu() {
img_a="$OUTDIR/qemu.hd.a.$1" img_a="$WORKDIR/qemu.hd.a.$1"
img_b="$OUTDIR/qemu.hd.b.$1" img_b="$WORKDIR/qemu.hd.b.$1"
pcisock="$OUTDIR/pci.$2" pcisock="$WORKDIR/pci.$2"
rm -f $img_a $img_b rm -f $img_a $img_b
echo Creating disk for qemu $1 echo Creating disk for qemu $1
if [ -z "$4" ]; then if [ -z "$4" ]; then
...@@ -74,7 +78,8 @@ run_qemu() { ...@@ -74,7 +78,8 @@ run_qemu() {
-serial mon:stdio -m $((16 * 1024)) -smp 1 -display none -enable-kvm \ -serial mon:stdio -m $((16 * 1024)) -smp 1 -display none -enable-kvm \
-nic none \ -nic none \
-chardev socket,path=$pcisock,id=cosimcd \ -chardev socket,path=$pcisock,id=cosimcd \
-device cosim-pci,chardev=cosimcd &>$OUTDIR/qemu.$1.log & -device cosim-pci,chardev=cosimcd \
$5 &>$OUTDIR/qemu.$1.log &
pid=$! pid=$!
ALL_PIDS="$ALL_PIDS $pid" ALL_PIDS="$ALL_PIDS $pid"
return $pid return $pid
...@@ -90,9 +95,9 @@ run_qemu() { ...@@ -90,9 +95,9 @@ run_qemu() {
# - [optional primary image name: default ubuntu1804-base] # - [optional primary image name: default ubuntu1804-base]
run_gem5() { run_gem5() {
echo Starting gem5 $1 echo Starting gem5 $1
pcisock="$OUTDIR/pci.$2" pcisock="$WORKDIR/pci.$2"
shm="$OUTDIR/shm.$2" shm="$WORKDIR/shm.$2"
cpdir="$OUTDIR/../checkpoint/checkpoints.$5" cpdir="$WORKDIR/../checkpoint/checkpoints.$5"
mkdir -p $cpdir mkdir -p $cpdir
if [ -z "$7" ]; then if [ -z "$7" ]; then
...@@ -126,7 +131,7 @@ run_gem5() { ...@@ -126,7 +131,7 @@ run_gem5() {
run_corundum_verilator() { run_corundum_verilator() {
echo Starting corundum_verilator $1 echo Starting corundum_verilator $1
$EHSIM_BASE/corundum/corundum_verilator \ $EHSIM_BASE/corundum/corundum_verilator \
$OUTDIR/pci.$1 $OUTDIR/eth.$1 $OUTDIR/shm.$1 \ $WORKDIR/pci.$1 $WORKDIR/eth.$1 $WORKDIR/shm.$1 \
&>$OUTDIR/corundum_verilator.$1.log & &>$OUTDIR/corundum_verilator.$1.log &
pid=$! pid=$!
ALL_PIDS="$ALL_PIDS $pid" ALL_PIDS="$ALL_PIDS $pid"
...@@ -138,7 +143,7 @@ run_corundum_verilator() { ...@@ -138,7 +143,7 @@ run_corundum_verilator() {
run_corundum_bm() { run_corundum_bm() {
echo Starting corundum_bm $1 echo Starting corundum_bm $1
$EHSIM_BASE/corundum_bm/corundum_bm \ $EHSIM_BASE/corundum_bm/corundum_bm \
$OUTDIR/pci.$1 $OUTDIR/eth.$1 $OUTDIR/shm.$1 \ $WORKDIR/pci.$1 $WORKDIR/eth.$1 $WORKDIR/shm.$1 \
&>$OUTDIR/corundum_bm.$1.log & &>$OUTDIR/corundum_bm.$1.log &
pid=$! pid=$!
ALL_PIDS="$ALL_PIDS $pid" ALL_PIDS="$ALL_PIDS $pid"
...@@ -150,7 +155,7 @@ run_corundum_bm() { ...@@ -150,7 +155,7 @@ run_corundum_bm() {
run_i40e_bm() { run_i40e_bm() {
echo Starting i40e $1 echo Starting i40e $1
$EHSIM_BASE/i40e_bm/i40e_bm \ $EHSIM_BASE/i40e_bm/i40e_bm \
$OUTDIR/pci.$1 $OUTDIR/eth.$1 $OUTDIR/shm.$1 \ $WORKDIR/pci.$1 $WORKDIR/eth.$1 $WORKDIR/shm.$1 \
&>$OUTDIR/i40e_bm.$1.log & &>$OUTDIR/i40e_bm.$1.log &
pid=$! pid=$!
ALL_PIDS="$ALL_PIDS $pid" ALL_PIDS="$ALL_PIDS $pid"
...@@ -171,7 +176,7 @@ run_wire() { ...@@ -171,7 +176,7 @@ run_wire() {
fi fi
$EHSIM_BASE/net_wire/net_wire \ $EHSIM_BASE/net_wire/net_wire \
$OUTDIR/eth.$2 $OUTDIR/eth.$3 $pcap &>$OUTDIR/wire.$1.log & $WORKDIR/eth.$2 $WORKDIR/eth.$3 $pcap &>$OUTDIR/wire.$1.log &
pid=$! pid=$!
ALL_PIDS="$ALL_PIDS $pid" ALL_PIDS="$ALL_PIDS $pid"
return $pid return $pid
...@@ -183,7 +188,7 @@ run_wire() { ...@@ -183,7 +188,7 @@ run_wire() {
run_ns3_bridge() { run_ns3_bridge() {
ports="" ports=""
for p in $2; do for p in $2; do
epath="`readlink -f $OUTDIR/eth.$p`" epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --CosimPort=$epath" ports="$ports --CosimPort=$epath"
done done
$NS3_BASE/cosim-run.sh cosim cosim-bridge-example \ $NS3_BASE/cosim-run.sh cosim cosim-bridge-example \
...@@ -201,11 +206,11 @@ run_ns3_bridge() { ...@@ -201,11 +206,11 @@ run_ns3_bridge() {
run_ns3_dumbbell() { run_ns3_dumbbell() {
ports="" ports=""
for p in $2; do for p in $2; do
epath="`readlink -f $OUTDIR/eth.$p`" epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --CosimPortLeft=$epath" ports="$ports --CosimPortLeft=$epath"
done done
for p in $3; do for p in $3; do
epath="`readlink -f $OUTDIR/eth.$p`" epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --CosimPortRight=$epath" ports="$ports --CosimPortRight=$epath"
done done
...@@ -224,11 +229,11 @@ run_ns3_dumbbell() { ...@@ -224,11 +229,11 @@ run_ns3_dumbbell() {
run_ns3_sequencer() { run_ns3_sequencer() {
ports="" ports=""
for p in $2; do for p in $2; do
epath="`readlink -f $OUTDIR/eth.$p`" epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --ClientPort=$epath" ports="$ports --ClientPort=$epath"
done done
for p in $3; do for p in $3; do
epath="`readlink -f $OUTDIR/eth.$p`" epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --ServerPort=$epath" ports="$ports --ServerPort=$epath"
done done
for p in $4; do for p in $4; do
...@@ -253,7 +258,11 @@ cleanup() { ...@@ -253,7 +258,11 @@ cleanup() {
kill -KILL $p &>/dev/null kill -KILL $p &>/dev/null
done done
rm -f $OUTDIR/{qemu.hd.*,shm.*,pci.*,eth.*} if [ "$OUTDIR" != "$WORKDIR" ]; then
rm -rf $WORKDIR
else
rm -f $WORKDIR/{qemu.hd.*,shm.*,pci.*,eth.*}
fi
date >>$OUTDIR/endtime date >>$OUTDIR/endtime
} }
......
#!/bin/bash
source common-functions.sh
init_out gem5-i40e-cc checkpoint
# first run to checkpoint with fast CPU
run_i40e_bm a
run_i40e_bm b
run_i40e_bm c
sleep 2
run_ns3_bridge bridge "a b c"
run_gem5 a a build/gem5-pair-i40e-server.tar X86KvmCPU server "--cosim-type=i40e"
run_gem5 b b build/gem5-pair-i40e-client.tar X86KvmCPU client "--cosim-type=i40e"
run_gem5 c c build/gem5-pair-i40e-client-2.tar X86KvmCPU client2 "--cosim-type=i40e"
client_pid=$!
wait $client_pid
cleanup
echo "Took checkpoint successfully"
#!/bin/bash
source common-functions.sh
init_out gem5-i40e-cc $1
echo "Restoring from checkpoint"
# then run with timing CPU
run_i40e_bm a
run_i40e_bm b
run_i40e_bm c
sleep 0.5
run_ns3_bridge bridge "a b c"
run_gem5 a a build/gem5-pair-i40e-server.tar TimingSimpleCPU server "-r 0 --cosim-sync --cosim-type=i40e"
run_gem5 b b build/gem5-pair-i40e-client.tar TimingSimpleCPU client "-r 0 --cosim-sync --cosim-type=i40e"
run_gem5 c c build/gem5-pair-i40e-client-2.tar TimingSimpleCPU client2 "-r 0 --cosim-sync --cosim-type=i40e"
client_pid=$!
wait $client_pid
cleanup
#!/bin/bash
source common-functions.sh
init_out qemu-i40e-bm-cc $1
run_i40e_bm a
run_i40e_bm b
run_i40e_bm c
sleep 0.5
run_ns3_bridge bridge "a b c"
run_qemu a a build/qemu-pair-i40e-server.tar
sleep 2
run_qemu b b build/qemu-pair-i40e-client.tar
run_qemu c c build/qemu-pair-i40e-client-2.tar
client_pid=$!
wait $client_pid
cleanup
...@@ -7,9 +7,8 @@ run_i40e_bm a ...@@ -7,9 +7,8 @@ run_i40e_bm a
run_i40e_bm b run_i40e_bm b
sleep 0.5 sleep 0.5
run_wire ab a b run_wire ab a b
run_qemu a a build/qemu-pair-server.tar run_qemu a a build/qemu-pair-i40e-server.tar
run_qemu b b build/qemu-pair-client.tar run_qemu b b build/qemu-pair-i40e-client.tar
#client_pid=$! client_pid=$!
#wait $client_pid wait $client_pid
sleep 30
cleanup cleanup
#!/bin/bash
source common-functions.sh
init_out qemu-i40e-bm-rpc $1
run_i40e_bm a
run_i40e_bm b
sleep 0.5
run_wire ab a b
run_qemu a a build/qemu-i40e-rpc-server.tar tas
run_qemu b b build/qemu-i40e-rpc-client.tar tas
client_pid=$!
wait $client_pid
cleanup
#!/bin/bash
source common-functions.sh
init_out qemu-i40e-bm-tas $1
run_i40e_bm a
run_i40e_bm b
sleep 0.5
run_wire ab a b
run_qemu a a build/qemu-tas-server.tar tas "-smp 4"
run_qemu b b build/qemu-tas-client.tar tas "-smp 4"
client_pid=$!
wait $client_pid
cleanup
#!/bin/bash
mount -t proc proc /proc
mount -t sysfs sysfs /sys
sysctl -w net.core.rmem_default=31457280
sysctl -w net.core.rmem_max=31457280
sysctl -w net.core.wmem_default=31457280
sysctl -w net.core.wmem_max=31457280
sysctl -w net.core.optmem_max=25165824
sysctl -w net.ipv4.tcp_mem="786432 1048576 26777216"
sysctl -w net.ipv4.tcp_rmem="8192 87380 33554432"
sysctl -w net.ipv4.tcp_wmem="8192 87380 33554432"
m5 checkpoint
modprobe i40e
ethtool -G eth0 rx 4096 tx 4096
ethtool -K eth0 tso off
ip link set eth0 txqueuelen 13888
ip link set dev eth0 mtu 9000 up
ip addr add 192.168.64.3/24 dev eth0
sleep 0.2
iperf -l 32M -w 32M -c 192.168.64.1 -i 1 -P 4
m5 exit
#!/bin/bash #!/bin/bash
mount -t proc proc /proc
mount -t sysfs sysfs /sys
sysctl -w net.core.rmem_default=31457280
sysctl -w net.core.rmem_max=31457280
sysctl -w net.core.wmem_default=31457280
sysctl -w net.core.wmem_max=31457280
sysctl -w net.core.optmem_max=25165824
sysctl -w net.ipv4.tcp_mem="786432 1048576 26777216"
sysctl -w net.ipv4.tcp_rmem="8192 87380 33554432"
sysctl -w net.ipv4.tcp_wmem="8192 87380 33554432"
m5 checkpoint m5 checkpoint
modprobe i40e modprobe i40e
ip link set dev eth0 up ethtool -G eth0 rx 4096 tx 4096
ip addr add 192.168.64.2/24 dev eth0
ethtool -K eth0 tso off ethtool -K eth0 tso off
sleep 2 ip link set eth0 txqueuelen 13888
iperf -l 1M -w 1M -c 192.168.64.1 -i 1 -P 4 ip link set dev eth0 mtu 9000 up
ip addr add 192.168.64.2/24 dev eth0
sleep 0.2
iperf -l 32M -w 32M -c 192.168.64.1 -i 1 -P 4
m5 exit m5 exit
#!/bin/bash #!/bin/bash
mount -t proc proc /proc
mount -t sysfs sysfs /sys
sysctl -w net.core.rmem_default=31457280
sysctl -w net.core.rmem_max=31457280
sysctl -w net.core.wmem_default=31457280
sysctl -w net.core.wmem_max=31457280
sysctl -w net.core.optmem_max=25165824
sysctl -w net.ipv4.tcp_mem="786432 1048576 26777216"
sysctl -w net.ipv4.tcp_rmem="8192 87380 33554432"
sysctl -w net.ipv4.tcp_wmem="8192 87380 33554432"
m5 checkpoint m5 checkpoint
modprobe i40e modprobe i40e
ip link set dev eth0 up ethtool -G eth0 rx 4096 tx 4096
ip addr add 192.168.64.1/24 dev eth0
ethtool -K eth0 tso off ethtool -K eth0 tso off
iperf -s -l 1M -w 1M -P 4 ip link set eth0 txqueuelen 13888
ip link set dev eth0 mtu 9000 up
ip addr add 192.168.64.1/24 dev eth0
iperf -s -l 32M -w 32M -P 8
m5 exit m5 exit
#!/bin/bash
modprobe i40e
ip link set dev eth0 up
ip addr add 192.168.64.2/24 dev eth0
sleep 2
cd /root/tasbench/micro_rpc
./testclient_linux 192.168.64.1 1234 1 /tmp/guest/mtcp.conf 1024 1 128 2 0 8 &
sleep 25
poweroff -f
#!/bin/bash
modprobe i40e
ip link set dev eth0 up
ip addr add 192.168.64.1/24 dev eth0
cd /root/tasbench/micro_rpc
./echoserver_linux 1234 1 /tmp/guest/mtcp.conf 1024 1024
poweroff -f
#!/bin/bash
mount -t proc proc /proc
mount -t sysfs sysfs /sys
#sysctl -w net.core.busy_poll=50
#sysctl -w net.core.busy_read=50
sysctl -w net.core.rmem_default=31457280
sysctl -w net.core.rmem_max=31457280
sysctl -w net.core.wmem_default=31457280
sysctl -w net.core.wmem_max=31457280
sysctl -w net.core.optmem_max=25165824
sysctl -w net.ipv4.tcp_mem="786432 1048576 26777216"
sysctl -w net.ipv4.tcp_rmem="8192 87380 33554432"
sysctl -w net.ipv4.tcp_wmem="8192 87380 33554432"
modprobe i40e
ethtool -G eth0 rx 4096 tx 4096
ethtool -K eth0 tso off
echo 13888 > /proc/sys/net/core/netdev_max_backlog
ip link set eth0 txqueuelen 13888
ip link set dev eth0 mtu 9000 up
ip addr add 192.168.64.3/24 dev eth0
sleep 2
iperf -l 32M -w 32M -c 192.168.64.1 -i 1 -P 4
poweroff -f
#!/bin/bash
mount -t proc proc /proc
mount -t sysfs sysfs /sys
#sysctl -w net.core.busy_poll=50
#sysctl -w net.core.busy_read=50
sysctl -w net.core.rmem_default=31457280
sysctl -w net.core.rmem_max=31457280
sysctl -w net.core.wmem_default=31457280
sysctl -w net.core.wmem_max=31457280
sysctl -w net.core.optmem_max=25165824
sysctl -w net.ipv4.tcp_mem="786432 1048576 26777216"
sysctl -w net.ipv4.tcp_rmem="8192 87380 33554432"
sysctl -w net.ipv4.tcp_wmem="8192 87380 33554432"
modprobe i40e
ethtool -G eth0 rx 4096 tx 4096
ethtool -K eth0 tso off
echo 13888 > /proc/sys/net/core/netdev_max_backlog
ip link set eth0 txqueuelen 13888
ip link set dev eth0 mtu 9000 up
ip addr add 192.168.64.2/24 dev eth0
sleep 2
iperf -l 32M -w 32M -c 192.168.64.1 -i 1 -P 4
poweroff -f
#!/bin/bash
mount -t proc proc /proc
mount -t sysfs sysfs /sys
#sysctl -w net.core.busy_poll=50
#sysctl -w net.core.busy_read=50
sysctl -w net.core.rmem_default=31457280
sysctl -w net.core.rmem_max=31457280
sysctl -w net.core.wmem_default=31457280
sysctl -w net.core.wmem_max=31457280
sysctl -w net.core.optmem_max=25165824
sysctl -w net.ipv4.tcp_mem="786432 1048576 26777216"
sysctl -w net.ipv4.tcp_rmem="8192 87380 33554432"
sysctl -w net.ipv4.tcp_wmem="8192 87380 33554432"
modprobe i40e
ethtool -G eth0 rx 4096 tx 4096
ethtool -K eth0 tso off
echo 13888 > /proc/sys/net/core/netdev_max_backlog
ip link set eth0 txqueuelen 13888
ip link set dev eth0 mtu 9000 up
ip addr add 192.168.64.1/24 dev eth0
iperf -s -l 32M -w 32M -P 8
poweroff -f
#!/bin/bash
export HOME=/root
export LANG=en_US
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mkdir -p /dev/hugepages
mount -t hugetlbfs nodev /dev/hugepages
mkdir -p /dev/shm
mount -t tmpfs tmpfs /dev/shm
insmod /root/dpdk/lib/modules/5.4.46/extra/dpdk/igb_uio.ko
/root/dpdk/sbin/dpdk-devbind -b igb_uio 0000:00:02.0
echo 4096 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
cd /root/tas
tas/tas --ip-addr=192.168.64.2/24 --fp-cores-max=1 --fp-no-ints &
sleep 3
cd /root/tasbench/micro_rpc
LD_PRELOAD=/root/tas/lib/libtas_interpose.so ./testclient_linux 192.168.64.1 1234 1 /tmp/guest/mtcp.conf 1024 1 128 2 0 8 &
sleep 25
poweroff -f
#!/bin/bash
export HOME=/root
export LANG=en_US
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mkdir -p /dev/hugepages
mount -t hugetlbfs nodev /dev/hugepages
mkdir -p /dev/shm
mount -t tmpfs tmpfs /dev/shm
insmod /root/dpdk/lib/modules/5.4.46/extra/dpdk/igb_uio.ko
/root/dpdk/sbin/dpdk-devbind -b igb_uio 0000:00:02.0
echo 4096 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
cd /root/tas
tas/tas --ip-addr=192.168.64.1/24 --fp-cores-max=1 --fp-no-ints &
sleep 3
cd /root/tasbench/micro_rpc
LD_PRELOAD=/root/tas/lib/libtas_interpose.so ./echoserver_linux 1234 1 /tmp/guest/mtcp.conf 1024 1024
poweroff -f
...@@ -219,6 +219,9 @@ uint32_t i40e_bm::reg_mem_read32(uint64_t addr) ...@@ -219,6 +219,9 @@ uint32_t i40e_bm::reg_mem_read32(uint64_t addr)
case I40E_GLGEN_RSTCTL: case I40E_GLGEN_RSTCTL:
val = regs.glgen_rstctl; val = regs.glgen_rstctl;
break; break;
case I40E_GLGEN_STAT:
val = regs.glgen_stat;
break;
case I40E_GLVFGEN_TIMER: case I40E_GLVFGEN_TIMER:
val = runner->time_ps() / 1000000; val = runner->time_ps() / 1000000;
...@@ -238,6 +241,20 @@ uint32_t i40e_bm::reg_mem_read32(uint64_t addr) ...@@ -238,6 +241,20 @@ uint32_t i40e_bm::reg_mem_read32(uint64_t addr)
regs.pfint_icr0 = 0; regs.pfint_icr0 = 0;
break; break;
case I40E_PFINT_DYN_CTL0:
val = regs.pfint_dyn_ctl0;
break;
case I40E_PFINT_ITR0(0):
val = regs.pfint_itr0[0];
break;
case I40E_PFINT_ITR0(1):
val = regs.pfint_itr0[1];
break;
case I40E_PFINT_ITR0(2):
val = regs.pfint_itr0[2];
break;
case I40E_GLPCI_CNF2: case I40E_GLPCI_CNF2:
val = ((NUM_PFINTS - 2) << I40E_GLPCI_CNF2_MSI_X_PF_N_SHIFT) | val = ((NUM_PFINTS - 2) << I40E_GLPCI_CNF2_MSI_X_PF_N_SHIFT) |
(2 << I40E_GLPCI_CNF2_MSI_X_VF_N_SHIFT); /* that is ugly, (2 << I40E_GLPCI_CNF2_MSI_X_VF_N_SHIFT); /* that is ugly,
...@@ -478,6 +495,18 @@ void i40e_bm::reg_mem_write32(uint64_t addr, uint32_t val) ...@@ -478,6 +495,18 @@ void i40e_bm::reg_mem_write32(uint64_t addr, uint32_t val)
case I40E_PFINT_ICR0: case I40E_PFINT_ICR0:
regs.pfint_icr0 = val; regs.pfint_icr0 = val;
break; break;
case I40E_PFINT_DYN_CTL0:
regs.pfint_dyn_ctl0 = val;
break;
case I40E_PFINT_ITR0(0):
regs.pfint_itr0[0] = val;
break;
case I40E_PFINT_ITR0(1):
regs.pfint_itr0[1] = val;
break;
case I40E_PFINT_ITR0(2):
regs.pfint_itr0[2] = val;
break;
case I40E_PFHMC_SDCMD: case I40E_PFHMC_SDCMD:
regs.pfhmc_sdcmd = val; regs.pfhmc_sdcmd = val;
...@@ -545,6 +574,64 @@ void i40e_bm::reg_mem_write32(uint64_t addr, uint32_t val) ...@@ -545,6 +574,64 @@ void i40e_bm::reg_mem_write32(uint64_t addr, uint32_t val)
} }
} }
void i40e_bm::timed_event(nicbm::TimedEvent &ev)
{
int_ev &iev = *((int_ev *) &ev);
#ifdef DEBUG_DEV
log << "timed_event: triggering interrupt (" << iev.vector << ")" <<
logger::endl;
#endif
iev.armed = false;
runner->msi_issue(0);
}
void i40e_bm::signal_interrupt(uint16_t vector, uint8_t itr)
{
if (vector != 0) {
log << "signal_interrupt() only supports vector 0" << logger::endl;
abort();
}
int_ev &iev = intevs[vector];
uint64_t mindelay;
if (itr <= 2) {
// itr 0-2
mindelay = regs.pfint_itr0[itr];
mindelay *= 2000000ULL;
} else if (itr == 3) {
// noitr
mindelay = 0;
} else {
log << "signal_interrupt() invalid itr (" << itr << ")" << logger::endl;
abort();
}
uint64_t curtime = runner->time_ps();
uint64_t newtime = curtime + mindelay;
if (iev.armed && iev.time <= newtime) {
// already armed and this is not scheduled sooner
#ifdef DEBUG_DEV
log << "signal_interrupt: vector " << vector << " already scheduled" <<
logger::endl;
#endif
return;
} else if (iev.armed) {
// need to reschedule
runner->event_cancel(iev);
}
iev.armed = true;
iev.time = newtime;
#ifdef DEBUG_DEV
log << "signal_interrupt: scheduled vector " << vector << " for time=" <<
newtime << " (itr " << itr << ")" << logger::endl;
#endif
runner->event_schedule(iev);
}
void i40e_bm::reset(bool indicate_done) void i40e_bm::reset(bool indicate_done)
{ {
#ifdef DEBUG_DEV #ifdef DEBUG_DEV
...@@ -558,6 +645,15 @@ void i40e_bm::reset(bool indicate_done) ...@@ -558,6 +645,15 @@ void i40e_bm::reset(bool indicate_done)
memset(&regs, 0, sizeof(regs)); memset(&regs, 0, sizeof(regs));
if (indicate_done) if (indicate_done)
regs.glnvm_srctl = I40E_GLNVM_SRCTL_DONE_MASK; regs.glnvm_srctl = I40E_GLNVM_SRCTL_DONE_MASK;
for (uint16_t i = 0; i < NUM_PFINTS; i++) {
intevs[i].vector = i;
if (intevs[i].armed) {
runner->event_cancel(intevs[i]);
intevs[i].armed = false;
}
intevs[i].time = 0;
}
} }
shadow_ram::shadow_ram(i40e_bm &dev_) shadow_ram::shadow_ram(i40e_bm &dev_)
...@@ -633,6 +729,12 @@ void shadow_ram::write(uint16_t addr, uint16_t val) ...@@ -633,6 +729,12 @@ void shadow_ram::write(uint16_t addr, uint16_t val)
#endif #endif
} }
int_ev::int_ev()
{
armed = false;
time = 0;
}
} //namespace i40e } //namespace i40e
using namespace i40e; using namespace i40e;
......
...@@ -28,6 +28,15 @@ class dma_base : public nicbm::DMAOp { ...@@ -28,6 +28,15 @@ class dma_base : public nicbm::DMAOp {
virtual void done() = 0; virtual void done() = 0;
}; };
class int_ev : public nicbm::TimedEvent {
public:
uint16_t vector;
bool armed;
int_ev();
};
class logger : public std::ostream { class logger : public std::ostream {
public: public:
static const char endl = '\n'; static const char endl = '\n';
...@@ -141,6 +150,8 @@ class queue_base { ...@@ -141,6 +150,8 @@ class queue_base {
desc_ctx &ctx; desc_ctx &ctx;
public: public:
size_t total_len;
size_t part_offset;
dma_data_fetch(desc_ctx &ctx_, size_t len, void *buffer); dma_data_fetch(desc_ctx &ctx_, size_t len, void *buffer);
virtual ~dma_data_fetch(); virtual ~dma_data_fetch();
virtual void done(); virtual void done();
...@@ -150,6 +161,8 @@ class queue_base { ...@@ -150,6 +161,8 @@ class queue_base {
protected: protected:
desc_ctx &ctx; desc_ctx &ctx;
public: public:
size_t total_len;
size_t part_offset;
dma_data_wb(desc_ctx &ctx_, size_t len); dma_data_wb(desc_ctx &ctx_, size_t len);
virtual ~dma_data_wb(); virtual ~dma_data_wb();
virtual void done(); virtual void done();
...@@ -311,7 +324,7 @@ class lan_queue_base : public queue_base { ...@@ -311,7 +324,7 @@ class lan_queue_base : public queue_base {
class lan_queue_tx : public lan_queue_base { class lan_queue_tx : public lan_queue_base {
protected: protected:
static const uint16_t MTU = 2048; static const uint16_t MTU = 9024;
class tx_desc_ctx : public desc_ctx { class tx_desc_ctx : public desc_ctx {
protected: protected:
...@@ -342,6 +355,8 @@ class lan_queue_tx : public lan_queue_base { ...@@ -342,6 +355,8 @@ class lan_queue_tx : public lan_queue_base {
}; };
uint8_t pktbuf[MTU]; uint8_t pktbuf[MTU];
uint32_t tso_off;
uint32_t tso_len;
std::deque<tx_desc_ctx *> ready_segments; std::deque<tx_desc_ctx *> ready_segments;
bool hwb; bool hwb;
...@@ -372,7 +387,7 @@ class lan_queue_rx : public lan_queue_base { ...@@ -372,7 +387,7 @@ class lan_queue_rx : public lan_queue_base {
public: public:
rx_desc_ctx(lan_queue_rx &queue_); rx_desc_ctx(lan_queue_rx &queue_);
virtual void process(); virtual void process();
void packet_received(const void *data, size_t len); void packet_received(const void *data, size_t len, bool last);
}; };
uint16_t dbuff_size; uint16_t dbuff_size;
...@@ -443,14 +458,18 @@ protected: ...@@ -443,14 +458,18 @@ protected:
static const uint32_t NUM_PFINTS = 512; static const uint32_t NUM_PFINTS = 512;
static const uint32_t NUM_VSIS = 384; static const uint32_t NUM_VSIS = 384;
static const uint16_t MAX_MTU = 2048; static const uint16_t MAX_MTU = 2048;
static const uint8_t NUM_ITR = 3;
struct i40e_regs { struct i40e_regs {
uint32_t glgen_rstctl; uint32_t glgen_rstctl;
uint32_t glgen_stat;
uint32_t gllan_rctl_0; uint32_t gllan_rctl_0;
uint32_t pfint_lnklst0; uint32_t pfint_lnklst0;
uint32_t pfint_icr0_ena; uint32_t pfint_icr0_ena;
uint32_t pfint_icr0; uint32_t pfint_icr0;
uint32_t pfint_itr0[NUM_ITR];
uint32_t pfint_dyn_ctl0;
uint32_t pfint_dyn_ctln[NUM_PFINTS - 1]; uint32_t pfint_dyn_ctln[NUM_PFINTS - 1];
uint32_t pfint_lnklstn[NUM_PFINTS - 1]; uint32_t pfint_lnklstn[NUM_PFINTS - 1];
uint32_t pfint_raten[NUM_PFINTS - 1]; uint32_t pfint_raten[NUM_PFINTS - 1];
...@@ -492,8 +511,6 @@ protected: ...@@ -492,8 +511,6 @@ protected:
}; };
public: public:
nicbm::Runner *runner;
i40e_bm(); i40e_bm();
~i40e_bm(); ~i40e_bm();
...@@ -505,6 +522,9 @@ public: ...@@ -505,6 +522,9 @@ public:
virtual void reg_write32(uint8_t bar, uint64_t addr, uint32_t val); virtual void reg_write32(uint8_t bar, uint64_t addr, uint32_t val);
virtual void dma_complete(nicbm::DMAOp &op); virtual void dma_complete(nicbm::DMAOp &op);
virtual void eth_rx(uint8_t port, const void *data, size_t len); virtual void eth_rx(uint8_t port, const void *data, size_t len);
virtual void timed_event(nicbm::TimedEvent &ev);
void signal_interrupt(uint16_t vector, uint8_t itr);
protected: protected:
logger log; logger log;
...@@ -514,6 +534,8 @@ protected: ...@@ -514,6 +534,8 @@ protected:
shadow_ram shram; shadow_ram shram;
lan lanmgr; lan lanmgr;
int_ev intevs[NUM_PFINTS];
/** Read from the I/O bar */ /** Read from the I/O bar */
virtual uint32_t reg_io_read(uint64_t addr); virtual uint32_t reg_io_read(uint64_t addr);
/** Write to the I/O bar */ /** Write to the I/O bar */
...@@ -530,4 +552,12 @@ protected: ...@@ -530,4 +552,12 @@ protected:
// places the tcp checksum in the packet (assuming ipv4) // places the tcp checksum in the packet (assuming ipv4)
void xsum_tcp(void *tcphdr, size_t l4len); void xsum_tcp(void *tcphdr, size_t l4len);
// calculates the full ipv4 & tcp checksum without assuming any pseudo header
// xsums
void xsum_tcpip_tso(void *iphdr, uint8_t iplen, uint8_t l4len,
uint16_t paylen);
void tso_postupdate_header(void *iphdr, uint8_t iplen, uint8_t l4len,
uint16_t paylen);
} // namespace corundum } // namespace corundum
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment