Skip to content

Instantly share code, notes, and snippets.

View garyachy's full-sized avatar

Denys Haryachyy garyachy

View GitHub Profile
struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_RSS,
},
.rx_adv_conf = {
.rss_conf = {
.rss_hf = ETH_RSS_IP |
ETH_RSS_TCP |
ETH_RSS_UDP |
ETH_RSS_SCTP,
@garyachy
garyachy / vpp-veth-setup.sh
Last active March 18, 2024 12:11
VPP testing using veth pairs
#!/bin/bash
PATH=$PATH:./build-root/build-vpp-native/vpp/bin/
if [ $USER != "root" ] ; then
echo "Restarting script with sudo..."
sudo $0 ${*}
exit
fi
@garyachy
garyachy / vpp-tap-setup.sh
Last active July 7, 2023 15:54
VPP testing using TAPs
#!/bin/bash
./build-root/build-vpp-native/vpp/bin/vppctl tap connect vpp1
./build-root/build-vpp-native/vpp/bin/vppctl tap connect vpp2
./build-root/build-vpp-native/vpp/bin/vppctl set interface state tapcli-0 up
./build-root/build-vpp-native/vpp/bin/vppctl set interface state tapcli-1 up
ip netns delete vpp1
ip netns delete vpp2
@garyachy
garyachy / vpp-internet-setup.sh
Created August 23, 2018 09:04
Setup VPP and host to enable internet access for a host
#!/bin/bash
PATH=$PATH:./build-root/build-vpp-native/vpp/bin/
if [ $USER != "root" ] ; then
echo "Restarting script with sudo..."
sudo $0 ${*}
exit
fi
@garyachy
garyachy / Vagrantfile
Last active October 27, 2020 22:55
vagrant config for VirtualBox provider with serial port enabled
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "trusty64"
config.vm.network "private_network", ip: "192.168.50.4"
@garyachy
garyachy / Makefile
Created August 27, 2016 15:22
Linux kernel module makefile
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules EXTRA_CFLAGS="-g -DDEBUG"
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
@garyachy
garyachy / dropper.c
Last active May 18, 2019 07:41
eBPF application example
#include <linux/bpf.h>
#ifndef __section
# define __section(NAME) \
__attribute__((section(NAME), used))
#endif
__section("prog")
int xdp_drop(struct xdp_md *ctx)
{
#define RSS_HASH_KEY_LENGTH 40
static uint8_t hash_key[RSS_HASH_KEY_LENGTH] = {
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
};
struct rte_eth_conf port_conf = {
@garyachy
garyachy / startup.conf
Last active August 16, 2018 10:18
VPP sample startup configuration
unix {
nodaemon
log /tmp/vpp.log
full-coredump
gid vpp
interactive
cli-listen /run/vpp/cli.sock
}
api-trace {
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm"
config.vm.box_check_update = false
vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2)
vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096)