Skip to content

Instantly share code, notes, and snippets.

View dmarion's full-sized avatar

Damjan Marion dmarion

  • Rijeka, Croatia
View GitHub Profile

startup.vpp

trace add avf-input 50
pipe create
create interface avf 0000:86:02.0 name eth0
create interface avf 0000:86:0a.0 name eth1

ip table add 1
set int ip table eth1 1
@dmarion
dmarion / perf.c
Last active April 13, 2022 09:42
Sample perf measurement with vppinfra perfmon
#if 0
clang \
-g \
-march=native \
-O3 \
-Isrc \
-Llib/x86_64-linux-gnu \
-Wl,-rpath ./lib/x86_64-linux-gnu \
"$0" \
-lvppinfra \
@dmarion
dmarion / b.c
Last active October 13, 2021 12:41
#include <vppinfra/clib.h>
#include <vppinfra/vector.h>
#include <vppinfra/string.h>
#include <vppinfra/random.h>
#include <iacaMarks.h>
#include </home/damarion/cisco/vpp-sandbox/include/tscmarks.h>
void __clib_noinline __clib_section (".ver1")
ver1 (u8 *dst, const u8 *src, size_t n)
{
#include <stdio.h>
#include <sys/mman.h>
#include <x86intrin.h>
int main() {
void *p = (void *)0x100000000ULL;
__m512i v, zero = {};
p = mmap(p, 4096, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_POPULATE | MAP_ANONYMOUS, -1, 0);
printf("p = %p\n", p);
#!/usr/bin/env python3
import sys, argparse, ezdxf, os
from xml.dom import minidom
from pprint import pprint
types = "POINT,LINE,POLYLINE,LWPOLYLINE"
p = argparse.ArgumentParser(description='dxf2gml')
p.add_argument('-i', '--input', action='store', help='input filename (DXF)', required = True)
p.add_argument('-o', '--output', action='store', help='output filename (GML)', required = True)
p.add_argument('-l', '--layers', action='store', help='coma separatted list of layers')
#!/usr/bin/env python3
import sys, argparse, ezdxf, os
from xml.dom import minidom
from pprint import pprint
p = argparse.ArgumentParser(description='dxf2gml')
p.add_argument('-i', '--input', action='store', help='input filename (DXF)', required = True)
p.add_argument('-o', '--output', action='store', help='output filename (GML)', required = True)
p.add_argument('-l', '--layers', action='store', help='coma separatted list of layers')
p.add_argument('-t', '--type', action='store', help='coma separatted list of object types [POINT, LWPOLYLINE]')
#include <stdio.h>
#include <stddef.h>
#include <syscall.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <x86intrin.h>
typedef unsigned long u64;
@dmarion
dmarion / vpp-py
Last active September 26, 2020 11:12
#!/bin/bash
VPP_ROOT=$(git rev-parse --show-toplevel)
PLATFORM=${PLATFORM:-"vpp"}
if [ "$1" == "-i" ] ; then
apt install -y python-dev
cd ${VPP_ROOT}
make -C build-root PLATFORM=${PLATFORM} TAG=${PLATFORM}_debug vpp-api-install
cd vpp-api/python
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/queue.h>
#include <unistd.h>
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_debug.h>
@dmarion
dmarion / vpp
Created January 14, 2016 15:17
vpp build wrapper script
#!/bin/bash
# load config if exists
[ -e $HOME/.vpp ] && source $HOME/.vpp
VPP_BUILD_ROOT=$(git rev-parse --show-toplevel)/build-root
VPP_CONFIG_DIR=${VPP_CONFIG_DIR:-${VPP_BUILD_ROOT}}
VPP_PLATFORM=${VPP_PLATFORM:-"vpp"}
VPP_VERBOSE=${VPP_VERBOSE:-"0"}
VPP_DPDK_VER=${VPP_DPDK_VER:-"default"}