Skip to content

Instantly share code, notes, and snippets.

@krsna1729
krsna1729 / Dockerfile
Last active November 23, 2021 11:06
dpdk af-xdp
FROM ubuntu as builder
RUN apt-get update && \
apt-get -y install --no-install-recommends \
ca-certificates \
git \
gcc \
libelf-dev \
libnuma-dev \
make \
pkg-config \
@krsna1729
krsna1729 / go.mod
Last active October 27, 2021 03:12
example organization of pfcp layer
module krsna1729/udp-test
go 1.17
require (
github.com/libp2p/go-reuseport v0.1.0
go.uber.org/goleak v1.1.12
)
require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 // indirect
@krsna1729
krsna1729 / filter-get.go
Last active August 17, 2021 05:35
Using native golang library to interact with TC
package main
import (
"fmt"
"net"
"os"
"github.com/davecgh/go-spew/spew"
tc "github.com/florianl/go-tc"
"golang.org/x/sys/unix"
@krsna1729
krsna1729 / 1024-qlen-upf.r
Last active April 20, 2021 07:25
compute universal scalability law USL co-efficient and plot
library(usl)
mpps.128 <- data.frame(workers=c(1,2,4,8,16), mpps=c(2.21,4.06,7.68,13.93,22.28))
mpps.256 <- data.frame(workers=c(1,2,4,8,16), mpps=c(2.13,3.83,7.03,12.04,19.80))
mpps.512 <- data.frame(workers=c(1,2,4,8,16), mpps=c(2.05,3.52,6.03,10.49,17.55))
mpps.1024 <- data.frame(workers=c(1,2,4,8,16), mpps=c(1.78,2.84,4.90,8.40,9.87))
plot(ylim=c(0,30), xlim=c(0,32), mpps ~ workers, data = mpps.128, col = "blue", pch = "o", type = "o", lty=1)
points(mpps.256$workers, mpps.256$mpps, col = "green", pch = "*")
@krsna1729
krsna1729 / cgroup.go
Last active March 24, 2021 05:24
loading systemd cgroup example slice:prefix:ctr
package main
import (
"log"
"strings"
"github.com/containerd/cgroups"
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"
)
@krsna1729
krsna1729 / changes-for-rx-cksum-offload.patch
Created March 3, 2021 06:21
With ability to parse inner packet comes more headache for simple rx checksum offloading
diff --git a/patches/bess/0008-Enable-hardware-checksum-offload.patch b/patches/bess/0008-Enable-hardware-checksum-offload.patch
index be1c751..7926150 100644
--- a/patches/bess/0008-Enable-hardware-checksum-offload.patch
+++ b/patches/bess/0008-Enable-hardware-checksum-offload.patch
@@ -17,7 +17,7 @@ index 9b29fc85..1501ea94 100644
eth_conf.lpbk_mode = 1;
}
+ if (arg.hwcksum()) {
-+ eth_conf.rxmode.offloads = DEV_RX_OFFLOAD_IPV4_CKSUM |
++ eth_conf.rxmode.offloads = DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_IPV4_CKSUM |
@krsna1729
krsna1729 / ddp-rss-testpmd.md
Last active February 4, 2021 11:01
Testing DDP in testpmd using BESS

Start testpmd with 2 ports in interactive mode

./build/app/dpdk-testpmd --legacy-mem --socket-mem 1024,1024 -- \
    -i --nb-cores=2 --total-num-mbufs=4096 \
    --nb-ports=2 --rxq=4 --txq=4 \
    --auto-start --forward-mode=rxonly

Make sure to set the RSS key to be same for both ports else, it would pick different queue on each port for same input

@krsna1729
krsna1729 / app-test-autorun.log
Created August 14, 2020 05:33
dpdk test app autorun.py
root@1fe53d78bd7f:/tmp# python /dpdk/app/test/autotest.py "/dpdk/build/app/test --no-huge --no-pci -m 4096" cycles
/dpdk/build/app/test --no-huge --no-pci -m 4096 -c f
Running tests with 4 workers
Test name Test result Test Total
================================================================================
Skipped autotests:
dump_physmem: Skipped [Not compiled] [00m 00s]
dump_memzone: Skipped [Not compiled] [00m 00s]
dump_struct_sizes: Skipped [Not compiled] [00m 00s]
apiVersion: v1
kind: Service
metadata:
annotations:
field.cattle.io/targetWorkloadIds: '["statefulset:omec:spgwu"]'
creationTimestamp: "2020-07-28T17:45:02Z"
labels:
cattle.io/metrics: e5d93ecc9487076aded83ebca70ae05a
name: spgwu-metrics
namespace: omec
@krsna1729
krsna1729 / guff.awk
Created July 24, 2020 17:43 — forked from katef/plot.awk
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# TODO: skip title row, if alphanumeric. save the labels for a legend
# TODO: legend to the rhs
# TODO: moving average