Git Product home page Git Product logo

sgbpf's Introduction

sgbpf: an eBPF-accelerated scatter-gather network primitive for UDP

About

MEng Project - Accelerating network communication patterns using eBPF

Environment setup

  1. The following dependencies are needed (note clang+llvm-12 is required):

$ sudo apt-get update

$ sudo apt install -y build-essential pkgconf git make gcc clang-12 llvm-12 libelf-dev gcc-multilib

  1. Ensure you have installed liburing and its headers on your system:

    $ git clone https://github.com/axboe/liburing

    $ cd liburing

    $ ./configure && make

    $ sudo make install

  2. Clone this project (and all the submodules) using:

$ git clone --recurse-submodules https://gitlab.doc.ic.ac.uk/ac3419/meng-project.git

  1. Build and install libbpf on your system (included as a submodule inside sgbpf):

    $ cd meng-project/sgbpf/dep/libbpf/src

    $ make all

    $ sudo DESTDIR=root make install

    $ sudo make install_headers

    $ sudo make install_uapi_headers

Starting a new project

  1. This assumes you have followed the steps above and installed all the required dependencies.

  2. Create a new directory. For this example, it will be called my-project.

  3. Add a Makefile pointing to the correct libbpf and sgbpf locations (see my-project/Makefile).

  4. Write your program using the sgbpf library (see my-project/main.cpp for an example).

  5. Run make install to build libbpf and sgbpf libraries.

  6. Run make to build your program.

    1. If you get a linker error (eg: undefined references), try re-running make install and then make.
  7. Now, you need to build the BPF object files that contain the programs that will be loaded into the kernel:

    1. You may optionally set the OUTPUT_BPF_OBJ_DIR environment variable to a (full) directory in which the built object files will be placed. If ommitted, the object files will be placed under bpfobj/ in the sgbpf directory by default.

    2. You are required to set the CUSTOM_AGGREGATION_BPF_PROG environment variable which should be the FULL path to your source file written in C containing the custom aggregation logic in a XDP program (which must be named aggregation_prog). See the example in my-project/custom_aggregation.bpf.c. Example (from inside my-project): export CUSTOM_AGGREGATION_BPF_PROG=$(pwd)/custom_aggregation.bpf.c

    3. Now, run make --directory=<path/to/sgbpf> bpf to build all required BPF object files.

  8. Create a line-separated config file containing a list of worker endpoints, in the format: IPv4_Address:Port (see the example in my-project).

  9. Run your program: sudo ./sg_program <path/to/bpfobjs> lo (remember that to load BPF programs, you need admin privileges).

Note: When running the loader program, if you get a message about the missing shared library libbpf.so.1, you can copy the missing shared object to lib/x86_64-linux-gnu from the build inside libbpf/src using: sudo cp sgbpf/dep/libbpf/src/libbpf.so.1 /lib/x86_64-linux-gnu/

sgbpf's People

Contributors

thealexcons avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.